/*
  LOBEE.CA — Memorial story page (/blogs/remembering-the-168 only)
  Full-viewport story slides with scroll-snap. Uses the shared light and dark tokens
  from lobee.css (no night-sky background, no forced theme). Linked AFTER lobee.css
  and lobee-sakuga.css. Header, theme toggle and button bursts are the shared ones
  (sakuga + press). Needs no inline style (CSP).
  Reveal on scroll: assets/js/lobee-story.js (IntersectionObserver). Off under prefers-reduced-motion.
*/

/* Snap on touch only. With a mouse wheel each 100px tick is pulled back to the slide start (tested in Chrome), so desktop pointers scroll freely */
@media (pointer: coarse) {
  html.memorial { scroll-snap-type: y proximity; }
}

/* ─── STORY SLIDES ────────────────────────────────────────────────────────── */
.story { display: block; }
.story-slide {
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  align-items: center;
  padding: var(--space-8) var(--space-4);
  scroll-snap-align: start;
}
@media (min-width: 640px) { .story-slide { padding-inline: var(--space-6); } }
@media (min-width: 960px) { .story-slide { padding-inline: var(--space-8); } }
.story-slide__inner {
  width: 100%;
  max-width: var(--content-default);
  margin-inline: auto;
  display: grid;
  gap: var(--space-6);
  align-items: center;
}
@media (min-width: 860px) {
  .story-slide__inner--figure { grid-template-columns: 1fr 1fr; gap: var(--space-10); }
  .story-slide--flip .story-figure { order: -1; }
  .story-slide__inner--portrait { grid-template-columns: 3fr 2fr; }
  .story-slide--flip .story-slide__inner--portrait { grid-template-columns: 2fr 3fr; }
}
.story-card { position: relative; }
.story-card > :last-child { margin-bottom: 0; }
.story-card h2 { font-size: var(--text-h2); font-weight: 600; color: var(--color-text); line-height: 1.3; margin-bottom: var(--flow-heading); }
.story-card p { font-size: var(--text-body); line-height: 1.6; color: var(--color-text); margin-bottom: var(--flow-text); }
.story-card p.story-lead { font-size: var(--text-body); line-height: 1.6; }
/* more specific than `.story-card p`, so Library sizes and muted colours actually apply */
.story-card p.story-kicker {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: var(--flow-heading);
}
.story-card p.story-ref { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: 0; }
.story-card p.story-hint { font-size: var(--text-sm); line-height: 1.6; color: var(--color-text-muted); }

/* the first slide carries the usual post title block, same pattern as every post */
.story-slide--title .page-header-block { margin-bottom: var(--flow-text); border-bottom: 0; padding-bottom: 0; }

/* ─── FIGURES (photo + visible credit) ────────────────────────────────────── */
.story-figure { padding: 0; margin: 0; }
.story-figure img {
  width: 100%;
  height: auto;
  max-height: 52vh;
  max-height: 52dvh;
  object-fit: cover;
  border-radius: var(--radius-lg); /* same as .prose img */
}
.story-figure figcaption {
  padding: var(--space-2) 0 0; /* same gap as .prose figure > figcaption */
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--color-text-faint);
  text-align: center;
}
.story-figure figcaption a { text-underline-offset: var(--space-0_5); }

/* ─── NAMES ───────────────────────────────────────────────────────────────── */
.story-slide--names { align-items: flex-start; }
.story-names {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, calc(var(--space-16) * 3)), 1fr));
  gap: var(--flow-text) var(--space-8);
  margin: var(--flow-block) 0;
}
.story-names li { padding-left: 0; }
.story-names__zh { display: block; font-size: var(--text-body); font-weight: 600; color: var(--color-text); line-height: 1.3; }
.story-names__en { display: block; font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.6; margin-top: var(--space-0_5); }
.story-names__en:only-child { font-size: var(--text-body); font-weight: 600; color: var(--color-text); line-height: 1.6; }
.story-rest { font-size: var(--text-body); line-height: 1.6; color: var(--color-text); }

/* ─── SOURCES ─────────────────────────────────────────────────────────────── */
.story-slide--sources { align-items: flex-start; }
.story-sources { padding-left: var(--space-5); margin-bottom: var(--flow-text); font-size: var(--text-sm); line-height: 1.6; color: var(--color-text-muted); }
.story-sources li { margin-bottom: var(--flow-item); }
.story-sources a { overflow-wrap: anywhere; }
/* Clear --flow-block gap between the Sources list and the Photo credits heading.
   The heading is the first h3 in the card, so a blanket margin-top: 0 used to leave them tight. */
.story-slide--sources ol.story-sources { margin-bottom: 0; }
.story-slide--sources ol.story-sources li:last-child { margin-bottom: 0; }
.story-slide--sources .story-sources + h2 { margin-top: var(--flow-block); }
.story-small { font-size: var(--text-sm) !important; color: var(--color-text-muted) !important; }

/* ─── REVEAL (needs script + motion allowed) ──────────────────────────────── */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .story-slide__inner {
    opacity: 0;
    transform: translate3d(0, var(--space-8), 0);
    transition: opacity 900ms ease, transform 900ms ease;
    animation: story-failsafe 1ms linear 3s forwards;   /* if the script never runs, show it anyway */
  }
  .story-slide__inner.is-in { opacity: 1; transform: none; animation: none; }
}
@keyframes story-failsafe { to { opacity: 1; transform: none; } }

/* ─── REDUCED MOTION: plain scroll, no fades ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html.memorial { scroll-snap-type: none; }
  .story-slide__inner { opacity: 1; transform: none; transition: none; }
}
