﻿/* kc-v2 v1.5.7 -- cards */
/* Full class contract and conventions: see README.md and kc-v2-base.css. */

/* ---------------------------------------------------------------------------
 * Cards
 *
 * .kc-v2-card is a container component (convention #3): it ships its own
 * descendant box-sizing reset rather than requiring a wrapper root. overflow
 * is hidden on the card itself so an edge-to-edge child (.kc-v2-card__media)
 * automatically respects the outer radius without duplicating radius values
 * on every child that happens to touch an edge.
 * ------------------------------------------------------------------------- */

/* Flex column, so a card stretched by its row (grid `align-items: stretch`) can hand the
   spare height to __body, which in turn pushes __cta to the bottom. Without this the CTA
   sits immediately under the text and buttons land at different heights across a row
   whenever one card's copy runs to an extra line. */
.kc-v2-card {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--kc-v2-ink-200);
  border-radius: var(--kc-v2-radius-lg);
  background-color: var(--kc-v2-white);
  box-shadow: 0 4px 12px rgba(13, 36, 56, 0.05);
}
.kc-v2-card *,
.kc-v2-card *::before,
.kc-v2-card *::after {
  box-sizing: border-box;
}

/* Takes the card's spare height and becomes the column that __cta's `margin-top: auto`
   works against. Safe to switch from block to flex: every child here sets margin-bottom
   only (and __text is margin: 0), so there were no collapsing adjacent margins to lose. */
.kc-v2-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: var(--kc-v2-space-4);
}

.kc-v2-card__media {
  flex-shrink: 0; /* a flex item by default shrinks; the media band has a fixed height */
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #DBE6F1, var(--kc-v2-blue-tint));
  color: #7D93A8;
  font-family: var(--kc-v2-font-family);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kc-v2-card__icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--kc-v2-space-2);
  border-radius: var(--kc-v2-radius-md);
  background-color: var(--kc-v2-blue-tint);
  color: var(--kc-v2-blue);
}
.kc-v2-card__icon-tile svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
}

/* Colour variants: an open, page-assigned palette, the same approach .kc-v2-tag
   takes -- the Figma landing page tints tiles by service, not by any fixed
   vocabulary, so these are named by colour rather than by meaning.
   Unmodified .kc-v2-card__icon-tile stays blue, so existing usage is unchanged.

   Each pairing was computed against the 3:1 non-text contrast minimum, not
   eyeballed -- the Phase 6 audit found several --kc-v2-ink-400 uses failing at
   2.92:1 precisely because they had been judged by eye:
     --kc-v2-green-2      #289A48 on #E7F6EE  ->  3.24:1  PASS
     --kc-v2-warning-icon #A06F00 on #FFF6E5  ->  4.10:1  PASS
     (existing blue       #00509D on #E6EEF7  ->  6.81:1)
   Green has the least headroom of the three; if the green tint is ever darkened,
   recompute before shipping. */
.kc-v2-card__icon-tile--green {
  background-color: var(--kc-v2-success-bg);
  color: var(--kc-v2-green-2);
}
.kc-v2-card__icon-tile--amber {
  background-color: var(--kc-v2-warning-bg);
  color: var(--kc-v2-warning-icon);
}

@media (forced-colors: active) {
  .kc-v2-card__icon-tile,
  .kc-v2-card__icon-tile--green,
  .kc-v2-card__icon-tile--amber {
    color: CanvasText;
  }
}

.kc-v2-card__meta {
  display: block;
  margin-bottom: var(--kc-v2-space-1);
  color: var(--kc-v2-ink-500);
  font-family: var(--kc-v2-font-family);
  font-size: 12px;
  font-weight: 600;
}

/* The green uppercase card heading -- "FILING PERIOD INFORMATION", "ACCOUNT", "ANNUAL" in the
   KENT-44 frames. margin-top is declared as of 1.2.0 because a page may legitimately use a
   heading element here rather than a <span>, and site.css styles `h1, h2, h3, h4, h5, h6`
   directly: a directly-applied declaration beats an inherited one, so an <h2 class="…__eyebrow">
   was picking up the host's heading margin above it. Same failure KENT-59 hit with the footer
   headings' font-family. */
