/*
 * Codex design system. Dark only.
 *
 * The palette is the apps' own — 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. Body text sits above AppTheme.silverMuted
 * for readability on the web.
 */

:root {
  color-scheme: dark;

  --bg: #0a0a0d;             /* AppTheme.black */
  --surface: #141417;        /* AppTheme.rowBlack */
  --surface-sunk: #2c2c2e;
  --text: #dbdee3;           /* AppTheme.silver */
  --text-muted: #dbdee3;
  --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 over the header. */
.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: 26px 24px 50px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.app-category {
  position: relative;
  margin-bottom: 12px;
  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: 10px;
  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-icon {
  position: relative;
  display: block;
  width: 84px;
  height: 84px;
  margin: 0 auto 14px;
  border-radius: 19px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* ── App toolbar: stores + resources, one container under the header ── */
.app-toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  max-width: max(36.6rem, 80vw);
  margin: -32px auto 0;
  padding: 16px 20px;
  border: 1px solid var(--accent-bright);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.store-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent-bright);
  color: #0a0a0d;
  font: 700 13px/1 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.store-btn:hover { opacity: 0.85; }
.store-btn:active { transform: scale(0.97); }
.store-btn svg { width: 16px; height: 16px; fill: currentColor; }

.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

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

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

/* ── Story: one screenshot per section, text beside it ──
   Narrow screens float the shot and wrap text around it; wide screens turn
   each row into an alternating image/text grid. */
.story { margin-bottom: 46px; }

.story-row::after { content: ''; display: block; clear: both; }
.story-row + .story-row { margin-top: 2rem; }

.story .shot { width: min(40%, 10.3rem); }
.story .shot.right { float: right; margin: 4px 0 20px 28px; }
.story .shot.left  { float: left;  margin: 4px 28px 20px 0; }

/* The shot carries its own border; a rule under the heading would cross it. */
.story h2 { border-bottom: 0; padding-bottom: 0; }

@media (min-width: 861px) {
  .story-row {
    display: grid;
    grid-template-columns: minmax(11rem, 14rem) 1fr;
    gap: 0 3rem;
    align-items: center;
  }
  .story-row + .story-row { margin-top: 3rem; }
  .story-row .shot { float: none; width: auto; margin: 0; }
  .story-row.media-right { grid-template-columns: 1fr minmax(11rem, 14rem); }
  .story-row.media-right .shot { order: 2; }
}

.shot { text-align: center; }

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-sunk);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.shot figcaption {
  margin-top: 8px;
  color: var(--text-muted);
  font: 600 10px/1.4 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Layout ── */
.container {
  max-width: max(36.6rem, 80vw);
  margin: 0 auto;
  padding: 36px 24px 80px;
}

section { margin-bottom: 46px; }

.lead {
  max-width: 58rem;
  margin-bottom: 36px;
  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 {
  max-width: 58rem;
  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(20rem, 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: 36px;
}

.spec {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 3px;
  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;
  max-width: 58rem;
  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 40px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  text-align: right;
}

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: 22px 20px 46px; }
  .container { padding: 30px 20px 80px; }
  .app-toolbar { margin: -28px 16px 0; padding: 14px 16px; }
  .story .shot { width: 46%; }
  .story .shot.right { margin: 4px 0 14px 16px; }
  .story .shot.left  { margin: 4px 16px 14px 0; }
  .privacy-box { padding: 24px; }
}

/* ── Links are pills: silver border, gold text ──
   Site-wide, above the per-page inline rules (hence the specificity), except
   the floating nav and the store buttons, which have their own shape. Links
   inside running text get a tighter pill so the line height holds. */
body a:not(.site-nav a):not(.store-btn),
body a:not(.site-nav a):not(.store-btn):visited {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border: 1px solid rgba(219, 222, 227, 0.55);
  border-radius: 999px;
  color: var(--accent);
  font: 600 15px/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}
body a:not(.site-nav a):not(.store-btn):hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  opacity: 1;
}
body p a:not(.site-nav a):not(.store-btn),
body li a:not(.site-nav a):not(.store-btn) {
  padding: 1px 10px;
  font-size: 0.85em;
  vertical-align: baseline;
}
.app-links, footer, .footer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
