/* ==========================================================
   SOOC — Interactive Fiction App website
   ========================================================== */

:root {
  --bg: #f6f1e9;
  --bg-elev: #fffaf2;
  --bg-sunken: #ede5d8;
  --ink: #1d1a17;
  --ink-soft: #5b534a;
  --ink-faint: #8c8277;
  --line: rgba(29, 26, 23, 0.12);
  --accent: #b4532a;
  --accent-ink: #fffaf2;
  --accent-soft: rgba(180, 83, 42, 0.1);
  --gold: #c99a3b;
  --night: #15131a;
  --night-elev: #1f1c26;
  --night-ink: #efe8dc;
  --night-soft: #a99f92;
  --shadow: 0 30px 60px -30px rgba(40, 25, 10, 0.35);
  --radius: 18px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --max: 1160px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121016;
    --bg-elev: #1b1820;
    --bg-sunken: #0d0b10;
    --ink: #efe8dc;
    --ink-soft: #b5aa9c;
    --ink-faint: #7f766c;
    --line: rgba(239, 232, 220, 0.12);
    --accent: #e0814f;
    --accent-ink: #1a1208;
    --accent-soft: rgba(224, 129, 79, 0.14);
    --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121016;
  --bg-elev: #1b1820;
  --bg-sunken: #0d0b10;
  --ink: #efe8dc;
  --ink-soft: #b5aa9c;
  --ink-faint: #7f766c;
  --line: rgba(239, 232, 220, 0.12);
  --accent: #e0814f;
  --accent-ink: #1a1208;
  --accent-soft: rgba(224, 129, 79, 0.14);
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.3; margin: 0; }
p { margin: 0; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .container { padding: 0 16px; } }

.skip-link {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 8px; z-index: 100;
}
.skip-link:focus { left: 8px; }

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

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 24px; }

.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-weight: 900; font-size: 22px; letter-spacing: .12em; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center;
}
.logo-mark svg { width: 18px; height: 18px; }

.nav-links { display: flex; align-items: center; gap: 30px; list-style: none; margin: 0; padding: 0; }
.nav-links a { text-decoration: none; font-size: 15px; color: var(--ink-soft); transition: color .15s; }
.nav-links a:hover { color: var(--ink); }

.nav-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  display: inline-grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

@media (max-width: 860px) {
  .menu-btn { display: inline-grid; }
  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 12px 4px; font-size: 16px; border-bottom: 1px solid var(--line); }
  .nav-links li:last-child a { border-bottom: 0; }
  .nav-actions .btn { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 46px; padding: 0 22px; border-radius: 999px;
  font: 600 15px/1 var(--sans); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: transform .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-faint); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 14px; }

