/*
 * The public pages (deploy/site). Mirrors the app's design tokens
 * (frontend/src/index.css) and its system font stacks (frontend/tailwind.config.js),
 * so the front door and the app read as one thing, with no font downloads.
 *
 * Theme: site.js sets .dark or .light on <html> from the app's own localStorage
 * "theme" before first paint. Without JavaScript, the OS preference applies.
 */

:root {
  --canvas: 246 241 231;
  --raised: 255 252 245;
  --sunken: 239 232 218;
  --hairline: 226 216 197;
  --edge: 201 188 162;
  --ink: 36 30 23;
  --ink-soft: 90 79 65;
  --ink-muted: 138 124 105;
  --accent: 168 91 18;
  --accent-hover: 133 68 15;
  --accent-quiet: 250 233 208;
  --accent-ink: 255 252 245;
  /* Entity colours in the sample document, as the app tints people and places. */
  --npc: 29 78 216;
  --place: 21 128 61;
  --faction: 126 34 206;
  color-scheme: light;
}

:root.dark {
  --canvas: 20 23 28;
  --raised: 27 31 38;
  --sunken: 16 19 24;
  --hairline: 42 48 58;
  --edge: 59 67 80;
  --ink: 232 227 217;
  --ink-soft: 169 162 150;
  --ink-muted: 122 117 108;
  --accent: 233 179 97;
  --accent-hover: 243 209 156;
  --accent-quiet: 101 52 19;
  --accent-ink: 20 23 28;
  --npc: 147 197 253;
  --place: 134 239 172;
  --faction: 216 180 254;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --canvas: 20 23 28;
    --raised: 27 31 38;
    --sunken: 16 19 24;
    --hairline: 42 48 58;
    --edge: 59 67 80;
    --ink: 232 227 217;
    --ink-soft: 169 162 150;
    --ink-muted: 122 117 108;
    --accent: 233 179 97;
    --accent-hover: 243 209 156;
    --accent-quiet: 101 52 19;
    --accent-ink: 20 23 28;
    --npc: 147 197 253;
    --place: 134 239 172;
    --faction: 216 180 254;
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: rgb(var(--canvas));
  color: rgb(var(--ink-soft));
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

h1,
h2,
h3,
.wordmark {
  font-family: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Georgia, Cambria, serif;
  color: rgb(var(--ink));
  line-height: 1.2;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.6rem;
  margin: 0 0 0.75rem;
}

h3 {
  font-size: 1.1rem;
  margin: 0 0 0.4rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: rgb(var(--accent));
  text-underline-offset: 2px;
}

a:hover {
  color: rgb(var(--accent-hover));
}

strong {
  color: rgb(var(--ink));
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: rgb(var(--raised));
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 16px;
}

.prose {
  max-width: 72ch;
}

/* --- Header and footer -------------------------------------------------- */

.site-header {
  border-bottom: 1px solid rgb(var(--hairline));
  background: rgb(var(--sunken) / 0.85);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: rgb(var(--ink));
  white-space: nowrap;
}

.wordmark svg {
  width: 1.1rem;
  height: 1.1rem;
  stroke: rgb(var(--accent));
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 0.95rem;
}

.nav a:not(.btn) {
  color: rgb(var(--ink-soft));
  text-decoration: none;
}

.nav a:not(.btn):hover {
  color: rgb(var(--accent));
}

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid rgb(var(--hairline));
  padding: 2rem 0 3rem;
  font-size: 0.875rem;
  color: rgb(var(--ink-muted));
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-bottom: 1rem;
}

.site-footer nav a {
  color: rgb(var(--ink-soft));
}

/* --- Signed-in swap: site.js marks <html> before first paint -------------- */

[data-auth="signed-in"] {
  display: none !important;
}

:root.signed-in [data-auth="signed-in"] {
  display: revert !important;
}

:root.signed-in [data-auth="signed-out"] {
  display: none !important;
}

/* --- Buttons --------------------------------------------------------------- */

.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.3;
}

.btn-primary {
  background: rgb(var(--accent));
  color: rgb(var(--accent-ink));
}

.btn-primary:hover {
  background: rgb(var(--accent-hover));
  color: rgb(var(--accent-ink));
}

.btn-secondary {
  border-color: rgb(var(--edge));
  color: rgb(var(--ink));
  background: rgb(var(--raised));
}

.btn-secondary:hover {
  border-color: rgb(var(--accent));
  color: rgb(var(--accent));
}

.btn-small {
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* --- Sections ------------------------------------------------------------- */

.hero {
  padding: 4rem 0 3rem;
}

.lead {
  font-size: 1.15rem;
  max-width: 62ch;
}

.note {
  font-size: 0.9rem;
  color: rgb(var(--ink-muted));
}

.section {
  padding: 2.5rem 0;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.grid-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
}

.card {
  background: rgb(var(--raised));
  border: 1px solid rgb(var(--hairline));
  border-radius: 10px;
  padding: 1.25rem;
  min-width: 0;
}

.card p:last-child {
  margin-bottom: 0;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  background: rgb(var(--accent-quiet));
  color: rgb(var(--accent));
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.price-tag {
  font-family: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: rgb(var(--ink));
}

/* --- The sample output ---------------------------------------------------- */

.sample-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(var(--ink-muted));
  margin-bottom: 0.75rem;
}

.transcript {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.transcript li {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  gap: 0.25rem 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgb(var(--hairline));
}

.transcript li:last-child {
  border-bottom: 0;
}

.transcript time {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.8rem;
  color: rgb(var(--ink-muted));
  padding-top: 0.15rem;
}

.speaker {
  display: block;
  font-weight: 600;
  color: rgb(var(--ink));
  font-size: 0.85rem;
}

.doc h3 {
  margin-top: 1rem;
}

.doc h3:first-child {
  margin-top: 0;
}

.doc ul {
  margin: 0 0 0.5rem;
  padding-left: 1.2rem;
}

.ent {
  font-weight: 600;
}

.ent-npc {
  color: rgb(var(--npc));
}

.ent-place {
  color: rgb(var(--place));
}

.ent-faction {
  color: rgb(var(--faction));
}

.ent-pc {
  color: rgb(var(--accent));
}

/* --- Tables, FAQ and the legal pages -------------------------------------- */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid rgb(var(--hairline));
  vertical-align: top;
}

.table th {
  color: rgb(var(--ink));
  font-weight: 600;
}

.table td.num,
.table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.checklist {
  padding-left: 1.2rem;
}

.checklist li {
  margin-bottom: 0.4rem;
}

.faq h2 {
  margin-top: 2rem;
}

.faq h2:first-child {
  margin-top: 0;
}

.faq details {
  background: rgb(var(--raised));
  border: 1px solid rgb(var(--hairline));
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: rgb(var(--ink));
}

.faq details[open] summary {
  margin-bottom: 0.5rem;
}

.faq details p:last-child {
  margin-bottom: 0;
}

.legal h2 {
  margin-top: 2rem;
  font-size: 1.3rem;
}

.legal ul {
  padding-left: 1.2rem;
}

.legal li {
  margin-bottom: 0.35rem;
}

.updated {
  color: rgb(var(--ink-muted));
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .hero {
    padding: 2.5rem 0 2rem;
  }

  .transcript li {
    grid-template-columns: 1fr;
  }
}

.spaced {
  margin-top: 1rem;
}