/* ACCESSIBILITY FIX (1.4.0, found by measurement in KENT-57 Phase 5).
 *
 * This was --kc-v2-green (#2BB673), which measures 2.61:1 against a white card -- a clear WCAG 1.4.3
 * failure. 11px/700 is NOT large text (that needs >=18.66px bold or >=24px), so the requirement is
 * the full 4.5:1, and 2.61 is not close.
 *
 * --kc-v2-success-icon (#1E8049) is the greenest existing token that passes, at 4.95:1. The darker
 * --kc-v2-success-text (#155E35, 7.82:1) was available but reads as a muted forest green rather than
 * the brand's; this keeps the heading recognisably green.
 *
 * NOTE FOR REVIEW: this darkens the card heading colour on EVERY kc-v2 card -- Annual, Quarterly and
 * the KENT-59 pages -- not just the views this ticket touched. That is the correct scope for an AA
 * failure in a shared component, but it is a visible change beyond the ticket's own screens.
 * The --blue variant below needs no change: --kc-v2-blue measures 7.97:1. */
.kc-v2-card__eyebrow {
  display: block;
  margin-top: 0;
  margin-bottom: var(--kc-v2-space-3);
  color: var(--kc-v2-success-icon);
  font-family: var(--kc-v2-font-family);
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* The City fees frame (100:2) draws the INSTRUCTIONS card's heading in blue while ACCOUNT and
   ANNUAL stay green -- blue marks the advisory card, green the data cards. */
.kc-v2-card__eyebrow--blue { color: var(--kc-v2-blue); }

.kc-v2-card__title {
  margin: 0 0 var(--kc-v2-space-1);
  color: var(--kc-v2-ink-800);
  font-family: var(--kc-v2-font-family);
  font-size: var(--kc-v2-h3-size);
  font-weight: var(--kc-v2-h3-weight);
  line-height: var(--kc-v2-h3-line-height);
}

.kc-v2-card__text {
  margin: 0;
  color: var(--kc-v2-ink-500);
  font-family: var(--kc-v2-font-family);
  font-size: 13.5px;
  line-height: 1.5;
}

/* Pinned to the bottom of the card so CTAs align across a row whose cards are equal height
   -- which is how both Figma frames draw them, with one card's copy a line longer than its
   neighbour's and the buttons still level.
     margin-top: auto  absorbs the spare height.
     padding-top       guarantees the gap from the copy when there is no spare height, which
                       is what the margin-top used to provide.
     align-self        keeps it shrink-to-content; as a flex item it would otherwise stretch
                       to the column's full width and widen the click target of a
                       .kc-v2-link used as a __cta. */
.kc-v2-card__cta {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  margin-top: auto;
  padding-top: var(--kc-v2-space-3);
}
.kc-v2-card__cta svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
}

/* Advisory card (KENT-44 1.2.0). The City fees frame (100:2) draws the INSTRUCTIONS panel on a pale
   blue fill with a blue heading, while the two data cards beside it stay white with green headings
   -- colour distinguishes guidance from the filer's own data. Pairs with
   .kc-v2-card__eyebrow--blue.

   Reuses the alert component's info tokens rather than introducing a third blue, so an alert and an
   advisory card read as the same family. */
.kc-v2-card--info {
  background-color: var(--kc-v2-info-bg);
  border-color: var(--kc-v2-info-border);
}

/* Spotlight: gradient background, no border (the gradient makes one
   unnecessary and Figma draws none), white text throughout. */
.kc-v2-card--spotlight {
  border-color: transparent;
  background: linear-gradient(135deg, var(--kc-v2-blue), var(--kc-v2-teal));
  box-shadow: 0 10px 28px rgba(0, 80, 157, 0.28);
}
.kc-v2-card--spotlight .kc-v2-card__title,
.kc-v2-card--spotlight .kc-v2-card__text {
  color: var(--kc-v2-white);
}
.kc-v2-card--spotlight .kc-v2-card__text {
  color: rgba(255, 255, 255, 0.9);
}
.kc-v2-card__badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: var(--kc-v2-space-2);
  padding: 5px 12px;
  border-radius: var(--kc-v2-radius-pill);
  background-color: rgba(255, 255, 255, 0.18);
  color: var(--kc-v2-white);
  font-family: var(--kc-v2-font-family);
  font-size: 11px;
  font-weight: 700;
}

@media (forced-colors: active) {
  .kc-v2-card {
    border-color: CanvasText;
  }
  .kc-v2-card--spotlight {
    border: 1px solid CanvasText;
  }
}

