/* ============================================================
   CHI SHAN — the shared parts for proof (WP-11, the her-site wave stage 1)
   StoryCard · FilmBlock · FaqList · Lightbox
   (src/components/*.astro, public/lightbox.js; design brief § 4.6–4.9, § 6,
   plan § 5).

   Every colour and face is a token from chishan.css :root; no hex here. The
   frame (SiteLayout) links this sheet on every page after parts-offer.css,
   whose Photo rules these parts build on.
   Every transition and animation below has its reduced-motion line beside it.
   ============================================================ */

/* ============================================================
   STORYCARD (brief § 4.6)
   ============================================================ */
.story-tile, .story-feature { position: relative; min-width: 0; }
.story-more { display: none; } /* hidden triggers: members of the viewer's set, not laid out */
.story-media { min-width: 0; }

.story-label {
  font-family: var(--label);
  font-size: var(--t-label);
  line-height: var(--lh-label);
  letter-spacing: var(--track-label);
  font-weight: 500;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.story-title { color: var(--ink); }
.story-summary { max-width: var(--measure); }

/* ---- Tile: the photo is the card; no box, no border ---- */
.story-tile .story-body { margin-top: var(--s-4); }
.story-tile .story-title { margin-top: var(--s-2); }
.story-tile .story-summary { margin-top: var(--s-2); }

/* A tile that links: the title is the link, and its hit area covers the tile */
.story-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: text-decoration-color var(--dur-hover) var(--ease);
}
.story-link::after { content: ""; position: absolute; inset: 0; }
.story-tile--link:hover .story-link,
.story-link:focus-visible { text-decoration-color: var(--brass-deep); }
@media (prefers-reduced-motion: reduce) { .story-link { transition: none; } }

/* ---- Feature: the lead photo on columns 1–7, the text on 8–12 ---- */
.story-feature {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--grid-gap);
  align-items: center;
}
.story-feature > .story-media { grid-column: 1 / span 7; grid-row: 1; }
.story-feature > .story-body  { grid-column: 8 / span 5; grid-row: 1; }
.story-feature--flip > .story-media { grid-column: 6 / span 7; }
.story-feature--flip > .story-body  { grid-column: 1 / span 5; }

/* The stacked feature (class story-feature--stack; stage 3, WP-28, the pages integrator's
   request 6): the photo, then the words under it, at every width — the phone layout, for a
   feature set inside a narrower column (the home page's proof, seven columns). */
.story-feature--stack { display: block; }
.story-feature--stack > .story-body { margin-top: var(--s-5); }

.story-feature .story-title { margin-top: var(--s-3); }
.story-feature .story-summary { margin-top: var(--s-4); }

/* A feature set without its photo (StoryCard media={false}; class story-words): the words
   alone, as one block, for a page that lays the story's photograph out elsewhere on itself. */
.story-words { display: block; }

