/* Scrollbible site. Palette from the app (ios/Scrollbible/DesignSystem/Theme.swift); system fonts only, so no page
   loads anything from a third party. Tokens first, then layout, components, pages. */

:root {
  --bg: #F7F2E6;
  --bg-raised: #FFFDF8;
  --bg-sunken: #EFE7D4;
  --line: #E2D8C2;
  --line-strong: #D4C9B1;
  --text: #1F1B17;
  --text-2: #5C5349;          /* 6.6:1 on --bg */
  --accent: #7A5B26;          /* gold, 5.6:1 on --bg: links and small text */
  --accent-soft: #EBDDC1;
  --btn-bg: #2A2425;
  --btn-text: #F7F2E6;
  --btn-bg-hover: #3A3334;
  --ring: #8A6A33;
  --glow: rgba(201, 168, 102, .35);
  --shadow: 0 1px 2px rgba(60, 45, 25, .06), 0 8px 24px rgba(60, 45, 25, .08);
  --shadow-lg: 0 2px 6px rgba(60, 45, 25, .08), 0 24px 60px rgba(60, 45, 25, .18);
  --header-bg: rgba(247, 242, 230, .78);

  --serif: "New York", ui-serif, "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 20px;
  --radius-sm: 12px;
  --max: 1120px;
  --prose: 680px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121011;
    --bg-raised: #1C1A1B;
    --bg-sunken: #171415;
    --line: #2E2A2B;
    --line-strong: #3A3536;
    --text: #F2EAD3;
    --text-2: #B3ABA0;
    --accent: #E9DDB5;
    --accent-soft: #2A2420;
    --btn-bg: #E9DDB5;
    --btn-text: #1C1A1B;
    --btn-bg-hover: #F4EBCF;
    --ring: #E9DDB5;
    --glow: rgba(201, 168, 102, .22);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .35), 0 24px 60px rgba(0, 0, 0, .5);
    --header-bg: rgba(18, 16, 17, .72);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color .15s var(--ease); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent-soft); }

h1, h2, h3 { color: var(--text); text-wrap: balance; }
h1 { font: 600 clamp(36px, 6vw, 60px)/1.08 var(--serif); letter-spacing: -.02em; margin: 0 0 16px; }
h2 { font: 600 clamp(26px, 3.4vw, 34px)/1.2 var(--serif); letter-spacing: -.01em; margin: 0 0 12px; }
h3 { font-size: 18px; line-height: 1.35; margin: 0 0 6px; }
p { margin: 0 0 16px; text-wrap: pretty; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--btn-bg); color: var(--btn-text); padding: 10px 16px; border-radius: 10px; text-decoration: none;
}
.skip:focus { top: 12px; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 14px;
}
.lead { font-size: clamp(18px, 2vw, 21px); color: var(--text-2); line-height: 1.55; }
.muted { color: var(--text-2); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -.01em;
}
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.nav { display: flex; gap: 4px; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px;
  color: var(--text-2); text-decoration: none; font-size: 15px; font-weight: 500;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.nav a:hover { color: var(--text); background: var(--bg-sunken); }
.nav a[aria-current="page"] { color: var(--text); background: var(--bg-sunken); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px; border-radius: 999px; border: 1px solid transparent;
  font: 600 16px/1 var(--sans); text-decoration: none; cursor: pointer;
  transition: transform .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--btn-bg); color: var(--btn-text); box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--btn-bg-hover); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-sunken); text-decoration: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn[aria-disabled="true"] { cursor: default; }