.store-btn {
  display: inline-flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 22px 0 18px; border-radius: 14px;
  background: var(--ink); color: var(--bg); text-decoration: none;
  transition: transform .15s;
}
.store-btn:hover { transform: translateY(-2px); }
.store-btn svg { width: 26px; height: 26px; flex: none; }
.store-btn small { display: block; font-size: 11px; opacity: .7; line-height: 1.2; }
.store-btn strong { display: block; font-size: 17px; line-height: 1.25; font-weight: 600; }
.store-btn.alt { background: transparent; color: var(--ink); border: 1px solid var(--line); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 72px 0 96px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto auto; width: 720px; height: 720px;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.hero-grid { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; }
.hero h1 { font-size: clamp(40px, 6vw, 72px); letter-spacing: -.02em; margin: 20px 0 22px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { font-size: 18px; color: var(--ink-soft); max-width: 30em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hero-note { margin-top: 18px; font-size: 13px; color: var(--ink-faint); }

@media (max-width: 920px) {
  .hero { padding: 40px 0 72px; }
  .hero-grid { grid-template-columns: 1fr; gap: 56px; }
}

/* ---------- Phone mockup (interactive demo) ---------- */
.phone-wrap { display: flex; justify-content: center; }
.phone {
  position: relative; width: 320px; max-width: 100%; aspect-ratio: 9 / 19;
  border-radius: 46px; padding: 12px;
  background: #0b0a0d;
  box-shadow: var(--shadow), inset 0 0 0 2px #2a2730;
}
.phone::before {
  content: ""; position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  width: 92px; height: 26px; border-radius: 20px; background: #0b0a0d; z-index: 3;
}
.screen {
  position: relative; height: 100%; border-radius: 36px; overflow: hidden;
  background:
    radial-gradient(120% 60% at 50% 0%, #3a2a33 0%, transparent 60%),
    linear-gradient(180deg, #1c1820 0%, #121016 100%);
  color: var(--night-ink);
  display: flex; flex-direction: column;
  padding: 58px 20px 22px;
  font-family: var(--serif);
}
.screen-top { display: flex; justify-content: space-between; align-items: center; font-family: var(--sans); font-size: 11px; color: var(--night-soft); letter-spacing: .08em; }
.screen-progress { height: 2px; background: rgba(255,255,255,.1); border-radius: 2px; margin: 12px 0 22px; overflow: hidden; }
.screen-progress span { display: block; height: 100%; width: 20%; background: #e0814f; transition: width .5s ease; }
.screen-chapter { font-size: 12px; color: #e0a57f; letter-spacing: .2em; margin-bottom: 8px; font-family: var(--sans); }
.screen-title { font-size: 20px; margin-bottom: 16px; }
.screen-text { font-size: 14.5px; line-height: 1.9; color: #ddd3c5; flex: 1; transition: opacity .3s; }
.screen-text p + p { margin-top: 10px; }
.screen-text .speaker { color: #e0a57f; }
.choices { display: grid; gap: 10px; margin-top: 16px; font-family: var(--sans); }
.choice {
  width: 100%; text-align: left; cursor: pointer;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(255,255,255,.06); color: #f3ece1;
  border: 1px solid rgba(255,255,255,.12);
  font: 500 13.5px/1.45 var(--sans);
  transition: background .15s, border-color .15s, transform .15s;
  display: flex; gap: 10px; align-items: flex-start;
}
.choice:hover { background: rgba(224,129,79,.16); border-color: rgba(224,129,79,.5); }
.choice:active { transform: scale(.98); }
.choice .k { flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; background: rgba(255,255,255,.1); color: #e0a57f; }
.choice.restart { justify-content: center; text-align: center; color: #e0a57f; }
.fade { opacity: 0; }
.demo-hint { text-align: center; margin-top: 18px; font-size: 13px; color: var(--ink-faint); }

/* ---------- Sections ---------- */
section { scroll-margin-top: 80px; }
.section { padding: 104px 0; }
.section-sunken { background: var(--bg-sunken); }
.section-head { max-width: 640px; margin-bottom: 56px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head h2 { font-size: clamp(30px, 4vw, 44px); margin: 14px 0 16px; }
.section-head p { color: var(--ink-soft); font-size: 17px; }
@media (max-width: 600px) { .section { padding: 72px 0; } .section-head { margin-bottom: 40px; } }

/* Features */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.feature {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 24px;
}
.feature-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 20px;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature h3 { font-size: 19px; margin-bottom: 10px; }
.feature p { color: var(--ink-soft); font-size: 15px; }
@media (max-width: 980px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }

/* Branch / how it works */
.branch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 52px 1fr; gap: 18px; counter-increment: step; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--serif); font-size: 26px; font-weight: 900; color: var(--accent); line-height: 1.2;
}
.steps h3 { font-size: 20px; margin-bottom: 6px; }
.steps p { color: var(--ink-soft); }
.branch-art { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.branch-art svg { width: 100%; height: auto; }
.branch-art .node { fill: var(--bg); stroke: var(--ink-faint); stroke-width: 1.5; }
.branch-art .node.hot { fill: var(--accent); stroke: var(--accent); }
.branch-art .edge { stroke: var(--line); stroke-width: 2; fill: none; }
.branch-art .edge.hot { stroke: var(--accent); }
.branch-art text { font-family: var(--sans); font-size: 12px; fill: var(--ink-soft); }
.branch-art text.end { fill: var(--ink); font-weight: 600; }
.branch-caption { margin-top: 14px; font-size: 13px; color: var(--ink-faint); text-align: center; }
@media (max-width: 920px) { .branch-grid { grid-template-columns: 1fr; gap: 48px; } }

/* Genres */
.genres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.genre {
  position: relative; overflow: hidden; border-radius: var(--radius);
  min-height: 200px; padding: 26px; color: #f6efe4;
  display: flex; flex-direction: column; justify-content: flex-end;
  isolation: isolate;
}
.genre::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 20%, rgba(0,0,0,.55)); }
.genre .glyph { position: absolute; top: 8px; right: 20px; font-family: var(--serif); font-style: italic; font-size: 104px; line-height: 1; opacity: .16; font-weight: 900; }
.genre h3 { font-size: 22px; margin-bottom: 4px; }
.genre p { font-size: 14px; opacity: .85; }
.g-mystery { background: linear-gradient(135deg, #2b3440, #151a21); }
.g-ancient { background: linear-gradient(135deg, #8a3b2a, #4a1d16); }
.g-romance { background: linear-gradient(135deg, #b3566b, #5e2433); }
.g-scifi { background: linear-gradient(135deg, #2f4f6b, #121f2e); }
.g-fantasy { background: linear-gradient(135deg, #4d6a3c, #1f2e18); }
.g-horror { background: linear-gradient(135deg, #3a2b3e, #120d14); }
@media (max-width: 860px) { .genres { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .genres { grid-template-columns: 1fr; } .genre { min-height: 160px; } }

/* Creator band */
.creator { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center;
  background: var(--night); color: var(--night-ink); border-radius: 28px; padding: 56px; overflow: hidden; position: relative; }
.creator::before { content: ""; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; background: radial-gradient(closest-side, rgba(224,129,79,.28), transparent); }
.creator h2 { font-size: clamp(28px, 3.6vw, 40px); margin: 14px 0 16px; }
.creator p { color: var(--night-soft); }
.creator .eyebrow { color: #e0a57f; }
.creator ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; position: relative; }
.creator li { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); }
.creator li svg { width: 20px; height: 20px; color: #e0a57f; flex: none; margin-top: 3px; }
.creator li strong { display: block; font-weight: 600; }
.creator li span { font-size: 14px; color: var(--night-soft); }
@media (max-width: 860px) { .creator { grid-template-columns: 1fr; padding: 36px 22px; border-radius: 22px; } }

/* FAQ */
.faq { max-width: 780px; margin: 0 auto; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; padding: 22px 0;
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  font-family: var(--serif); font-size: 18px; font-weight: 600;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--sans); font-size: 24px; font-weight: 300; color: var(--accent); transition: transform .2s; flex: none; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 22px; color: var(--ink-soft); }

/* CTA */
.cta { text-align: center; }
.cta h2 { font-size: clamp(32px, 5vw, 56px); margin-bottom: 18px; }
.cta p { color: var(--ink-soft); font-size: 17px; margin-bottom: 36px; }
.cta .hero-cta { justify-content: center; margin-top: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 56px 0 40px; font-size: 14px; color: var(--ink-soft); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
.footer-grid h4 { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: .08em; margin-bottom: 14px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-grid a { text-decoration: none; }
.footer-grid a:hover { color: var(--ink); }
.footer-brand p { margin-top: 14px; max-width: 22em; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-faint); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* Reveal */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0s !important; }
}

/* ==========================================================
   Legal pages
   ========================================================== */
.legal-hero { padding: 64px 0 40px; border-bottom: 1px solid var(--line); }
.legal-hero h1 { font-size: clamp(32px, 5vw, 48px); margin: 14px 0 14px; }
.legal-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; color: var(--ink-faint); font-size: 14px; }
.legal-layout { display: grid; grid-template-columns: 240px 1fr; gap: 64px; padding-top: 56px; padding-bottom: 96px; align-items: start; }
.toc { position: sticky; top: 92px; font-size: 14px; }
.toc h2 { font-family: var(--sans); font-size: 12px; letter-spacing: .14em; color: var(--ink-faint); font-weight: 600; margin-bottom: 14px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.toc a { display: block; padding: 6px 12px; border-left: 2px solid var(--line); text-decoration: none; color: var(--ink-soft); }
.toc a:hover, .toc a.active { color: var(--ink); border-left-color: var(--accent); }

.prose { max-width: 720px; min-width: 0; }
.prose .summary {
  background: var(--accent-soft); border-radius: 14px; padding: 20px 22px; margin-bottom: 40px;
  font-size: 15px;
}
.prose .summary strong { color: var(--accent); }
.prose h2 { font-size: 24px; margin: 48px 0 16px; padding-top: 8px; scroll-margin-top: 90px; }
.prose h2:first-of-type { margin-top: 0; }
.prose h3 { font-size: 18px; margin: 28px 0 10px; }
.prose p, .prose li { color: var(--ink-soft); }
.prose p + p { margin-top: 12px; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 12px 0; }
.prose li + li { margin-top: 6px; }
.prose strong { color: var(--ink); }
.prose a { color: var(--accent); }
.prose .table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
.prose th, .prose td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-soft); }
.prose th { background: var(--bg-sunken); color: var(--ink); font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }
.ph { background: rgba(201, 154, 59, .22); color: var(--ink); padding: 0 4px; border-radius: 4px; }

@media (max-width: 900px) {
  .legal-layout { grid-template-columns: 1fr; gap: 32px; padding-top: 32px; }
  .toc { position: static; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
}

/* Name expansion under hero headline */
.name-line { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--ink-soft); margin: -6px 0 18px; letter-spacing: .01em; }
.name-line b { font-style: normal; font-weight: 900; color: var(--accent); }
.footer-brand strong { color: var(--ink); font-weight: 600; }
