/* COLL·HEADER (201) + COLL·ITEM (202) — THE COLLECTION READER. (D-447 · D-560)
 *
 * ═══════════════════════════════════════════════════════════════════════════════════════════════
 * 🔴 THE SURFACE IS A READER, NOT AN INDEX. (D-447)
 *
 * A stack of tone-lifted item cards, the lead one OPEN, each expanding INLINE when she taps the row.
 * No page hop. She came here to CONSUME, and every tap-and-load between her and the answer is a tax
 * on a woman holding a baby. An index is a menu of places to go next; a reader is the thing itself.
 *
 * ── 🔴 THE WELL WAS BLANK, FOR EVERY COLLECTION, AND NOBODY KNEW ────────────────────────────────
 * `reader.js` said in its own header: "Not one collection in content-items.json has a member list."
 * That stopped being true. All six carry `items: [ids]`, and every one of the thirty ids resolves.
 * But `renderItems()` still did `if (!members.length) return <empty>; return '';` — so for EVERY
 * REAL COLLECTION it rendered a header and then AN EMPTY WELL. Not the honest-empty state. Nothing.
 * A comment describing a fact that had since become false, load-bearing, in a return statement.
 *
 * ── COLOUR IS KIND-FAMILY, AND IT COMES FROM THE CHIP ALONE (D-454) ────────────────────────────
 *   Read  = teal   (faq · article · topic)
 *   Do    = clay   (how-to · checklist)
 *   Watch = gold   (animation)
 *   Track = slate  (tool)
 * Titles and body are `--text-primary`. AREA IS NEVER COLOUR-CODED (D-379/D-444): "Sleep is always
 * blue" is forbidden — shape says what a thing IS, colour says what STATE it is in.
 * ═══════════════════════════════════════════════════════════════════════════════════════════════ */

.crd { min-height: 100%; padding: var(--rhythm-pad); display: flex; flex-direction: column; gap: var(--space-12); }

/* ── 201 · THE HEADER. Bare, not boxed (D-435: one level of carding). ───────────────────────── */
.crd-bar { display: flex; align-items: center; justify-content: space-between; }
.crd-close { width: var(--dim-40); height: var(--dim-40); border: 0; background: 0; color: var(--text-secondary); border-radius: var(--radius-round); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.crd-close svg { width: var(--size-18); height: var(--size-18); }
.crd-close:active { opacity: 0.72; }
.crd-close:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }

.crd-eyebrow { display: flex; align-items: center; gap: var(--space-8); font-family: var(--font-label); font-size: var(--size-11); font-weight: var(--weight-700); letter-spacing: var(--tracking-05); text-transform: uppercase; color: var(--text-tertiary); }
/* "Curated" is a claim, and D-443 makes it TRUE BY CONSTRUCTION: a curated collection is read-only,
 * because a parent's own pins in a reviewed set would break the very thing the badge asserts. */
.crd-curated { display: inline-flex; align-items: center; gap: var(--space-4); color: var(--accent); }
.crd-curated svg { width: var(--size-14); height: var(--size-14); }
.crd-title { font-family: var(--font-display); font-weight: var(--weight-500); font-size: var(--size-28); line-height: var(--leading-115); color: var(--text-primary); margin: 0; }
.crd-stand { font-family: var(--font-body); font-size: var(--size-15); line-height: var(--leading-150); color: var(--text-secondary); margin: 0; max-width: 34em; } /* token-exception: measure */

/* ── 202 · THE ITEM CARD ────────────────────────────────────────────────────────────────────── */
.crd-well { display: flex; flex-direction: column; gap: var(--space-8); margin-top: var(--space-8); }

.crd-item { background: var(--surface-card); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow: hidden; }

/* 🔴 THE WHOLE ROW IS THE EXPAND AFFORDANCE — THERE IS NO PER-ITEM EXPAND CHEVRON. (D-453 amended)
 * The chevron means exactly ONE thing app-wide: "reveal Pin · Remind me · Share". If it ALSO meant
 * "open this item", it would mean two things, and a parent would learn neither. */
/* 🔴 THE ROW AND THE MENU ARE SIBLINGS. (D-561)
 * I nested the actions <button> inside the row <button>. A BUTTON CANNOT CONTAIN A BUTTON — the
 * parser closes the outer one when it meets the inner one and re-parents everything after it. The
 * DOM the browser built was not the DOM I wrote, and the JS never threw, so it presented as a
 * styling bug. It was a structure bug, in string-concatenated markup, where no compiler was ever
 * going to tell me. */
