/* Card directory: a hub's cards on one chapter field (DESIGN.md, The One Field Per Chapter Rule). Each card spans six
   rows of the list grid (picture, tag, title, text, figures, link) through subgrid, so the same part lines up across a
   row of cards (The Level Row Rule). A part a card leaves out leaves its row empty; the gaps live on the parts, not
   the rows, so an empty row takes no space. Whole-card links, hover lift and focus come from .card-link
   (components.css). Logical properties, so Arabic pages mirror. */
.cd-head { display: grid; gap: 18px; max-width: 900px; }
.cd-field {
  margin-top: clamp(36px, 4.5vw, 64px); padding: clamp(16px, 2.6vw, 36px);
  border-radius: var(--r-xl); background: var(--cd-field, var(--field-mint));
  corner-shape: var(--sq-shape, round);
}
.cd-sky { --cd-field: var(--field-sky); }
.cd-mint { --cd-field: var(--field-mint); }
.cd-green { --cd-field: var(--field-green); }
.cd-coral { --cd-field: var(--field-coral); }
.cd-periwinkle { --cd-field: var(--field-blue); }

.cd-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 22px); }
.cd-list.cd-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cd-card { display: grid; grid-row: span 6; grid-template-rows: subgrid; row-gap: 0; align-content: start; }
.cd-pic { grid-row: 1; margin-bottom: 14px; }
.cd-tag { grid-row: 2; margin-bottom: 8px; }
.cd-card .card-title { grid-row: 3; }
.cd-card .card-text { grid-row: 4; margin-top: 8px; }
.cd-stats { grid-row: 5; margin-top: 16px; }
.cd-card .card-cta { grid-row: 6; margin-top: 18px; align-self: end; }
@supports not (grid-template-rows: subgrid) {
  .cd-card { display: flex; flex-direction: column; }
  .cd-card .card-cta { margin-top: auto; padding-top: 18px; }
}

/* Flo breaks out of her card (DESIGN.md, Flo: standing on, riding or leaping out of a field). She stands in the
   card's top end corner and rises above its top edge by --flo-up, so each row of cards leaves her that much room and
   the first row is pushed down by it. The title and the start of the text wrap round her (a float inside .cd-body);
   below her feet the text takes the card's full width, and the link keeps to the card's foot, level across the row.
   Her square picture is drawn --flo-h tall; every pose's figure sits in its middle 60% (measured, December 2026), so
   the float is that 60% and the picture overhangs it by 20% each side, its clear margins over nothing that matters.
   A soft contact shadow sets her down in the card. Flo's art never mirrors; on Arabic pages she moves to the left. */
.cd-has-flo {
  --flo-h: clamp(196px, 17vw, 236px); --flo-up: calc(var(--flo-h) * 0.42);
  row-gap: calc(var(--flo-up) + 26px); padding-top: var(--flo-up);
}
.cd-has-flo > .cd-card { grid-row: auto; }
.cd-card-flo { display: flex; flex-direction: column; }
.cd-card-flo .cd-body { display: flow-root; }
.cd-card-flo .cd-pic-flo {
  float: inline-end; position: relative; z-index: 1;
  width: calc(var(--flo-h) * 0.6); height: calc(var(--flo-h) - var(--flo-up) - 20px);
  margin-block: 0 10px; margin-inline: 12px -6px; pointer-events: none;
}
.cd-card-flo .cd-pic-flo::after {
  content: ""; position: absolute; z-index: -1; inset-inline: 6%; bottom: -5px; height: 12px;
  background: radial-gradient(closest-side, rgb(11 31 58 / 0.16), transparent);
}
.cd-card-flo .cd-pic-flo img {
  position: absolute; bottom: 0; left: calc(var(--flo-h) * -0.2);
  display: block; width: var(--flo-h); height: var(--flo-h); max-width: none; object-fit: contain; object-position: 50% 100%;
}
.cd-card-flo .card-text { margin-top: 8px; }
.cd-card-flo .card-cta { align-self: start; margin-top: auto; padding-top: 18px; }
/* Under a fine pointer she hops a little higher as her card lifts */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .cd-card-flo .cd-pic-flo img { transition: translate 280ms var(--ease-out); }
  .cd-card-flo.card-link:hover .cd-pic-flo img { translate: 0 -5px; }
}
/* A logo sits on a tile */
.cd-pic-tile-light, .cd-pic-tile-dark {
  display: flex; align-items: center; justify-content: center;
  width: 176px; height: 84px; padding: 14px 20px;
  border-radius: calc(16px * var(--sq-scale, 1)); border: 1px solid var(--tile-dark); background: var(--tile-dark);
  corner-shape: var(--sq-shape, round);
}
.cd-pic-tile-light { background: var(--tile-light); border-color: var(--tile-light-line); }
.cd-pic-tile-light img, .cd-pic-tile-dark img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* A logo with its own dark-background version: the tile follows the theme */
.cd-pic .on-dark { display: none; }
:root[data-theme="dark"] .cd-pic.themed { background: var(--tile-dark); border-color: var(--tile-dark); }
:root[data-theme="dark"] .cd-pic.themed .on-light { display: none; }
:root[data-theme="dark"] .cd-pic.themed .on-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cd-pic.themed { background: var(--tile-dark); border-color: var(--tile-dark); }
  :root:not([data-theme="light"]) .cd-pic.themed .on-light { display: none; }
  :root:not([data-theme="light"]) .cd-pic.themed .on-dark { display: block; }
}

.cd-tag { font: 700 13px/1.3 var(--text); letter-spacing: 0.02em; color: var(--ink-soft); }
.cd-stats { display: grid; align-content: start; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.cd-stats li { display: grid; align-content: start; gap: 2px; }
.cd-stats strong { font: 800 1.6rem/1.1 var(--display); letter-spacing: -0.02em; color: var(--ink); }
.cd-stats span { font-size: 15px; line-height: 1.4; color: var(--ink-soft); }

/* Cards with Flo give her and the words room: two across until 1180px, where three still leave the title a line */
@media (max-width: 1179px) {
  .cd-has-flo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .cd-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .cd-list, .cd-list.cd-two { grid-template-columns: minmax(0, 1fr); }
}
