/* ==========================================================================
   Stories in Stone — Design Tokens & Base Styles
   ========================================================================== */


:root {
  /* Color — light (default) */
  --ink: #1a1712;
  --ink-soft: #322c22;
  --paper: #f6f1e7;
  --paper-alt: #efe6d3;
  --card: #fbf8f1;
  --vermillion: #b23b2e;
  --vermillion-dark: #8f2e23;
  --jade: #33604c;
  --jade-soft: #4c7d67;
  --gold: #a9803c;
  --stone: #6b6558;
  --stone-light: #a29a89;
  --border: #ddd0b3;
  --border-soft: #e7dcc4;
  --focus-ring: #8f2e23;

  --on-vermillion: #fbf3e9;
  --on-ink: #f6f1e7;

  --shadow-sm: 0 1px 2px rgba(26, 23, 18, 0.06), 0 1px 1px rgba(26, 23, 18, 0.04);
  --shadow-md: 0 6px 20px rgba(26, 23, 18, 0.10);
  --shadow-lg: 0 20px 50px rgba(26, 23, 18, 0.16);

  /* Type */
  --font-display: 'Fraunces', 'Noto Serif SC', ui-serif, Georgia, serif;
  --font-body: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing (8px rhythm) */
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;
  --space-8: 6.5rem;

  --container: 1240px;
  --radius-sm: 4px;
  --radius-md: 10px;

  --dur-fast: 160ms;
  --dur-med: 300ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f3ead9;
    --ink-soft: #d8cbaf;
    --paper: #15130f;
    --paper-alt: #1c1912;
    --card: #1f1c15;
    --vermillion: #e2685a;
    --vermillion-dark: #c94c3d;
    --jade: #6fa78c;
    --jade-soft: #86bda2;
    --gold: #cbab6f;
    --stone: #b6ac97;
    --stone-light: #8a8271;
    --border: #3a3427;
    --border-soft: #2a251c;
    --on-vermillion: #1a0d09;
    --on-ink: #15130f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ink: #f3ead9;
  --ink-soft: #d8cbaf;
  --paper: #15130f;
  --paper-alt: #1c1912;
  --card: #1f1c15;
  --vermillion: #e2685a;
  --vermillion-dark: #c94c3d;
  --jade: #6fa78c;
  --jade-soft: #86bda2;
  --gold: #cbab6f;
  --stone: #b6ac97;
  --stone-light: #8a8271;
  --border: #3a3427;
  --border-soft: #2a251c;
  --on-vermillion: #1a0d09;
  --on-ink: #15130f;
  color-scheme: dark;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2.5px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 2px;
}

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
@media (min-width: 768px) { .container { padding-inline: var(--space-6); } }

/* language visibility -------------------------------------------------- */
[lang-zh] { display: none; }
html[data-lang="zh"] [lang-en] { display: none; }
html[data-lang="zh"] [lang-zh] { display: revert; }
html[data-lang="zh"] { --font-display-active: var(--font-display); }
html[data-lang="zh"] body { font-family: 'Noto Sans SC', var(--font-body); }
html[data-lang="zh"] h1, html[data-lang="zh"] h2, html[data-lang="zh"] h3, html[data-lang="zh"] h4 {
  font-family: 'Noto Serif SC', var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ---- Type scale ---- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vermillion);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1.5px;
  background: currentColor;
  display: inline-block;
}
h1, .h1 { font-size: clamp(2.4rem, 4.6vw, 4.4rem); letter-spacing: -0.01em; }
h2, .h2 { font-size: clamp(1.9rem, 3.2vw, 2.9rem); letter-spacing: -0.01em; }
h3, .h3 { font-size: clamp(1.35rem, 1.8vw, 1.7rem); }
h4, .h4 { font-size: 1.1rem; }
.lede { font-size: clamp(1.05rem, 1.4vw, 1.25rem); color: var(--stone); line-height: 1.65; max-width: 62ch; }
.prose { max-width: 68ch; }
.prose p + p { margin-top: 1.3em; }

/* ---- Buttons ---- */
.btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.9em 1.6em;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 260ms var(--ease), box-shadow 260ms var(--ease), color 260ms var(--ease), border-color 260ms var(--ease);
  white-space: nowrap;
}
/* the sweep that fills the button on hover */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 380ms var(--ease);
}
.btn:hover::before,
.btn:focus-visible::before { transform: scaleX(1); }
.btn > * { position: relative; }
.btn svg {
  width: 1.05em;
  height: 1.05em;
  flex: none;
  transition: transform 300ms var(--ease);
}
.btn:hover svg,
.btn:focus-visible svg { transform: translateX(4px); }

.btn-primary { background: var(--vermillion); color: var(--on-vermillion); box-shadow: var(--shadow-sm); }
.btn-primary::before { background: var(--vermillion-dark); }
.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -8px color-mix(in srgb, var(--vermillion-dark) 55%, transparent);
}
.btn-primary:active { transform: translateY(0) scale(0.97); box-shadow: var(--shadow-sm); }

.btn-ghost { border: 1.5px solid var(--border); color: var(--ink); }
.btn-ghost::before { background: var(--paper-alt); }
.btn-ghost:hover,
.btn-ghost:focus-visible { border-color: var(--ink); transform: translateY(-2px); }
.btn-ghost:active { transform: translateY(0) scale(0.97); }

