/* Octant — public site.
   Tokens are lifted from DailyEngine/engine/template.html so the pages read as
   the same product as the app. The one deliberate difference: system fonts
   instead of the app's bundled Syne / IBM Plex, so this site makes no request
   of any kind to any third party. No web fonts, no scripts, no images. */

:root {
  /* backbone — engine/template.html :root */
  --bg: #f1eee5;
  --surface: #fbfaf6;
  --surface-2: #ece9df;
  --ink: #16171b;
  --ink-2: #4c4e56;
  /* --ink-3 carries the TOC section numbers, which are real content, so it has
     to clear AA 4.5:1 on --bg (4.79:1), --surface (5.32:1) and --surface-2
     (4.57:1). The old #7e8089 was 3.39:1 on --bg and failed. */
  --ink-3: #666870;
  --rule: rgba(22, 23, 27, 0.10);
  --rule-2: rgba(22, 23, 27, 0.24);
  --g-hub: #2f3742;
  --accent: var(--g-hub);
  --on-accent: #f7f9f8;
  --shadow: 0 1px 2px rgba(22,23,27,0.05), 0 12px 30px -16px rgba(22,23,27,0.28);

  /* link ink: Basin's blue, deepened so it clears 4.5:1 on parchment */
  --link: #1f5a92;
  --link-hover: #16171b;

  /* the eight game accents, light theme, from each game.json */
  --g-meander: #1a7a74;
  --g-tell: #b8641f;
  --g-crease: #a3325a;
  --g-basin: #2a6fb0;
  --g-jam: #c2452a;
  --g-scree: #7a6d2a;
  --g-wedge: #5b45b8;
  --g-overprint: #8a5a12;

  /* type scale */
  --type-wordmark: 1.35rem;
  --type-h1: 1.7rem;
  --type-h2: 1.06rem;
  --type-body: 1rem;
  --type-small: 0.88rem;
  --type-caption: 0.78rem;

  --measure: 37rem;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1116;
    --surface: #171a21;
    --surface-2: #1f232c;
    --ink: #ecebe4;
    --ink-2: #b3b4bc;
    --ink-3: #83858e;
    --rule: rgba(236, 235, 228, 0.12);
    --rule-2: rgba(236, 235, 228, 0.26);
    --g-hub: #c9ccd6;
    --on-accent: #0f1116;
    --shadow: 0 1px 2px rgba(0,0,0,0.5), 0 14px 34px -18px rgba(0,0,0,0.8);

    --link: #6fb8f0;
    --link-hover: #ecebe4;

    --g-meander: #6fe3d2;
    --g-tell: #f0a45a;
    --g-crease: #f07aa3;
    --g-basin: #6fb8f0;
    --g-jam: #ff8a6b;
    --g-scree: #d8c66a;
    --g-wedge: #a996f5;
    --g-overprint: #e8b25a;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1116;
  --surface: #171a21;
  --surface-2: #1f232c;
  --ink: #ecebe4;
  --ink-2: #b3b4bc;
  --ink-3: #83858e;
  --rule: rgba(236, 235, 228, 0.12);
  --rule-2: rgba(236, 235, 228, 0.26);
  --g-hub: #c9ccd6;
  --on-accent: #0f1116;
  --shadow: 0 1px 2px rgba(0,0,0,0.5), 0 14px 34px -18px rgba(0,0,0,0.8);

  --link: #6fb8f0;
  --link-hover: #ecebe4;

  --g-meander: #6fe3d2;
  --g-tell: #f0a45a;
  --g-crease: #f07aa3;
  --g-basin: #6fb8f0;
  --g-jam: #ff8a6b;
  --g-scree: #d8c66a;
  --g-wedge: #a996f5;
  --g-overprint: #e8b25a;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--type-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------------------------------------------------------------- layout */

.shell {
  max-width: var(--measure);
  margin: 0 auto;
  padding: calc(1.5rem + env(safe-area-inset-top, 0px)) 1.25rem
           calc(3.5rem + env(safe-area-inset-bottom, 0px));
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border-radius: 4px;
  z-index: 20;
}
.skip:focus { left: 0.75rem; top: 0.75rem; }

/* ---------------------------------------------------------------- masthead */

.mast {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  margin: 0;
  font-size: var(--type-wordmark);
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1;
}
.wordmark a { color: inherit; text-decoration: none; }
.wordmark a:hover { color: inherit; }
.wordmark span { color: var(--accent); }

.mast nav {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  font-size: var(--type-small);
}
.mast nav a { color: var(--ink-2); text-decoration: none; }
.mast nav a:hover { color: var(--ink); text-decoration: underline; }
.mast nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ---------------------------------------------------------------- text */

h1 {
  font-size: var(--type-h1);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 2rem 0 0.5rem;
  text-wrap: balance;
}

h2 {
  font-size: var(--type-h2);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.35;
  margin: 2.4rem 0 0.6rem;
  scroll-margin-top: 1.25rem;
  text-wrap: pretty;
}

h3 {
  font-size: var(--type-body);
  font-weight: 600;
  margin: 1.5rem 0 0.4rem;
  scroll-margin-top: 1.25rem;
}

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

strong, b { font-weight: 650; color: var(--ink); }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--link-hover); }
a:focus-visible,
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

