/* Flowy Canvas marketing site.
   Brand: airy blue-gray ground, serif display voice, #2f74d0 ink-blue
   accent. Frosted-glass panels over soft color blobs. Motion: a
   scroll-driven flip book whose pages are media-dominant (video or SVG
   diagram taking ~2/3 of each topic), self-drawing SVG ink, gentle
   reveals. */

/* ---------- tokens + reset ------------------------------------------ */
:root {
  --paper: #ffffff;
  --ink: #16283c;
  --muted: #55677a;
  --line: rgba(22, 40, 60, 0.12);
  --hair: rgba(22, 40, 60, 0.10);
  --blue: #2f74d0;
  --blue-dark: #2058a8;
  --ink-blue: #2f74d0;
  --ink-red: #e2504a;
  --ink-amber: #eda93b;
  --ink-slate: #8296ac;
  --serif: "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
          Roboto, Helvetica, Arial, sans-serif;
  --zh: "寒蝉拙楷体 R", "ChillZhuoKai";
  --zh-title: "寒蝉正楷体", "ChillKai";
  /* One container width so every card group's edges line up down the page */
  --wrap: 1120px;
  --glass-bg: rgba(255, 255, 255, 0.62);
  --glass-brd: rgba(255, 255, 255, 0.72);
  --glass-blur: blur(22px) saturate(180%);
  --shadow-lg: 0 30px 80px rgba(22, 40, 60, 0.18), 0 8px 24px rgba(22, 40, 60, 0.08);
  --shadow-md: 0 14px 40px rgba(22, 40, 60, 0.12), 0 2px 8px rgba(22, 40, 60, 0.06);
  --radius: 22px;
}

/* 寒蝉正楷体 — hero-title glyphs only. Chill Type, OFL-1.1. */
@font-face {
  font-family: "寒蝉正楷体";
  src: local("寒蝉正楷体"), local("ChillKai"),
       url("assets/fonts/chillkai/ChillKai.woff2?v=20260821d") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+4E0D, U+4E3A, U+518D, U+5C4F, U+5E55, U+6210,
                 U+6C9F, U+7684, U+788D, U+8BA9, U+901A, U+963B;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #eef3fa 0%, #e6eef7 45%, #eaf0f8 100%);
  background-attachment: fixed;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
kbd {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82em;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 7px;
}

.h2 {
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.015em;
  font-weight: 700;
}
.serif { font-family: var(--serif); font-weight: 600; }
.serif em, .hero-title em { font-style: italic; color: var(--blue); }
.lead {
  font-size: clamp(16px, 1.6vw, 20px);
  color: var(--muted);
  max-width: 640px;
  margin: 14px auto 0;
}

/* ---------- frosted-glass surface ----------------------------------- */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd);
}

