/* wyrdsekai.org — one stylesheet, no build step, no external requests.
 *
 * A project about running your own software on your own machines should not
 * make your browser phone out to three CDNs to render a paragraph. Everything
 * here is system fonts, two local SVGs and a handful of custom properties.
 *
 * Colours are sampled from the emblem: deep indigo at the roots, violet in the
 * canopy. Dark is the default; the toggle in the header persists a choice. */

:root {
  --plum-900: #150e22;
  --plum-850: #1b1329;
  --plum-800: #241834;
  --plum-700: #33174d;
  --violet-600: #6b3494;
  --violet-500: #8a4fb5;
  --violet-300: #c39ae8;
  --violet-200: #ddc6f3;
  --cream: #faf7f1;

  --measure: 34rem;    /* ~66 characters at 18px */
  --wide: 50rem;
  --radius: 10px;
}

/* ── dark (default) ─────────────────────────────────────────────────────── */
:root,
:root[data-theme="dark"] {
  --bg: var(--plum-900);
  --surface: var(--plum-850);
  --surface-2: var(--plum-800);
  --fg: #ece7f3;
  --muted: #a79bb8;
  --rule: #33294a;
  --accent: var(--violet-300);
  --accent-strong: var(--violet-200);
  --brand: var(--violet-300);
  --code-bg: #1e1630;
  --glow: rgba(138, 79, 181, 0.20);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* ── light ──────────────────────────────────────────────────────────────── */
:root[data-theme="light"] {
  --bg: var(--cream);
  --surface: #f3eee6;
  --surface-2: #ede6db;
  --fg: #1f1729;
  --muted: #5f5670;
  --rule: #ddd3c6;
  --accent: var(--violet-600);
  --accent-strong: var(--plum-700);
  --brand: var(--plum-700);
  --code-bg: #efe9df;
  --glow: rgba(107, 52, 148, 0.10);
  --shadow: 0 1px 2px rgba(51, 23, 77, 0.10);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  /* 16px serif reads small on a wide screen — a serif's x-height runs
   * lower than a sans at the same nominal size. 18px with slightly tighter
   * leading is the same measure, just legible. */
  font: 18px/1.62 ui-serif, Georgia, "Times New Roman", serif;
  padding: 0 1.25rem 5rem;
}

main { max-width: var(--measure); margin: 0 auto; }
main.wide { max-width: var(--wide); }

/* ── brand marks ────────────────────────────────────────────────────────── */

/* Both SVGs are single-colour paths, so a mask lets one file serve both
 * themes — the colour comes from `background`, never from the file. */
.mark,
.wordmark {
  display: block;
  background: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.mark {
  -webkit-mask-image: url(/img/emblem.svg);
  mask-image: url(/img/emblem.svg);
  aspect-ratio: 1 / 1;
}
.wordmark {
  -webkit-mask-image: url(/img/wordmark.svg);
  mask-image: url(/img/wordmark.svg);
  aspect-ratio: 2263 / 632;
}

/* ── header ─────────────────────────────────────────────────────────────── */

.site {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.5rem 0 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--brand);
  text-decoration: none;
  flex: 0 0 auto;
}
.brand .mark { width: 34px; }
.brand .wordmark { width: 132px; }
.brand:hover { color: var(--accent); }

.site nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-size: 0.9rem;
}
.site nav a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
.site nav a:hover,
.site nav a[aria-current="page"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.theme {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}
.theme:hover { color: var(--accent); border-color: var(--accent); }
/* The button shows the theme you would switch *to*, not the one you are in. */
.theme .moon { display: none; }
:root[data-theme="light"] .theme .moon { display: block; }
:root[data-theme="light"] .theme .sun { display: none; }

/* ── hero ───────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 4.5rem 0 2.5rem;
  text-align: center;
  overflow: hidden;
}

/* The emblem, very faint, behind the opening lines — the same tree the world
 * is named for, not a stock illustration. */
.hero::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(30rem, 100%);
  aspect-ratio: 1 / 1;
  background: var(--accent);
  opacity: 0.075;
  -webkit-mask-image: url(/img/emblem.svg);
  mask-image: url(/img/emblem.svg);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  pointer-events: none;
}
/* Violet on cream carries further than violet on plum — the same opacity reads
 * roughly twice as loud in light mode, so it gets its own value. */