code, .mono { font-family: var(--mono); font-size: 0.92em; }
code {
  background: var(--surface-2);
  padding: 0.08em 0.3em;
  border-radius: 3px;
}

.lede {
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}

.meta {
  font-family: var(--mono);
  font-size: var(--type-caption);
  color: var(--ink-2);
  letter-spacing: 0.02em;
  margin: 0 0 0.35rem;
}

.muted { color: var(--ink-2); }
.small { font-size: var(--type-small); }

.eyebrow {
  font-family: var(--mono);
  font-size: var(--type-caption);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-2);
  margin: 2.4rem 0 0.5rem;
}

.hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

/* section permalinks */
.permalink {
  color: var(--ink-3);
  text-decoration: none;
  font-weight: 400;
  margin-left: 0.4rem;
  opacity: 0;
  transition: opacity 0.12s ease;
}
h2:hover .permalink,
h2:focus-within .permalink,
.permalink:focus { opacity: 1; }
.permalink:hover { color: var(--link); }

/* ---------------------------------------------------------------- blocks */

.note {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 0.85rem 1rem;
  margin: 0 0 1.25rem;
  font-size: var(--type-small);
  color: var(--ink-2);
}
.note p:last-child { margin-bottom: 0; }
.note strong { color: var(--ink); }

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

blockquote {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border-radius: 4px;
  font-style: italic;
  color: var(--ink-2);
}
blockquote p:last-child { margin-bottom: 0; }

/* table of contents */
.toc {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.1rem 0.75rem;
  margin: 1.5rem 0 2rem;
}
.toc h2 {
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  font-size: var(--type-caption);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-2);
}
.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 1.5rem;
  font-size: var(--type-small);
}
.toc li {
  margin-bottom: 0.3rem;
  break-inside: avoid;
  display: flex;
  gap: 0.5rem;
}
.toc .n {
  font-family: var(--mono);
  color: var(--ink-3);
  min-width: 1.35rem;
  text-align: right;
  font-size: var(--type-caption);
  padding-top: 0.1rem;
}
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--link); text-decoration: underline; }

@media (max-width: 34rem) {
  .toc ol { columns: 1; }
}

/* tables — long legal tables must scroll inside themselves, never the page */
.scroll {
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 30rem;
  font-size: var(--type-small);
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--rule);
}
th {
  font-weight: 650;
  color: var(--ink);
  background: var(--surface-2);
  white-space: nowrap;
}
tr:last-child td { border-bottom: 0; }

/* ---------------------------------------------------------------- index page */

.games {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: grid;
  gap: 0.5rem;
}
.games li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  margin: 0;
}
.games .dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: var(--card-accent, var(--accent));
  align-self: center;
}
.games b {
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: var(--type-small);
  text-transform: uppercase;
}
.games .tagline { color: var(--ink-2); font-size: var(--type-small); }
.games .soon {
  font-family: var(--mono);
  font-size: var(--type-caption);
  color: var(--ink-2);
  display: block;
}

.facts {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}
.facts li {
  padding-left: 1.4rem;
  position: relative;
  margin-bottom: 0.5rem;
}
.facts li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--ink-3);
}

.linkrow {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
}
.linkrow a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.75rem 0.95rem;
  text-decoration: none;
  color: var(--ink);
}
.linkrow a:hover { border-color: var(--rule-2); }
.linkrow b { display: block; font-weight: 650; }
.linkrow span { display: block; color: var(--ink-2); font-size: var(--type-small); }

/* ---------------------------------------------------------------- footer */

footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: var(--type-small);
  color: var(--ink-2);
}
footer p { margin: 0 0 0.5rem; }
footer .legal {
  font-family: var(--mono);
  font-size: var(--type-caption);
  line-height: 1.65;
  color: var(--ink-2);
}
footer .legal b { color: var(--ink); font-weight: 650; }
footer nav { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
footer nav a { color: var(--ink-2); }

/* ---------------------------------------------------------------- a11y + print */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

@media print {
  :root { --bg: #ffffff; --surface: #ffffff; --surface-2: #ffffff; --ink: #000000; --ink-2: #333333; }
  body { font-size: 11pt; }
  .mast nav, .skip, .permalink, .linkrow { display: none; }
  .shell { max-width: none; }
  h2 { page-break-after: avoid; }
  .scroll, .card, .note, .toc { page-break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
}
