/*
 * Codex design system.
 *
 * Dark mode is the apps' own palette — the values below are the sRGB of the AppTheme
 * constants in Codex Books and Codex IPO, so the site and the apps are the same colours
 * rather than an approximation. Light mode keeps the gold accent but darkens it: #dbb84a
 * scores about 1.9:1 on white, nowhere near readable, so text-weight gold gets its own
 * deeper token while the bright gold stays for fills, borders and rules.
 *
 * Tokens are named by role, not by colour, because each one has to mean something in both
 * schemes.
 */

:root {
  color-scheme: light dark;

  --bg: #faf9f7;
  --surface: #ffffff;
  --surface-sunk: #f2efe9;
  --text: #1a1a1d;
  --text-muted: #55555c;
  --accent: #7a5e12;         /* gold, at text contrast */
  --accent-bright: #b8912c;  /* gold for fills, rules and borders */
  --accent-dim: rgba(184, 145, 44, 0.14);
  --border: #dcd7cf;
  --shadow: 0 24px 60px rgba(26, 26, 29, 0.10);
  --grain-opacity: 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0d;             /* AppTheme.black */
    --surface: #141417;        /* AppTheme.rowBlack */
    --surface-sunk: #2c2c2e;
    --text: #dbdee3;           /* AppTheme.silver */
    --text-muted: #bdbfc7;     /* AppTheme.silverMuted */
    --accent: #dbb84a;         /* AppTheme.gold */
    --accent-bright: #dbb84a;
    --accent-dim: rgba(219, 184, 74, 0.18);
    --border: #36363a;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    --grain-opacity: 0.35;
  }
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Cormorant Garamond', Georgia, serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* Fine grain, dark mode only — it reads as dirt on a light ground. */
.grain::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: var(--grain-opacity);
  pointer-events: none;
}

/* ── Header ── */
header {
  position: relative;
  overflow: hidden;
  padding: 64px 24px 52px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.app-category {
  position: relative;
  margin-bottom: 20px;
  color: var(--accent);
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

header h1 {
  position: relative;
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: clamp(1.75rem, 6vw, 2.625rem);
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

header .tagline {
  position: relative;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 1.05rem;
  font-style: italic;
  letter-spacing: 0.05em;
}

header .rule {
  position: relative;
  width: 90px;
  height: 1px;
  margin: 26px auto 0;
  background: linear-gradient(to right, transparent, var(--accent-bright), transparent);
}

.app-links {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
  margin-top: 24px;
}

.app-links a {
  color: var(--text-muted);
  font: 600 11px/1 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.app-links a:hover { color: var(--accent); }

/* ── Layout ── */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 60px 24px 120px;
}

section { margin-bottom: 46px; }

.lead {
  margin-bottom: 52px;
  padding: 20px 26px;
  border-left: 3px solid var(--accent-bright);
  background: var(--surface);
  color: var(--text);
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.7;
}

h2 {
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

p {
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

p strong { color: var(--text); font-weight: 600; }

/* ── Feature grid ── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  margin-bottom: 46px;
  border: 1px solid var(--border);
  background: var(--border);
}

.feature {
  padding: 26px 24px;
  background: var(--surface);
}

.feature-icon {
  display: block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 1.35rem;
  line-height: 1;
}

.feature h3 {
  margin-bottom: 8px;
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.feature p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

/* ── Platform / spec strip ── */
.specs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 46px;
}

.spec {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font: 600 11px/1.6 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.spec.accent {
  border-color: var(--accent-bright);
  background: var(--accent-dim);
  color: var(--accent);
}

/* ── Definition rows ── */
.rows {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.rows .row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.rows .row:last-child { border-bottom: 0; }

.rows .row dt {
  min-width: 150px;
  color: var(--accent);
  font: 600 0.95rem/1.6 system-ui, -apple-system, sans-serif;
}

.rows .row dd {
  flex: 1;
  min-width: 220px;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ── Privacy callout ── */
.privacy-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 52px;
  padding: 30px 34px;
  border: 1px solid var(--accent-bright);
  border-radius: 12px;
  background: var(--surface);
}

.privacy-box .privacy-text {
  flex: 1;
  min-width: 200px;
  color: var(--text-muted);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.6;
}

.privacy-box .privacy-text strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.privacy-box a.policy-link {
  padding-bottom: 2px;
  border-bottom: 1px solid var(--accent-bright);
  color: var(--accent);
  font-size: 1.05rem;
  font-style: italic;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.25s;
}

.privacy-box a.policy-link:hover { opacity: 0.72; }

/* ── Footer ── */
footer {
  padding: 30px 24px 96px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  text-align: center;
}

footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

.container a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.container a:hover { opacity: 0.75; }

@media (max-width: 560px) {
  header { padding: 52px 20px 42px; }
  .container { padding: 44px 20px 110px; }
  .privacy-box { padding: 24px; }
}