.crd-row { display: flex; align-items: flex-start; padding-right: var(--space-8); }
.crd-head { display: flex; align-items: flex-start; gap: var(--space-12); flex: 1; min-width: 0; padding: var(--space-16); border: 0; background: 0; text-align: left; cursor: pointer; }
.crd-row .act-wrap { margin-top: var(--space-16); }
.crd-head:active { background: var(--surface-card-hover); }
.crd-head:focus-visible { outline: var(--focus-ring); outline-offset: calc(-1 * var(--focus-offset)); }

/* the chip: SHAPE = the exact kind, COLOUR = the family (D-454) */
.crd-chip { width: var(--dim-32); height: var(--dim-32); flex: none; border-radius: var(--radius-round); display: flex; align-items: center; justify-content: center; }
.crd-chip svg { width: var(--size-16); height: var(--size-16); }
.k-read  .crd-chip { background: var(--kind-read-fill);  color: var(--kind-read-icon); }
.k-do    .crd-chip { background: var(--kind-do-fill);    color: var(--kind-do-icon); }
.k-watch .crd-chip { background: var(--kind-watch-fill); color: var(--kind-watch-icon); }
.k-track .crd-chip { background: var(--kind-track-fill); color: var(--kind-track-icon); }

.crd-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.crd-ititle { font-family: var(--font-display); font-size: var(--size-16); font-weight: var(--weight-500); line-height: var(--leading-115); color: var(--text-primary); }
.crd-imeta { font-family: var(--font-label); font-size: var(--size-11); font-weight: var(--weight-600); letter-spacing: var(--tracking-05); text-transform: uppercase; color: var(--text-tertiary); }

.crd-body { display: none; padding: 0 var(--space-16) var(--space-16); }
.crd-item.is-open .crd-body { display: block; }
.crd-p { font-family: var(--font-body); font-size: var(--size-15); line-height: var(--leading-150); color: var(--text-primary); margin: 0 0 var(--space-12); max-width: 34em; } /* token-exception: measure */
.crd-p:last-child { margin-bottom: 0; }
.crd-p strong { font-weight: var(--weight-600); }

/* ── FORMAT BY JOB (D-466) ──────────────────────────────────────────────────────────────────── */

/* a HOW-TO has an order that matters ⇒ NUMBERED steps */
.crd-steps { margin: 0 0 var(--space-12); padding-left: var(--space-20); display: flex; flex-direction: column; gap: var(--space-8); }
.crd-steps li { font-family: var(--font-body); font-size: var(--size-15); line-height: var(--leading-150); color: var(--text-primary); }
.crd-steps li::marker { font-family: var(--font-label); font-weight: var(--weight-700); color: var(--kind-do-icon); }

/* a CHECKLIST is an unordered SET of things to try ⇒ static markers, NO counter, NO ticking-off.
 * 🔴 D-452: it is a list of OPTIONS, not a quota. "3 of 5 done" turns a kindness into homework, at
 * 4am, for someone already convinced she is failing. */
.crd-check { list-style: none; margin: 0 0 var(--space-12); padding: 0; display: flex; flex-direction: column; gap: var(--space-8); }
.crd-check li { display: flex; align-items: flex-start; gap: var(--space-8); font-family: var(--font-body); font-size: var(--size-15); line-height: var(--leading-150); color: var(--text-primary); }
.crd-check svg { width: var(--size-16); height: var(--size-16); flex: none; margin-top: var(--nudge-2); color: var(--kind-do-icon); }

/* a WATCH item shows the poster and a play mark. 🔴 IT NEVER AUTOPLAYS (D-450 / WCAG 2.2.2) —
 * motion starts when she asks for it, not when the page decides she is ready. */
.crd-poster { position: relative; border-radius: var(--radius-card); overflow: hidden; margin-bottom: var(--space-12); background: var(--cream-150); }
.crd-poster img, .crd-poster video { display: block; width: 100%; height: auto; }
.crd-play { position: absolute; inset: 0; margin: auto; width: var(--dim-56, 56px); height: var(--dim-56, 56px); border: 0; border-radius: var(--radius-round); background: var(--surface-card); color: var(--kind-watch-icon); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-card); } /* token-exception */
.crd-play svg { width: var(--size-20); height: var(--size-20); margin-left: var(--nudge-2); }
.crd-play:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.crd-poster.is-playing .crd-play { display: none; }

/* a TRACK item does NOT inline the tool. It is a door, and it says where it goes. */
.crd-openlog { display: inline-flex; align-items: center; gap: var(--space-8); min-height: var(--dim-44); padding: 0 var(--space-16); border: 0; border-radius: var(--radius-pill); background: var(--kind-track-fill); color: var(--kind-track-icon); font-family: var(--font-label); font-size: var(--size-14); font-weight: var(--weight-700); cursor: pointer; }
.crd-openlog svg { width: var(--size-16); height: var(--size-16); }
.crd-openlog:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }

