:root {
  --ink: #0e1330;
  --night: #141a3f;
  --night-2: #1c2457;
  --dusk: #3e52a3;
  --horizon: #b79bc4;
  --robe: #7b3f22;
  --robe-dark: #4b2615;
  --rope: #ecdfc2;
  --cream: #f4ecdb;
  --muted: #b9b6cf;
  --gold: #e9b95f;
  --jade: #5fd59b;
  --jade-dark: #2c9d67;
  --lantern: #e0492f;
  --line: rgba(236, 223, 194, 0.14);

  --f-display: "Cormorant Garamond", Georgia, serif;
  --f-brush: "Ma Shan Zheng", "STKaiti", "KaiTi", serif;
  --f-body: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 18px;
  --max: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

/* painterly grain over everything */
.grain {
  position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: 0.09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0.85em 1.5em; border-radius: 999px; font-weight: 700; letter-spacing: 0.01em;
  text-decoration: none; border: 1.5px solid transparent; cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-jade { background: var(--jade); color: #072615; box-shadow: 0 8px 28px -8px rgba(95, 213, 155, 0.65); }
.btn-jade:hover { background: #79e3af; box-shadow: 0 12px 34px -8px rgba(95, 213, 155, 0.8); }
.btn-ghost { border-color: rgba(236, 223, 194, 0.45); color: var(--cream); }
.btn-ghost:hover { background: rgba(236, 223, 194, 0.08); }
.btn-sm { padding: 0.55em 1.1em; font-size: 0.9rem; }
.btn-lg { padding: 1em 2em; font-size: 1.1rem; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}
.nav.scrolled {
  background: rgba(14, 19, 48, 0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
  padding-top: 10px; padding-bottom: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--f-display); font-weight: 700; font-size: 1.35rem; }
.brand img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--rope); object-fit: cover; }
.nav-links { display: flex; gap: 28px; }
.nav-links a { text-decoration: none; font-size: 0.95rem; color: var(--muted); transition: color 0.2s; }
.nav-links a:hover { color: var(--cream); }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; overflow: hidden;
  padding: 110px var(--gutter) 80px;
}
.sky {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(1200px 500px at 70% 78%, rgba(183, 155, 196, 0.55), transparent 60%),
    linear-gradient(180deg, #141a3f 0%, #23306f 38%, #3e52a3 62%, #8c86b9 76%, #2a3670 77%, #18204a 100%);
}
.stars {
  position: absolute; inset: 0 0 40% 0; opacity: 0.7;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent),
    radial-gradient(1px 1px at 28% 8%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 44% 26%, #fff, transparent),
    radial-gradient(1px 1px at 61% 12%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 79% 22%, #fff, transparent),
    radial-gradient(1px 1px at 90% 6%, #fff, transparent),
    radial-gradient(1px 1px at 6% 40%, #fff, transparent),
    radial-gradient(1px 1px at 52% 44%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 35% 52%, #fff, transparent);
  animation: twinkle 5s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.85; } }
.sea {
  position: absolute; left: 0; right: 0; bottom: 0; height: 23%;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 9px), linear-gradient(180deg, #2a3670, #121839);
}
.lanterns span {
  position: absolute; bottom: -60px; width: 16px; height: 22px; border-radius: 6px 6px 8px 8px;
  background: radial-gradient(circle at 50% 40%, #ffd98a, var(--gold) 45%, #c4682a 100%);
  box-shadow: 0 0 22px 6px rgba(233, 185, 95, 0.45);
  opacity: 0; animation: rise linear infinite;
}
.lanterns span:nth-child(1) { left: 6%;  animation-duration: 19s; animation-delay: 0s;  transform: scale(0.8); }
.lanterns span:nth-child(2) { left: 18%; animation-duration: 24s; animation-delay: 5s; }
.lanterns span:nth-child(3) { left: 31%; animation-duration: 21s; animation-delay: 11s; transform: scale(0.6); }
.lanterns span:nth-child(4) { left: 47%; animation-duration: 26s; animation-delay: 2s;  transform: scale(0.7); }
.lanterns span:nth-child(5) { left: 58%; animation-duration: 20s; animation-delay: 8s; }
.lanterns span:nth-child(6) { left: 69%; animation-duration: 23s; animation-delay: 14s; transform: scale(0.5); }
.lanterns span:nth-child(7) { left: 81%; animation-duration: 18s; animation-delay: 4s;  transform: scale(0.9); }
.lanterns span:nth-child(8) { left: 92%; animation-duration: 25s; animation-delay: 9s;  transform: scale(0.65); }
.lanterns span:nth-child(9) { left: 39%; animation-duration: 28s; animation-delay: 16s; transform: scale(0.45); }
@keyframes rise {
  0%   { opacity: 0; translate: 0 0; }
  10%  { opacity: 0.9; }
  85%  { opacity: 0.7; }
  100% { opacity: 0; translate: 30px -110vh; }
}

.hero-inner {
  position: relative; z-index: 1; width: 100%; max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(32px, 5vw, 72px); align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 18px;
  padding: 6px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 500;
  background: rgba(14, 19, 48, 0.45); border: 1px solid var(--line); color: var(--rope);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--jade); box-shadow: 0 0 0 0 rgba(95,213,155,0.7); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(95,213,155,0); } 100% { box-shadow: 0 0 0 0 rgba(95,213,155,0); } }

h1, h2, h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.02; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(3.4rem, 9vw, 7.2rem); text-shadow: 0 6px 40px rgba(14, 19, 48, 0.5); }
h1 em { font-style: italic; color: var(--gold); font-weight: 600; }
.ticker {
  margin: 10px 0 0; font-weight: 700; font-size: clamp(1.1rem, 2.2vw, 1.5rem); letter-spacing: 0.18em; color: var(--jade);
}
.lede { margin: 20px 0 32px; max-width: 32ch; font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: #e6e0f0; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-art { position: relative; display: grid; place-items: center; }
.hanzi {
  position: absolute; z-index: 0; font-family: var(--f-brush); line-height: 1;
  font-size: clamp(9rem, 22vw, 17rem); color: rgba(244, 236, 219, 0.1); white-space: nowrap;
  top: 50%; left: 50%; translate: -50% -55%; pointer-events: none; user-select: none;
}
.portrait {
  position: relative; z-index: 1; width: min(440px, 82vw); aspect-ratio: 4 / 5; padding: 0; cursor: pointer;
  border: 3px solid var(--rope); border-radius: 999px 999px 26px 26px; overflow: visible;
  background: var(--robe-dark);
  box-shadow: 0 0 0 10px rgba(236, 223, 194, 0.08), 0 30px 80px -20px rgba(0, 0, 0, 0.7), 0 0 90px -10px rgba(233, 185, 95, 0.35);
  transition: transform 0.4s ease;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; border-radius: inherit; }
.portrait.bow { animation: bow 0.9s ease; }
@keyframes bow { 0% { transform: rotate(0); } 35% { transform: rotate(-2deg) translateY(10px); } 100% { transform: rotate(0); } }
.bubble {
  position: absolute; top: 8%; right: -6%; z-index: 2;
  padding: 10px 16px; border-radius: 16px 16px 16px 4px;
  background: var(--cream); color: var(--robe-dark); font-family: var(--f-brush); font-size: 1.6rem; line-height: 1.1;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  opacity: 0; transform: translateY(8px) scale(0.9); transition: opacity 0.25s ease, transform 0.25s ease; pointer-events: none;
}
.portrait.talking .bubble { opacity: 1; transform: none; }
.hint { position: relative; z-index: 1; margin: 16px 0 0; font-size: 0.8rem; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(236,223,194,0.6); }

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden; background: var(--robe); color: var(--rope);
  border-top: 2px solid var(--robe-dark); border-bottom: 2px solid var(--robe-dark);
  transform: rotate(-1.2deg); margin: -18px -10px 0; position: relative; z-index: 2;
}
.marquee-track { display: flex; width: max-content; animation: marquee 38s linear infinite; }
.marquee span {
  padding: 14px 26px; white-space: nowrap; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.95rem;
  display: flex; align-items: center; gap: 26px;
}
.marquee span::after { content: "✦"; color: var(--gold); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding: clamp(80px, 11vw, 140px) var(--gutter); max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; }
.section-head { text-align: center; margin-bottom: clamp(40px, 6vw, 64px); }
.kicker { margin: 0 0 12px; color: var(--gold); font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; font-size: 0.8rem; }
h2 { font-size: clamp(2.4rem, 5.5vw, 4rem); }
.sub { margin: 16px auto 0; max-width: 52ch; color: var(--muted); }

/* Legend */
.legend-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: clamp(32px, 5vw, 64px); align-items: start; }
.legend-art { margin: 0; position: sticky; top: 100px; }
.legend-art img { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: 0 30px 70px -25px rgba(0,0,0,0.8); aspect-ratio: 4 / 5; object-fit: cover; object-position: 70% 50%; width: 100%; }
.legend-art figcaption { margin-top: 12px; font-family: var(--f-display); font-style: italic; color: var(--muted); font-size: 1.05rem; }
.legend-text p { margin: 0 0 1.3em; font-size: 1.08rem; color: #ddd8ea; }
.legend-text strong { color: var(--cream); }
.legend-text em { font-family: var(--f-display); font-size: 1.15em; color: var(--rope); }
.dropcap::first-letter {
  float: left; font-family: var(--f-display); font-weight: 700; font-size: 4.6em; line-height: 0.8; padding: 0.06em 0.1em 0 0; color: var(--gold);
}
.jade { color: var(--jade); font-weight: 700; }
.closing { font-family: var(--f-display); font-size: 1.45rem !important; line-height: 1.4; color: var(--cream) !important; border-left: 3px solid var(--gold); padding-left: 20px; }

/* Scrolls */
.scrolls { max-width: calc(1320px + 2 * var(--gutter)); }
.scroll-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(18px, 2.4vw, 28px); }
.scroll-card {
  display: flex; flex-direction: column; text-align: left; padding: 0; cursor: pointer; overflow: hidden;
  background: linear-gradient(180deg, #1a2150, #141a3f); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}
.scroll-card:hover { transform: translateY(-6px); border-color: rgba(233,185,95,0.5); box-shadow: 0 28px 60px -24px rgba(0,0,0,0.85); }
.scroll-img { display: block; overflow: hidden; aspect-ratio: 16 / 9; }
.scroll-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s ease; }
.scroll-card:hover .scroll-img img { transform: scale(1.05); }
.scroll-meta { display: flex; gap: 18px; align-items: flex-start; padding: 20px 22px 24px; }
.scroll-num {
  flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px;
  background: var(--robe); color: var(--rope); font-family: var(--f-brush); font-size: 1.8rem; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(236,223,194,0.25);
}
.scroll-words { display: flex; flex-direction: column; gap: 4px; }
.scroll-title { font-family: var(--f-display); font-weight: 700; font-size: 1.55rem; line-height: 1.15; }
.scroll-text { color: var(--muted); font-size: 0.98rem; }

/* Teachings */
.teachings { max-width: calc(1080px + 2 * var(--gutter)); }
.sayings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.sayings blockquote {
  position: relative; margin: 0; padding: 30px 26px 28px; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(160deg, rgba(123,63,34,0.55), rgba(75,38,21,0.35)); border: 1px solid rgba(236,223,194,0.16);
}
.sayings .glyph { position: absolute; right: 14px; top: 2px; font-family: var(--f-brush); font-size: 4.4rem; line-height: 1; color: rgba(236,223,194,0.12); }
.sayings p { position: relative; margin: 0; font-family: var(--f-display); font-style: italic; font-weight: 600; font-size: 1.5rem; line-height: 1.3; }
.sayings p::before { content: "“"; color: var(--gold); }
.sayings p::after { content: "”"; color: var(--gold); }

/* Token */
.token { max-width: calc(1000px + 2 * var(--gutter)); }
.token-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat {
  display: flex; flex-direction: column; gap: 6px; padding: 24px; border-radius: var(--radius);
  background: rgba(28, 36, 87, 0.6); border: 1px solid var(--line);
}
.stat .label { font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.stat .value { font-family: var(--f-display); font-weight: 700; font-size: 1.7rem; line-height: 1.15; }

/* Buy */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: s; }
.steps li { position: relative; padding: 28px 24px; border-radius: var(--radius); background: rgba(20, 26, 63, 0.9); border: 1px solid var(--line); }
.steps li:not(:last-child)::after {
  content: ""; position: absolute; top: 50px; right: -18px; width: 18px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--rope) 0 4px, transparent 4px 7px); opacity: 0.6;
}
.step-num { font-family: var(--f-display); font-weight: 700; font-size: 2.6rem; color: var(--jade); line-height: 1; }
.steps h3 { font-size: 1.6rem; margin: 12px 0 8px; }
.steps p { margin: 0; color: var(--muted); font-size: 0.98rem; }
.steps strong { color: var(--cream); }

/* Final CTA */
.final { position: relative; overflow: hidden; display: grid; place-items: center; min-height: 80vh; padding: 100px var(--gutter); text-align: center; }
.final-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 40% 40%; }
.final::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, var(--ink) 0%, rgba(14,19,48,0.35) 30%, rgba(14,19,48,0.55) 70%, var(--ink) 100%); }
.final-inner { position: relative; z-index: 2; max-width: 680px; }
@media (min-width: 861px) {
  .final { place-items: center end; text-align: right; padding-right: clamp(40px, 8vw, 140px); }
  .final-bg { object-position: 20% 40%; }
  .final::before { background: linear-gradient(180deg, var(--ink) 0%, transparent 25%, transparent 75%, var(--ink) 100%), linear-gradient(90deg, transparent 35%, rgba(14,19,48,0.75) 75%); }
  .final-inner { max-width: 520px; }
}
.final-hanzi { margin: 0; font-family: var(--f-brush); font-size: clamp(5rem, 14vw, 9rem); line-height: 1; color: var(--cream); text-shadow: 0 0 40px rgba(233,185,95,0.6); }
.final h2 { margin-top: 10px; text-shadow: 0 4px 30px rgba(0,0,0,0.6); }
.final p:not(.final-hanzi) { margin: 14px 0 30px; font-size: 1.15rem; color: #ece6f3; text-shadow: 0 2px 16px rgba(0,0,0,0.7); }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 48px var(--gutter) 40px; max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; display: grid; gap: 18px; }
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand img { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--rope); }
.footer-brand strong { display: block; font-family: var(--f-display); font-size: 1.4rem; }
.footer-brand span { color: var(--muted); font-size: 0.9rem; }
.disclaimer { margin: 0; max-width: 80ch; color: #8f8ca8; font-size: 0.86rem; }
.copy { margin: 0; color: #6f6d88; font-size: 0.82rem; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 24px 16px; background: rgba(8, 10, 26, 0.94); backdrop-filter: blur(6px);
}
.lightbox[hidden] { display: none; }
.lb-figure { margin: 0; max-width: min(1200px, 100%); display: flex; flex-direction: column; gap: 14px; }
.lb-figure img { max-height: 76vh; width: auto; margin: 0 auto; border-radius: 14px; border: 1px solid var(--line); }
.lb-figure figcaption { display: flex; flex-direction: column; gap: 2px; text-align: center; }
.lb-num { color: var(--gold); font-size: 0.8rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700; }
.lb-figure strong { font-family: var(--f-display); font-size: 1.8rem; }
.lb-figure figcaption span:last-child { color: var(--muted); }
.lb-close, .lb-nav {
  flex: none; display: grid; place-items: center; cursor: pointer; border-radius: 50%;
  background: rgba(236,223,194,0.08); border: 1px solid var(--line); transition: background 0.2s;
}
.lb-close:hover, .lb-nav:hover { background: rgba(236,223,194,0.18); }
.lb-close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; font-size: 1.8rem; line-height: 1; }
.lb-nav { width: 52px; height: 52px; font-size: 2rem; line-height: 1; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
  .steps li::after { display: none; }
  .sayings { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .nav-links { display: none; }
  .hero { padding-top: 100px; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-copy { order: 2; }
  .hero-art { order: 1; }
  .lede { margin-left: auto; margin-right: auto; }
  .cta-row { justify-content: center; }
  .portrait { width: min(320px, 72vw); }
  .bubble { right: -2%; font-size: 1.3rem; }
  .legend-grid { grid-template-columns: 1fr; }
  .legend-art { position: static; }
  .legend-art img { aspect-ratio: 16 / 9; object-position: 50% 50%; }
  .scroll-grid { grid-template-columns: 1fr; }
  .token-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .brand span { display: none; }
  .steps, .sayings, .token-grid { grid-template-columns: 1fr; }
  .stat .value { font-size: 1.45rem; }
  .lb-nav { position: absolute; bottom: 18px; }
  .lb-prev { left: calc(50% - 64px); }
  .lb-next { right: calc(50% - 64px); }
  .lightbox { padding-bottom: 90px; }
  .scroll-title { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
