/* focus-area-cards - dedicated card-grid styling for
   transform-2030-focus-areas's right-hand content area, ported from the
   reference gff-focus-area-cards.html. Deliberately its own file, loaded
   in place of (not alongside) layouts/cards__layout2/css/cards__layout.css
   - this is a different card design, not a variant of the shared one.
   Scoped to .focus-areas__card* class names (not the reference's own
   `fa-*` prefix) to match this project's own BEM convention and avoid any
   collision with Font Awesome's own `.fa-` icon-class prefix if that's
   ever loaded on the same real page. */

/* .focus-area-cards-scope: a second hook alongside .focus-areas, for any
   other component (e.g. transform-2030-tabs) that wants this exact card
   file without also being named/shaped like the focus-areas sidebar
   layout - the --card-* variables below are the only thing those
   consumers actually need from this selector. */
.focus-areas,
.focus-area-cards-scope {
  /* Colors checked against base/color/color.css's token collection first
     (see WORKLOG for the exact diffs) - reused where a token was close:
     --bg (diff 2) -> --clr-neutral-200, --placeholder (diff 3) ->
     --clr-blue-gray-200, --yellow (diff 14) -> --clr-yellow-500, --ink
     (diff 15) -> --clr-gray-900, --navy (diff 20, same hue family as the
     project's own canonical GFF blue) -> --clr-blue. The remaining four
     (--card-rule/--card-muted/--card-navy-ink/--card-teal-dark) had no
     close match (diff 26-66) and are genuinely new - scoped locally here,
     not added to the global token file, since they're specific to this
     one card design rather than a sitewide need. */
  --card-bg: var(--clr-neutral-200);
  --card-surface: var(--clr-white);
  --card-placeholder: var(--clr-blue-gray-200);
  --card-yellow: var(--clr-yellow-500);
  --card-ink: var(--clr-gray-900);
  --card-navy: var(--clr-blue);
  --card-rule: #bfc7d1;
  --card-muted: #4e5866;
  --card-navy-ink: #1f3a60;
  --card-teal-dark: #2e7f76;
  /* darkened from brand teal for AA contrast with white text - not used by the card grid itself currently, kept for parity with the reference's own token set */

  --card-h: 168px;
  /* thumbnail height = card height; text is clamped to fit - tall enough for the --long-title worst case (3-line 18px title + 1-line 14px desc + the 30px foot row) at the larger font sizes, so flexbox's default shrink doesn't compress the title below its clamped line-clamp box and visibly cut the 3rd line */
  --card-thumb-w: 174px;
  --card-pad: 18px;
  /* one inner padding for the whole card: around the photo, photo-to-text gap, around the text */
  --card-leaf: 32px;
  /* leaf corner radius: two opposite corners rounded */
  --card-leaf-in: calc(var(--card-leaf) - var(--card-pad));
  /* photo leaf, concentric with the card */
  --card-gap: 16px;
  --card-min: 360px;
  /* min column width before the grid drops to 1 column */

  /* icon-tile background cycle, 4 colors repeating via nth-child below */
  --card-icon-bg-1: #bee9e6;
  --card-icon-bg-2: #c3dbf1;
  --card-icon-bg-3: #ffe2d9;
  --card-icon-bg-4: #e5c9e2;
}

.focus-areas__card-grid {
  display: grid;
  /* grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min)), 1fr)); */
  grid-template-columns: repeat(2, 1fr);
  gap: var(--card-gap);
}

@media (max-width: 1199px) {
  .focus-areas__card-grid {
    grid-template-columns: 1fr;
  }
}

.focus-areas__card {
  display: flex;
  height: var(--card-h);
  background: var(--card-surface);
  border-radius: 0 var(--card-leaf) 0 var(--card-leaf);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(30, 50, 80, 0.08);
  transition: box-shadow 0.2s;
}

.focus-areas__card:hover {
  box-shadow: 0 4px 14px rgba(30, 50, 80, 0.14);
}

.focus-areas__card:focus-visible {
  outline: 3px solid var(--card-navy-ink);
  outline-offset: 3px;
}

/* Mirrored pairs: every second card flips the leaf so neighbours face each other */
.focus-areas__card:nth-child(even) {
  border-radius: var(--card-leaf) 0 var(--card-leaf) 0;
}

/* 1200-1599px: the grid is a fixed 2 columns here (--card-min:360px never
   lets a 3rd column fit in that range), so the simple odd/even stripe above
   would make every card in the SAME column repeat the SAME corner forever,
   however many rows get added. A diagonal/checkerboard swap instead - each
   2x2 block mirrors both across AND down (1&4 share one leaf direction, 2&3
   the other) - reads as proper facing pairs in every direction and repeats
   cleanly as more cards add more rows: nth-child(4n+2)/(4n+3) are rows
   1,3,5...'s RIGHT card and rows 2,4,6...'s LEFT card (positions
   2,3,6,7,10,11...). >=1600px forces 3 columns instead (below) - the plain
   odd/even stripe above is what you want again there (each column still
   needs a single consistent corner, just 3 columns' worth instead of 2),
   so this diagonal override stops applying at that width. */
.focus-areas__card:nth-child(even) {
  border-radius: 0 var(--card-leaf) 0 var(--card-leaf);
}

.focus-areas__card:nth-child(4n + 2),
.focus-areas__card:nth-child(4n + 3) {
  border-radius: var(--card-leaf) 0 var(--card-leaf) 0;
}