/* ---------------------------------------------------------------------------
 * Height-clamped card (KENT-44 1.3.0)
 *
 * Caps a card at the height of a sibling card and scrolls its CONTENT, leaving the heading
 * fixed in place. Used for the Annual earnings Instructions panel, which carries four
 * paragraphs of guidance and otherwise stretched its row far past the two summary cards
 * beside it.
 *
 * The cap VALUE is set by JS (data-kc-v2-match-height) rather than here, because CSS cannot
 * express "size this grid row from the other items only". The usual pure-CSS trick is to
 * absolutely-position the card's body so its content cannot drive the row height -- but
 * .kc-v2-grid--cards wraps at a container-driven point with no media query, so the moment the
 * grid stacks to one column that card would collapse to zero height, with no breakpoint to
 * scope the hack to. The JS measures instead, and removes the cap entirely when the cards are
 * no longer sharing a row.
 * ------------------------------------------------------------------------- */
.kc-v2-card--clamp {
  display: flex;
  flex-direction: column;
  /* The cap has to actually clip. Without this the body would simply overflow the border. */
  overflow: hidden;
}

.kc-v2-card--clamp > .kc-v2-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  /* A flex item will not shrink below its content height without this, which would push the
     scroll region past the clamp and defeat the whole thing. */
  min-height: 0;
}

/* The heading is outside the scroll region and must not be squeezed by it -- flex items
   default to shrinking, so the title would compress before the content started scrolling. */
.kc-v2-card--clamp > .kc-v2-card__body > .kc-v2-card__eyebrow,
.kc-v2-card--clamp > .kc-v2-card__body > .kc-v2-card__title {
  flex: 0 0 auto;
}

/* A strip pinned below the card body (1.5.0, KENT-56).
 *
 * The Business License agreement frame (node 100:545) puts the acceptance checkbox in a bar that
 * stays put while the terms scroll behind it. Without this the checkbox would sit INSIDE
 * .kc-v2-card__scroll and scroll away with the prose -- so a filer would have to reach the bottom of
 * a long agreement before they could see the control they are being asked to use.
 *
 * `flex: 0 0 auto` is the whole trick: __scroll is `flex: 1 1 auto` and absorbs the remaining
 * height, so a sibling that refuses to grow or shrink ends up pinned. Lives outside
 * .kc-v2-card__body deliberately, as a direct child of the card, so the body's padding does not
 * apply and the strip's border can span the card's full width. */
.kc-v2-card__footer-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--kc-v2-space-3);
  padding: var(--kc-v2-space-3) var(--kc-v2-space-4);
  border-top: 1px solid var(--kc-v2-ink-200);
  background-color: var(--kc-v2-white);
}

/* The scrolling region. Safe to apply outside a clamped card: with no height constraint above
   it, overflow-y: auto never produces a scrollbar and the flex properties are inert. */
/* A ceiling on the scroll region's own natural height (1.5.1, KENT-44 QA).
 *
 * `flex: 1 1 auto` lets this region ABSORB height that something else has already decided. It does
 * not stop the region ASKING for its full content height when nothing has decided one -- and a CSS
 * grid track sized `auto` asks every item for its max-content contribution. So the instructions
 * card, holding several hundred words, sized the whole summary row and the two cards beside it
 * stretched to match. That is what `align-items: start` was previously papering over, at the cost of
 * three cards of three different heights, which is what QA reported.
 *
 * With a ceiling here the card's natural height is bounded, the row settles on the tallest of the
 * three, and stretch makes them equal -- no JS measurement in the loop. 15rem, not px, so it tracks
 * the user's text size: at a larger base size the region grows with the words rather than clipping
 * more of them.
 *
 * OPT-IN, not automatic. The ceiling is a MODIFIER because .kc-v2-card__scroll is also worn by
 * things that are already bounded and must not be re-bounded -- the Business License agreement
 * puts it straight on a <textarea rows="16">, and capping that clipped the terms. A card only
 * needs --clamped when its natural height would otherwise size a row it shares.
 *
 * A card that WANTS to be driven by a sibling still can be -- data-kc-v2-match-height sets an
 * explicit max-height, which wins over this.
 *
 * ONLY WHILE THE CARDS SHARE A ROW. Below 640px these grids are one column, and a full-width card
 * has no sibling to be taller than -- capping it there would make it scroll for no reason, which is
 * the same rule the match-height JS already follows when it releases its cap on wrap. The first
 * version of this had no media query and made the stacked card scroll; clamp-test caught it at
 * 375px. */
@media (min-width: 641px) {
  .kc-v2-card__scroll--clamped {
    max-height: 15rem;
  }
}