/* ghost button sitting on a dark/photographic background: inverts to cream fill */
.btn-ghost-light { border-color: rgba(246, 241, 231, 0.45); color: #fbf3e9; }
.btn-ghost-light::before { background: #fbf3e9; }
.btn-ghost-light:hover,
.btn-ghost-light:focus-visible { color: #1a1712; border-color: #fbf3e9; }

@media (prefers-reduced-motion: reduce) {
  .btn:hover, .btn:focus-visible, .btn:active { transform: none; }
  .btn::before { transition: none; }
}

/* ---- Header / nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
}
.brand { display: flex; align-items: center; gap: 0.7em; }
.brand img { height: 34px; width: auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-mark { filter: invert(1); } }
:root[data-theme="dark"] .logo-mark { filter: invert(1); }
.brand-name { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: 0.01em; }
html[data-lang="zh"] .brand-name { font-family: 'Noto Serif SC', serif; }
html[data-lang="zh"] .brand-name .sub[lang-zh] { display: block; letter-spacing: 0.08em; }
.lang-toggle button { white-space: nowrap; }
.brand-name .sub { display: block; font-family: var(--font-body); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--stone); font-weight: 600; margin-top: 1px; }

.nav-links { display: none; align-items: center; gap: var(--space-5); }
.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
  padding-block: 4px;
  transition: color var(--dur-fast) var(--ease);
}
.nav-links a:hover { color: var(--vermillion); }
.nav-links a[aria-current="page"] { color: var(--vermillion); }
.nav-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 2px;
  background: var(--vermillion);
  border-radius: 2px;
}
@media (min-width: 900px) { .nav-links { display: flex; } }

.nav-actions { display: flex; align-items: center; gap: var(--space-2); }

.lang-toggle {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 700;
}
.lang-toggle button {
  padding: 0.5em 0.85em;
  color: var(--stone);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.lang-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.lang-toggle button:not([aria-pressed="true"]):hover { background: var(--paper-alt); color: var(--ink); }

.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
}
.menu-btn svg { width: 18px; height: 18px; }
@media (min-width: 900px) { .menu-btn { display: none; } }

.mobile-menu {
  display: none;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4) var(--space-4);
  border-top: 1px solid var(--border-soft);
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  padding: 0.85em 0.2em;
  font-size: 1.05rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border-soft);
}
.mobile-menu a[aria-current="page"] { color: var(--vermillion); }
@media (min-width: 900px) { .mobile-menu { display: none !important; } }

/* ---- Sections ---- */
section { padding-block: var(--space-8); }
.section-tight { padding-block: var(--space-6); }
.section-head { max-width: 46rem; margin-bottom: var(--space-6); }
.section-head h2 { margin-top: var(--space-2); }

.bg-alt { background: var(--paper-alt); }
.bg-ink { background: var(--ink); color: var(--paper); }
.bg-ink .eyebrow { color: var(--vermillion); }
.bg-ink .lede { color: var(--stone-light); }

/* ---- Hero ---- */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--ink);
  color: var(--on-ink);
}
.hero img.hero-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.62;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(21,19,15,0.15) 0%, rgba(21,19,15,0.35) 55%, rgba(21,19,15,0.92) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  padding-block: var(--space-8) var(--space-6);
  width: 100%;
}
.hero .eyebrow { color: #e8b199; }
.hero h1 { margin-top: var(--space-3); color: #fbf3e9; max-width: 16ch; }
.hero .lede { color: #d9cdb8; margin-top: var(--space-3); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-5); }
.hero-scroll {
  position: absolute; bottom: var(--space-3); right: var(--space-4);
  z-index: 2; color: #d9cdb8; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  display: none; align-items: center; gap: 0.5em;
}
@media (min-width: 700px) { .hero-scroll { display: flex; } }
.hero-scroll .line { width: 1px; height: 28px; background: currentColor; opacity: 0.5; }

/* ---- Cards ---- */
.grid { display: grid; gap: var(--space-4); }
.grid-3 { grid-template-columns: repeat(1, 1fr); }
@media (min-width: 700px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-2 { grid-template-columns: repeat(1, 1fr); }
@media (min-width: 800px) { .grid-2 { grid-template-columns: 1.1fr 0.9fr; gap: var(--space-6); align-items: center; } }

.story-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-med) var(--ease), transform var(--dur-med) var(--ease);
}
a.story-card:hover, a.story-card:focus-visible { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.story-card .thumb { aspect-ratio: 4/3; overflow: hidden; background: var(--paper-alt); }
.story-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); }
a.story-card:hover .thumb img { transform: scale(1.045); }
.story-card .body { padding: var(--space-4); display: flex; flex-direction: column; gap: 0.6em; flex: 1; }
.story-card .tag { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--jade); }
.story-card h3 { font-size: 1.25rem; }
.story-card p { color: var(--stone); font-size: 0.95rem; }
.story-card .meta { margin-top: auto; padding-top: 0.8em; display: flex; align-items: center; gap: 0.6em; font-size: 0.82rem; color: var(--stone-light); border-top: 1px solid var(--border-soft); }

.story-card.is-placeholder { opacity: 0.72; cursor: default; }
.story-card.is-placeholder .thumb { display: flex; align-items: center; justify-content: center; }
.story-card.is-placeholder .thumb svg { width: 42px; height: 42px; color: var(--stone-light); }
.badge-soon {
  align-self: flex-start;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--paper-alt); color: var(--stone); padding: 0.3em 0.7em; border-radius: 999px; border: 1px solid var(--border);
}

/* ---- Pull quote ---- */
.pull-quote {
  border-left: 3px solid var(--vermillion);
  padding-left: var(--space-4);
  margin-block: var(--space-6);
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  line-height: 1.45;
  color: var(--ink-soft);
}
html[data-lang="zh"] .pull-quote { font-family: 'Noto Serif SC', serif; font-style: normal; }
.pull-quote cite { display: block; margin-top: 0.6em; font-family: var(--font-body); font-style: normal; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; color: var(--stone); }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border-soft); padding-block: var(--space-6) var(--space-5); background: var(--paper-alt); }
.footer-grid { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
@media (min-width: 800px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-brand p { color: var(--stone); margin-top: var(--space-2); max-width: 34ch; }
.footer-col h4 { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--stone); font-family: var(--font-body); font-weight: 700; margin-bottom: var(--space-2); }
.footer-col ul { display: flex; flex-direction: column; gap: 0.65em; }
.footer-col a:hover { color: var(--vermillion); }
.footer-bottom { margin-top: var(--space-6); padding-top: var(--space-3); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: space-between; font-size: 0.82rem; color: var(--stone-light); }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 0.45em; }
.field label { font-size: 0.85rem; font-weight: 600; }
.field input, .field textarea {
  padding: 0.85em 1em;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
}
.field input:focus, .field textarea:focus { border-color: var(--vermillion); }
.field .hint { font-size: 0.78rem; color: var(--stone); }
.form-status { font-size: 0.88rem; margin-top: var(--space-2); display: none; }
.form-status.visible { display: block; }
.form-status.ok { color: var(--jade); }