/* ---------- fixed backdrop blobs ------------------------------------ */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
}
.b1 { width: 540px; height: 540px; background: #6db0f5; top: -140px; left: -100px; }
.b2 { width: 460px; height: 460px; background: #a9cef6; top: 26%; right: -140px; }
.b3 { width: 440px; height: 440px; background: #f4c6a6; bottom: 8%; left: -120px; }
.b4 { width: 520px; height: 520px; background: #cdb8f2; bottom: -160px; right: 8%; }

/* ---------- reveal-on-scroll ---------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- nav ------------------------------------------------------ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background 0.25s ease, box-shadow 0.25s ease, backdrop-filter 0.25s ease;
}
.nav.scrolled {
  background: rgba(238, 243, 250, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 rgba(22, 40, 60, 0.08);
}
.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.nav-logo { width: 26px; height: 26px; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 14px;
  font-weight: 500;
}
.nav-links a { color: var(--ink); opacity: 0.75; transition: opacity 0.15s ease; }
.nav-links a:hover { opacity: 1; }
.nav-links .nav-cta {
  background: var(--blue);
  color: #fff;
  opacity: 1;
  padding: 7px 16px;
  border-radius: 999px;
  transition: background 0.15s ease;
}
.nav-links .nav-cta:hover { background: var(--blue-dark); }

/* ---------- buttons -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--sans);
  padding: 13px 26px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(47, 116, 208, 0.35);
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.4);
  color: var(--blue);
  box-shadow: inset 0 0 0 1.5px rgba(47, 116, 208, 0.45);
}
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--blue); background: rgba(255, 255, 255, 0.65); }

/* ---------- hero ------------------------------------------------------ */
.hero {
  padding: 130px 24px 40px;
  text-align: center;
}
.hero-eyebrow {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}
.hero-title {
  font-family: var(--serif);
  font-size: clamp(44px, 8vw, 92px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 18px 0 22px;
}
.hero-sub {
  font-size: clamp(17px, 2vw, 22px);
  color: var(--muted);
  margin-bottom: 34px;
}
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-fine { margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.hero-fine strong { color: var(--ink); }

/* Square 1:1 card — matches the demo videos, which are recorded square.
   Swappable for a real demo video/image via the admin Feature videos tab
   (topic "hero"); the browser-mockup below is only the placeholder shown
   until one is uploaded. */
.hero-stage {
  position: relative;
  margin: 64px auto 0;
  width: min(760px, 92vw);
  aspect-ratio: 1 / 1;
  perspective: 1400px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hero-media {
  position: absolute; inset: 0;
  overflow: hidden;
}
.hero-media video, .hero-media img {
  width: 100%; height: 100%; object-fit: cover;   /* square video fills the square frame */
}
/* Placeholder mockup stretched to fill the full 9:16 card — title bar and
   toolbar bookend the top/bottom edges instead of floating mid-card with
   dead space above and below. */
.shot-frame {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  border-radius: var(--radius); overflow: hidden;
  background: rgba(255, 255, 255, 0.4);
}
.hero-shot { transform: rotateX(4deg); transform-origin: center top; }
.shot-titlebar {
  display: flex; gap: 7px; padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(242, 245, 249, 0.6);
}
.shot-titlebar i { width: 11px; height: 11px; border-radius: 50%; background: #d6dee8; }
.shot-titlebar i:first-child { background: #f09a96; }
.shot-titlebar i:nth-child(2) { background: #f2cf8d; }
.shot-titlebar i:nth-child(3) { background: #a8d8ae; }
.shot-body { position: relative; flex: 1; min-height: 0; padding: 26px 28px 20px; }
.skeleton { display: grid; gap: 13px; }
.sk { height: 12px; border-radius: 6px; background: rgba(200, 214, 230, 0.7); width: 72%; }
.sk-lg { width: 42%; height: 18px; background: rgba(190, 208, 228, 0.8); }
.sk-md { width: 58%; }
.sk-block { height: 84px; width: 88%; border-radius: 12px; background: rgba(220, 230, 242, 0.7); }
.hero-ink { position: absolute; inset: 0; width: 100%; height: 100%; }
.shot-toolbar {
  display: flex; gap: 6px; justify-content: center; padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(242, 245, 249, 0.6);
}
.tb {
  width: 34px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tb.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------- shared SVG ink ------------------------------------------- */
.ink { stroke-dasharray: 1500; stroke-dashoffset: 1500; }
.lit .ink, .in .ink { animation: draw 1.6s cubic-bezier(0.5, 0, 0.3, 1) forwards; }
.in .draw-2, .lit .draw-b { animation-delay: 0.55s; }
.in .draw-3 { animation-delay: 1.05s; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.nodes circle { fill: #fff; stroke: var(--blue); stroke-width: 2.5; opacity: 0; transform-origin: center; }
.lit .nodes circle, .in .nodes circle { animation: node-pop 0.4s ease forwards; }
.in .nodes circle:nth-child(1), .lit .nodes circle:nth-child(1) { animation-delay: 1.5s; }
.in .nodes circle:nth-child(2), .lit .nodes circle:nth-child(2) { animation-delay: 1.62s; }
.in .nodes circle:nth-child(3), .lit .nodes circle:nth-child(3) { animation-delay: 1.74s; }
.in .nodes circle:nth-child(4), .lit .nodes circle:nth-child(4) { animation-delay: 1.86s; }
.in .nodes circle:nth-child(5), .lit .nodes circle:nth-child(5) { animation-delay: 1.98s; }
.in .nodes circle:nth-child(6), .lit .nodes circle:nth-child(6) { animation-delay: 2.1s; }
@keyframes node-pop {
  from { opacity: 0; transform: scale(0.2); }
  60% { opacity: 1; transform: scale(1.25); }
  to { opacity: 1; transform: scale(1); }
}
.handles line { stroke: var(--ink-slate); stroke-width: 2; stroke-dasharray: 5 5; }
.handles circle { fill: var(--ink-slate); }
.handles { opacity: 0; }
.lit .handles, .in .handles { animation: fade-in 0.5s ease 2.1s forwards; }
@keyframes fade-in { to { opacity: 1; } }

.paper { fill: #fbfcfe; stroke: var(--line); }
.paper.cold { fill: #f2f7fd; stroke: #cfe0f2; }
.skrect { fill: #dbe4ee; }
.skrect.dim { fill: #e8edf4; }
.skrect.tint { fill: #dce9f8; }
.keycap rect { fill: #fff; stroke: #c8d3e0; stroke-width: 1.5; }
.keycap text {
  fill: var(--ink); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px; font-weight: 600; text-anchor: middle;
}
.drag-node circle { fill: #fff; stroke: var(--blue); stroke-width: 2.5; }
.drag-node .halo { fill: rgba(47, 116, 208, 0.15); stroke: none; }
.lit .drag-node { animation: node-drag 3.2s ease-in-out 0.8s infinite; }
@keyframes node-drag {
  0%, 15% { transform: translate(0, 0); }
  45%, 65% { transform: translate(36px, 34px); }
  90%, 100% { transform: translate(0, 0); }
}
.lit .morph { animation: morph-squish 3.2s ease-in-out 0.8s infinite; }
@keyframes morph-squish {
  0%, 15% { d: path("M80 240 C 170 130, 330 130, 440 220"); }
  45%, 65% { d: path("M80 240 C 200 190, 320 190, 440 220"); }
  90%, 100% { d: path("M80 240 C 170 130, 330 130, 440 220"); }
}
.sel-box rect { fill: none; stroke: var(--ink-slate); stroke-width: 1.5; stroke-dasharray: 6 6; }
.tr-sel { fill: rgba(47, 116, 208, 0.14); stroke: var(--ink-blue); stroke-width: 1.5; stroke-dasharray: 6 6; }
.lit .tr-sel { animation: fade-in 0.5s ease 0.8s forwards; opacity: 0; }
.tr-arrow { stroke: var(--ink-blue); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.tr-out { opacity: 0; }
.lit .tr-out { animation: fade-in 0.5s ease 1.4s forwards; }
.lit .sel-box { animation: fade-in 0.4s ease 0.4s forwards; opacity: 0; }
.swatch-ring { fill: none; stroke: var(--ink); stroke-width: 2; }
.lit .swatch-ring { animation: swatch-hop 3.2s steps(1) 0.8s infinite; }
@keyframes swatch-hop {
  0% { transform: translateX(0); }
  45% { transform: translateX(30px); }
  75% { transform: translateX(0); }
}
.fill-shape { fill: rgba(47, 116, 208, 0); }
.lit .fill-shape { animation: flood 2.6s ease 0.9s infinite; }
@keyframes flood {
  0%, 18% { fill: rgba(47, 116, 208, 0); }
  40%, 78% { fill: rgba(47, 116, 208, 0.28); }
  100% { fill: rgba(47, 116, 208, 0); }
}
.bucket { transform: translate(300px, 120px); }
.bucket path { fill: var(--ink); }
.bucket .drop { fill: var(--blue); }
.lit .bucket { animation: bucket-tip 2.6s ease 0.55s infinite; }
@keyframes bucket-tip {
  0%, 12% { transform: translate(300px, 120px) rotate(0deg); }
  28%, 70% { transform: translate(296px, 128px) rotate(-18deg); }
  100% { transform: translate(300px, 120px) rotate(0deg); }
}
.crop-ring { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-dasharray: 10 7; }
.lit .long-scroll { animation: page-crawl 5s linear 0.4s infinite; }
@keyframes page-crawl { from { transform: translateY(0); } to { transform: translateY(-190px); } }
.stepbtn { fill: #fff; stroke: var(--line); }
.steparrow { fill: var(--blue); }
.steparrow.up { opacity: 0.35; }
.stitch-fill { fill: #dce9f8; stroke: var(--blue); stroke-width: 1.5; }
.lit .stitch-fill { animation: stitch-grow 5s linear 0.4s infinite; }
@keyframes stitch-grow { from { height: 24px; } to { height: 248px; } }
.rec-ring { stroke: var(--ink-red); }
.rec-dot { fill: var(--ink-red); }
.lit .rec-dot { animation: rec-blink 1.2s ease infinite; }
@keyframes rec-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.rec-text { fill: var(--ink-red); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; font-weight: 700; }
.rec-wave path { stroke-dasharray: 500; stroke-dashoffset: 500; }
.lit .rec-wave path { animation: draw 2.4s linear 0.3s infinite; }
.rec-progress { fill: var(--ink-red); }
.lit .rec-progress { animation: rec-fill 4.5s linear 0.3s infinite; }
@keyframes rec-fill { from { width: 0; } to { width: 300px; } }
.gal-grid rect { fill: #e2eaf4; stroke: #ccd9e8; opacity: 0; transform-origin: center; }
.lit .gal-grid rect { animation: node-pop 0.5s ease forwards; }
.lit .gal-grid rect:nth-child(1) { animation-delay: 0.15s; }
.lit .gal-grid rect:nth-child(2) { animation-delay: 0.25s; }
.lit .gal-grid rect:nth-child(3) { animation-delay: 0.35s; }
.lit .gal-grid rect:nth-child(4) { animation-delay: 0.45s; }
.lit .gal-grid rect:nth-child(5) { animation-delay: 0.55s; }
.lit .gal-grid rect:nth-child(6) { animation-delay: 0.65s; }
.lit .gal-grid rect:nth-child(7) { animation-delay: 0.75s; }
.lit .gal-grid rect:nth-child(8) { animation-delay: 0.85s; }
.lit .gal-grid rect:nth-child(9) { animation-delay: 0.95s; }
.lit .gal-grid rect:nth-child(10) { animation-delay: 1.05s; }
.lit .gal-grid rect:nth-child(11) { animation-delay: 1.15s; }
.lit .gal-grid rect:nth-child(12) { animation-delay: 1.25s; }
.gal-badge rect { fill: var(--ink); opacity: 0.85; }
.gal-badge text { fill: #fff; font-size: 13px; font-weight: 600; text-anchor: middle; font-family: var(--sans); }
.flake path { stroke: #7fb3e8; stroke-width: 2.5; fill: none; }
.lit .flake { animation: flake-spin 6s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes flake-spin { to { transform: rotate(360deg); } }
.mode-label { fill: var(--muted); font-size: 14px; font-weight: 600; text-anchor: middle; font-family: var(--sans); }
.live-cursor path { fill: var(--ink); }
.lit .live-cursor { animation: cursor-roam 4s ease-in-out infinite; }
@keyframes cursor-roam {
  0%, 100% { transform: translate(310px, 100px); }
  30% { transform: translate(420px, 150px); }
  60% { transform: translate(360px, 185px); }
}
.lit .live-lines rect { animation: line-shift 4s ease-in-out infinite; }
@keyframes line-shift { 0%, 100% { transform: translateY(0); } 45%, 60% { transform: translateY(-8px); } }
.slotbg { fill: #eef2f8; stroke: var(--line); }
.tool rect { fill: #fff; stroke: #c8d3e0; stroke-width: 1.5; }
.tool text { fill: var(--ink); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; font-weight: 700; text-anchor: middle; }
.tool.t1 { transform: translate(0, 0); } .tool.t2 { transform: translate(66px, 0); }
.tool.t3 { transform: translate(132px, 0); } .tool.t4 { transform: translate(198px, 0); }
.tool.t5 { transform: translate(264px, 0); } .tool.t6 { transform: translate(330px, 0); }
.lit .tool.t2 { animation: swap-right 3.6s ease-in-out 0.6s infinite; }
.lit .tool.t5 { animation: swap-left 3.6s ease-in-out 0.6s infinite; }
@keyframes swap-right {
  0%, 12% { transform: translate(66px, 0); } 20% { transform: translate(66px, -34px); }
  45% { transform: translate(264px, -34px); } 55%, 100% { transform: translate(264px, 0); }
}
@keyframes swap-left {
  0%, 12% { transform: translate(264px, 0); } 20% { transform: translate(264px, 34px); }
  45% { transform: translate(66px, 34px); } 55%, 100% { transform: translate(66px, 0); }
}
.kc2 rect { stroke: var(--blue); }
.lit .kc2 { animation: kc-glow 3.6s ease 1s infinite; transform-box: fill-box; }
@keyframes kc-glow { 0%, 40%, 100% { opacity: 0.55; } 55%, 80% { opacity: 1; } }
.remap-arrow { opacity: 0.7; }

/* ---------- stats band ------------------------------------------------ */
.band {
  max-width: var(--wrap);
  margin: 22px auto;
  border-radius: var(--radius);
  padding: 36px 28px;
  box-shadow: var(--shadow-md);
}
.band-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}
.stat strong { display: block; font-size: 22px; letter-spacing: -0.01em; font-family: var(--serif); }
.stat span { font-size: 13.5px; color: var(--muted); }

/* ---------- feature flip book ---------------------------------------- */
.book-heading { text-align: center; padding: 100px 24px 10px; }

/* Desktop: JS moves chapters into the flip book and adds .book-active. */
.book-scroll { display: none; }
.book-section.book-active .book-scroll { display: block; height: 1320vh; }
.book-section.book-active .chapters { display: none; }

.book-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  /* reserve the fixed nav's band so the pinned card never slides under it */
  padding-top: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}
.book {
  position: relative;
  /* Fixed 3:2 page: the 2fr media column is exactly 1:1, so the square
     demo videos fill it edge-to-edge at any viewport — no letterbox bands.
     The width cap keeps the page under the nav on short screens. */
  width: min(var(--wrap), 94vw, calc((100vh - 190px) * 1.5));
  aspect-ratio: 3 / 2;
  border-radius: var(--radius);
  overflow: hidden;                 /* clip pages to the rounded frame */
  /* frosted base the pages cross-fade over. The book's own box-shadow is
     not clipped by its own overflow, so the card still floats. */
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-lg);
}
/* Each page is a frosted card the scroll engine cross-fades in and out. */
.leaf {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  will-change: opacity, transform;
  opacity: 0;
}

/* topic page: media (2/3) + caption (1/3) */
.leaf-front { display: grid; grid-template-columns: 2fr 1fr; height: 100%; }
/* media fills its whole 2/3 frame, edge to edge — no inner card/padding */
.leaf-media {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #0b1826;              /* dark backing; real videos cover it */
  /* Never let a tall caption stretch this box past square: a stretched
     box letter-bands the video at the top and clips its bottom (toolbar)
     behind the leaf's rounded corner. */
  aspect-ratio: 1 / 1;
  align-self: center;
  height: auto;
  max-height: 100%;
}
.leaf-media svg, .leaf-media video, .leaf-media img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
/* Demo videos are square (1:1) — fit them whole instead of cropping top
   and bottom; the dark backing absorbs whatever letterbox remains. */
.leaf-media video, .leaf-media img { object-fit: contain; }
/* placeholder diagram: framed on white, comfortably inset */
.leaf-media svg { background: #fff; padding: clamp(16px, 2.4vw, 34px); }
.leaf-caption {
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(26px, 3.4vw, 56px);
  border-left: 1px solid var(--hair);
}
.leaf-caption .ch-kicker {
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--blue); margin-bottom: 14px;
}
.leaf-caption h3 {
  font-family: var(--serif);
  font-size: clamp(24px, 2.8vw, 38px);
  line-height: 1.1; letter-spacing: -0.015em; margin-bottom: 16px;
}
.leaf-caption p { color: var(--muted); font-size: clamp(14px, 1.25vw, 17px); line-height: 1.55; }
.leaf-caption .ch-num {
  margin-top: 24px; font-family: var(--serif); font-style: italic;
  font-size: 14px; color: var(--ink-slate);
}

/* feature bullet list shared by leaf + stacked captions */
.ch-list { list-style: none; display: grid; gap: 8px; }
.ch-list li {
  position: relative; padding-left: 17px;
  color: var(--muted); font-size: clamp(12.5px, 1.05vw, 14.5px); line-height: 1.5;
}
.ch-list li::before {
  content: ""; position: absolute; left: 2px; top: 0.5em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue); opacity: 0.55;
}
.ch-list li strong { color: var(--ink); }
.leaf-caption p + .ch-list, .chapter-caption p + .ch-list { margin-top: 12px; }

/* end page (static; the last cross-fade lands here) */
.leaf.end {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 16px; padding: 40px;
}
.leaf.end img { width: 88px; }
.leaf.end h3 { font-family: var(--serif); font-size: clamp(28px, 3vw, 44px); }
.leaf.end p { color: var(--muted); }

.book-progress { display: flex; gap: 9px; }
.book-progress i {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(22, 40, 60, 0.2);
  transition: background 0.2s ease, transform 0.2s ease;
}
.book-progress i.on { background: var(--blue); transform: scale(1.25); }
.book-hint { font-size: 12.5px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

/* Mobile / no-JS: chapters as stacked cards, media on top (2/3) */
.chapters {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 40px 24px 90px;
  display: grid;
  gap: 26px;
}
.chapter {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.chapter .chapter-media {
  display: flex; align-items: center; justify-content: center;
  padding: clamp(20px, 3vw, 40px);
  background: rgba(255, 255, 255, 0.3);
  min-width: 0;
}
.chapter .chapter-media svg, .chapter .chapter-media video, .chapter .chapter-media img {
  width: 100%; height: auto; max-height: 340px; object-fit: contain; border-radius: 14px;
}
/* Demo videos size themselves by aspect ratio — never squashed into a
   letterbox by the 340px clamp (stacked/no-JS layout). */
.chapter .chapter-media video { max-height: none; }
.chapter .chapter-media video, .chapter .chapter-media img { background: #0b1826; }
.chapter .chapter-caption {
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(24px, 3.4vw, 44px);
}
.chapter-caption .ch-num { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--ink-slate); }
.chapter-caption .ch-kicker {
  display: block; margin: 6px 0 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--blue);
}
.chapter-caption h3 {
  font-family: var(--serif); font-size: clamp(23px, 3vw, 34px);
  line-height: 1.14; letter-spacing: -0.015em; margin-bottom: 12px;
}
.chapter-caption p { color: var(--muted); font-size: 15px; }

/* ---------- privacy --------------------------------------------------- */
.privacy {
  text-align: center;
  padding: 110px 24px;
  margin: 40px auto;
  max-width: var(--wrap);
  border-radius: var(--radius);
  background: rgba(18, 30, 45, 0.9);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.privacy .h2 { color: #f2f6fa; }
.privacy .lead { color: #9fb1c4; }

/* ---------- pricing --------------------------------------------------- */
.pricing { padding: 100px 24px 40px; text-align: center; }
.price-grid {
  max-width: var(--wrap);
  margin: 54px auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: stretch;
}
.price-card {
  position: relative;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 42px 34px 38px;
  display: flex;
  flex-direction: column;
  text-align: center;
}
.price-card.featured {
  border-color: rgba(47, 116, 208, 0.5);
  box-shadow: 0 22px 60px rgba(47, 116, 208, 0.22), var(--shadow-md);
  transform: scale(1.04);
}
.ribbon {
  position: absolute;
  top: -13px; left: 50%;
  transform: translateX(-50%);
  background: var(--blue);
  color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 14px; border-radius: 999px;
}
.price-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.price { font-family: var(--serif); font-size: 54px; line-height: 1; letter-spacing: -0.02em; }
.price sup { font-size: 22px; vertical-align: super; margin-right: 2px; }
.price-sub { color: var(--muted); font-size: 13.5px; margin: 8px 0 20px; }
.price-card ul {
  list-style: none; text-align: left; margin: 0 auto 26px;
  display: grid; gap: 9px; font-size: 14px; color: var(--muted);
}
.price-card ul li::before { content: "✓"; color: var(--blue); font-weight: 700; margin-right: 9px; }
.price-card .btn { margin-top: auto; }
.pricing-fine { margin-top: 30px; font-size: 13.5px; color: var(--muted); }

/* ---------- checkout modal -------------------------------------------- */
.pay-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(22, 40, 60, 0.34);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: pay-fade 0.18s ease both;
}
.pay-overlay.hidden { display: none; }
@keyframes pay-fade { from { opacity: 0; } to { opacity: 1; } }
.pay-modal {
  position: relative;
  width: min(430px, 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 34px 32px 28px;
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  animation: pay-rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes pay-rise { from { transform: translateY(14px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.pay-close {
  position: absolute; top: 12px; right: 14px;
  width: 34px; height: 34px; border: none; border-radius: 50%;
  background: transparent; color: var(--muted);
  font-size: 26px; line-height: 1; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pay-close:hover { background: rgba(22, 40, 60, 0.08); color: var(--ink); }
.pay-title { font-size: 23px; margin-bottom: 4px; }
.pay-price { color: var(--muted); font-size: 14.5px; margin-bottom: 22px; }
.pay-methods { display: flex; flex-direction: column; gap: 12px; }
.pay-method {
  flex-direction: column; gap: 2px; padding: 13px 16px;
  height: auto; line-height: 1.25;
}
.pay-method-big { font-weight: 600; font-size: 15.5px; }
.pay-method-sub { font-size: 12px; font-weight: 400; opacity: 0.82; }
.pay-note { margin-top: 20px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ---------- download --------------------------------------------------- */
.download { padding: 100px 24px; text-align: center; }
.dl-grid { max-width: var(--wrap); margin: 50px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.dl-card {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 46px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.dl-os { display: flex; align-items: center; gap: 10px; }
.dl-os h3 { font-size: 22px; font-family: var(--serif); }
.os-icon { width: 26px; height: 26px; fill: var(--ink); }
.dl-req { font-size: 13px; color: var(--muted); }
.dl-card .btn { margin-top: 6px; }
.dl-alt { font-size: 13.5px; }
.dl-note { font-size: 12.5px; color: var(--muted); max-width: 34ch; }

/* ---------- faq --------------------------------------------------------- */
/* +48px so the list content lands at the same edges as the cards above */
.faq { padding: 100px 24px; max-width: calc(var(--wrap) + 48px); margin: 0 auto; }
.faq .h2 { text-align: center; margin-bottom: 44px; }
.faq-list { display: grid; gap: 12px; }
.faq details { border-radius: 16px; padding: 18px 22px; }
.faq summary {
  cursor: pointer; font-weight: 600; font-size: 15.5px; list-style: none;
  position: relative; padding-right: 30px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 2px; top: 50%;
  transform: translateY(-50%); font-size: 20px; color: var(--blue); transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq details p { margin-top: 12px; color: var(--muted); font-size: 14.5px; }

/* ---------- final CTA + footer ------------------------------------------ */
.final-cta { text-align: center; padding: 110px 24px; }
.cta-logo { width: 92px; margin: 0 auto 26px; }
.final-cta .hero-actions { margin-top: 30px; }

.footer { margin: 0 12px 12px; border-radius: var(--radius); }
.footer-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 44px 24px;
  display: grid; gap: 18px; justify-items: center; text-align: center;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.footer-links { display: flex; flex-wrap: wrap; gap: 22px; font-size: 14px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--blue); }
.footer-admin { opacity: 0.55; }
.footer-note { font-size: 13px; color: var(--muted); }

/* ---------- responsive --------------------------------------------------- */
.mobile-br { display: none; }
@media (max-width: 900px) {
  .nav-links a:not(.nav-cta) { display: none; }
  .band-inner { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .chapter { grid-template-columns: 1fr; }
  .chapter .chapter-media { order: -1; }
  .price-grid { grid-template-columns: 1fr; max-width: 420px; }
  .price-card.featured { transform: none; }
  .dl-grid { grid-template-columns: 1fr; max-width: 420px; }
  .mobile-br { display: inline; }
  .book-heading { padding-top: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .ink { stroke-dashoffset: 0; animation: none !important; }
  .nodes circle, .handles, .sel-box { opacity: 1 !important; animation: none !important; }
  .lit *, .in * { animation: none !important; }
}

/* ======================================================================
   Admin console (admin.html)
   ==================================================================== */
.admin-body { min-height: 100vh; display: flex; flex-direction: column; }
.admin-wrap { flex: 1 1 auto; max-width: 760px; margin: 0 auto; padding: 90px 22px 60px; width: 100%; }
.admin-head { text-align: center; margin-bottom: 30px; }
.admin-head .logo { width: 56px; margin: 0 auto 14px; }
.admin-head h1 { font-family: var(--serif); font-size: 30px; }
.admin-head p { color: var(--muted); font-size: 14px; margin-top: 6px; }

.admin-card { border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 30px 28px; }
.gate-form { display: grid; gap: 14px; max-width: 380px; margin: 0 auto; }
.field { display: grid; gap: 6px; text-align: left; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input, .textarea, .select {
  width: 100%;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--sans);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--blue); background: #fff; }
.textarea { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; resize: vertical; min-height: 96px; }
.admin-msg { font-size: 13px; margin-top: 4px; min-height: 18px; }
.admin-msg.err { color: var(--ink-red); }
.admin-msg.ok { color: #2f8a4e; }
.admin-hidden { display: none !important; }

.tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 22px; }
.tab-btn {
  border: 1px solid var(--glass-brd);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--ink); font-family: var(--sans); font-size: 13.5px; font-weight: 600;
  padding: 8px 18px; border-radius: 999px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.gen-grid { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.serial-out {
  margin-top: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px; word-break: break-all;
  background: rgba(47, 116, 208, 0.08);
  border: 1px solid rgba(47, 116, 208, 0.25);
  border-radius: 10px; padding: 12px; color: var(--ink);
}
.media-rows { display: grid; gap: 12px; }
.media-row {
  border: 1px solid var(--glass-brd);
  background: rgba(255, 255, 255, 0.45);
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}
.media-head { display: flex; align-items: center; gap: 10px; }
.media-head .mnum { font-family: var(--serif); font-style: italic; color: var(--ink-slate); }
.media-head .mlabel { font-weight: 600; font-size: 14px; flex: 1 1 auto; }
.media-head .mstate {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(22, 40, 60, 0.12); color: var(--muted);
}
.media-head .mstate.on { background: rgba(52, 170, 90, 0.22); color: #2f8a4e; }
.media-ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.media-ctl .mfile { flex: 1 1 180px; font-size: 12.5px; min-width: 0; }
.media-ctl .murl { flex: 1 1 180px; }
.media-ctl .btn { padding: 8px 15px; font-size: 13px; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.admin-note { font-size: 12.5px; color: var(--muted); margin-top: 14px; line-height: 1.5; }
.admin-back { display: inline-block; margin-top: 24px; font-size: 13.5px; }

/* ---------- payments tab --------------------------------------------- */
#tab-pay .field { margin-bottom: 12px; }
#tab-pay .row { margin-bottom: 12px; }
#tab-pay .btn-primary { margin-top: 4px; }
.pay-h {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-slate);
  margin: 26px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--hair);
}
.pay-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 12px; }
.pay-status {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 999px; margin-left: 6px;
  background: rgba(22, 40, 60, 0.12); color: var(--muted);
}
.pay-status.on { background: rgba(52, 170, 90, 0.22); color: #2f8a4e; }
.pay-hooks { margin-top: 28px; }
.pay-hook-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 0; border-top: 1px solid var(--hair); font-size: 13px;
}
.pay-hook-row span { font-weight: 700; min-width: 56px; color: var(--ink); }
.pay-hook-row code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; word-break: break-all; color: var(--blue);
  background: rgba(47, 116, 208, 0.08); padding: 4px 8px; border-radius: 6px;
}

/* language toggle */
.lang-toggle { display: inline-flex; border: 1px solid rgba(16,24,40,.14); border-radius: 999px; overflow: hidden; margin-left: 10px; }
.lang-toggle button { border: 0; background: transparent; padding: 5px 11px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--muted, #5b6b83); }
.lang-toggle button.on { background: var(--ink-blue, #2f74d0); color: #fff; }

/* Chinese copy: 寒蝉拙楷 for every CJK glyph (body, headings, buttons,
   brand). Latin/mono keep their stacks as fallbacks; no faux italic. */
html[lang="zh-CN"] {
  --serif: var(--zh), "Kaiti SC", "STKaiti", "KaiTi", Georgia, "Times New Roman", serif;
  --sans: var(--zh), "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
          -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-synthesis: weight;
}
html[lang="zh-CN"] .hero-title,
html[lang="zh-CN"] .hero-title em {
  font-family: var(--zh-title), var(--zh), "Kaiti SC", "KaiTi", serif;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.06em;
}
html[lang="zh-CN"] .h2,
html[lang="zh-CN"] .serif,
html[lang="zh-CN"] .leaf-caption h3,
html[lang="zh-CN"] .chapter-caption h3,
html[lang="zh-CN"] [data-i18n="brand.name"] {
  font-family: var(--zh), "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.04em;
}
html[lang="zh-CN"] .serif em,
html[lang="zh-CN"] .hero-title em {
  font-style: normal;
}
.lang-toggle button[data-lang="zh"] {
  font-family: var(--zh), var(--sans);
}

/* Short viewports: the 3:2 leaf is height-capped by the viewport, but ch 01's
   7-bullet caption is the tallest column and outgrows the card — the media
   box then floats centered with a gap above it (video looks offset) and the
   caption clips top/bottom (text disappears). Compress the caption type in
   steps so the caption always fits the leaf; the media column then fills the
   card edge-to-edge again. Breakpoints verified at 1470x956/820/700,
   1366x768, 1280x800/633 (2026-08-04). */
@media (max-height: 950px) {
  .leaf-caption { padding: clamp(20px, 2.6vw, 40px); }
  .leaf-caption .ch-kicker { margin-bottom: 12px; }
  .leaf-caption h3 { font-size: clamp(21px, 2.4vw, 33px); margin-bottom: 12px; }
  .leaf-caption p { font-size: clamp(13px, 1.1vw, 15.5px); line-height: 1.5; }
  .leaf-caption .ch-list { gap: 7px; }
  .leaf-caption .ch-list li { font-size: clamp(12px, 0.95vw, 13.5px); line-height: 1.45; }
  .leaf-caption .ch-num { margin-top: 18px; }
}
@media (max-height: 780px) {
  .leaf-caption { padding: clamp(16px, 2vw, 26px); }
  .leaf-caption .ch-kicker { margin-bottom: 10px; }
  .leaf-caption h3 { font-size: clamp(19px, 2.1vw, 27px); margin-bottom: 10px; }
  .leaf-caption p { font-size: clamp(12px, 1vw, 14px); line-height: 1.45; }
  .leaf-caption .ch-list { gap: 6px; }
  .leaf-caption .ch-list li { font-size: clamp(11.5px, 0.85vw, 12.5px); line-height: 1.4; }
  .leaf-caption .ch-num { margin-top: 14px; }
}
@media (max-height: 720px) {
  .leaf-caption { padding: clamp(14px, 1.8vw, 22px); }
  .leaf-caption .ch-kicker { margin-bottom: 9px; }
  .leaf-caption h3 { font-size: clamp(17px, 1.9vw, 24px); margin-bottom: 9px; }
  .leaf-caption p { font-size: clamp(11.5px, 0.95vw, 13px); line-height: 1.4; }
  .leaf-caption .ch-list { gap: 5px; }
  .leaf-caption .ch-list li { font-size: clamp(11px, 0.8vw, 12px); line-height: 1.35; }
  .leaf-caption .ch-num { margin-top: 12px; }
}
@media (max-height: 660px) {
  .leaf-caption { padding: clamp(12px, 1.6vw, 18px); }
  .leaf-caption .ch-kicker { font-size: 11px; margin-bottom: 8px; }
  .leaf-caption h3 { font-size: clamp(16px, 1.8vw, 22px); margin-bottom: 8px; }
  .leaf-caption p { font-size: clamp(11px, 0.9vw, 12.5px); line-height: 1.35; }
  .leaf-caption .ch-list { gap: 4px; }
  .leaf-caption .ch-list li { font-size: clamp(10.5px, 0.75vw, 11.5px); line-height: 1.3; }
  .leaf-caption .ch-num { margin-top: 10px; }
}
