/*
 * Mohzi 使用指南 — the site's own look (site/src/styles.css): neutral greys with no blue in them, Songti for the
 * display lines, Inter and PingFang for the rest, one vermilion for the brush; the app's near-black windows on a
 * charcoal page. One page one thing: what to do on the left, the real screen on the right, lit where to look, the
 * narrator along the bottom.
 */
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/inter.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('fonts/instrument-serif.woff2') format('woff2');
}
:root {
  --page: #ffffff;
  --page-2: #f5f5f5;
  --page-3: #ebebeb;
  --card: #f7f7f7;
  --ink: #151515;
  --ink-2: #2b2b2b;
  --mute: #5e5e5e;
  --faint: #8c8c8c;
  --vermilion: #b8312a;
  --hollow: rgba(0, 0, 0, 0.5);
  --lift: 0 2.125rem 5.625rem -2.125rem rgba(22, 19, 15, 0.45), 0 0.125rem 0.625rem rgba(22, 19, 15, 0.06);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --sans: 'Inter Variable', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --serif: 'Instrument Serif', 'Songti SC', 'STSong', 'Noto Serif CJK SC', 'Source Han Serif SC', serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #1a1a1a;
    --page-2: #252525;
    --page-3: #313131;
    --card: #212121;
    --ink: #f2f2f2;
    --ink-2: #d6d6d6;
    --mute: #a2a2a2;
    --faint: #707070;
    --lift: 0 2.125rem 5.625rem -1.875rem rgba(0, 0, 0, 0.8), 0 0.125rem 0.625rem rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* 1rem is a hundredth of the stage's width: the 1600×900 page, drawn at whatever size fits, nothing scaled. */
html { font-size: calc(min(100vw, 100vh * 16 / 9) / 100); }
html, body { height: 100%; background: var(--page); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 0.125rem solid var(--ink); outline-offset: 0.125rem; border-radius: 0.75rem; }

/* The 16:9 stage, 1600×900, scaled to fit (deck.ts). */
#viewport { position: fixed; inset: 0; display: grid; place-items: center; }
#stage { position: relative; width: 100rem; height: 56.25rem; overflow: hidden; }

/* The site's light behind the words (Aurora.tsx), on the cover and each chapter's page. */
.aurora { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity 1.2s var(--ease); }
.on .aurora { opacity: 1; }
.aurora-light {
  --aurora-veil: repeating-linear-gradient(100deg, #fff 0%, #fff 7%, transparent 10%, transparent 12%, #fff 16%);
  --aurora-bands: repeating-linear-gradient(100deg, #000 10%, #666 15%, #ccc 20%, #fff 25%, #333 30%);
  position: absolute; inset: -10px;
  background-image: var(--aurora-veil), var(--aurora-bands);
  background-size: 300%, 200%; background-position: 50% 50%, 50% 50%;
  opacity: 0.5; filter: blur(0.625rem) invert(1); will-change: transform;
  mask-image: radial-gradient(ellipse at 100% 0%, #000 10%, transparent 70%);
}
.aurora-light::after {
  content: ''; position: absolute; inset: 0;
  background-image: var(--aurora-veil), var(--aurora-bands);
  background-size: 200%, 100%; background-attachment: fixed; mix-blend-mode: difference;
  animation: aurora 60s linear infinite;
}
@keyframes aurora { from { background-position: 50% 50%, 50% 50%; } to { background-position: 350% 50%, 350% 50%; } }
@media (prefers-color-scheme: dark) {
  .aurora-light { --aurora-veil: repeating-linear-gradient(100deg, #000 0%, #000 7%, transparent 10%, transparent 12%, #000 16%); filter: blur(0.625rem); }
}

/* A page: in from the right, out to the left. */
.slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transform: translateX(2.25rem); transition: opacity 0.6s var(--ease), transform 0.8s var(--ease), visibility 0s linear 0.8s; }
.slide.on { opacity: 1; visibility: visible; transform: none; transition: opacity 0.6s var(--ease), transform 0.8s var(--ease), visibility 0s; }
.slide.past { transform: translateX(-2.25rem); }
.body { position: absolute; inset: 4rem 5.25rem 8rem; }

/* What comes in one after another. */
.rise { opacity: 0; transform: translateY(1rem); filter: blur(0.375rem); transition: opacity 0.7s var(--ease), transform 0.8s var(--ease), filter 0.7s var(--ease); }
.on .rise { opacity: 1; transform: none; filter: none; }
.on .rise.d1 { transition-delay: 0.1s; } .on .rise.d2 { transition-delay: 0.2s; } .on .rise.d3 { transition-delay: 0.3s; }
.on .rise.d4 { transition-delay: 0.4s; } .on .rise.d5 { transition-delay: 0.5s; } .on .rise.d6 { transition-delay: 0.6s; }

/* A display line inking in a character at a time (Ink.tsx Marked). */
.ink { font-family: var(--serif); font-weight: 400; letter-spacing: 0.01em; }
.ink .ch { display: inline; opacity: 0; filter: blur(0.5rem); transition: opacity 0.9s var(--ease), filter 0.9s var(--ease); transition-delay: var(--d); }
.on .ink .ch { opacity: 1; filter: none; }
.mark { position: relative; z-index: 0; white-space: nowrap; }

.kicker { font-size: 0.9375rem; letter-spacing: 0.22em; color: var(--faint); font-weight: 560; text-transform: uppercase; }

/* Cover. */
.cover .body { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; inset: 0 5.25rem 2.5rem; }
.cover .face-big { width: 6rem; height: 6rem; border-radius: 1.875rem; background: var(--page-2); display: grid; place-items: center; }
.cover h1 { margin-top: 2.125rem; font-size: 7.5rem; line-height: 1.05; }
.cover .lead { margin-top: 3.5rem; font-size: 1.5625rem; color: var(--mute); line-height: 1.6; }
.cover .start { display: flex; gap: 0.875rem; margin-top: 3.25rem; }
.pill { display: inline-flex; align-items: center; gap: 0.625rem; height: 3.5rem; padding: 0 1.75rem; border-radius: 62.4375rem; font-size: 1.125rem; font-weight: 600; transition: transform 0.25s var(--ease), background 0.25s; }
.pill:hover { transform: translateY(-1px); }
.pill.main { background: var(--ink); color: var(--page); }
.pill.quiet { background: var(--page-2); }
.pill svg { width: 1.125rem; height: 1.125rem; }
.cover .meta { margin-top: 1.875rem; font-size: 0.875rem; color: var(--faint); }

/* A chapter's page. */
.chapter .body { display: grid; grid-template-columns: 1fr 1fr; gap: 5rem; align-items: center; }
.chapter .no { font-family: var(--serif); font-size: 9.375rem; line-height: 1; color: var(--faint); }
.chapter h2 { margin-top: 1.125rem; font-size: 5.25rem; line-height: 1.1; }
.chapter .lead { margin-top: 1.625rem; font-size: 1.4375rem; color: var(--mute); line-height: 1.65; max-width: 37.5rem; }
.chapter ol { list-style: none; display: grid; gap: 0.625rem; counter-reset: item; }
.chapter li { counter-increment: item; display: grid; grid-template-columns: 3.25rem 1fr; align-items: baseline; padding: 1rem 1.375rem; border-radius: 1rem; font-size: 1.375rem; }
.chapter li::before { content: counter(item, decimal-leading-zero); font-size: 0.9375rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.chapter li { background: color-mix(in srgb, var(--page-2) 72%, transparent); backdrop-filter: blur(0.75rem); -webkit-backdrop-filter: blur(0.75rem); }

/* A thing to do: its steps on the left, the screen on the right. */
.feature .body { display: grid; grid-template-columns: 28.125rem 1fr; gap: 3.5rem; align-items: center; }
.feature h3 { margin-top: 0.875rem; font-size: 3.25rem; line-height: 1.16; }
.feature .lead { margin-top: 1.125rem; font-size: 1.125rem; line-height: 1.7; color: var(--mute); }
.steps { list-style: none; margin-top: 1.875rem; display: grid; gap: 0.375rem; }
.steps li { position: relative; display: grid; grid-template-columns: 2rem 1fr; gap: 0.875rem; align-items: start; padding: 0.8125rem 1rem 0.8125rem 0.875rem; border-radius: 1rem; color: var(--faint); font-size: 1.0938rem; line-height: 1.6; transition: background 0.4s var(--ease), color 0.4s var(--ease); }
.steps li i { font-style: normal; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; margin-top: -1px; border-radius: 50%; background: var(--page-2); color: var(--mute); font-size: 0.875rem; font-weight: 650; font-variant-numeric: tabular-nums; transition: background 0.4s, color 0.4s; }
.steps li.now { background: var(--page-2); color: var(--ink); }
.steps li.now i { background: var(--ink); color: var(--page); }
.steps li.done { color: var(--mute); }
.steps li.done i { background: var(--page-3); }
.tip { margin-top: 1.125rem; padding: 0.875rem 1.125rem 0.875rem 1rem; border-radius: 1rem; background: var(--page-2); color: var(--mute); font-size: 0.9688rem; line-height: 1.65; display: grid; grid-template-columns: 1.375rem 1fr; gap: 0.625rem; }
.tip::before { content: ''; width: 0.5rem; height: 0.5rem; margin: 0.5625rem 0 0 0.375rem; border-radius: 50%; background: var(--vermilion); }

/* The app's window as Mohzi draws it, lit where to look. */
.window { position: relative; border-radius: 1rem; overflow: hidden; background: #0c0c0c; box-shadow: var(--lift); }
.window img { display: block; width: 100%; height: auto; }
.canvas { position: relative; transform-origin: 0 0; transition: transform 1.1s var(--ease); }
.spot { position: absolute; border-radius: 0.75rem; box-shadow: 0 0 0 200vmax var(--hollow); opacity: 0; transition: left 0.75s var(--ease), top 0.75s var(--ease), width 0.75s var(--ease), height 0.75s var(--ease), opacity 0.5s var(--ease); pointer-events: none; }
.spot.on { opacity: 1; }
.spot::after { content: ''; position: absolute; inset: -2px; border-radius: 0.875rem; box-shadow: 0 0 0 0.125rem rgba(255, 255, 255, 0.9), 0 0 1.875rem 0.25rem rgba(255, 255, 255, 0.35); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 0.125rem rgba(255, 255, 255, 0.55), 0 0 1rem 0.125rem rgba(255, 255, 255, 0.15); } }
.pin { position: absolute; width: 1.875rem; height: 1.875rem; margin: -0.9375rem 0 0 -0.9375rem; border-radius: 50%; background: #f2f2f2; color: #151515; font-size: 0.875rem; font-weight: 700; display: grid; place-items: center; opacity: 0; transform: scale(0.5); box-shadow: 0 0.375rem 1.25rem rgba(0, 0, 0, 0.45); transition: opacity 0.4s, transform 0.55s var(--ease), left 0.75s var(--ease), top 0.75s var(--ease); }
.pin.on { opacity: 1; transform: none; }

/* The narrator along the bottom: Mohzi's face, what it says, and what to press. */
#narrator { position: absolute; left: 5.25rem; right: 5.25rem; bottom: 2rem; height: 4.25rem; display: grid; grid-template-columns: 3.75rem 1fr auto; gap: 1rem; align-items: center; padding: 0 0.625rem 0 0.75rem; border-radius: 62.4375rem; background: var(--page-2); z-index: 5; }
#say { font-size: 1.0938rem; line-height: 1.5; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: opacity 0.35s var(--ease), filter 0.35s; }
#say.fade { opacity: 0; filter: blur(0.25rem); }
.controls { display: flex; align-items: center; gap: 0.125rem; }
.icon { width: 2.875rem; height: 2.875rem; border-radius: 50%; display: grid; place-items: center; color: var(--mute); transition: background 0.2s, color 0.2s; }
.icon:hover { background: var(--page-3); color: var(--ink); }
.icon.active { background: var(--ink); color: var(--page); }
.icon svg { width: 1.25rem; height: 1.25rem; }
#count { min-width: 4.375rem; text-align: center; font-size: 0.875rem; color: var(--faint); font-variant-numeric: tabular-nums; }
#bar { position: absolute; left: 0; top: 0; height: 0.125rem; background: var(--ink); opacity: 0.6; transition: width 0.6s var(--ease); z-index: 6; }

/* The narrator's face: Mohzi's mark, blinking, its smile moving as it speaks. */
.face { width: 3.25rem; height: 1.875rem; display: block; }
.face .eye { transform-box: fill-box; transform-origin: center; animation: blink 4.6s infinite; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.12); } }
.talking .face .smile { transform-box: fill-box; transform-origin: 0% 50%; animation: talk 0.34s ease-in-out infinite alternate; }
@keyframes talk { to { transform: scaleY(0.6); } }

/* 目录. */
#toc { position: absolute; inset: 0; z-index: 10; background: color-mix(in srgb, var(--page) 92%, transparent); backdrop-filter: blur(1.125rem); -webkit-backdrop-filter: blur(1.125rem); padding: 4rem 5.25rem 2.5rem; opacity: 0; visibility: hidden; transition: opacity 0.35s var(--ease), visibility 0s linear 0.35s; overflow-y: auto; }
#toc.open { opacity: 1; visibility: visible; transition: opacity 0.35s var(--ease); }
#toc .top { display: flex; align-items: center; }
#toc h4 { font-family: var(--serif); font-weight: 400; font-size: 3.375rem; }
#toc .groups { margin-top: 2.125rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.875rem 2.125rem; }
#toc .group p { font-size: 0.8125rem; letter-spacing: 0.2em; color: var(--faint); font-weight: 600; margin-bottom: 0.625rem; }
#toc .group button { display: block; width: 100%; text-align: left; padding: 0.5625rem 0.75rem; margin-left: -0.75rem; border-radius: 0.75rem; font-size: 1rem; color: var(--mute); transition: background 0.2s, color 0.2s; }
#toc .group button:hover, #toc .group button.here { background: var(--page-2); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .aurora-light::after, .spot::after, .face .eye, .talking .face .smile { animation: none; }
  .slide, .rise, .ink .ch { transition-duration: 0.01s !important; transition-delay: 0s !important; }
}

/* ── Points: a few things side by side ── */
.points .body { display: grid; grid-template-columns: 28.125rem 1fr; gap: 3.5rem; align-items: center; }
.points h3 { margin-top: 0.875rem; font-size: 3.25rem; line-height: 1.16; }
.points .lead { margin-top: 1.125rem; font-size: 1.125rem; line-height: 1.7; color: var(--mute); }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem; }
.cards.n3 .card:first-child { grid-column: 1 / -1; }
.cards.n5 .card:first-child { grid-column: 1 / -1; }
.card { padding: 1.625rem 1.75rem 1.75rem; border-radius: 1.25rem; background: color-mix(in srgb, var(--page-2) 72%, transparent); color: var(--mute); transition: background 0.45s var(--ease), color 0.45s var(--ease), transform 0.6s var(--ease); }
.card h4 { font-family: var(--serif); font-weight: 400; font-size: 1.75rem; line-height: 1.25; color: var(--ink-2); transition: color 0.45s var(--ease); }
.card p { margin-top: 0.75rem; font-size: 1.0625rem; line-height: 1.7; }
.card.now { background: var(--page-3); color: var(--ink-2); transform: translateY(-0.1875rem); }
.card.now h4 { color: var(--ink); }

/* ── The end ── */
.end .body { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; inset: 0 5.25rem 2.5rem; }
.end .face-big { width: 6rem; height: 6rem; border-radius: 1.875rem; background: var(--page-2); display: grid; place-items: center; }
.end h1 { margin-top: 2.125rem; font-size: 6rem; line-height: 1.1; }
.end .lead { margin-top: 2.25rem; font-size: 1.5rem; color: var(--mute); line-height: 1.6; max-width: 50rem; }
.end .start { display: flex; gap: 0.875rem; margin-top: 3rem; }
.end .meta { margin-top: 1.875rem; font-size: 0.9375rem; color: var(--faint); }
.end a { color: inherit; text-decoration: none; }
.end .meta a { text-decoration: underline; text-underline-offset: 0.25em; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
.end .meta a:hover { color: var(--ink); }

/* ── Phones, upright: one column, the step on top, the screen under it, the narrator at the foot ── */
@media (max-aspect-ratio: 4/5), (max-width: 640px) {
  html { font-size: min(calc(100vw / 25), 17px); }
  #stage { width: 100vw; height: 100vh; height: 100dvh; }
  .body { inset: 1.5rem 1.25rem 8.25rem; }
  .slide { transform: translateX(1rem); }
  .slide.past { transform: translateX(-1rem); }

  .cover .body, .end .body { inset: 0 1.5rem 3rem; }
  .cover .face-big, .end .face-big { width: 4.5rem; height: 4.5rem; border-radius: 1.375rem; }
  .cover h1 { font-size: 3.75rem; margin-top: 1.5rem; }
  .end h1 { font-size: 3rem; margin-top: 1.5rem; }
  .cover .lead, .end .lead { margin-top: 2rem; font-size: 1.0625rem; }
  .cover .start, .end .start { margin-top: 2.25rem; flex-direction: column; width: 100%; max-width: 18rem; }
  .pill { height: 3.125rem; justify-content: center; font-size: 1rem; }
  .cover .meta { display: none; }

  .chapter .body { display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 2rem; }
  .chapter .no { font-size: 4.5rem; }
  .chapter h2 { font-size: 2.625rem; margin-top: 0.5rem; }
  .chapter .lead { font-size: 1rem; margin-top: 1rem; }
  .chapter li { font-size: 1rem; padding: 0.75rem 1rem; grid-template-columns: 2.25rem 1fr; }
  .chapter li::before { font-size: 0.75rem; }

  .feature .body { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
  .feature .side { display: contents; }
  .feature .kicker { order: 1; font-size: 0.75rem; }
  .feature h3 { order: 2; font-size: 2rem; margin-top: 0.5rem; }
  .feature .lead { order: 3; font-size: 0.9375rem; margin-top: 0.625rem; }
  .feature .window { order: 4; margin-top: 1.25rem; border-radius: 0.75rem; flex: none; }
  .feature .steps { order: 5; margin-top: 0.875rem; }
  .feature .tip { order: 6; font-size: 0.875rem; }
  .steps li { font-size: 1rem; padding: 0.75rem 0.875rem; }
  .steps li:not(.now) { display: none; }
  .spot { border-radius: 0.5rem; }
  .pin { width: 1.5rem; height: 1.5rem; margin: -0.75rem 0 0 -0.75rem; font-size: 0.75rem; }

  .points .body { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 1.25rem; overflow-y: auto; }
  .points h3 { font-size: 2rem; }
  .points .lead { font-size: 0.9375rem; }
  .cards { grid-template-columns: 1fr; gap: 0.625rem; }
  .card { padding: 1rem 1.125rem 1.125rem; border-radius: 1rem; }
  .card h4 { font-size: 1.25rem; }
  .card p { font-size: 0.9375rem; margin-top: 0.375rem; }

  #narrator { left: 0.75rem; right: 0.75rem; bottom: 0.75rem; height: auto; grid-template-columns: 2.75rem 1fr; grid-template-rows: auto auto; row-gap: 0.25rem; padding: 0.75rem 0.75rem 0.375rem; border-radius: 1.5rem; }
  #narrator .speaker .face { width: 2.5rem; height: 1.5rem; }
  #say { font-size: 0.9375rem; -webkit-line-clamp: 3; }
  .controls { grid-column: 1 / -1; justify-content: space-between; }
  .controls [data-act="full"] { display: none; }
  .icon { width: 2.75rem; height: 2.75rem; }

  #toc { padding: 1.5rem 1.25rem; }
  #toc h4 { font-size: 2.25rem; }
  #toc .groups { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ── The other language ── */
.lang { text-decoration: none; font-size: 0.9375rem; color: var(--mute); padding: 0.5rem 0.9375rem; border-radius: 62.4375rem; background: var(--page-2); transition: color 0.2s, background 0.2s; }
.lang:hover { color: var(--ink); background: var(--page-3); }
.cover > .lang { position: absolute; top: 2rem; right: 2.5rem; z-index: 2; }
#toc .top .lang { margin-left: auto; margin-right: 0.5rem; }
@media (max-aspect-ratio: 4/5), (max-width: 640px) { .cover > .lang { top: 1rem; right: 1rem; } }