.newsletter-inline { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.6em; max-width: 30rem; }
/* the input sits inside a column-flex .field, so width — not flex-basis — is what we want here */
.newsletter-inline input { width: 100%; }

/* ---- Reveal-on-scroll ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; will-change: auto; }

/* siblings in a grid or stack arrive in sequence rather than all at once */
.grid > .reveal:nth-child(2) { transition-delay: 90ms; }
.grid > .reveal:nth-child(3) { transition-delay: 180ms; }
.grid > .reveal:nth-child(4) { transition-delay: 270ms; }

/* images settle out of a slight zoom as their block reveals */
.reveal .ratio-16-9 img,
.reveal .ratio-4-5 img,
.reveal .gallery-strip img {
  transform: scale(1.07);
  transition: transform 1100ms var(--ease);
}
.reveal.in .ratio-16-9 img,
.reveal.in .ratio-4-5 img,
.reveal.in .gallery-strip img { transform: scale(1); }

/* ---- Scroll progress ---- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 200;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--vermillion), var(--gold));
  pointer-events: none;
}

/* ---- Header reacts to scroll ---- */
.site-header { transition: box-shadow 300ms var(--ease), background 300ms var(--ease); }
.site-header.is-scrolled {
  box-shadow: 0 6px 24px -10px rgba(26, 23, 18, 0.28);
  background: color-mix(in srgb, var(--paper) 96%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .reveal .ratio-16-9 img,
  .reveal .ratio-4-5 img,
  .reveal .gallery-strip img { transform: none; }
  .grid > .reveal { transition-delay: 0ms !important; }
}

/* ---- Utility ---- */
.stack { display: flex; flex-direction: column; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.center-text { text-align: center; margin-inline: auto; }
.muted { color: var(--stone); }
.mt-2{margin-top:var(--space-2)} .mt-3{margin-top:var(--space-3)} .mt-4{margin-top:var(--space-4)} .mt-5{margin-top:var(--space-5)} .mt-6{margin-top:var(--space-6)}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -60px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 0.8em 1.2em; border-radius: 6px;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: 1rem; }

.divider { height: 1px; background: var(--border-soft); border: 0; margin-block: var(--space-6); }
.ratio-16-9 { aspect-ratio: 16/9; overflow: hidden; border-radius: var(--radius-md); }
.ratio-16-9 img, .ratio-4-5 img { width: 100%; height: 100%; object-fit: cover; }
.ratio-4-5 { aspect-ratio: 4/5; overflow: hidden; border-radius: var(--radius-md); }
.framed { border-radius: var(--radius-md); box-shadow: var(--shadow-md); }

.stat { display: flex; flex-direction: column; gap: 0.2em; }
.stat .num { font-family: var(--font-display); font-size: clamp(2rem, 3vw, 2.6rem); color: var(--vermillion); }
.stat .label { font-size: 0.82rem; color: var(--stone); letter-spacing: 0.02em; }

.chip { display:inline-flex; align-items:center; gap:0.4em; font-size:0.78rem; font-weight:600; padding:0.4em 0.8em; border-radius:999px; border:1px solid var(--border); color: var(--stone); }

/* ---- Map: axis, landmarks, story pins, popup ---- */
.map-wrap { position: relative; }
.axis-map {
  width: 100%;
  height: auto;
  display: block;
  background: var(--paper-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-md);
}
.map-pin { cursor: pointer; outline: none; }
.map-pin .pin-icon {
  transition: transform 150ms var(--ease), filter 150ms var(--ease);
  transform-box: fill-box;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 2px 3px rgba(26, 23, 18, 0.25));
}
.map-pin:hover .pin-icon,
.map-pin:focus-visible .pin-icon,
.map-pin[aria-pressed="true"] .pin-icon { transform: scale(1.12) translateY(-1px); }

.landmark-pin { cursor: pointer; outline: none; }
.landmark-pin .lm-icon-clear { fill: var(--card); }
.landmark-pin .lm-icon {
  color: var(--stone);
  transition: color 150ms var(--ease), transform 150ms var(--ease);
  transform-box: fill-box;
  transform-origin: center;
}
.landmark-pin text { fill: var(--stone-light); font-size: 10.5px; transition: fill 150ms var(--ease); }
.landmark-pin:hover .lm-icon,
.landmark-pin:focus-visible .lm-icon,
.landmark-pin[aria-pressed="true"] .lm-icon { color: var(--vermillion); transform: scale(1.18); }
.landmark-pin:hover text,
.landmark-pin:focus-visible text,
.landmark-pin[aria-pressed="true"] text { fill: var(--ink-soft); }

.map-popup {
  position: absolute;
  top: 0; left: 0;
  width: 228px;
  z-index: 20;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.9em 1.9em 0.85em 1em;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
  --arrow-left: 50%;
}
.map-popup[data-open] { opacity: 1; transform: scale(1); pointer-events: auto; }
.map-popup::after {
  content: "";
  position: absolute;
  left: var(--arrow-left);
  bottom: -7px;
  width: 13px; height: 13px;
  background: var(--card);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: translateX(-50%) rotate(45deg);
}
.map-popup.below::after {
  top: -7px; bottom: auto;
  border-right: 0; border-bottom: 0;
  border-left: 1px solid var(--border); border-top: 1px solid var(--border);
}
.map-popup h4 { font-size: 0.9rem; line-height: 1.35; }
.map-popup p { font-size: 0.79rem; color: var(--stone); margin-top: 0.35em; line-height: 1.5; }
.popup-close {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; color: var(--stone-light);
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.popup-close:hover { background: var(--paper-alt); color: var(--ink); }
.popup-close svg { width: 12px; height: 12px; }

/* ==========================================================================
   Reader survey, story feedback, nav call-to-action (added Nov 2026)
   ========================================================================== */
.nav-links a.nav-cta { color: var(--vermillion); font-weight: 600; }
.form-status.err { color: var(--vermillion); }

.survey-promise { list-style: none; padding: 0; display: grid; gap: 0.45em; font-size: 0.92rem; color: var(--stone); }
.survey-promise li { padding-left: 1.3em; position: relative; }
.survey-promise li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 0.5em; height: 0.5em; border-radius: 50%; background: var(--gold); }