:root[data-theme="light"] .hero::before { opacity: 0.045; }

.hero .mark {
  width: 108px;
  margin: 0 auto 1.1rem;
  color: var(--brand);
  position: relative;
}
.hero .wordmark {
  width: 260px;
  max-width: 72%;
  margin: 0 auto 0.9rem;
  color: var(--brand);
  position: relative;
}
.hero .tagline {
  position: relative;
  margin: 0 auto;
  max-width: 30rem;
  font-size: 1.12rem;
  font-style: italic;
  color: var(--muted);
}

.hero-actions {
  position: relative;
  margin: 2rem 0 0;
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  text-decoration: none;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--glow); }
.btn-primary {
  background: var(--violet-600);
  border-color: var(--violet-600);
  color: #fff;
}
.btn-primary:hover { background: var(--violet-500); border-color: var(--violet-500); }

/* ── type ───────────────────────────────────────────────────────────────── */

h1 {
  font-size: 1.95rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.4rem;
}
.hero h1 { margin: 0 0 0.5rem; }

.tagline { color: var(--muted); margin: 0 0 2.5rem; font-style: italic; }

h2 {
  font-size: 1.18rem;
  margin: 3rem 0 0.8rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-size: 1rem;
  margin: 1.6rem 0 0.4rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
}

p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }

code, pre, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
}

code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  border: 1px solid var(--rule);
}

pre {
  background: var(--code-bg);
  padding: 0.95rem 1.05rem;
  border-radius: var(--radius);
  overflow-x: auto;          /* long commands scroll here, never the page */
  border: 1px solid var(--rule);
}
pre code { background: none; padding: 0; border: 0; }

.note {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.7rem 1rem;
  color: var(--muted);
  margin: 1.35rem 0;
  font-size: 0.95rem;
}

/* ── cards ──────────────────────────────────────────────────────────────── */

.cards {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.85rem;
}
.cards > li {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem;
  margin: 0;
  box-shadow: var(--shadow);
}
.cards > li strong { color: var(--fg); }
.cards > li p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.95rem; }

/* A reading list where each entry is a link plus one line of why. */
.reading { list-style: none; padding: 0; margin: 0 0 1rem; }
.reading > li { margin-bottom: 0.9rem; }
.reading .what { display: block; color: var(--muted); font-size: 0.94rem; }

/* ── tables ─────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; margin: 0 0 1rem; }
table { border-collapse: collapse; width: 100%; }
th, td {
  text-align: left;
  padding: 0.5rem 0.7rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}
th {
  font-weight: 600;
  font-size: 0.85rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
td.size { color: var(--muted); white-space: nowrap; font-size: 0.9rem; }

/* ── footer ─────────────────────────────────────────────────────────────── */

footer {
  max-width: var(--measure);
  margin: 4.5rem auto 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.88rem;
}
main.wide + footer { max-width: var(--wide); }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }
.footer-marks {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
  opacity: 0.75;
}
.footer-marks .mark { width: 22px; }
.footer-marks .wordmark { width: 86px; }

.platforms { list-style: none; padding: 0; }
.platforms > li { margin-bottom: 1.9rem; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--surface);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
}

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

@media (max-width: 34rem) {
  /* Two rows: brand and the toggle share the first, nav gets the second —
   * otherwise the toggle wraps alone to the left and looks orphaned. */
  .site { flex-wrap: wrap; gap: 0.7rem; }
  .theme { order: 1; margin-left: auto; }
  .site nav {
    order: 2;
    flex-basis: 100%;
    margin-left: 0;
    gap: 1.1rem;
    font-size: 0.88rem;
  }
  .hero { padding: 3rem 0 2rem; }
  .hero .mark { width: 84px; }
  body { padding-bottom: 3.5rem; }
}
