:root {
  --paper: #f4ecd8;
  --paper-alt: #ede2c8;
  --ink: #2b241a;
  --ink-soft: #5a5140;
  --rule: #d8c9a3;
  --maroon: #7a2e2e;
  --maroon-dark: #5c2222;
  --gold: #a9822c;
  --card-bg: #faf5e8;
  --shadow: rgba(43, 36, 26, 0.12);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1c1712;
    --paper-alt: #221b14;
    --ink: #ece3cf;
    --ink-soft: #c9bd9f;
    --rule: #46392a;
    --maroon: #d98a6a;
    --maroon-dark: #e3a888;
    --gold: #d3a94a;
    --card-bg: #241d15;
    --shadow: rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  --paper: #1c1712;
  --paper-alt: #221b14;
  --ink: #ece3cf;
  --ink-soft: #c9bd9f;
  --rule: #46392a;
  --maroon: #d98a6a;
  --maroon-dark: #e3a888;
  --gold: #d3a94a;
  --card-bg: #241d15;
  --shadow: rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  color: var(--ink);
  margin: 0 0 0.5em;
  line-height: 1.15;
}

img { max-width: 100%; }
[hidden] { display: none !important; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding-inline: 24px;
}

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

/* Header */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 100;
  background: rgba(244, 236, 216, 0.9);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--rule);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header { background: rgba(28, 23, 18, 0.85); }
}
:root[data-theme="dark"] .site-header { background: rgba(28, 23, 18, 0.85); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-block: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.3rem;
  margin-right: auto;
}
.brand-mark { font-size: 1.3rem; }

.site-nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--maroon); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--maroon); color: #fbf3e2; }
.btn-primary:hover { background: var(--maroon-dark); }
.btn-secondary { background: transparent; color: var(--maroon); border-color: var(--maroon); }
.btn-secondary:hover { background: color-mix(in srgb, var(--maroon) 10%, transparent); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-ghost:hover { border-color: var(--ink-soft); }
.btn-small { padding: 8px 16px; font-size: 0.9rem; }
.btn-large { padding: 15px 28px; font-size: 1.05rem; }

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: 64px 40px;
  border-bottom: 1px solid var(--rule);
}
.hero-inner { position: relative; z-index: 2; max-width: 720px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 14px;
}
.hero h1 {
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  font-weight: 600;
}
.hero-sub {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 60ch;
}
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 26px; }
.hero-note { margin-top: 16px; font-size: 0.9rem; color: var(--ink-soft); }

.hero-art {
  position: absolute;
  right: -60px;
  top: 40px;
  width: 420px;
  height: 300px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  opacity: 0.55;
  transform: rotate(4deg);
}
.pane-mock {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 12px 24px var(--shadow);
}
@media (max-width: 900px) { .hero-art { display: none; } }

/* Stat strip */
.strip { background: var(--maroon); color: #fbf3e2; }
.strip-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: space-between;
  padding-block: 22px;
}
.strip-item { display: flex; flex-direction: column; min-width: 140px; }
.strip-item strong { font-family: 'Fraunces', serif; font-size: 1.6rem; }
.strip-item span { font-size: 0.85rem; opacity: 0.85; }

/* Sections */
.section { padding-block: 64px; }
.section-alt { background: var(--paper-alt); }
.section-title { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.section-lede { color: var(--ink-soft); max-width: 62ch; font-size: 1.05rem; margin-bottom: 36px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 860px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .feature-grid { grid-template-columns: 1fr; } }

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 22px;
}
.feature-card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.feature-card p { margin: 0; color: var(--ink-soft); font-size: 0.96rem; }
.feature-card-wide { grid-column: span 3; background: transparent; border-style: dashed; }
@media (max-width: 860px) { .feature-card-wide { grid-column: span 2; } }
@media (max-width: 560px) { .feature-card-wide { grid-column: span 1; } }

/* Download */
.download-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
@media (max-width: 700px) { .download-grid { grid-template-columns: 1fr; } }
.download-card {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 26px;
}
.download-card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
}
.tag {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--gold);
  color: #2b241a;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.download-card p { color: var(--ink-soft); margin-bottom: 18px; }

.notice {
  border-left: 3px solid var(--gold);
  background: var(--card-bg);
  padding: 16px 20px;
  border-radius: 6px;
  font-size: 0.92rem;
  color: var(--ink-soft);
  max-width: 74ch;
}
.notice strong { color: var(--ink); }

/* Support */
.support { background: var(--maroon); color: #fbf3e2; }
.support .section-title, .support p { color: #fbf3e2; }
.support-inner { max-width: 680px; }
.support .btn-primary { background: #fbf3e2; color: var(--maroon-dark); margin-top: 8px; }
.support .btn-primary:hover { background: #fff; }

/* Sources */
.source-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: grid;
  gap: 12px;
}
.source-list li {
  padding-left: 18px;
  border-left: 2px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.source-list strong { color: var(--ink); }
.section-footnote { font-size: 0.85rem; color: var(--ink-soft); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 28px calc(28px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.footer-inner p { margin: 4px 0; }
.footer-meta { font-size: 0.8rem; }

@media (max-width: 640px) {
  .site-nav { display: none; }
}