.survey-progress { list-style: none; padding: 0; margin: 0 0 var(--space-5); display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-1); counter-reset: step; }
.survey-progress li { counter-increment: step; font-size: 0.8rem; font-weight: 600; color: var(--stone-light); padding-top: 0.7em; border-top: 3px solid var(--border); }
.survey-progress li::before { content: counter(step) " · "; }
.survey-progress li.is-current { color: var(--ink); border-top-color: var(--vermillion); }
.survey-progress li.is-done { color: var(--jade); border-top-color: var(--jade); }

.survey { display: block; }
.survey-step { display: flex; flex-direction: column; gap: var(--space-3); }
.survey-step[hidden] { display: none; }
.survey-h { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: var(--space-4); }

.survey .q { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); padding: var(--space-4); margin: 0; }
.survey .q legend { font-weight: 600; font-size: 1rem; line-height: 1.45; padding: 0 0.35em; margin-left: -0.35em; }
.survey .q legend em, .survey .field label em { font-weight: 400; color: var(--stone); font-style: normal; }
.survey .q.is-missing, .survey .field.is-missing textarea, .survey label.check.is-missing { border-color: var(--vermillion); box-shadow: 0 0 0 2px color-mix(in srgb, var(--vermillion) 18%, transparent); }
.q-num { color: var(--gold); font-weight: 700; margin-right: 0.2em; }
.q-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin-top: var(--space-2); }
@media (max-width: 640px) { .q-grid { grid-template-columns: 1fr; } }

.survey select, .survey .field textarea {
  padding: 0.75em 0.9em; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); font: inherit; width: 100%;
}
.survey .field textarea { resize: vertical; }
.survey select:focus, .survey .field textarea:focus { border-color: var(--vermillion); outline: none; }

/* Likert: five choices in a row on desktop, stacked on phones */
.likert-row, .pill-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4em; margin-top: var(--space-2); }
.pill-row { grid-template-columns: repeat(4, 1fr); }
.likert-row label, .pill-row label, .quiz-options label { position: relative; cursor: pointer; }
.likert-row input, .pill-row input, .quiz-options input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.likert-row label > span, .pill-row label > span {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 3.2em; height: 100%;
  font-size: 0.8rem; line-height: 1.25; padding: 0.5em 0.4em; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--paper); transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.likert-row input:checked + span, .pill-row input:checked + span, .quiz-options input:checked + span {
  border-color: var(--vermillion); background: color-mix(in srgb, var(--vermillion) 10%, var(--card)); color: var(--ink); font-weight: 600;
}
.likert-row input:focus-visible + span, .pill-row input:focus-visible + span, .quiz-options input:focus-visible + span { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
@media (max-width: 560px) {
  .likert-row, .pill-row { grid-template-columns: 1fr; }
  .likert-row label > span, .pill-row label > span { justify-content: flex-start; text-align: left; min-height: 2.6em; padding-inline: 0.9em; }
}
.quiz-options { display: grid; gap: 0.4em; margin-top: var(--space-2); }
.quiz-options label > span { display: block; padding: 0.7em 0.9em; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--paper); font-size: 0.92rem; }

label.check { display: flex; gap: 0.7em; align-items: flex-start; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); cursor: pointer; font-size: 0.95rem; }
label.check input { width: 1.15em; height: 1.15em; margin-top: 0.2em; accent-color: var(--vermillion); flex: none; }

.survey-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); justify-content: flex-end; margin-top: var(--space-4); }
.survey-nav [data-back] { margin-right: auto; }
.survey-error { color: var(--vermillion); font-size: 0.88rem; flex-basis: 100%; text-align: right; }
.story-choice .story-card { max-width: 26rem; }
.survey-done { padding-block: var(--space-5); }

