/* SkoolNext Books — one memorable thing (the 3D book), everything else quiet. */
:root {
  --ink: #0a1020;
  --night: #121a2e;
  --night-2: #1a2440;
  --paper: #f4f6fb;
  --card: #ffffff;
  --line: #dde3ee;
  --text: #334155;
  --heading: #0f172a;
  --muted: #64748b;
  --accent: #38bdf8;
  --accent-ink: #075985;
  --indigo: #818cf8;
  --ok: #15803d;
  --warn: #b45309;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 400 16px/1.6 Inter, system-ui, sans-serif; color: var(--text); background: var(--paper); overflow-x: hidden; }
h1, h2, h3 { font-family: "Space Grotesk", Inter, sans-serif; color: var(--heading); line-height: 1.08; margin: 0 0 .45em; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
a { color: var(--accent-ink); }
img { max-width: 100%; display: block; }
code, pre, kbd { font-family: "JetBrains Mono", ui-monospace, monospace; }
code { font-size: .9em; background: #e8eef8; color: var(--heading); padding: .1em .35em; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar { position: absolute; inset: 0 0 auto 0; z-index: 10; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { color: #fff; text-decoration: none; font: 700 18px "Space Grotesk", sans-serif; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), var(--indigo)); display: grid; place-items: center; color: var(--ink); font-size: 14px; }
.brand span.dim { color: #9fb2d4; font-weight: 500; }
.topnav a { color: #c7d2e6; text-decoration: none; font-size: 15px; font-weight: 500; }
.topnav a:hover { color: #fff; }
body.light-top .topbar { position: static; background: var(--ink); }

/* ---------- buttons ---------- */
.btn { --b: var(--accent); display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 14px; font: 700 16px Inter, sans-serif; padding: 15px 24px; cursor: pointer; text-decoration: none; position: relative; isolation: isolate; transition: transform .15s ease, box-shadow .2s ease, background .2s ease; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--b); color: var(--ink); box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--b) 70%, transparent); }
.btn-primary:hover { box-shadow: 0 14px 36px -10px color-mix(in srgb, var(--b) 90%, transparent); }
.btn-primary::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%) var(--b); background-size: 250% 100%; background-position: 130% 0; transition: background-position .7s ease; }
.btn-primary:hover::after { background-position: -30% 0; }
.btn-lg { font-size: 18px; padding: 18px 30px; width: 100%; max-width: 420px; }
.btn-ghost { background: transparent; color: var(--accent-ink); border: 1.5px solid var(--line); }
.btn-ghost.on-dark { color: #e2e8f0; border-color: #33415a; }
.btn[disabled] { opacity: .65; cursor: progress; }

/* ---------- dark hero shell ---------- */
.hero { position: relative; background: var(--ink); color: #c7d2e6; overflow: hidden; padding: 96px 0 72px; }
.hero::before { content: ""; position: absolute; inset: -20% -10% auto auto; width: 70vmax; height: 70vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 28%, transparent), transparent 70%); pointer-events: none; }
.hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(to bottom, #000 30%, transparent 95%); pointer-events: none; }
.hero .wrap { position: relative; z-index: 1; }
.hero h1 { color: #fff; }

/* ---------- the 3D book ---------- */
.book3d-stage { perspective: 1400px; display: grid; place-items: center; }
.book3d { --w: 260px; --d: 26px; --rx: 6deg; --ry: -24deg; width: var(--w); aspect-ratio: 875 / 1240; position: relative; transform-style: preserve-3d; transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .5s cubic-bezier(.2,.7,.2,1); will-change: transform; }
.book3d.tracking { transition: transform .12s linear; }
.book3d > * { position: absolute; inset: 0; backface-visibility: hidden; }
.book3d .front { transform: translateZ(calc(var(--d) / 2)); border-radius: 3px 8px 8px 3px; overflow: hidden; box-shadow: inset 6px 0 10px -6px rgba(0,0,0,.6); }
.book3d .front img { width: 100%; height: 100%; object-fit: cover; }
.book3d .front::after { content: ""; position: absolute; inset: 0; background: linear-gradient(calc(110deg + var(--ry) * 2), transparent 30%, rgba(255,255,255,.22) 48%, transparent 62%); mix-blend-mode: screen; pointer-events: none; }
.book3d .back { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); background: var(--night); border-radius: 8px 3px 3px 8px; }
.book3d .spine { width: var(--d); left: calc(var(--d) / -2); transform: rotateY(-90deg); background: linear-gradient(90deg, #070c19, #16213f 50%, #0b1328); display: grid; place-items: center; }
.book3d .spine span { writing-mode: vertical-rl; transform: rotate(180deg); font: 700 10px "Space Grotesk", sans-serif; color: #9fb2d4; letter-spacing: .08em; white-space: nowrap; }
.book3d .pages { width: calc(var(--d) - 4px); left: auto; right: calc((var(--d) - 4px) / -2); top: 4px; bottom: 4px; transform: rotateY(90deg) translateZ(-2px); background: repeating-linear-gradient(90deg, #f8fafc 0 1px, #dfe5ee 1px 2px); }
.book3d-shadow { width: 72%; height: 26px; margin-top: 28px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.55), transparent); filter: blur(4px); transform: translateX(8%); }
@keyframes book-in { from { opacity: 0; transform: translateY(40px) rotateX(18deg) rotateY(-60deg); } to { opacity: 1; } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.book3d.intro { animation: book-in 1.1s cubic-bezier(.2,.8,.2,1) both; }
.book3d-float { animation: float 6s ease-in-out infinite; animation-delay: 1.2s; }

/* ---------- store home ---------- */
.store-hero { padding-bottom: 120px; }
.store-hero .wrap { display: grid; gap: 40px; align-items: center; }
.store-hero h1 { font-size: clamp(40px, 9vw, 76px); max-width: 12ch; }
.store-hero p.lead { font-size: 18px; max-width: 42ch; color: #b8c5dc; }
.shelf { position: relative; margin-top: -80px; z-index: 2; }
.shelf-grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.book-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px 22px 22px; display: flex; flex-direction: column; text-decoration: none; color: inherit; position: relative; overflow: hidden; transition: transform .25s ease, box-shadow .25s ease; }
.book-card:hover { transform: translateY(-4px); box-shadow: 0 30px 60px -30px rgba(15,23,42,.45); }
.book-card .cover-zone { background: var(--ink); border-radius: var(--r-md); padding: 26px 0 8px; margin-bottom: 18px; }
.book-card .book3d { --w: 140px; --d: 16px; --ry: -28deg; }
.book-card:hover .book3d { --ry: -12deg; --rx: 4deg; }
.book-card .book3d-shadow { margin-top: 14px; height: 16px; }
.book-card h2 { font-size: 22px; margin-bottom: 4px; }
.book-card .tagline { color: var(--muted); font-size: 15px; margin-bottom: 14px; }
.book-card .row { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.book-card .price { font: 700 22px "Space Grotesk", sans-serif; color: var(--heading); }
.book-card .go { font-weight: 600; color: var(--accent-ink); }
.book-card.soon { border-style: dashed; background: #eef2f8; justify-content: center; text-align: center; min-height: 320px; }
.book-card.soon .ghost-book { width: 90px; height: 128px; border-radius: 4px 8px 8px 4px; margin: 0 auto 18px; border: 2px dashed #b6c2d6; }
.store-why { padding: 72px 0 8px; }
.store-why .grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 18px; }
.store-why .item { padding: 4px 0; }
.store-why .item h3 { font-size: 19px; margin-bottom: 4px; }
.store-why .item p { margin: 0; color: var(--muted); font-size: 15px; }
@media (min-width: 900px) { .store-hero .wrap { grid-template-columns: 1.1fr .9fr; } }

/* ---------- book page hero ---------- */
.book-hero .wrap { display: grid; gap: 36px; align-items: center; }
.book-hero h1 { font-size: clamp(40px, 9.5vw, 72px); margin-bottom: 16px; max-width: 11ch; }
.book-hero .lead { font-size: 18px; color: #b8c5dc; max-width: 36ch; margin-bottom: 26px; }
.price-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.price-row .price { font: 700 44px "Space Grotesk", sans-serif; color: #fff; letter-spacing: -.02em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; }
.chips li { font-size: 14px; color: #d6e0f0; border: 1px solid #2a3654; background: rgba(18,26,46,.6); border-radius: 999px; padding: 6px 12px; }
.hero-copy > * { animation: rise .7s ease both; }
.hero-copy > *:nth-child(2) { animation-delay: .08s; } .hero-copy > *:nth-child(3) { animation-delay: .16s; }
.hero-copy > *:nth-child(4) { animation-delay: .24s; } .hero-copy > *:nth-child(5) { animation-delay: .32s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (min-width: 900px) { .book-hero .wrap { grid-template-columns: 1.15fr .85fr; } .book-hero .book3d { --w: 300px; --d: 30px; } }

/* ---------- puzzle / console ---------- */
.puzzle { position: relative; z-index: 2; margin-top: -40px; }
.puzzle .wrap { max-width: 820px; }
.terminal { background: var(--night); border-radius: var(--r-lg); box-shadow: 0 40px 80px -40px rgba(10,16,32,.8); overflow: hidden; border: 1px solid #22304f; }
.terminal-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; background: #0e1527; border-bottom: 1px solid #1f2b47; }
.terminal-bar i { width: 11px; height: 11px; border-radius: 50%; background: #2a3654; }
.terminal-bar i:nth-child(1) { background: #f87171; } .terminal-bar i:nth-child(2) { background: #fbbf24; } .terminal-bar i:nth-child(3) { background: #34d399; }
.terminal-bar span { margin-left: 8px; color: #8394b5; font: 500 13px "JetBrains Mono", monospace; }
.terminal-body { padding: 20px 20px 22px; color: #dbe4f3; }
.terminal-body h2 { color: #fff; font-size: 22px; }
.terminal-body > p { color: #9fb2d4; }
.terminal pre { margin: 0 0 18px; font-size: clamp(12px, 3.3vw, 15px); line-height: 1.75; white-space: pre-wrap; min-height: 8.8em; }
.terminal pre .k { color: #f9a8d4; } .terminal pre .s { color: #86efac; } .terminal pre .f { color: #93c5fd; }
.caret { display: inline-block; width: .55em; height: 1.1em; vertical-align: -0.2em; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.console { border-top: 1px dashed #2a3654; margin-top: 4px; padding-top: 14px; font: 500 15px "JetBrains Mono", monospace; }
.console .out { display: flex; gap: 10px; opacity: 0; transform: translateX(-6px); transition: opacity .25s ease, transform .25s ease; }
.console .out b { color: var(--accent); font-weight: 600; }
.console .out.show { opacity: 1; transform: none; }
.console .why { font-family: Inter, sans-serif; font-size: 15px; color: #b8c5dc; margin: 12px 0 0; opacity: 0; transition: opacity .4s ease .1s; }
.console .why.show { opacity: 1; }
.terminal .btn-ghost { color: #e2e8f0; border-color: #33415a; }

/* ---------- sections ---------- */
.section { padding: 80px 0 0; }
.section .wrap { max-width: 980px; }
.section h2 { font-size: clamp(30px, 6vw, 44px); max-width: 18ch; }
.section .intro { font-size: 17px; max-width: 60ch; }

/* preview carousel */
.previews { margin-top: 26px; }
.preview-track { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 20px 26px; margin: 0 -20px; scrollbar-width: none; }
.preview-track::-webkit-scrollbar { display: none; }
.preview { flex: 0 0 min(72vw, 300px); scroll-snap-align: center; margin: 0; }
.preview img { border-radius: 8px; border: 1px solid var(--line); box-shadow: 0 24px 40px -28px rgba(15,23,42,.55); background: #fff; transition: transform .3s ease; }
.preview:hover img { transform: translateY(-4px) rotate(-.5deg); }
.preview figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; }
.preview-dots { display: flex; justify-content: center; gap: 8px; }
.preview-dots button { width: 8px; height: 8px; border-radius: 99px; border: 0; padding: 0; background: #c7d2e2; cursor: pointer; transition: width .25s ease, background .25s ease; }
.preview-dots button.on { width: 24px; background: var(--accent-ink); }

/* parts: a real sequence, so numbered */
.parts { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 0; counter-reset: part; border-left: 2px solid var(--line); }
.parts li { counter-increment: part; position: relative; padding: 0 0 26px 34px; }
.parts li::before { content: counter(part); position: absolute; left: -17px; top: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--accent); font: 700 15px/32px "Space Grotesk", sans-serif; text-align: center; box-shadow: 0 0 0 5px var(--paper); }
.parts h3 { font-size: 20px; margin: 0 0 4px; }
.parts p { margin: 0; color: var(--muted); }
.parts .count { font-size: 14px; color: var(--accent-ink); font-weight: 600; }

.who-grid { display: grid; gap: 14px; margin-top: 22px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.who-grid div { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 20px; font-weight: 500; color: var(--heading); }
.author { display: flex; gap: 18px; align-items: flex-start; margin-top: 18px; }
.avatar { flex: 0 0 60px; height: 60px; border-radius: 18px; background: var(--ink); color: var(--accent); display: grid; place-items: center; font: 700 24px "Space Grotesk", sans-serif; }
details { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 20px; margin: 10px 0; }
summary { cursor: pointer; font-weight: 600; color: var(--heading); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font: 500 22px/1 Inter, sans-serif; color: var(--muted); transition: transform .2s ease; }
details[open] summary::after { transform: rotate(45deg); }
details p { margin: 10px 0 0; }
.final-cta { margin: 90px 0 0; background: var(--ink); color: #c7d2e6; padding: 60px 0; text-align: center; position: relative; overflow: hidden; }
.final-cta h2 { color: #fff; font-size: clamp(30px, 6vw, 44px); margin: 0 auto 10px; max-width: 20ch; }
.final-cta .btn-lg { margin-top: 18px; }

/* reveal on scroll (only where it helps) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- sticky buy bar (mobile) ---------- */
.sticky { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); background: rgba(10,16,32,.94); backdrop-filter: blur(10px); padding: 10px 10px 10px 18px; border-radius: 18px; border: 1px solid #22304f; display: flex; align-items: center; gap: 12px; transform: translateY(140%); transition: transform .3s cubic-bezier(.2,.8,.2,1); z-index: 20; }
.sticky.show { transform: none; }
.sticky .p { color: #fff; font: 700 21px "Space Grotesk", sans-serif; line-height: 1.1; }
.sticky .p small { display: block; color: #8fa1c1; font: 400 12px Inter, sans-serif; }
.sticky .btn { flex: 1; padding: 14px 18px; }
@media (min-width: 900px) { .sticky { display: none; } }
body.has-sticky { padding-bottom: 90px; }

/* ---------- buy sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(2,6,23,.62); opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 40; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 24px 24px 0 0; padding: 26px 20px calc(22px + env(safe-area-inset-bottom)); z-index: 41; transform: translateY(105%); transition: transform .28s cubic-bezier(.2,.8,.2,1); max-width: 520px; margin: 0 auto; }
.sheet.open { transform: none; }
.sheet::before { content: ""; position: absolute; top: 9px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: #d5dce8; }
@media (min-width: 640px) {
  .sheet { bottom: auto; top: 50%; border-radius: 24px; transform: translateY(-46%) scale(.97); opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
  .sheet.open { transform: translateY(-50%); opacity: 1; pointer-events: auto; }
  .sheet::before { display: none; }
}
.sheet h2 { font-size: 24px; margin-bottom: 4px; }
.sheet .line { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; color: var(--heading); }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 14px; font-weight: 600; color: var(--heading); margin-bottom: 6px; }
.field input { width: 100%; font: 400 17px Inter, sans-serif; padding: 14px 15px; border: 1.5px solid var(--line); border-radius: 12px; color: var(--heading); background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.field input:focus { border-color: var(--accent-ink); outline: none; box-shadow: 0 0 0 4px #bae6fd; }
.field input[aria-invalid="true"] { border-color: var(--warn); }
.field small { color: var(--muted); font-size: 13px; }
.form-error { color: var(--warn); font-size: 14px; min-height: 1.3em; margin: 0 0 10px; }
.sheet .btn-lg { max-width: none; }
.sheet .close { position: absolute; right: 10px; top: 10px; background: none; border: 0; font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer; padding: 6px 10px; }
.secure { text-align: center; font-size: 13px; color: var(--muted); margin: 12px 0 0; }

/* ---------- status + policy ---------- */
.status { min-height: 62vh; display: grid; place-items: center; padding: 48px 20px; }
.status-card { background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 34px 24px; max-width: 520px; width: 100%; text-align: center; box-shadow: 0 30px 60px -40px rgba(15,23,42,.45); }
.status-card section { animation: rise .35s ease both; }
.status-card .btn-lg { margin: 12px auto 16px; }
.status-icon { width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; font: 700 30px "Space Grotesk", sans-serif; }
.status-icon.ok { background: #dcfce7; color: var(--ok); }
.status-icon.ok svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s ease .15s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.status-icon.bad { background: #fef3c7; color: var(--warn); }
.status-icon.wait { background: #e0f2fe; }
.spinner { width: 30px; height: 30px; border: 3px solid #bae6fd; border-top-color: var(--accent-ink); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.order-id { margin: 8px 0 0; }
.policy-body { max-width: 720px; margin: 0 auto; padding: 40px 20px 10px; }
.policy-body h1 { font-size: 34px; }
.policy-body h2 { font-size: 20px; margin-top: 1.6em; }

.foot { margin-top: 0; padding: 30px 20px 40px; text-align: center; font-size: 14px; color: var(--muted); }
.final-cta + .foot, .section + .foot { margin-top: 70px; border-top: 1px solid var(--line); }
.foot nav { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.foot a { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .console .out, .console .why { opacity: 1; transform: none; }
}

/* fixes after review */
.terminal code { background: #1f2b47; color: #e2e8f0; }
@media (max-width: 899px) { .store-hero .book3d-stage { display: none; } .store-hero { padding-bottom: 110px; } }
