/* PlotFable website — one stylesheet, no build step. */

:root {
  --navy: #141B3D;
  --navy-2: #1E2752;
  --orange: #E0832F;
  --amber: #FFB547;
  --paper: #FBF8F3;
  --surface: #FFFFFF;
  --ink: #1C2033;
  --muted: #5E6478;
  --line: rgba(20, 27, 61, 0.12);
  --accent: var(--orange);
  --accent-ink: #B35F14;
  --shadow: 0 24px 60px -24px rgba(20, 27, 61, 0.45), 0 2px 6px rgba(20, 27, 61, 0.08);
  --radius: 14px;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;

  /* The app's link colours, for the story devices. */
  --link-plain: #8A8FA3;
  --link-clue: #2FA7B5;
  --link-herring: #E0832F;
  --link-irony: #B05CC8;
  --plot-point: #141B3D;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E1330;
    --surface: #161C40;
    --ink: #EEF0F8;
    --muted: #A3A9C2;
    --line: rgba(238, 240, 248, 0.12);
    --accent: var(--amber);
    --accent-ink: var(--amber);
    --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.3);
    --link-plain: #9DA3BA;
    --plot-point: #FFD166;
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-ink); }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(2.3rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
h3 { font-size: 1.3rem; }
p { margin: 0; }

.eyebrow {
  display: inline-block;
  font: 600 0.78rem/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 14px;
}

kbd {
  font: 600 0.8em var(--mono);
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 600 1.25rem var(--serif); }
.brand img { width: 30px; height: 30px; }
.site-footer .brand img { width: 24px; height: 24px; }
.site-nav { display: flex; gap: 22px; margin-left: auto; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.site-nav a:hover { color: var(--ink); }

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border: 0;
  white-space: nowrap;
}
.button:hover { background: #CC7426; }
.button.small { padding: 8px 16px; font-size: 0.9rem; }
.button.ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 1.5px currentColor; }
.button.ghost:hover { background: rgba(255, 255, 255, 0.08); }
.button svg { width: 18px; height: 18px; }

@media (max-width: 860px) {
  .site-nav { display: none; }
  .site-header .button { margin-left: auto; }
}

/* Hero */

.hero {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(224, 131, 47, 0.28), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 88px 0 0;
  overflow: hidden;
}
.hero .wrap { text-align: center; }
.hero h1 { max-width: 15ch; margin-inline: auto; }
.hero h1 em { font-style: normal; color: var(--amber); }
.hero .lede { max-width: 40rem; margin: 22px auto 0; font-size: 1.2rem; color: rgba(255, 255, 255, 0.82); }
.hero .actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 34px; }
.hero .note { margin-top: 14px; font-size: 0.9rem; color: rgba(255, 255, 255, 0.6); }
.hero-shot {
  margin: 64px auto -1px;
  width: min(1120px, 100% - 40px);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -10px 80px -10px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 0;
}
.hero-shot img { width: 100%; }

/* Sections */

section { padding: 104px 0; }
section + section { border-top: 1px solid var(--line); }
.section-head { max-width: 46rem; margin-bottom: 56px; }
.section-head p { margin-top: 16px; font-size: 1.12rem; color: var(--muted); }
.center { text-align: center; margin-inline: auto; }

/* The idea */

