/* FableForge marketing site v2 — 2026-07-29 */
:root {
  --bg: #050505;
  --bg-elevated: #0e0e10;
  --bg-card: rgba(18, 18, 22, 0.88);
  --bg-panel: rgba(12, 12, 16, 0.9);
  --ink: #f4f1ea;
  --ink-muted: #b4aea4;
  --ink-dim: #7a756c;
  --gold: #e8c547;
  --gold-soft: #c9a227;
  --accent: #ffeb3b;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(232, 197, 71, 0.38);
  --ok: #6dbf7a;
  --danger: #c45c5c;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  --radius: 14px;
  --max: 1120px;
  --font-display: "Cinzel Decorative", "Palatino Linotype", serif;
  --font-title: "Cinzel", "Palatino Linotype", serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --discord: #5865f2;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
.wrap { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }

/* Fixed rotating backgrounds */
.bg-rotator {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-rotator .bg-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.8s ease;
  transform: scale(1.04);
}
.bg-rotator .bg-slide.active { opacity: 1; }
.bg-rotator .bg-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5,5,5,0.72) 0%, rgba(5,5,5,0.82) 45%, rgba(5,5,5,0.94) 100%),
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(232,197,71,0.06), transparent 60%);
}

.site-shell { position: relative; z-index: 1; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(5, 5, 5, 0.82);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}
.brand img { width: 2.6rem; height: 2.6rem; object-fit: contain; }
.brand-text {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: center;
}
.nav a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.92rem;
}
.nav a:hover { color: var(--ink); }
.nav a.is-active { color: var(--gold); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.72rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-weight: 650;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  background: transparent;
  color: var(--ink);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(180deg, #f0d56a 0%, var(--gold-soft) 100%);
  color: #1a1405;
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 8px 24px rgba(201,162,39,0.25);
}
.btn-primary:hover { color: #0b0903; background: linear-gradient(180deg, #ffe28a 0%, #d4ad2d 100%); }
.btn-ghost {
  background: rgba(0,0,0,0.25);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-discord {
  background: var(--discord);
  color: #fff;
  border-color: transparent;
}
.btn-discord:hover { background: #4752c4; color: #fff; }
.btn-disabled, .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

/* Hero */
.hero {
  position: relative;
  min-height: clamp(30rem, 72vh, 42rem);
  display: grid;
  align-items: end;
  border-bottom: 1px solid var(--border);
}
.hero-content { padding: 5.5rem 0 3.5rem; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.eyebrow::before {
  content: "";
  width: 1.4rem;
  height: 1px;
  background: var(--gold);
}
.hero h1 {
  margin: 0 0 1rem;
  max-width: 15ch;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5.2vw, 3.7rem);
  line-height: 1.08;
  text-shadow: 0 8px 30px rgba(0,0,0,0.7);
}
.hero-lead {
  max-width: 38rem;
  color: var(--ink-muted);
  font-size: 1.12rem;
  margin: 0 0 1.5rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
  color: var(--ink-dim);
  font-size: 0.92rem;
}
.hero-meta strong { color: var(--ink-muted); font-weight: 600; }

/* Panels / sections */
section { padding: 3.75rem 0; }
.section-head { max-width: 42rem; margin-bottom: 2rem; }
.section-head h2 {
  margin: 0 0 0.7rem;
  font-family: var(--font-title);
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  letter-spacing: 0.02em;
}
.section-head p { margin: 0; color: var(--ink-muted); }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.panel + .panel { margin-top: 1rem; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.2rem 1.35rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-title);
  font-size: 1.1rem;
}
.card p { margin: 0; color: var(--ink-muted); font-size: 0.98rem; }
.card .num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 0.55rem;
}

/* Worlds gallery */
.worlds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.world-card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.world-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #111;
}
.world-card .caption {
  padding: 0.85rem 1rem 1rem;
}
.world-card h3 {
  margin: 0 0 0.45rem;
  font-family: var(--font-title);
  font-size: 1.05rem;
}
.world-card p,
.world-card .world-madlib {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.note {
  margin-top: 1.1rem;
  padding: 0.9rem 1.05rem;
  border-radius: 10px;
  background: rgba(255, 235, 59, 0.06);
  border: 1px solid rgba(232, 197, 71, 0.22);
  color: var(--ink-muted);
  font-size: 0.94rem;
}

/* Modes / pillars */
.mode {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 1.4rem;
  backdrop-filter: blur(8px);
}
.mode.featured {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px rgba(232,197,71,0.08), var(--shadow);
}
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ink-muted);
  margin-bottom: 0.8rem;
}
.mode.featured .badge {
  color: #1a1405;
  background: var(--gold);
  border-color: transparent;
}
.mode h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-title);
  font-size: 1.25rem;
}
.mode p { margin: 0 0 0.85rem; color: var(--ink-muted); }
.mode ul { margin: 0; padding-left: 1.1rem; color: var(--ink-muted); }
.mode li + li { margin-top: 0.3rem; }