/* ---------- home: hero ---------- */
.hero { position: relative; overflow: hidden; padding: 72px 0 96px; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto auto; width: 720px; height: 720px; z-index: -1;
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
  pointer-events: none;
}
.hero .container { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero-icon { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow); margin-bottom: 28px; }
.hero .lead { max-width: 30em; margin-bottom: 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-note { font-size: 14px; color: var(--text-2); margin: 16px 0 0; }

/* phone mock: a verse card as the app shows it */
.phone {
  position: relative; justify-self: center;
  width: min(320px, 82vw); aspect-ratio: 9 / 19.5;
  border-radius: 48px; padding: 12px;
  background: #0E0C0D; box-shadow: var(--shadow-lg), inset 0 0 0 2px #2A2627;
}
.phone-screen {
  position: relative; height: 100%; border-radius: 38px; overflow: hidden;
  background: radial-gradient(120% 70% at 50% 0%, #3A3029 0%, #1C1A1B 55%, #121011 100%);
  color: #F2EAD3; display: flex; flex-direction: column; padding: 56px 26px 28px;
}
.phone-screen::before {
  content: ""; position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 96px; height: 28px; border-radius: 20px; background: #0E0C0D;
}
.phone-chip {
  align-self: flex-start; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  padding: 6px 12px; border-radius: 999px; background: rgba(233, 221, 181, .12); color: #E9DDB5;
}
.phone-body { margin: auto 0; }
.phone-verse { margin: 0; font: 400 23px/1.45 var(--serif); letter-spacing: -.005em; }
.phone-ref { font-size: 14px; color: #A39C93; margin: 14px 0 0; }
.phone-actions { display: flex; justify-content: center; gap: 14px; }
.phone-actions span {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(242, 234, 211, .08); border: 1px solid rgba(242, 234, 211, .12);
}
.phone-actions svg { width: 20px; height: 20px; stroke: #F2EAD3; }

/* ---------- home: sections ---------- */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-sunken); border-block: 1px solid var(--line); }
.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head.center { margin-inline: auto; text-align: center; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; list-style: none; padding: 0; margin: 0; }
.card {
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
}
.feature .icon {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 18px;
}
.feature .icon svg { width: 24px; height: 24px; }
.feature p { color: var(--text-2); margin: 0; font-size: 16px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line-strong); font: 600 17px/1 var(--serif); color: var(--accent); margin-bottom: 16px;
}
.steps p { color: var(--text-2); margin: 0; }

.translations { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.translations .card { padding: 24px 28px; }
.translations .lang { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.translations h3 { font: 600 21px/1.3 var(--serif); margin: 6px 0 4px; }
.translations p { margin: 0; color: var(--text-2); font-size: 15px; }

.cta { text-align: center; }
.cta .card { padding: 56px 32px; background: radial-gradient(90% 120% at 50% 0%, var(--glow), transparent 70%), var(--bg-raised); }
.cta .lead { max-width: 34em; margin: 0 auto 28px; }

/* ---------- document pages (privacy, terms, support) ---------- */
.doc-hero { padding: 64px 0 40px; border-bottom: 1px solid var(--line); }
.doc-hero h1 { font-size: clamp(34px, 5vw, 48px); }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--text-2); font-size: 15px; margin: 0; }
.doc-meta span { display: inline-flex; align-items: center; gap: 6px; }
.doc-meta svg { width: 16px; height: 16px; }

.doc { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 64px; padding: 48px 24px 96px; }
.toc { position: sticky; top: 96px; align-self: start; font-size: 14px; }
.toc p { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a {
  display: block; padding: 7px 0 7px 16px; margin-left: -1px; border-left: 2px solid transparent;
  color: var(--text-2); text-decoration: none; line-height: 1.35;
}
.toc a:hover { color: var(--text); border-left-color: var(--line-strong); }
.toc a.active { color: var(--text); border-left-color: var(--accent); font-weight: 600; }

.prose { max-width: var(--prose); }
.prose section { padding-top: 8px; margin-bottom: 40px; }
.prose h2 { font-size: clamp(24px, 3vw, 28px); margin-bottom: 14px; }
.prose h3 { margin-top: 24px; }
.prose ul { padding-left: 22px; margin: 0 0 16px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--accent); }

.summary { margin-bottom: 48px; }
.summary h2 { font: 600 13px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.checklist li { display: grid; grid-template-columns: 24px 1fr; gap: 12px; margin: 0; }
.checklist svg { width: 22px; height: 22px; color: var(--accent); margin-top: 2px; }

/* table → cards on small screens */
.table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 8px 0 16px; }
.table th, .table td { text-align: left; vertical-align: top; padding: 14px 12px; border-bottom: 1px solid var(--line); }
.table th { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.table td:first-child { font-weight: 600; }

.callout {
  display: grid; grid-template-columns: 24px 1fr; gap: 14px;
  background: var(--accent-soft); border-radius: var(--radius-sm); padding: 18px 20px; margin: 0 0 20px;
}
.callout svg { width: 22px; height: 22px; color: var(--accent); margin-top: 2px; }
.callout p { margin: 0; }

.to-top {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  font-size: 15px; color: var(--text-2); text-decoration: none;
}
.to-top svg { width: 16px; height: 16px; }

/* ---------- support ---------- */
.contact-card { display: flex; flex-wrap: wrap; gap: 20px 32px; align-items: center; justify-content: space-between; margin-bottom: 56px; }
.contact-card > div { flex: 1 1 360px; }
.contact-card h2 { font-size: 24px; margin-bottom: 6px; }
.contact-card p { margin: 0; color: var(--text-2); }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; list-style: none; padding: 0; margin: 0 0 56px; }
.quick a {
  display: flex; flex-direction: column; gap: 10px; height: 100%;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 20px; color: var(--text); text-decoration: none;
  transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.quick a:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.quick svg { width: 24px; height: 24px; color: var(--accent); }
.quick b { font-size: 16px; }
.quick span { font-size: 14px; color: var(--text-2); line-height: 1.45; }

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; padding: 14px 0; font-weight: 600; font-size: 17px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--accent); }
.faq summary svg { width: 20px; height: 20px; flex: none; color: var(--text-2); transition: transform .2s var(--ease); }
.faq details[open] summary svg { transform: rotate(180deg); }
.faq .answer { padding: 0 0 20px; color: var(--text-2); max-width: var(--prose); }
.faq .answer p:last-child { margin-bottom: 0; }

/* ---------- 404 ---------- */
.notfound { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 80px 24px; }
.notfound .code { font: 600 96px/1 var(--serif); color: var(--accent); opacity: .5; margin-bottom: 8px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0 48px; font-size: 15px; color: var(--text-2); }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-footer a { color: var(--text-2); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .45s var(--ease), transform .45s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero { padding: 48px 0 72px; }
  .hero .container { grid-template-columns: 1fr; gap: 56px; text-align: center; }
  .hero .lead { margin-inline: auto; }
  .hero-icon { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .features, .translations, .quick { grid-template-columns: 1fr 1fr; }
  .doc { grid-template-columns: 1fr; gap: 0; padding-top: 32px; }
  .toc { position: static; margin-bottom: 40px; padding: 20px; background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-sm); }
  .toc ol { columns: 2; column-gap: 24px; border-left: 0; }
  .toc a { padding-left: 0; border-left: 0; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .container { padding: 0 20px; }
  .section { padding: 72px 0; }
  .features, .translations, .quick, .steps { grid-template-columns: 1fr; }
  .nav a { padding: 0 10px; font-size: 14px; }
  .brand span { display: none; }
  .doc { padding: 28px 20px 72px; }
  .toc ol { columns: 1; }
  .toc a { padding: 5px 0; }
  .card { padding: 24px; }
  .cta .card { padding: 40px 24px; }
  .contact-card .btn { width: 100%; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: 2px 0; }
  .table td::before { content: attr(data-label) " · "; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
  .table td:first-child::before { content: none; }
}