/* 🔴 A HARD GATE IS NOT A PARAGRAPH. (SAFE-12 is a member of COLL-03.)
 * "Stop swaddling now." must not arrive as the fourth sentence of a body. It sits ABOVE the steps,
 * in gold — the one colour that means NOTICE (D-440) — because a safety line she scrolls past is a
 * safety line we did not give her. */
.crd-gate { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-12) var(--space-16); margin-bottom: var(--space-12); background: var(--gold-90); border-radius: var(--radius-card); }
.crd-gate-h { font-family: var(--font-label); font-size: var(--size-14); font-weight: var(--weight-700); color: var(--gold-700); }
.crd-gate-b { font-family: var(--font-body); font-size: var(--size-14); line-height: var(--leading-150); color: var(--text-primary); }

/* ── 🔴 PROVENANCE: RENDERED FROM DATA, OR NOT AT ALL. (D-439 · D-451 · D-465) ────────────────
 *
 * Source on the LEFT, "Reviewed by a paediatrician" on the RIGHT, one hairline above, NO DATE.
 * The reviewer is OUR commissioned clinician; the source is the evidence. They are NEVER fused —
 * "Source: NHS · Reviewed by a paediatrician" as one string reads as an NHS endorsement, which is a
 * fabrication.
 *
 * ⚠️ AND NOT ONE ITEM IN THE CORPUS HAS EITHER FIELD. So today this footer DOES NOT RENDER — and
 * the previous reader hardcoded it, stamping "Source: NHS · Reviewed by a paediatrician" onto a
 * dummy page about reflux (D-541). There is a test that fails the build if anyone does it again. */
.crd-prov { margin-top: var(--space-16); padding-top: var(--space-12); border-top: 1px solid var(--border-hairline); display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); } /* token-exception: a hairline */
.crd-src { font-family: var(--font-label); font-size: var(--size-11); font-weight: var(--weight-600); color: var(--text-tertiary); }
.crd-rev { display: inline-flex; align-items: center; gap: var(--space-4); font-family: var(--font-label); font-size: var(--size-11); font-weight: var(--weight-700); color: var(--accent); }
.crd-rev svg { width: var(--size-14); height: var(--size-14); }

/* the honest empty — deliberately plain. It must NOT look like a designed page of content, because
 * the failure it replaced was a page that looked exactly like one (D-541). */
.crd-empty { padding: var(--space-40) var(--space-24); text-align: center; }
.crd-empty-h { font-family: var(--font-display); font-size: var(--size-18); font-weight: var(--weight-500); color: var(--text-primary); margin: 0 0 var(--space-8); }
.crd-empty-s { font-family: var(--font-body); font-size: var(--size-14); line-height: var(--leading-150); color: var(--text-secondary); margin: 0; }


/* ── 🔴 RELATED TOPICS — the exit D-455 promised in July and nobody built. (D-564) ─────────────
 *
 * Dropping nesting did not just delete the sub-collection menu; it REPLACED it with "an editorial
 * related-link". The link WAS the compensation for losing the hierarchy — and it never arrived. A
 * parent who finished "Reflux & spit-up" hit the bottom of the page and the app had nothing more to
 * say, while "Crying and colic" next door shared two of its five items.
 *
 * It is the LAST thing on the page, deliberately: she came here to read one thing, and the exit is
 * offered when she has finished it, not alongside it (D-447 — a reader, not an index).
 *
 * ⚠️ AND IT IS BARE, NOT CARDED. One level of carding (D-435): the item cards above are the cards.
 * A second stack of cards under them would read as more of the collection, which is the one thing
 * these are not. */
.crd-related { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-24); padding-top: var(--space-16); border-top: 1px solid var(--border-hairline); } /* token-exception: a hairline */
.crd-relh { font-family: var(--font-label); font-size: var(--size-12); font-weight: var(--weight-700); letter-spacing: var(--tracking-05); text-transform: uppercase; color: var(--text-tertiary); margin: 0 0 var(--space-4); }
.crd-rel { display: flex; align-items: center; gap: var(--space-12); width: 100%; min-height: var(--dim-56, 56px); padding: var(--space-12) var(--space-4); border: 0; background: 0; text-align: left; cursor: pointer; }
.crd-rel:active { background: var(--surface-card-hover); border-radius: var(--radius-card); }
.crd-rel:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.crd-relmid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.crd-relt { font-family: var(--font-display); font-size: var(--size-16); font-weight: var(--weight-500); color: var(--text-primary); }
.crd-relm { font-family: var(--font-label); font-size: var(--size-11); font-weight: var(--weight-600); letter-spacing: var(--tracking-05); text-transform: uppercase; color: var(--text-tertiary); }
.crd-rel svg { width: var(--size-16); height: var(--size-16); flex: none; color: var(--text-tertiary); }