.kc-v2-card__scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 4px;
  overflow-y: auto;
  /* Reserves the scrollbar track only once scrolling is actually possible, so the prose does
     not sit under the scrollbar and does not reflow when the cap is added or removed. */
  scrollbar-gutter: stable;
}

/* ---------------------------------------------------------------------------
 * Card groups (1.5.5, KENT-55 QA)
 *
 * QA on the Community home page: "proposed three-column layout to group the nine cards... visual
 * bounding box around each column to aid scanning... label each column." The page had one flat
 * auto-fitting grid, so a filer scanning for "where do I upload a document" read every card.
 *
 * A GROUP IS A REGION, NOT A CARD. It takes a border and a label but no fill, deliberately: the page
 * ground is --kc-v2-ink-100 and the cards inside are white, so tinting the group would either flatten
 * that contrast or force the cards to grow a border of their own. ink-300 is the same border colour
 * inputs and segmented options already use, and it reads clearly against ink-100 -- ink-200, the next
 * step down, is barely a line on that ground.
 *
 * STRETCH, not align-items:start. Three bounding boxes of three different heights read as ragged
 * rather than as columns, which is the same conclusion the Annual summary cards reached under
 * KENT-44. A group with fewer cards ends with space beneath them, and that is the correct shape for
 * a column with less in it.
 *
 * The container reuses the auto-fit track list from .kc-v2-grid--cards rather than declaring three
 * fixed columns: the number of GROUPS is fixed at three, but a 320px floor is what keeps them from
 * being crushed at tablet widths, and it collapses to one column with no media query.
 * ------------------------------------------------------------------------- */
.kc-v2-card-groups {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--kc-v2-space-4);
}

.kc-v2-card-group {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--kc-v2-space-4);
  padding: var(--kc-v2-space-4);
  border: 1px solid var(--kc-v2-ink-300);
  border-radius: var(--kc-v2-radius-lg);
}

/* ---------------------------------------------------------------------------
 * EVERY CARD THE SAME HEIGHT, ACROSS GROUPS
 *
 * As flex columns each card took its natural height: File Taxes carries two stacked buttons and
 * Upload Annual Reconciliation wraps its title, so both stood taller than the cards beside them.
 * Flex cannot fix this -- equalising within one column says nothing about the next, and the columns
 * hold two, two and three cards, so any proportional split makes them differ by design.
 *
 * Subgrid is what makes it work: a group opts into the PARENT's rows rather than creating its own, so
 * the Nth card of every column lands in one shared row and therefore one shared height. The parent's
 * card rows are 1fr, so every one of them matches.
 *
 * THE ROW COUNT IS DERIVED IN CSS, not passed in. It has to equal the largest group's card count, and
 * four of the seven cards are behind app settings -- so it is between one and three depending on
 * configuration. :has() reads it straight off the rendered DOM, which means the view stays declarative
 * and no count can drift out of step with the cards actually present. Hardcoding the maximum instead
 * would leave a full-height empty row in every box whenever a flag is off, because an empty 1fr row
 * still takes an equal share.
 *
 * :nth-of-type counts the group's DIVs, and its only non-div child is the label, so "third div" is
 * exactly "third card".
 *
 * GATED ON BOTH FEATURES TOGETHER. Where either is missing the whole block is skipped and the groups
 * stay flex columns at natural heights -- grouped, boxed and labelled, just not equalised. Splitting
 * the gate would apply the row template without the subgrid that consumes it.
 * ------------------------------------------------------------------------- */
@media (min-width: 1024px) {
@supports (grid-template-rows: subgrid) and (selector(:has(*))) {
  .kc-v2-card-groups {
    grid-template-rows: auto repeat(1, minmax(0, 1fr));
  }
  .kc-v2-card-groups:has(.kc-v2-card-group > .kc-v2-card:nth-of-type(2)) {
    grid-template-rows: auto repeat(2, minmax(0, 1fr));
  }
  .kc-v2-card-groups:has(.kc-v2-card-group > .kc-v2-card:nth-of-type(3)) {
    grid-template-rows: auto repeat(3, minmax(0, 1fr));
  }

  .kc-v2-card-group {
    display: grid;
    grid-row: 1 / -1;
    grid-template-rows: subgrid;
    /* A grid item's automatic minimum size is its CONTENT, in both axes. Left at auto, a group
       refuses to narrow past its widest card, the auto-fit column track cannot shrink with it, and
       the three columns stay side by side at 375px and push the page sideways -- which is what
       happened: 698px of scroll width in a 375px viewport. Flex items did not have this problem
       because they were already free to shrink. */
    min-width: 0;
  }

  /* Same reasoning one level down, plus the height: without it one long card raises its own row above
     the others and undoes the equalising. */
  .kc-v2-card-group > .kc-v2-card {
    min-width: 0;
    min-height: 0;
  }
}
}