.pillar {
  padding: 1.15rem 1.2rem;
  border-left: 3px solid var(--gold-soft);
  background: linear-gradient(90deg, rgba(232,197,71,0.07), transparent 60%);
  border-radius: 0 var(--radius) var(--radius) 0;
  backdrop-filter: blur(6px);
}
.pillar h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-title);
  font-size: 1.02rem;
}
.pillar p { margin: 0; color: var(--ink-muted); font-size: 0.96rem; }

/* Roadmap / steps */
.road-item, .loop-step {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem;
  align-items: start;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  margin-bottom: 0.75rem;
}
.road-item .status, .loop-step .step-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  padding-top: 0.2rem;
}
.status-now { color: var(--ok) !important; }
.status-next { color: var(--gold) !important; }
.status-later { color: var(--ink-dim) !important; }
.road-item h3, .loop-step h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-family: var(--font-title);
}
.road-item p, .loop-step p { margin: 0; color: var(--ink-muted); font-size: 0.95rem; }

/* CTA */
.cta { text-align: center; padding: 3.5rem 0 4.5rem; }
.cta-box {
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(ellipse 70% 80% at 50% 0%, rgba(232,197,71,0.1), transparent 55%),
    var(--bg-panel);
  padding: clamp(1.8rem, 4vw, 3rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.cta-box h2 {
  margin: 0 0 0.7rem;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
}
.cta-box p {
  margin: 0 auto 1.35rem;
  max-width: 36rem;
  color: var(--ink-muted);
}
.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}
.fineprint {
  margin-top: 1.1rem;
  color: var(--ink-dim);
  font-size: 0.88rem;
}

/* Engine page */
.engine-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.engine-toc a {
  text-decoration: none;
  font-size: 0.88rem;
  color: var(--ink-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(0,0,0,0.25);
}
.engine-toc a:hover { color: var(--gold); border-color: var(--border-strong); }
.engine-section {
  margin-bottom: 2rem;
}
.engine-section h2 {
  font-family: var(--font-title);
  font-size: 1.45rem;
  margin: 0 0 0.75rem;
}
.engine-section .body { color: var(--ink-muted); }
.engine-section .body p { margin: 0 0 0.75rem; }
.engine-section .body p:last-child { margin-bottom: 0; }
.engine-section .body ul { margin: 0.4rem 0 0.8rem; padding-left: 1.2rem; }
.engine-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 1.25rem;
  align-items: start;
}
.side-art {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.side-art img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
}
.side-art figcaption {
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  color: var(--ink-dim);
  background: var(--bg-card);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0 2.5rem;
  color: var(--ink-dim);
  font-size: 0.9rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}
.site-footer a { color: var(--ink-muted); text-decoration: none; }
.site-footer a:hover { color: var(--gold); }

.draft-ribbon {
  position: fixed;
  top: 5.2rem;
  right: -2.4rem;
  z-index: 50;
  transform: rotate(35deg);
  background: var(--gold);
  color: #1a1405;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.4rem 3rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  pointer-events: none;
}

/* Editor chrome */
.editor-toolbar {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 100;
  display: none;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border-radius: 999px;
  background: rgba(12, 12, 16, 0.95);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}
.editor-toolbar.visible { display: flex; }
.editor-toolbar button {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #1a1a20;
  color: var(--ink);
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}
.editor-toolbar button.primary {
  background: var(--gold);
  color: #1a1405;
  border-color: transparent;
}
.editor-toolbar button:disabled { opacity: 0.45; cursor: not-allowed; }
.editor-toolbar .status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
  min-width: 5rem;
  padding: 0 0.35rem;
}
body.edit-mode [data-edit-key] {
  outline: 1px dashed rgba(232, 197, 71, 0.55);
  outline-offset: 3px;
  min-height: 1em;
  cursor: text;
}
body.edit-mode [data-edit-key]:focus {
  outline: 2px solid var(--gold);
  background: rgba(232, 197, 71, 0.06);
}
.editor-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.72);
}
.editor-modal.visible { display: flex; }
.editor-modal .box {
  width: min(92vw, 380px);
  background: #121216;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 1.35rem;
  box-shadow: var(--shadow);
}
.editor-modal h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-title);
}
.editor-modal p { margin: 0 0 0.9rem; color: var(--ink-muted); font-size: 0.95rem; }
.editor-modal input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0a0a0c;
  color: var(--ink);
  font: inherit;
  margin-bottom: 0.85rem;
}
.editor-modal .row {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Demo page extras live mostly in demos/dm.css */

@media (max-width: 900px) {
  .grid-3, .grid-2, .worlds-grid, .engine-layout { grid-template-columns: 1fr; }
  .road-item, .loop-step { grid-template-columns: 1fr; gap: 0.35rem; }
  .hero h1 { max-width: 16ch; }
}
@media (max-width: 640px) {
  .nav a:not(.btn) { display: none; }
  .wrap { width: min(100% - 1.5rem, var(--max)); }
  .hero-content { padding-top: 4rem; }
  .draft-ribbon { top: 4.6rem; font-size: 0.65rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover { transform: none; }
  .bg-rotator .bg-slide { transition: none; }
}