/* 1200-1300px: narrow the auto-fill minimum in just this tight range so
   the grid has room to behave normally instead of being squeezed toward a
   single awkward column by the default 360px minimum. */
@media (min-width: 1200px) and (max-width: 1300px) {

  .focus-areas,
  .focus-area-cards-scope {
    --card-min: 320px;
  }
}

.focus-areas__card-thumb {
  flex: 0 0 30%;
  max-width: var(--card-thumb-w);
  padding: var(--card-pad) 0 var(--card-pad) var(--card-pad);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
}

/* Icon tile, not a photo panel: fills the thumb slot, uniform rounding
   (no leaf-flip - that was a photo-panel treatment). The data-theme-type
   attribute is set by the twig template itself, straight from
   card.theme_type ("theme_1".."theme_4"). js/focus-area-cards.js only
   covers cards with no theme_type - it walks whatever icon tiles are still
   uncolored in real DOM order and cycles the same 4 colors positionally
   (setting the same attribute, so the rules below cover both paths). */
.focus-areas__card-icon {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.focus-areas__card-icon[data-theme-type="theme_1"] {
  background-color: var(--card-icon-bg-1);
}

.focus-areas__card-icon[data-theme-type="theme_2"] {
  background-color: var(--card-icon-bg-2);
}

.focus-areas__card-icon[data-theme-type="theme_3"] {
  background-color: var(--card-icon-bg-3);
}

.focus-areas__card-icon[data-theme-type="theme_4"] {
  background-color: var(--card-icon-bg-4);
}

.focus-areas__card-icon img {
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  max-width: 95%;
}

/* Coming soon: not a link (rendered as a plain <div>), no arrow - icon tile keeps its cycle color */
.focus-areas__card--soon {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.focus-areas__card--soon:hover {
  box-shadow: none;
}

.focus-areas__card--soon .focus-areas__card-title,
.focus-areas__card-soon {
  color: var(--card-muted);
}

.focus-areas__card-soon {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  font-size: 13.5px;
  font-weight: 700;
}

.focus-areas__card-body {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--card-pad);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.focus-areas__card-title,
.focus-areas__card-desc {
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.focus-areas__card-title {
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--clr-gray-dark);
}

.focus-areas__card-desc {
  font-size: 14px;
  line-height: 1.45;
  color: var(--card-muted);
}

/* card.blurb can be rich text with its own real <p> tags now that the
   wrapper is a div - strip their default margin so multiple paragraphs
   read as one clamped block instead of gapping inside it, and force every
   child back to the desc's own 14px regardless of whatever font-size the
   rich-text editor baked into its markup (inline style or its own class). */
.focus-areas__card-desc p {
  margin: 0;
}

.focus-areas__card-desc>* {
  font-size: inherit;
}

/* Long titles get a third line; the description gives one up so the card height never changes */
.focus-areas__card--long-title .focus-areas__card-title {
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.focus-areas__card--long-title .focus-areas__card-desc {
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

.focus-areas__card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.focus-areas__card-link {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--card-navy);
}

.focus-areas__card-arrow {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--clr-yellow-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  /* The arrow's svg uses stroke="currentColor" with no color of its own,
     so it was inheriting .focus-areas__card's color - fine normally, but
     a global `a:hover, a:focus { color: var(--site-primary-color) }` rule
     (outside this component, specificity (0,0,1,1) vs this class rule's
     (0,1,0,0) - loses the tie here, but the card is an <a>, so that global
     rule still legitimately WINS the color on the card itself, and the
     arrow then inherited that hover color instead of staying put) was
     bleeding into it on hover/focus. Setting an explicit color here (same
     navy-ink the reference hardcodes directly on its own arrow svg via
     stroke="#1F3A60") decouples the arrow from the card's own color in
     every state, rather than chasing the override through :hover/:focus. */
  color: var(--card-navy-ink);
}

.focus-areas__card:hover .focus-areas__card-arrow {
  transform: translateX(3px);
  background: var(--clr-blue);
  color: var(--clr-white);
}

/* ---------- Responsive (breakpoints match the reference exactly - 767/600,
   not this project's own 991/767 convention, since this card system's own
   proportions were tuned against those specific widths) ---------- */
@media (max-width: 767px) {
  .focus-areas__card-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  /* Placed before the max-600px block below - that one's own 15px override
     still wins at <=600px (equal specificity, later in source), this one
     only takes effect in the 601-767px gap between the two breakpoints. */
  .focus-areas__card-title {
    font-size: 16px;
  }
}

@media (max-width: 600px) {

  .focus-areas,
  .focus-area-cards-scope {
    --card-h: 144px;
    --card-leaf: 28px;
    --card-pad: 14px;
  }

  .focus-areas__card-thumb {
    flex-basis: 30%;
    max-width: 146px;
  }

  .focus-areas__card-icon {
    border-radius: 16px;
  }

  .focus-areas__card-icon img {
    width: 60px;
    height: 60px;
  }

  .focus-areas__card-title {
    font-size: 15px;
  }

  .focus-areas__card--long-title-sm .focus-areas__card-title {
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }

  .focus-areas__card--long-title-sm .focus-areas__card-desc {
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }
}

@media (prefers-reduced-motion: reduce) {

  .focus-areas__card,
  .focus-areas__card-arrow {
    transition: none !important;
  }
}