/* Own box-sizing reset, per contract rule 3: no required wrapper root, so each container component
   normalises its own descendants. */
.kc-v2-card-group *,
.kc-v2-card-group *::before,
.kc-v2-card-group *::after {
  box-sizing: border-box;
}

/* The label. h3 scale rather than the card eyebrow: this names a region CONTAINING cards, so it has
   to outrank the card titles under it rather than read as a caption. margin:0 -- the group's own flex
   gap owns the space beneath it, and a heading margin would add to that rather than replace it. */
.kc-v2-card-group__title {
  margin: 0;
  color: var(--kc-v2-ink-900);
  font-family: var(--kc-v2-font-family);
  font-size: var(--kc-v2-h3-size);
  font-weight: var(--kc-v2-h3-weight);
  line-height: var(--kc-v2-h3-line-height);
  letter-spacing: var(--kc-v2-h3-letter-spacing);
}

/* The border is the whole affordance, so it cannot be a background the OS drops. */
@media (forced-colors: active) {
  .kc-v2-card-group {
    border-color: CanvasText;
  }
}

/* ---------------------------------------------------------------------------
 * Record card (KENT-115)
 *
 * One editable record inside a larger card: a tinted __head holding the record's own fields and its
 * remove action, a __body (usually a .kc-v2-table--light), and a __foot for row-level actions and
 * messages. First used for the Quarterly employee list, one card per employee, where name and SSN had
 * been columns repeated on every city row.
 *
 * __body owns the horizontal scroll, as .kc-v2-table-wrapper does for a free-standing table: the
 * table scrolls inside the card, never the page. min-width: 0 for the same flex reason given there.
 * ------------------------------------------------------------------------- */
.kc-v2-record {
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--kc-v2-ink-200);
  border-radius: var(--kc-v2-radius-md);
  background-color: var(--kc-v2-white);
  font-family: var(--kc-v2-font-family);
}
.kc-v2-record *,
.kc-v2-record *::before,
.kc-v2-record *::after {
  box-sizing: border-box;
}

.kc-v2-record__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--kc-v2-space-3);
  padding: var(--kc-v2-space-3);
  border-bottom: 1px solid var(--kc-v2-ink-200);
  background-color: var(--kc-v2-ink-50);
}

/* The record's ordinal. Decorative (the section is labelled "Employee n"), so it is aria-hidden in
   the markup. Bottom margin centres it on the 34px compact inputs beside it. */
.kc-v2-record__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-bottom: 4px;
  border-radius: 50%;
  background-color: var(--kc-v2-ink-900);
  color: var(--kc-v2-white);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* A <label> wrapping its caption and control. display and margin restated against Bootstrap's bare
   label rule (inline-block, margin-bottom: 5px). */
.kc-v2-record__field {
  display: block;
  flex: 0 1 170px;
  min-width: 0;
  margin: 0;
}
.kc-v2-record__field--wide { flex-basis: 300px; }
.kc-v2-record__field .kc-v2-input { width: 100%; }
.kc-v2-record__field .kc-v2-label { font-size: 12px; line-height: 14px; }

/* Pushes an item (and everything after it) to the far end of a __head or __foot row. */
.kc-v2-record__end { margin-left: auto; }

.kc-v2-record__body {
  overflow-x: auto;
  min-width: 0;
}

.kc-v2-record__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kc-v2-space-3);
  padding: var(--kc-v2-space-3);
  border-top: 1px solid var(--kc-v2-ink-100);
}

/* The primary row's label beside its tag, kept on one line where the column allows. */
.kc-v2-record__primary-city {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--kc-v2-ink-800);
}

/* A row subordinate to the one above it: a turn-arrow, then the control. */
.kc-v2-record__child {
  display: flex;
  align-items: center;
  gap: 6px;
}
.kc-v2-record__child-marker {
  flex: 0 0 auto;
  color: var(--kc-v2-ink-400);
  font-size: 14px;
}
.kc-v2-record__child > .kc-v2-select-wrapper {
  flex: 1 1 auto;
  min-width: 165px;
}