/* "Also in …" — DERIVED from membership (D-565). A quiet, true line, not a recommendation. */
.crd-also { font-family: var(--font-label); font-size: var(--size-11); font-weight: var(--weight-600); letter-spacing: var(--tracking-05); text-transform: uppercase; color: var(--text-tertiary); margin: var(--space-12) 0 0; }
.crd-alsol { border: 0; background: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-transform: none; letter-spacing: 0; }
.crd-alsol:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }


/* ── 🔴 THE THREE BANDS — "KEEPING HER SAFE". (D-568) ─────────────────────────────────────────
 *
 * Andrew: "how will the user know it has changed? wont they assume they have already read it so
 * will ignore it for later updates."
 *
 * The answer is NOT a badge. It is a page whose SHAPE says it is not finished: NOW / EARLIER /
 * COMING UP. She reads it once and learns the page is time-shaped — there is stuff ahead, and it is
 * ahead on purpose. No unread count, no dot, no nudge (D-452).
 *
 * ⚠️ COMING UP IS DELIBERATELY QUIET, AND DELIBERATELY SHUT. Tertiary text, no chip fill, no actions
 * chevron, and the row does not open (`:disabled`) — she can SEE that the cot mattress is waiting
 * for her at around eight months without being able to walk into advice about a baby she does not
 * have yet (D-490). The whole point is the promise, not the content. */
.crd-well-banded { gap: var(--space-24); }
.crd-band { display: flex; flex-direction: column; gap: var(--space-8); }
.crd-bandh { font-family: var(--font-label); font-size: var(--size-12); font-weight: var(--weight-700); letter-spacing: var(--tracking-05); text-transform: uppercase; color: var(--text-tertiary); margin: 0; }

/* NOW is the one band that is allowed to raise its voice — and gold NOTICES (D-440). One gold
 * moment: the band label. The gate inside the lead card is the same gold, and that is the pair. */
.crd-band-now .crd-bandh { color: var(--gold-700); }

/* the honest quiet week. Most weeks nothing new goes live, and saying so is the most reassuring
 * line on the page — suppressing the band would leave her unable to tell "nothing to do" from
 * "the app forgot". */
.crd-bandq { font-family: var(--font-body); font-size: var(--size-14); line-height: var(--leading-150); color: var(--text-tertiary); margin: 0; }

/* 🔴 THE FLAG — what CHANGED, above the title, which still says which article. (D-568)
 * Gold notices, teal acts (D-440). This is the one gold moment in the row, and it is the same gold
 * as the hard gate inside the body it opens onto — the alert and its page, in one colour. */
.crd-flag { display: flex; align-items: center; gap: var(--space-4); font-family: var(--font-label); font-size: var(--text-label); font-weight: var(--weight-700); letter-spacing: var(--tracking-05); text-transform: uppercase; color: var(--gold-700); }
.crd-flag svg { width: var(--size-12); height: var(--size-12); flex: none; }

/* ── 🔴 "OTHER STAGES" — THE QUIET LABEL D-455 HAS REQUIRED SINCE JULY. (D-570) ────────────────
 *
 * Seventeen items carry an age band and NOT ONE of them said so on any surface. "The 4-month sleep
 * shift" offered "Swaddling, safely" (1–20 weeks) to the parent of a 30-week-old with no hint that
 * it had stopped applying ten weeks ago. It rendered. It looked like advice.
 *
 * ⚠️ IT IS A WHISPER, NOT A GATE. Not struck through, not disabled, not hidden — she may be reading
 * back, or ahead, or have a second baby. It says WHEN it applied and lets her decide (D-452). The
 * hard floor is a different thing, and that is what the gold gate is for. */
.crd-stage { color: var(--text-tertiary); text-transform: none; letter-spacing: 0; font-weight: var(--weight-400); }
.crd-stage::before { content: ' · '; }

.crd-b-coming .crd-ititle { color: var(--text-tertiary); font-weight: var(--weight-400); }
.crd-b-coming .crd-chip { background: 0; color: var(--text-tertiary); }
.crd-b-coming .crd-head { cursor: default; }
.crd-b-coming .crd-head:active { background: 0; }