/* Story pages: key-ideas box, reader feedback, return-to-survey bar */
.key-ideas { border-left: 3px solid var(--gold); background: var(--paper-alt); padding: var(--space-4); border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.key-ideas h3 { font-size: 1.05rem; margin-bottom: 0.5em; }
.key-ideas dl { display: grid; gap: 0.7em; margin: 0; }
.key-ideas dt { font-weight: 700; }
.key-ideas dd { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.reader-feedback { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); padding: var(--space-5); }
.survey-return { position: sticky; top: 0; z-index: 60; background: var(--jade); color: var(--on-ink); padding: 0.7em 0; font-size: 0.92rem; }
.survey-return .container { display: flex; gap: 1em; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.survey-return a { color: inherit; font-weight: 700; text-decoration: underline; }
.survey-return[hidden] { display: none; }
.field-notes { border: 1px dashed var(--border); border-radius: var(--radius-md); padding: var(--space-4); background: var(--card); }
.field-notes .eyebrow { margin-bottom: 0.4em; }
.survey, .survey .q, label.check { scroll-margin-top: 96px; }
/* language toggle must win over .story-meta span{display:flex} */
html:not([data-lang="zh"]) .story-meta [lang-zh] { display: none; }
html[data-lang="zh"] .story-meta [lang-en] { display: none; }
.prose figure { margin-left: 0; margin-right: 0; }
/* keep long multi-line questions inside their box instead of sitting on the border */
.survey .q legend { float: left; width: 100%; padding: 0; margin: 0 0 0.6em; }
.survey .q legend + * { clear: both; }

/* ==========================================================================
   Reader survey v2 — assets/js/survey.js (pop-up dialog + Take Part page)
   ========================================================================== */
html.sv-lock { overflow: hidden; }
.sv {
  --sv-pad: 1.75rem;
  display: flex; flex-direction: column; min-height: 0; width: 100%;
  background: var(--paper); color: var(--ink);
}
.sv-page { scroll-margin-top: 110px; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-md); overflow: hidden; background: var(--card); }
.sv-page .sv-top, .sv-page .sv-nav { background: var(--card); }

/* top bar: step label, language, close, three-part progress (before · read · after) */
.sv-top { flex: none; padding: 0.85rem var(--sv-pad) 0; background: var(--paper); }
.sv-topline { display: flex; align-items: center; gap: 0.75rem; min-height: 34px; }
.sv-steptext { margin-right: auto; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone); }
.sv-count { margin-left: 0.4em; font-variant-numeric: tabular-nums; color: var(--vermillion); letter-spacing: 0.02em; }
.sv-lang { font-size: 0.72rem; }
.sv-x { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; color: var(--stone); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.sv-x:hover { background: var(--paper-alt); color: var(--ink); }
.sv-x svg { width: 12px; height: 12px; }
.sv-progress { display: grid; grid-template-columns: 7fr 2fr 9fr; gap: 5px; margin: 0.75rem 0 0; }
.sv-progress span { height: 4px; border-radius: 4px; background: var(--border-soft); overflow: hidden; }
.sv-progress i { display: block; height: 100%; width: 0; background: var(--vermillion); border-radius: inherit; transition: width 420ms var(--ease); }
.sv-progress span[data-seg="read"] i { background: var(--gold); }
.sv[data-view="results"] .sv-progress i { background: var(--jade); }
.sv[data-view="invite"] .sv-progress { visibility: hidden; height: 0; margin: 0; }

/* stage */
.sv-stage { flex: 1 1 auto; min-height: 0; padding: 1.5rem var(--sv-pad) 1.25rem; }
.sv-pop .sv-stage { overflow-y: auto; overscroll-behavior: contain; }
.sv[data-view="invite"] .sv-stage, .sv[data-view="post-invite"] .sv-stage { padding-top: 0.85rem; }
.sv-card { animation: sv-in 320ms var(--ease) both; }
.sv-card.sv-enter-back { animation-name: sv-in-back; }
@keyframes sv-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes sv-in-back { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
.sv-q { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
.sv-legend { float: left; width: 100%; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.sv-legend + * { clear: both; }
.sv-kicker { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.sv-title { font-family: var(--font-display); font-size: clamp(1.3rem, 2.6vw, 1.65rem); font-weight: 500; line-height: 1.28; color: var(--ink); }
.sv-title:focus, .sv-h:focus { outline: none; }
.sv-q-scenario .sv-title { font-size: clamp(1.08rem, 2.2vw, 1.25rem); line-height: 1.45; }
.sv-q-scenario .sv-title strong { color: var(--vermillion); font-weight: 600; }
.sv-help { margin: 0; color: var(--stone); font-size: 0.92rem; }
.sv-note { margin: 0; color: var(--stone); font-size: 0.85rem; }

/* agreement scale: five dots on a line, larger at the ends */
.sv-scale { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 0.75rem; }
.sv-scale::before { content: ""; position: absolute; left: 10%; right: 10%; top: 22px; height: 2px; background: var(--border); }
.sv-pt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; cursor: pointer; text-align: center; padding: 0 2px; }
.sv-pt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sv-dot {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
}
.sv-dot::before {
  content: ""; width: var(--d, 26px); height: var(--d, 26px); border-radius: 50%;
  border: 2px solid var(--stone-light); background: var(--card);
  transition: transform 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}
.sv-pt-1 .sv-dot, .sv-pt-5 .sv-dot { --d: 40px; }
.sv-pt-2 .sv-dot, .sv-pt-4 .sv-dot { --d: 32px; }
.sv-pt-3 .sv-dot { --d: 24px; }
.sv-pt:hover .sv-dot::before { border-color: var(--ink); transform: scale(1.06); }
.sv-pt input:checked + .sv-dot::before { background: var(--vermillion); border-color: var(--vermillion); box-shadow: 0 0 0 5px color-mix(in srgb, var(--vermillion) 18%, transparent); }
.sv-pt input:focus-visible + .sv-dot::before { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.sv-lab { font-size: 0.78rem; line-height: 1.25; color: var(--stone); transition: color 160ms var(--ease); }
.sv-pt input:checked ~ .sv-lab { color: var(--ink); font-weight: 700; }

/* quiz options: lettered cards */
.sv-options { display: grid; gap: 0.55rem; }
.sv-opt, .sv-pill, .sv-story { position: relative; cursor: pointer; }
.sv-opt input, .sv-pill input, .sv-story input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sv-opt > span {
  display: flex; align-items: center; gap: 0.85rem; padding: 0.8rem 1rem; border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--card); font-size: 0.95rem; line-height: 1.4;
  transition: border-color 160ms var(--ease), background 160ms var(--ease), transform 160ms var(--ease);
}
.sv-letter {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-size: 0.8rem; font-weight: 700;
  border: 1.5px solid var(--border); color: var(--stone); background: var(--paper);
  transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.sv-opt:hover > span { border-color: var(--stone-light); transform: translateY(-1px); }
.sv-opt input:checked + span { border-color: var(--vermillion); background: color-mix(in srgb, var(--vermillion) 7%, var(--card)); }
.sv-opt input:checked + span .sv-letter { background: var(--vermillion); border-color: var(--vermillion); color: var(--on-vermillion); }
.sv-opt input:focus-visible + span, .sv-pill input:focus-visible + span, .sv-story input:focus-visible ~ .sv-story-body { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.sv-opt-unsure > span { border-style: dashed; color: var(--stone); }

/* pill choices (self-change, would share) */
.sv-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.sv-pill > span {
  display: flex; align-items: center; justify-content: center; min-height: 3.2rem; padding: 0.5rem; text-align: center;
  border: 1.5px solid var(--border); border-radius: 12px; background: var(--card); font-size: 0.9rem; font-weight: 600;
  transition: border-color 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease);
}
.sv-pill:hover > span { border-color: var(--stone-light); }
.sv-pill input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* story choice */
.sv-stories { display: grid; gap: 0.75rem; }
.sv-story, .sv-storylink {
  display: grid; grid-template-columns: 112px 1fr; overflow: hidden; border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--card); color: inherit; text-decoration: none;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), transform 180ms var(--ease);
}
.sv-story:hover, .sv-storylink:hover { border-color: var(--stone-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.sv-story:has(input:checked) { border-color: var(--vermillion); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vermillion) 16%, transparent); }
.sv-story.is-done { opacity: 0.7; }
.sv-story-img { position: relative; min-height: 112px; background: var(--paper-alt); }
.sv-story-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sv-story-body { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.85rem 1rem; }
.sv-story-body strong { font-family: var(--font-display); font-size: 1.12rem; font-weight: 500; line-height: 1.25; }
.sv-story-meta { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--stone); }
.sv-story-blurb { font-size: 0.86rem; color: var(--stone); line-height: 1.45; }
.sv-cta { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.2rem; font-size: 0.88rem; font-weight: 700; color: var(--vermillion); }
.sv-cta svg { width: 14px; height: 14px; transition: transform 180ms var(--ease); }
.sv-storylink:hover .sv-cta svg { transform: translateX(3px); }

/* form fields */
.sv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1rem; }
.sv-field { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.88rem; font-weight: 600; color: var(--ink-soft); }
.sv-field select, .sv-field textarea {
  width: 100%; padding: 0.75em 0.9em; border: 1.5px solid var(--border); border-radius: 10px; background: var(--card);
  color: var(--ink); font: inherit; font-weight: 400; font-size: 0.95rem;
}
.sv-field textarea { resize: vertical; line-height: 1.5; }
.sv-field select:focus, .sv-field textarea:focus { outline: none; border-color: var(--vermillion); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vermillion) 14%, transparent); }
.sv-consent { display: flex; gap: 0.85rem; align-items: flex-start; padding: 1rem 1.1rem; border: 1.5px solid var(--border); border-radius: 12px; background: var(--card); cursor: pointer; line-height: 1.5; }
.sv-consent:has(input:checked) { border-color: var(--jade); background: color-mix(in srgb, var(--jade) 7%, var(--card)); }
.sv-consent input { flex: none; width: 1.2em; height: 1.2em; margin-top: 0.2em; accent-color: var(--jade); }