.ideas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.idea { padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.idea .num { font: 600 2rem var(--serif); color: var(--accent); }
.idea h3 { margin: 10px 0 10px; }
.idea p { color: var(--muted); }
@media (max-width: 860px) { .ideas { grid-template-columns: 1fr; } }

/* Views */

.view { display: grid; grid-template-columns: 5fr 7fr; gap: 56px; align-items: center; }
.view + .view { margin-top: 96px; }
.view:nth-child(even) { grid-template-columns: 7fr 5fr; }
.view:nth-child(even) .view-text { order: 2; }
.view-text h3 { font-size: 1.7rem; margin-bottom: 14px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.view-text p { color: var(--muted); }
.view-text ul { margin: 18px 0 0; padding: 0; list-style: none; }
.view-text li { padding: 6px 0 6px 26px; position: relative; }
.view-text li::before {
  content: "";
  position: absolute; left: 4px; top: 15px;
  width: 9px; height: 9px;
  background: var(--plot-point);
  transform: rotate(45deg);
}
.shot { border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); background: var(--surface); }
@media (max-width: 860px) {
  .view, .view:nth-child(even) { grid-template-columns: 1fr; gap: 28px; }
  .view:nth-child(even) .view-text { order: 0; }
}

/* Structures */

.structures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.structure { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 8px; }
.structure .author { color: var(--muted); font-size: 0.9rem; }
.structure .best { margin-top: auto; padding-top: 10px; font-size: 0.88rem; color: var(--accent-ink); font-weight: 500; }
.stages { display: flex; gap: 3px; margin: 6px 0 2px; }
.stages span { height: 6px; border-radius: 3px; background: var(--line); flex: 1; }
.stages span.pp { background: var(--plot-point); }
@media (max-width: 1000px) { .structures { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .structures { grid-template-columns: 1fr; } }
.split { display: grid; grid-template-columns: 6fr 5fr; gap: 56px; align-items: center; margin-top: 72px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 28px; } }

/* Story devices */

.devices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.device { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.device h3 { font-size: 1.15rem; margin-bottom: 8px; }
.device p { color: var(--muted); font-size: 0.95rem; }
.device .sample { display: flex; align-items: center; gap: 0; margin-bottom: 16px; height: 22px; }
.device .sample .card { width: 34px; height: 22px; border-radius: 5px; border: 1.5px solid var(--line); background: var(--paper); flex: none; }
.device .sample .line { flex: 1; height: 0; border-top: 2px solid var(--link-plain); margin: 0 -1px; position: relative; }
.device .sample .line::after {
  content: ""; position: absolute; right: -2px; top: -6px;
  border-left: 9px solid var(--c, var(--link-plain));
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.line.plain { --c: var(--link-plain); }
.line.dotted { border-top-style: dotted !important; --c: var(--link-plain); }
.line.clue { border-top-color: var(--link-clue) !important; --c: var(--link-clue); }
.line.herring { border-top: 2px dashed var(--link-herring) !important; --c: var(--link-herring); }
.line.irony { border-top-color: var(--link-irony) !important; --c: var(--link-irony); }
.line.callback { border-top: 2px dashed var(--link-plain) !important; --c: var(--link-plain); }
.device .mark { font: 700 0.8rem var(--sans); color: var(--orange); margin-bottom: 14px; height: 22px; display: flex; align-items: center; gap: 8px; }
.device .mark .badge { width: 18px; height: 18px; border-radius: 50%; background: var(--orange); color: #fff; display: inline-grid; place-items: center; font-size: 0.75rem; }
@media (max-width: 900px) { .devices { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .devices { grid-template-columns: 1fr; } }

/* Writers */

.formats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.formats span { padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 500; font-size: 0.95rem; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 56px; }
.fact h3 { font-size: 1.15rem; margin-bottom: 8px; }
.fact p { color: var(--muted); }
@media (max-width: 860px) { .facts { grid-template-columns: 1fr; } }

/* Privacy band */

.band {
  background: var(--navy);
  color: #fff;
  border-top: 0 !important;
}
.band .section-head p { color: rgba(255, 255, 255, 0.75); }
.band .eyebrow { color: var(--amber); }
.promises { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.promise { border-top: 2px solid var(--amber); padding-top: 18px; }
.promise h3 { font-size: 1.2rem; margin-bottom: 8px; }
.promise p { color: rgba(255, 255, 255, 0.75); }
@media (max-width: 860px) { .promises { grid-template-columns: 1fr; } }

/* Download */

.download { text-align: center; }
.download img.icon { width: 128px; height: 128px; margin: 0 auto 28px; filter: drop-shadow(0 18px 30px rgba(20, 27, 61, 0.3)); }
.download p { color: var(--muted); max-width: 34rem; margin: 16px auto 0; }
.download .actions { margin-top: 30px; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.download .button.ghost { color: var(--ink); }

/* FAQ */

.faq { max-width: 46rem; margin-inline: auto; }
.faq details { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; gap: 20px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 1.4rem/1 var(--sans); color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin-top: 12px; color: var(--muted); }

/* Footer */

.site-footer { border-top: 1px solid var(--line); padding: 44px 0; font-size: 0.92rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 32px; }
.site-footer nav { display: flex; gap: 22px; flex-wrap: wrap; margin-left: auto; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* Plain pages (privacy, support) */

.page { padding: 72px 0 104px; }
.page .wrap { max-width: 46rem; }
.page h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 10px; }
.page .updated { color: var(--muted); margin-bottom: 40px; }
.page h2 { font-size: 1.45rem; margin: 40px 0 12px; }
.page p, .page li { color: var(--ink); }
.page p + p { margin-top: 14px; }
.page ul { padding-left: 1.2em; }
.page li { margin: 6px 0; }
.page .callout { padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); margin: 28px 0; }
