/* Etude Fantasia landing — Sepia Etude, hand-set.
   Token values mirror frontend/src/app.css (the source of truth). The page
   is scribe's paper; the weave, the pips, and the board plate are the
   illuminator's fixed-rich moments, identical in both modes. */

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/static/fonts/CormorantGaramond-Regular.otf') format('opentype');
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/static/fonts/CormorantGaramond-Medium.otf') format('opentype');
  font-display: swap;
  font-style: normal;
  font-weight: 500;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/static/fonts/CormorantGaramond-SemiBold.otf') format('opentype');
  font-display: swap;
  font-style: normal;
  font-weight: 600 900;
}
@font-face {
  font-family: 'Lato';
  src: url('/static/fonts/Lato-Regular.ttf') format('truetype');
  font-display: swap;
  font-style: normal;
  font-weight: 400 600;
}
@font-face {
  font-family: 'Lato';
  src: url('/static/fonts/Lato-Bold.ttf') format('truetype');
  font-display: swap;
  font-style: normal;
  font-weight: 700 900;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/static/fonts/JetBrainsMono-Regular.ttf') format('truetype');
  font-display: swap;
  font-style: normal;
  font-weight: 400 700;
}

:root {
  color-scheme: light dark;

  --mountain-red: #973427;
  --sepia-bronze: #6d5a35;
  --ivory: #f8f1e0;

  /* The vivid pie: constants in both modes, like card art. */
  --vivid-w: #f2ad25;
  --vivid-u: #2f74d0;
  --vivid-b: #9550b4;
  --vivid-r: #e04a18;
  --vivid-g: #46a230;

  /* Parchment */
  --bg: #ebdfc6;
  --bg-surface: #f7f0e0;
  --bg-muted: #ded0af;
  --bg-field: #fcf9ee;
  --border: #c9b892;
  --border-strong: #a5926a;
  --text: #3a3122;
  --text-secondary: #5f553d;
  --text-tertiary: #6e6247;
  --accent: var(--mountain-red);
  --accent-text: var(--sepia-bronze);
  --accent-hover: #ab4634;
  --accent-pressed: #822d21;

  /* Registers at library volume */
  --forest: #4c8040;
  --plains: #9f7a1c;
  --island: #2e6da8;
  --swamp: #6a5f86;
  --mountain: var(--mountain-red);
  --wash-strength: 10%;

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  --shadow-sheet: 0 1px 2px rgb(58 40 20 / 0.1), 0 22px 56px rgb(58 40 20 / 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* The library after dark */
    --bg: #191510;
    --bg-surface: #221c14;
    --bg-muted: #2b241a;
    --bg-field: #2f2717;
    --border: #423a2b;
    --border-strong: #625741;
    --text: #ece4d0;
    --text-secondary: #b3a88e;
    --text-tertiary: #9a9077;
    --accent: #b24d38;
    --accent-text: #c3a568;
    --accent-hover: #a34531; /* dark hover deepens: lighter red cannot hold ivory at AA */
    --accent-pressed: #93402d;
    --wash-strength: 26%;
    --shadow-sheet: 0 1px 2px rgb(0 0 0 / 0.4), 0 22px 56px rgb(0 0 0 / 0.45);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 24px;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

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

::selection {
  background: var(--accent);
  color: var(--ivory);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bg-field);
  color: var(--text);
  padding: 8px 16px;
  z-index: 100;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* Masthead: the weave is the brand's one moment of full color. */
.weave {
  display: flex;
  height: 6px;
}
.weave-band {
  flex: 1;
}
.weave-w { background: var(--vivid-w); }
.weave-u { background: var(--vivid-u); }
.weave-b { background: var(--vivid-b); }
.weave-r { background: var(--vivid-r); }
.weave-g { background: var(--vivid-g); }

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 20px;
}
.brand-group {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.brand {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: -0.01em;
  color: var(--accent-text);
}
.pips {
  display: inline-flex;
  gap: 4px;
  transform: translateY(1px);
}
.pip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
}
.pip img {
  display: block;
}
/* Mana chips: the traditional symbol grounds, fixed in both modes. */
.pip-w { background: #f8f6d8; }
.pip-u { background: #c1d7e9; }
.pip-b { background: #bab1ab; }
.pip-r { background: #e49977; }
.pip-g { background: #a3c095; }
.pip img {
  filter: none;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a:not(.btn) {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-color: transparent;
  padding: 8px 0;
  transition: color 100ms ease-out, text-decoration-color 100ms ease-out;
}
.nav-links a:not(.btn):hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

/* Buttons: three roles, one shape. */
.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 20px;
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background-color 100ms ease-out, border-color 100ms ease-out;
}
.btn-primary {
  background: var(--accent);
  color: var(--ivory);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-primary:active {
  background: var(--accent-pressed);
}
.btn-secondary {
  background: var(--bg-field);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
}
.btn-secondary:active {
  background: var(--bg-muted);
}

/* Hero */
.hero {
  padding: 64px 0 48px;
}
.hero-tagline {
  font-family: var(--font-serif);
  font-size: 44px;
  font-weight: 600;
  line-height: 52px;
  letter-spacing: -0.01em;
  color: var(--accent-text);
  margin: 0;
  max-width: 18ch;
}
.hero-subline {
  font-size: 17px;
  line-height: 28px;
  color: var(--text-secondary);
  max-width: 58ch;
  margin: 16px 0 0;
}
.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* The board plate: a printed plate tipped onto the page — fixed-rich,
   framed, in slight relief. */
.showcase {
  margin: 48px auto 0;
}
.showcase img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-sheet);
}
.showcase figcaption {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  line-height: 20px;
  color: var(--text-secondary);
  margin-top: 12px;
  text-align: center;
}

/* Sections read as ruled regions, never boxed. */
main h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 32px;
  color: var(--accent-text);
  margin: 0 0 12px;
}
main h3 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 24px;
  color: var(--text);
  margin: 0 0 8px;
}
main section {
  border-top: 1px solid var(--border);
  padding: 48px 0;
}
main .hero {
  border-top: none;
}

/* Pillars: each subsystem speaks its register through a wash and a rule. */
.pillar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.pillar {
  border-left: 3px solid var(--register);
  background: color-mix(in srgb, var(--register) var(--wash-strength), var(--bg-surface));
  border-radius: 0 8px 8px 0;
  padding: 20px;
}
.pillar p {
  margin: 0;
  font-size: 14px;
  line-height: 22px;
  color: var(--text-secondary);
}
.register-island { --register: var(--island); }
.register-mountain { --register: var(--mountain); }
.register-forest { --register: var(--forest); }

/* Play / Train */
.step-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 32px;
}
.step p {
  color: var(--text-secondary);
  margin: 0 0 16px;
  max-width: 52ch;
}
pre {
  background: var(--bg-field);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 0;
  overflow-x: auto;
}
code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
  color: var(--text);
}

/* Research */
.research p {
  color: var(--text-secondary);
  max-width: 58ch;
  margin: 0 0 12px;
}
.quiet-link {
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: underline;
}
.quiet-link:hover {
  color: var(--text);
}

/* Colophon */
.colophon {
  border-top: 1px solid var(--border);
  margin-top: 32px;
}
.colophon-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 22rem);
  gap: 48px;
  padding-top: 32px;
  padding-bottom: 40px;
}
.colophon-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
  color: var(--accent-text);
  margin: 0;
}
.colophon-identity {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-secondary);
  max-width: 48ch;
  margin: 4px 0 0;
}
.colophon-built-by {
  font-size: 12px;
  line-height: 16px;
  margin: 8px 0 0;
}
.colophon-built-by .quiet-link {
  font-weight: 400;
}
.colophon-legal {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-tertiary);
  margin: 0;
}
.colophon-legal a {
  color: inherit;
}
.colophon-legal a:hover {
  color: var(--text);
}

@media (max-width: 720px) {
  .hero-tagline {
    font-size: 32px;
    line-height: 40px;
  }
  .pillar-grid,
  .step-grid,
  .colophon-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