/* bottom navigation */
.sv-nav { flex: none; display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem var(--sv-pad) 1rem; border-top: 1px solid var(--border-soft); background: var(--paper); }
.sv-nav[hidden] { display: none; }
.sv-back { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.2rem; font-size: 0.9rem; font-weight: 600; color: var(--stone); }
.sv-back:hover { color: var(--ink); }
.sv-back svg, .sv-next svg { width: 15px; height: 15px; }
.sv-back[hidden] { display: none; }
.sv-hint { flex: 1; font-size: 0.85rem; color: var(--vermillion); text-align: right; }
.sv-next { margin-left: auto; }
.sv-next:disabled { opacity: 0.38; cursor: not-allowed; transform: none; box-shadow: none; }
.sv-next:disabled::before { transform: scaleX(0) !important; }

/* screens: invite, read, results */
.sv-screen { display: flex; flex-direction: column; }
.sv-banner { position: relative; height: 190px; margin: 0 calc(var(--sv-pad) * -1) 0; overflow: hidden; }
.sv-banner img { width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%); transform: scale(1.03); animation: sv-kenburns 9s ease-out both; }
@keyframes sv-kenburns { from { transform: scale(1.1); } to { transform: scale(1.02); } }
.sv-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 17, 12, 0) 25%, rgba(20, 17, 12, 0.82) 100%); }
.sv-banner-txt { position: absolute; left: var(--sv-pad); right: var(--sv-pad); bottom: 1rem; z-index: 1; display: flex; flex-direction: column; gap: 0.3rem; color: #fbf3e9; }
.sv-eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #e8c98f; }
.sv-banner-txt strong { font-family: var(--font-display); font-weight: 500; font-size: 1.45rem; line-height: 1.2; }
.sv-pad { display: flex; flex-direction: column; gap: 1rem; padding-top: 1.35rem; }
.sv-pad > p { margin: 0; color: var(--ink-soft); line-height: 1.6; }
.sv-center { align-items: center; text-align: center; }
.sv-h { font-family: var(--font-display); font-size: clamp(1.4rem, 3vw, 1.8rem); font-weight: 500; line-height: 1.22; margin: 0; }
.sv-promises { list-style: none; margin: 0.25rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.sv-promises li { display: flex; flex-direction: column; gap: 0.45rem; padding: 0.85rem; border-radius: 12px; background: var(--paper-alt); font-size: 0.82rem; line-height: 1.4; color: var(--ink-soft); }
.sv-promises svg { width: 22px; height: 22px; color: var(--vermillion); }
.sv-promises b { color: var(--ink); }
.sv-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: flex-end; margin-top: 0.5rem; }
.sv-actions-center { justify-content: center; }
.sv-actions .btn svg { width: 15px; height: 15px; }
.sv-badge { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: color-mix(in srgb, var(--jade) 14%, var(--card)); color: var(--jade); animation: sv-pop 480ms var(--ease) both; }
.sv-badge svg { width: 26px; height: 26px; }
@keyframes sv-pop { 0% { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
.sv-center .sv-storylink { text-align: left; width: 100%; }

/* results: before → after */
.sv-result { padding: 1.1rem 1.2rem 1.2rem; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.sv-result h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 0 0 0.85rem; font-size: 1rem; }
.sv-score { font-size: 0.9rem; font-weight: 600; color: var(--stone); font-variant-numeric: tabular-nums; }
.sv-score b { color: var(--jade); }
.sv-db-legend { display: flex; gap: 1.2rem; margin-bottom: 0.6rem; font-size: 0.8rem; color: var(--stone); }
.sv-db-legend > span { display: inline-flex; align-items: center; gap: 0.45rem; }
.sv-db-legend .sv-db-dot { position: static; transform: none; }
.sv-db { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; }
.sv-db-row { display: grid; grid-template-columns: minmax(0, 11rem) 1fr; align-items: center; gap: 1rem; }
.sv-db-label { font-size: 0.86rem; line-height: 1.3; color: var(--ink-soft); }
.sv-db-track { position: relative; height: 22px; margin: 0 9px; background: linear-gradient(90deg, var(--border) 0 0) center / 100% 2px no-repeat; }
.sv-db-track::before { content: ""; position: absolute; inset: 7px 0; background: repeating-linear-gradient(90deg, var(--border) 0 2px, transparent 2px 25%); background-size: calc(100% + 2px) 100%; opacity: 0.8; }
.sv-db-span { position: absolute; top: 9px; height: 4px; background: color-mix(in srgb, var(--vermillion) 45%, transparent); border-radius: 4px; transform-origin: left; animation: sv-grow 700ms 200ms var(--ease) both; }
@keyframes sv-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.sv-db-dot { position: absolute; top: 50%; display: inline-block; width: 14px; height: 14px; border-radius: 50%; transform: translate(-50%, -50%); }
.sv-db-before { background: var(--card); border: 2px solid var(--stone); }
.sv-db-after { background: var(--vermillion); border: 2px solid var(--vermillion); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vermillion) 20%, transparent); }
.sv-db-axis { display: flex; justify-content: space-between; margin: 0.5rem 0 0 calc(min(11rem, 40%) + 1rem); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--stone-light); }
.sv-qz { list-style: none; counter-reset: q; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.sv-qz li { counter-increment: q; display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border-soft); }
.sv-qz li:last-child { border-bottom: 0; padding-bottom: 0; }
.sv-qz-q { grid-column: 1; font-size: 0.88rem; color: var(--stone); }
.sv-qz-q::before { content: "Q" counter(q) " "; font-weight: 700; color: var(--gold); }
.sv-qz-a { grid-column: 1; font-size: 0.92rem; font-weight: 600; color: var(--ink); }
.sv-qz-marks { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 0.7rem; align-items: center; font-size: 0.72rem; color: var(--stone); }
.sv-qz-marks > span { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.sv-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; }
.sv-mark svg { width: 12px; height: 12px; }
.sv-mark.is-ok { background: color-mix(in srgb, var(--jade) 16%, var(--card)); color: var(--jade); }
.sv-mark.is-no { background: var(--paper-alt); color: var(--stone-light); }
.sv-fallback { padding: 2rem; text-align: center; color: var(--stone); }