/* The quotation (Barker, P:81): Cormorant italic between two --line rules */
.story-quote {
  margin: var(--s-6) 0 0;
  padding: var(--s-5) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.story-quote blockquote {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: 0;
  color: var(--ink);
  quotes: "\201C" "\201D";
}
.story-quote blockquote p::before { content: open-quote; }
.story-quote blockquote p::after { content: close-quote; }
.story-quote-src {
  display: flex; flex-direction: column; align-items: flex-start;
  margin-top: var(--s-3);
  font-family: var(--label);
  font-size: var(--t-label);
  line-height: var(--lh-label);
  letter-spacing: var(--track-label);
  font-weight: 500;
  text-transform: uppercase;
  color: var(--ink-soft);
}
/* The link under the source reads as a link, not a label */
.story-quote-link {
  margin-top: var(--s-1);
  font-family: var(--body);
  font-size: var(--t-small);
  letter-spacing: 0;
  text-transform: none;
  line-height: var(--lh-small);
}
.text-link .arrow { display: inline-block; vertical-align: -2px; margin-left: var(--s-1); }
/* The link's last word and its ↗ stay together (StoryCard's story-quote-end) */
.story-quote-end { white-space: nowrap; }

.story-tags {
  margin-top: var(--s-5);
  font-family: var(--label);
  font-size: var(--t-label);
  line-height: var(--lh-label);
  letter-spacing: var(--track-label);
  font-weight: 500;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.story-cta { margin-top: var(--s-2); }
/* Standalone links here: a 44 px target whatever the line height (Chinese runs taller) */
.story-cta .text-link, .story-quote-link { display: inline-flex; align-items: center; min-height: 44px; padding-block: 0; }
.story-quote + .story-tags { margin-top: var(--s-5); }

/* On the green band */
.ground-green :is(.story-label, .story-tags, .story-quote-src) { color: var(--on-green-soft); }
.ground-green :is(.story-title, .story-quote blockquote) { color: var(--paper); }
.ground-green .story-quote { border-color: var(--line-on-green); }

/* A label with a date or a place breaks only after its own · or /, never inside
   "20 OCTOBER 2026" or "2026 年 10 月 20 日" (StoryCard splits it into parts; stage 3,
   the schools and work-story-enquire polish seats' requests) */
.story-label-part { white-space: nowrap; }

@media (max-width: 760px) {
  .story-feature { display: block; }
  .story-feature > .story-body { margin-top: var(--s-5); }
  .story-quote blockquote { font-size: 24px; }
}

/* ============================================================
   FILMBLOCK (brief § 4.7) — renders nothing while the film is held (D10).
   These rules wait for the day a film is set.
   ============================================================ */
.film { margin: 0; min-width: 0; }
.film-well {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--night);
}
.film-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: var(--night);
}
/* The one play control: a 72 px --paper disc with a triangle, its words beside it */
.film-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: var(--s-4);
  padding: 0; border: 0; margin: 0;
  background: transparent;
  color: var(--paper);
  font: inherit;
  cursor: pointer;
}
.film-play[hidden] { display: none; }
.film-play-disc {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper); color: var(--green);
  transition: background-color var(--dur-hover) var(--ease);
}
.film-play-disc svg { display: block; margin-left: 3px; }
.film-play-label {
  font-family: var(--body);
  font-size: var(--t-small);
  font-weight: 500;
  line-height: 1.25;
  color: var(--paper);
  background: var(--night-disc);
  padding: var(--s-2) var(--s-3);
}
.film-play:hover .film-play-disc { background: var(--band); }
.film-play:focus-visible { outline: 2px solid var(--paper); outline-offset: -6px; }
@media (prefers-reduced-motion: reduce) { .film-play-disc { transition: none; } }
.film-cap {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4);
  margin-top: var(--s-3);
  font-family: var(--label);
  font-size: var(--t-label);
  line-height: var(--lh-label);
  letter-spacing: var(--track-label);
  font-weight: 500;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.film-cap-text { min-width: 0; }
.film-cap-end { flex: none; font-variant-numeric: lining-nums tabular-nums; }

/* ============================================================
   FAQLIST (brief § 4.8) — native <details>
   ============================================================ */
.faq { border-bottom: 1px solid var(--line); }
.faq-item { border-top: 1px solid var(--line); }
.faq-q {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-5);
  min-height: 64px;
  padding: var(--s-4) 0;
  font-family: var(--display);
  font-size: var(--t-h4);
  line-height: var(--lh-h4);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink);
  text-wrap: balance;
}
summary.faq-q { cursor: pointer; list-style: none; }
summary.faq-q::-webkit-details-marker { display: none; }
summary.faq-q::marker { content: ""; }
.faq-q-text { min-width: 0; }

/* The plus: two 14 px lines; the upright turns flat when open */
.faq-plus { position: relative; flex: none; width: 14px; height: 14px; }
.faq-plus::before, .faq-plus::after {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 14px; height: 1.5px; margin-top: -0.75px;
  background: var(--ink);
}
.faq-plus::after { transform: rotate(90deg); transition: transform var(--dur-hover) var(--ease); }
details[open] > summary .faq-plus::after { transform: rotate(0deg); }
@media (prefers-reduced-motion: reduce) { .faq-plus::after { transition: none; } }

.faq-a { padding-bottom: var(--s-5); max-width: var(--measure); color: var(--ink); }
.faq-a p + p { margin-top: var(--s-3); }
.faq--one .faq-q { min-height: 0; padding-bottom: var(--s-3); }
/* On a phone a balanced question wrapped well short of its row ("Can you bring a /
   workshop to our school?" in a 350 px row; the home polish seat's request): there
   the line fills, and only a lone last word is avoided */
@media (max-width: 760px) { .faq-q { text-wrap: pretty; } }

.ground-green .faq, .ground-green .faq-item { border-color: var(--line-on-green); }
.ground-green :is(.faq-q, .faq-a) { color: var(--paper); }
.ground-green .faq-plus::before, .ground-green .faq-plus::after { background: var(--paper); }

