/* About page (R5, D44, owner's pick B): a short story in the dazprojects style.
   Title, one big photo, short headed sections, a row of photos, one pull quote, the facts.
   No boxes around the text: space and a few hairlines do the separating.
   Shared header, tokens and footer live in styles.css; the card lives in cardyles.css */

/* Rounded photos and popover: --radius-soft in styles.css. (It was a page token, --about-radius,
   set on .story, but the popover sits OUTSIDE .story, so it never got the value: square corners) */
.story {
  padding-bottom: var(--space-8);     /* the top comes from --page-top (styles.css) */
}

/* =========================================================
   HEAD: the name on the left, the Profile card button on the right.
   flex-wrap lets the button drop under the name on a narrow phone
   ========================================================= */
.story-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-3) var(--space-5);
}

.story-head h1 {
  margin: 0;
}

.story-sub {
  margin: var(--space-1) 0 0;
  color: var(--color-muted);
}

/* Same outline pill as Home's "Next card" and Art's "Shuffle" */
.card-open,
.card-close {
  padding: var(--space-1) var(--space-4);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-pill);
  background: none;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  cursor: pointer;
}

.card-open:hover,
.card-close:hover {
  border-color: var(--color-highlight);
}

/* =========================================================
   PHOTOS. Every picture is cropped to its box with object-fit: cover
   (fills it, never stretches); the pale surface shows while it loads.
   Phones get a taller 4:3 hero: 21:9 on a 390px screen is a thin strip
   ========================================================= */
.story-hero,
.story-row img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius-soft);
  background: var(--color-surface);
}

/* Until a real photo replaces it, the stand-in shows at its own size on the pale surface
   instead of being blown up. [src$="…"] matches a src that ENDS with that text, so this
   rule switches itself off the moment the src points at your photo */
.story img[src$="placeholder.svg"] {
  object-fit: none;
}

.story-hero {
  aspect-ratio: 4 / 3;
  margin: var(--space-6) 0;
}

@media (min-width: 52rem) {
  .story-hero {
    aspect-ratio: 21 / 9;
  }
}

/* auto-fit + minmax: three across when there's room, then two, then one. No media query */
.story-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-7);
}

.story-row figure {
  margin: 0;
}

.story-row img {
  aspect-ratio: 4 / 3;
}

.story-row figcaption {
  margin-top: var(--space-2);
  font-size: var(--step--1);
  color: var(--color-muted);
}

/* =========================================================
   TEXT: a bigger lead, then quiet section headings (body font,
   text colour). Only the page title is Cinzel and pine (D44)
   ========================================================= */
.story-lead {
  font-size: var(--step-1);
  line-height: 1.5;
}

.story h2 {
  margin: var(--space-7) 0 var(--space-3);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--color-ink);
}

/* The reset in styles.css zeroes every <p> margin; "p + p" puts the gap BETWEEN paragraphs only */
.story section p + p {
  margin-top: var(--space-3);
}

/* The one pull quote, centred. p already has max-width (65ch), so margin auto centres it */
.story-quote {
  margin: var(--space-7) 0 0;
  padding: 0;
  text-align: center;
}

.story-quote p {
  margin: 0 auto;
  font-family: var(--font-display);
  font-size: var(--step-2);
  color: var(--color-accent);
}

/* =========================================================
   AT A GLANCE: label left, value right, a hairline under each pair.
   Two columns when there's room (auto-fit again)
   ========================================================= */
.story-facts dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  column-gap: var(--space-6);
  margin: 0;
  border-top: 1px solid var(--color-line);
  font-size: var(--step--1);
}

.story-facts dl div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-line);
}

.story-facts dt {
  color: var(--color-muted);
}

.story-facts dd {
  margin: 0;
  text-align: right;
}

/* =========================================================
   PROFILE CARD POPOVER: a golden rectangle, clear of the window edges (owner's pick A, D46).
   Two rules, both worked out from numbers already on the page:
   1. Proportion: width = φ × height (--golden, 1.618). The height is fixed by what's
      inside (padding + the 63:88 card + the Close row), so the width follows from it.
      At 1440px: 455px tall -> 736px wide. (The band it replaced was 3:1, a thin strip.)
   2. Clearance: never wider than the window minus the page gutter on BOTH sides, so it
      stays centred with room around it. (It cleared the edge stripes until they became the
      small mark under the name, O2 / D51.) min() takes whichever rule is smaller: φ on
      screens, clearance on phones.
   The browser places a popover with position: fixed; inset: 0; margin: auto, so a set
   width + margin: auto centres it both ways. The reset in styles.css zeroes every
   margin, so margin: auto has to be put back here, or it sticks to the top-left
   ========================================================= */
.card-pop {
  --pop-card: 16rem;                  /* the card's width inside the panel */
  --pop-close: 2rem;                  /* the Close button's height (small mono text + padding + border) */
  --pop-height: calc(2 * var(--space-5) + var(--pop-card) * 88 / 63 + var(--space-4) + var(--pop-close));
  --pop-clear: var(--gutter);
  width: min(var(--golden) * var(--pop-height), 100% - 2 * var(--pop-clear));
  margin: auto;
  max-height: calc(100dvh - 2 * var(--space-4));   /* a phone on its side: scroll, don't cut off */
  overflow-y: auto;
  padding: var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-soft);
  background: var(--color-bg);
  color: var(--color-ink);
  text-align: center;
}

/* The dimmed page behind it. A plain colour, not a token: older browsers didn't let
   ::backdrop inherit custom properties, so var(--…) here could silently fail */
.card-pop::backdrop {
  background: rgb(0 0 0 / 0.45);
}

/* .card-holder fills its parent, so in the wide panel the card would grow huge: cap it */
.card-pop .card-holder {
  width: min(var(--pop-card), 100%);
  margin-inline: auto;
}

.card-close {
  margin-top: var(--space-4);
}