/* the dialog */
.sv-dialog {
  width: min(42rem, calc(100vw - 32px)); max-width: none; height: min(40rem, calc(100vh - 48px)); max-height: none;
  padding: 0; border: 0; border-radius: 20px; background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 80px rgba(26, 23, 18, 0.35); overflow: hidden;
}
.sv-dialog[open] { display: flex; animation: sv-dialog-in 360ms var(--ease) both; }
.sv-dialog::backdrop { background: rgba(26, 23, 18, 0.58); backdrop-filter: blur(3px); animation: sv-fade 300ms ease both; }
@keyframes sv-dialog-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes sv-fade { from { opacity: 0; } to { opacity: 1; } }
/* the short screens don't need the full height */
.sv-dialog:has(.sv[data-view="invite"]), .sv-dialog:has(.sv[data-view="read"]), .sv-dialog:has(.sv[data-view="post-invite"]) { height: fit-content; max-height: calc(100vh - 48px); }
/* question cards sit in the middle of the fixed-height dialog (margins collapse when a card is taller and scrolls) */
.sv-pop .sv-stage { display: flex; flex-direction: column; }
.sv-pop[data-view="card"] .sv-card { margin-block: auto; }

/* reminder pill */
.sv-pill {
  position: fixed; right: 18px; bottom: 18px; z-index: 150; display: flex; align-items: center;
  background: var(--ink); color: var(--paper); border-radius: 999px; box-shadow: var(--shadow-lg);
  animation: sv-dialog-in 360ms var(--ease) both;
}
.sv-pill[hidden] { display: none; }
.sv-pill-go { display: flex; align-items: center; gap: 0.65em; padding: 0.8em 0.6em 0.8em 1.15em; font-size: 0.88rem; font-weight: 600; color: inherit; }
.sv-pill-go:hover { text-decoration: underline; text-underline-offset: 3px; }
.sv-pill-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--vermillion); animation: sv-pulse 2.4s ease-in-out infinite; }
@keyframes sv-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--vermillion) 55%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }
.sv-pill-x { display: grid; place-items: center; width: 34px; height: 34px; margin-right: 4px; border-radius: 999px; color: inherit; opacity: 0.65; }
.sv-pill-x:hover { opacity: 1; background: rgba(255, 255, 255, 0.12); }
.sv-pill-x svg { width: 11px; height: 11px; }