/* Chinese headings and names are Noto Serif SC (brief § 2.4.2). The display stack
   alone would set her full-width ， and ？ in Cormorant's Latin forms, so the face is
   named here; the --t-h3 / --t-h4 tokens already carry the Chinese size and line height. */
:lang(zh) :is(.faq-q, .story-title), :is(.faq-q, .story-title):lang(zh) { font-family: var(--cjk); }

/* ============================================================
   LIGHTBOX (brief § 4.9) — a <dialog> over the whole screen
   ============================================================ */
html.lb-lock { overflow: hidden; }
html.lb-lock body { padding-right: var(--lb-gap, 0px); }

.lb {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  overflow: hidden;
  background: var(--night-scrim);
  color: var(--paper);
}
.lb::backdrop { background: transparent; }
.lb[open] {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  padding: 72px 0 var(--s-5);
}

/* The photo whole, at up to 88vw × 80vh. The stage is a fixed box, so moving
   between photos of different shapes moves nothing. */
.lb-stage {
  position: relative;
  width: 88vw;
  height: min(80vh, calc(100vh - 168px));
  height: min(80dvh, calc(100dvh - 168px));
}
.lb-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  max-width: none;
  object-fit: contain;
}
.lb-img:not([src]) { visibility: hidden; }
.lb-img.is-loading { opacity: 0; }

.lb-foot { width: 88vw; padding-top: var(--s-4); }
.lb-cap {
  display: flex; justify-content: center; align-items: baseline; gap: var(--s-4);
  min-height: calc(2em * var(--lh-small));
  text-align: center;
  font-size: var(--t-small);
  line-height: var(--lh-small);
  color: var(--paper);
}
.lb-cap-text { min-width: 0; max-width: var(--measure); text-wrap: balance; }
.lb-count { flex: none; font-size: var(--t-label); line-height: var(--lh-label); color: var(--on-green-soft); font-variant-numeric: lining-nums tabular-nums; }
.lb-count[hidden] { display: none; }

/* Controls: 48 px round, a 1 px --on-green-soft ring */
.lb-btn {
  position: absolute;
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  padding: 0; margin: 0;
  border: 1px solid var(--on-green-soft);
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  transition: background-color var(--dur-hover) var(--ease);
}
.lb-btn[hidden] { display: none; }
.lb-btn:hover { background: color-mix(in srgb, var(--paper) 14%, transparent); }
.lb-btn svg { display: block; }
.lb :focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }
.lb-close { top: var(--s-4); right: var(--s-4); }
.lb-prev, .lb-next { top: calc(50% - 32px); } /* the stage's middle: the top pad is larger than the foot */
.lb-prev { left: var(--s-5); }
.lb-next { right: var(--s-5); }

/* It opens in 200 ms (the backdrop), then the photo over 120 ms */
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lb[open] { animation: lb-in var(--dur-lightbox) var(--ease); }
.lb[open] .lb-img { animation: lb-in 120ms var(--ease) var(--dur-lightbox) both; }
@media (prefers-reduced-motion: reduce) {
  .lb[open], .lb[open] .lb-img { animation: none; }
  .lb-btn { transition: none; }
}

/* Phone: the photo full width inside the gutter; Previous and Next at the bottom
   corners, beside the caption */
@media (max-width: 760px) {
  .lb[open] { padding: 72px 0 calc(var(--s-4) + env(safe-area-inset-bottom, 0px)); }
  .lb-stage { width: calc(100vw - 2 * var(--gutter)); height: min(70vh, calc(100vh - 200px)); height: min(70dvh, calc(100dvh - 200px)); }
  .lb-foot { width: 100%; padding: var(--s-4) 80px 0; min-height: 64px; }
  .lb-cap { flex-direction: column; align-items: center; gap: var(--s-1); min-height: 48px; }
  .lb-prev, .lb-next { top: auto; bottom: calc(var(--s-4) + env(safe-area-inset-bottom, 0px)); }
  .lb-prev { left: var(--gutter); }
  .lb-next { right: var(--gutter); }
}

/* The mix: the Synthesis study's red dot before a quotation */
/* The synthesis: her seal as the mark before a quotation (prototype B's red dot), the one red in a story */
.story-quote blockquote::before {
  content: ""; display: block; width: 10px; height: 10px; margin-bottom: .55em;
  border-radius: 50%; background: var(--seal);
}