/* phones: the dialog becomes a sheet from the bottom */
@media (max-width: 640px) {
  .sv { --sv-pad: 1.1rem; }
  .sv-dialog { width: 100vw; height: 94vh; max-height: 94vh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .sv-dialog[open] { animation-name: sv-sheet-in; }
  @keyframes sv-sheet-in { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }
  .sv-dialog:has(.sv[data-view="invite"]), .sv-dialog:has(.sv[data-view="read"]), .sv-dialog:has(.sv[data-view="post-invite"]) { height: fit-content; max-height: 94vh; }
  .sv-banner { height: 150px; }
  .sv-pop[data-view="card"] .sv-card { margin-block: 0.5rem auto; }
  .sv-promises { grid-template-columns: 1fr; }
  .sv-promises li { flex-direction: row; align-items: center; padding: 0.65rem 0.8rem; }
  .sv-actions .btn { flex: 1 1 auto; justify-content: center; }
  .sv-grid { grid-template-columns: 1fr; }
  .sv-pills { grid-template-columns: repeat(2, 1fr); }
  .sv-story, .sv-storylink { grid-template-columns: 88px 1fr; }
  .sv-lab { font-size: 0.7rem; }
  .sv-dot { width: 40px; height: 40px; }
  .sv-pt-1 .sv-dot, .sv-pt-5 .sv-dot { --d: 34px; }
  .sv-pt-2 .sv-dot, .sv-pt-4 .sv-dot { --d: 28px; }
  .sv-pt-3 .sv-dot { --d: 22px; }
  .sv-scale::before { top: 20px; }
  .sv-db-row { grid-template-columns: 1fr; gap: 0.35rem; }
  .sv-db-axis { margin-left: 0; }
  .sv-pill { left: 16px; right: 16px; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  .sv-card, .sv-dialog[open], .sv-dialog::backdrop, .sv-pill, .sv-badge, .sv-db-span, .sv-banner img, .sv-pill-dot { animation: none; }
}

/* ==========================================================================
   Quick feedback: side tab + small card with five faces (main.js initFeedback)
   ========================================================================== */
/* a vertical tab on the right edge: English reads bottom-to-top, Chinese stacks upright */
.fb-tab {
  position: fixed; right: 0; top: 50%; z-index: 140; display: flex; align-items: center; gap: 0.5rem;
  writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg);
  padding: 0.9rem 0.55rem 0.9rem 0.6rem; border-radius: 0 10px 10px 0; background: var(--jade); color: #fbf3e9;
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.03em; box-shadow: var(--shadow-md);
  transition: background var(--dur-fast) var(--ease), padding var(--dur-fast) var(--ease);
}
html[data-lang="zh"] .fb-tab { transform: translateY(-50%); border-radius: 10px 0 0 10px; text-orientation: upright; letter-spacing: 0.2em; }
html[data-lang="zh"] .fb-tab svg { transform: none; }
.fb-tab svg { width: 16px; height: 16px; transform: rotate(90deg); }
.fb-tab:hover, .fb-tab.is-open { background: var(--jade-soft); padding-left: 0.85rem; }
html[data-lang="zh"] .fb-tab:hover, html[data-lang="zh"] .fb-tab.is-open { padding-left: 0.6rem; padding-right: 0.8rem; }
.fb-tab:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.fb-card {
  position: fixed; right: 64px; bottom: 24px; z-index: 160; width: min(26rem, calc(100vw - 32px));
  background: var(--card); color: var(--ink); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(26, 23, 18, 0.22); overflow: hidden;
  opacity: 0; transform: translateY(12px) scale(0.98); transform-origin: bottom right;
  transition: opacity 200ms var(--ease), transform 220ms var(--ease);
}
.fb-card.is-in { opacity: 1; transform: none; }
.fb-card[hidden] { display: none; }
.fb-x { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 999px; color: var(--stone); }
.fb-x:hover { background: var(--paper-alt); color: var(--ink); }
.fb-x svg { width: 12px; height: 12px; }
.fb-body { padding: 1.5rem 1.4rem 1.1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.fb-title { margin: 0; padding-right: 1.5rem; font-family: var(--font-body); font-size: 1.12rem; font-weight: 600; line-height: 1.4; }
.fb-title:focus, .fb-thanks strong:focus { outline: none; }
.fb-faces { display: flex; justify-content: space-between; gap: 0.25rem; margin: 0.35rem 0 0.4rem; padding: 0; border: 0; }
.fb-face { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; cursor: pointer; flex: 1; }
.fb-face input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fb-face svg { width: 54px; height: 54px; color: var(--c); transition: transform 180ms var(--ease); }
.fb-face-1 { --c: #c4473a; } .fb-face-2 { --c: #d4703f; } .fb-face-3 { --c: #c99a3f; } .fb-face-4 { --c: #5f9474; } .fb-face-5 { --c: #2f6d55; }
.fb-ring { fill: color-mix(in srgb, var(--c) 9%, transparent); stroke: color-mix(in srgb, var(--c) 70%, var(--card)); stroke-width: 2.6; transition: fill 180ms var(--ease), stroke 180ms var(--ease); }
.fb-ln { stroke: color-mix(in srgb, var(--c) 80%, var(--card)); stroke-width: 2.6; stroke-linecap: round; }
.fb-pt { fill: color-mix(in srgb, var(--c) 80%, var(--card)); }
.fb-face:hover svg { transform: translateY(-2px) scale(1.06); }
.fb-face input:checked + svg { transform: scale(1.12); }
.fb-face input:checked + svg .fb-ring { fill: var(--c); stroke: var(--c); }
.fb-face input:checked + svg .fb-ln { stroke: #fff; }
.fb-face input:checked + svg .fb-pt { fill: #fff; }
.fb-faces:has(input:checked) .fb-face:not(:has(input:checked)) svg { opacity: 0.55; }
.fb-face input:focus-visible + svg { outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: 50%; }
.fb-face-lab { font-size: 0.72rem; color: var(--stone); opacity: 0; transition: opacity 160ms var(--ease); }
.fb-face:hover .fb-face-lab, .fb-face input:checked ~ .fb-face-lab { opacity: 1; }
.fb-face input:checked ~ .fb-face-lab { color: var(--ink); font-weight: 700; }
.fb-label { font-size: 0.95rem; font-weight: 600; }
.fb-label em { font-style: normal; font-weight: 400; color: var(--stone); }
.fb-body textarea {
  width: 100%; min-height: 6rem; padding: 0.75rem 0.85rem; border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: 0.92rem; resize: vertical;
}
.fb-body textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
.fb-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.4rem; border-top: 1px solid var(--border-soft); }
.fb-note { font-size: 0.78rem; color: var(--stone); }
.fb-submit { padding: 0.65rem 1.3rem; border-radius: 8px; background: var(--jade); color: #fbf3e9; font-weight: 700; font-size: 0.95rem; transition: background var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease); }
.fb-submit:hover:not(:disabled) { background: var(--jade-soft); }
.fb-submit:disabled { opacity: 0.4; cursor: not-allowed; }
.fb-status { margin: 0; padding: 0 1.4rem; font-size: 0.85rem; }
.fb-status:empty { display: none; }
.fb-status.visible { padding-bottom: 0.8rem; }
.fb-thanks { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2.2rem 1.6rem; text-align: center; }
.fb-thanks[hidden] { display: none; }
.fb-thanks strong { font-size: 1.15rem; }
.fb-thanks > span:last-child { color: var(--stone); font-size: 0.9rem; }
.fb-check { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: color-mix(in srgb, var(--jade) 15%, var(--card)); color: var(--jade); animation: sv-pop 480ms var(--ease) both; }
.fb-check svg { width: 22px; height: 22px; }
@media (max-width: 640px) {
  .fb-card { right: 8px; left: 8px; bottom: 8px; width: auto; }
  .fb-face svg { width: 46px; height: 46px; }
  .fb-tab { font-size: 0.76rem; }
}
@media (prefers-reduced-motion: reduce) { .fb-card { transition: none; } }
