/* Chain Tycoon website: landing pages and docs.
   Same world as the game: a bright sky, chunky rounded buttons with pressed-in bottoms, gold lettering.
   Light and dark come from these tokens: dark follows the visitor's system setting, and a page that sets
   data-theme="light" or "dark" on <html> wins either way. */
:root {
  color-scheme: light;
  --bg: #e9f6ff;
  --sky-1: #9bdcff;
  --sky-2: #e9f6ff;
  --paper: #ffffff;
  --paper-2: #f2f7ff;
  --ink: #1d2a4d;
  --ink-soft: #3d4f7a;
  --muted: #5d6d92;
  --line: #d6e1f6;
  --edge: #c5d3ee;
  --link: #1b5bd6;
  --go: #22c55e;
  --go-top: #3ade7a;
  --go-edge: #15803d;
  --gold: #ffcf33;
  --gold-2: #ffb000;
  --chip: #e8f1ff;
  --code-bg: #eef3fc;
  --note-bg: #fff6d6;
  --note-line: #f0c94d;
  --note-ink: #5c4300;
  --shadow: rgba(29, 42, 77, 0.14);
  --font-display: 'Baloo 2', 'Nunito', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0d1532;
    --sky-1: #0b1330;
    --sky-2: #17224a;
    --paper: #1b2547;
    --paper-2: #222d55;
    --ink: #eef3ff;
    --ink-soft: #c9d4f2;
    --muted: #9aa9cd;
    --line: #34426f;
    --edge: #0a1129;
    --link: #8db8ff;
    --go-edge: #0f6b34;
    --chip: #20356a;
    --code-bg: #141d3d;
    --note-bg: #3a3012;
    --note-line: #b8901c;
    --note-ink: #ffe7a3;
    --shadow: rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d1532;
  --sky-1: #0b1330;
  --sky-2: #17224a;
  --paper: #1b2547;
  --paper-2: #222d55;
  --ink: #eef3ff;
  --ink-soft: #c9d4f2;
  --muted: #9aa9cd;
  --line: #34426f;
  --edge: #0a1129;
  --link: #8db8ff;
  --go-edge: #0f6b34;
  --chip: #20356a;
  --code-bg: #141d3d;
  --note-bg: #3a3012;
  --note-line: #b8901c;
  --note-ink: #ffe7a3;
  --shadow: rgba(0, 0, 0, 0.35);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 600;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: 1140px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

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

.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 10;
  background: var(--paper);
  padding: 8px 12px;
}

/* ── header ────────────────────────────────────────────────── */
.top {
  background: linear-gradient(180deg, var(--sky-1), var(--sky-2));
}

.top-in {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 14px;
}

.mark {
  display: inline-flex;
  gap: 0.25em;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  --o: 0.06em;
}

.mark span {
  color: var(--gold);
  text-shadow: var(--o) 0 0 #1d2a4d, calc(-1 * var(--o)) 0 0 #1d2a4d, 0 var(--o) 0 #1d2a4d, 0 calc(-1 * var(--o)) 0 #1d2a4d,
    var(--o) var(--o) 0 #1d2a4d, calc(-1 * var(--o)) var(--o) 0 #1d2a4d, var(--o) calc(-1 * var(--o)) 0 #1d2a4d,
    calc(-1 * var(--o)) calc(-1 * var(--o)) 0 #1d2a4d, 0 0.12em 0 #1d2a4d;
}

.mark span + span {
  color: var(--gold-2);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px 18px;
  flex-wrap: wrap;
  margin-left: auto;
  font-weight: 800;
}

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

.nav a:hover {
  text-decoration: underline;
}

.nav .lang {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--edge);
  font-size: 14px;
}

/* ── buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 26px 12px;
  border-radius: 18px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  line-height: 1.1;
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.05);
  text-decoration: none;
}

.btn:active {
  transform: translateY(4px);
}

.btn-go {
  background: linear-gradient(180deg, var(--go-top), var(--go));
  color: #fff;
  box-shadow: 0 6px 0 var(--go-edge), 0 16px 26px var(--shadow);
}

.btn-go:active {
  box-shadow: 0 2px 0 var(--go-edge), 0 6px 12px var(--shadow);
}

.btn-ghost {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 6px 0 var(--edge), 0 16px 26px var(--shadow);
}

.btn-ghost:active {
  box-shadow: 0 2px 0 var(--edge), 0 6px 12px var(--shadow);
}

.btn-small {
  min-height: 40px;
  padding: 6px 16px 8px;
  border-radius: 14px;
  font-size: 16px;
}

/* ── landing ───────────────────────────────────────────────── */
.hero {
  background: linear-gradient(180deg, var(--sky-2), var(--bg));
}

.hero-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: center;
  gap: 40px;
  padding-block: 40px 56px;
}

.hero-text {
  min-width: 0;
}

.hero h1 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(38px, 5.4vw, 62px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lead {
  margin: 0 0 26px;
  max-width: 34em;
  font-size: 19px;
  color: var(--ink-soft);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.cta-note {
  margin: 16px 0 0;
  font-size: 15px;
  color: var(--muted);
}

.shot {
  margin: 0;
  min-width: 0;
  border-radius: 26px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--edge), 0 30px 60px var(--shadow);
  aspect-ratio: 3 / 2;
  max-width: 100%;
}

.shot picture {
  display: block;
  width: 100%;
  height: 100%;
}

.shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.band {
  padding-block: 56px;
}

.band-alt {
  background: var(--paper-2);
}

.band h2 {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 3.4vw, 38px);
  line-height: 1.1;
  text-wrap: balance;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  min-width: 0;
  padding: 20px 20px 22px;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 6px 0 var(--edge), 0 18px 34px var(--shadow);
}

.card h3 {
  margin: 10px 0 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  line-height: 1.2;
}

.card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
}

.ico {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--chip);
  color: var(--ink);
}

.num {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold);
  color: #1d2a4d;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
}

.status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 22px 24px;
  border-radius: 22px;
  background: var(--note-bg);
  border: 2px solid var(--note-line);
  color: var(--note-ink);
}

.status h2 {
  margin: 0 0 6px;
  font-size: 26px;
}

.status p {
  margin: 0;
}

/* ── footer ────────────────────────────────────────────────── */
.foot {
  padding-block: 28px 40px;
  color: var(--muted);
  font-size: 15px;
}

.foot-in {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
}

.foot a {
  color: var(--ink-soft);
  font-weight: 800;
}

.foot .made {
  margin-left: auto;
}

/* ── docs ──────────────────────────────────────────────────── */
.docs {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 44px;
  padding-block: 32px 56px;
}

.side {
  min-width: 0;
}

.side-in {
  position: sticky;
  top: 16px;
}

.side ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.side a {
  display: block;
  padding: 7px 12px;
  border-radius: 12px;
  color: var(--ink-soft);
  font-weight: 800;
  text-decoration: none;
  line-height: 1.3;
}

.side a:hover {
  background: var(--paper);
}

.side a[aria-current='page'] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--edge);
}

.side .side-play {
  margin-top: 14px;
}

.doc {
  min-width: 0;
  max-width: 76ch;
}

.doc h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.08;
  text-wrap: balance;
}

.doc .desc {
  margin: 0 0 26px;
  font-size: 19px;
  color: var(--muted);
}

.doc h2 {
  margin: 38px 0 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 27px;
  line-height: 1.15;
  text-wrap: balance;
}

.doc h3 {
  margin: 26px 0 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  line-height: 1.2;
}

.doc p,
.doc ul,
.doc ol {
  margin: 0 0 14px;
}

.doc ul,
.doc ol {
  padding-left: 1.4em;
}

.doc li {
  margin: 4px 0;
}

.doc li::marker {
  color: var(--muted);
}

.doc strong {
  font-weight: 900;
}

.doc code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 0.86em;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.doc pre {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--code-bg);
  overflow-x: auto;
}

.doc pre code {
  padding: 0;
  background: none;
  font-size: 14px;
  overflow-wrap: normal;
}

.doc blockquote {
  margin: 0 0 18px;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--note-bg);
  border-left: 5px solid var(--note-line);
  color: var(--note-ink);
}

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

.doc hr {
  border: 0;
  border-top: 2px solid var(--line);
  margin: 28px 0;
}

.table-wrap {
  margin: 0 0 18px;
  overflow-x: auto;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 4px 0 var(--edge);
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.45;
}

.doc th,
.doc td {
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.doc th {
  font-weight: 900;
  color: var(--ink);
  background: var(--paper-2);
  white-space: nowrap;
}

.doc tr:last-child td {
  border-bottom: 0;
}

.doc td.n,
.doc th.n {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 4px;
  vertical-align: -1px;
}

.pager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 40px;
}

.pager a {
  display: block;
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 4px 0 var(--edge);
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
}

.pager small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.pager .next {
  grid-column: 2;
  text-align: right;
}

/* ── narrow screens ────────────────────────────────────────── */
@media (max-width: 940px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .hero-in {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding-block: 24px 40px;
  }

  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding-block: 18px 40px;
  }

  .side-in {
    position: static;
  }

  /* the page list becomes a strip of chips that scrolls sideways */
  .side ol {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
  }

  .side a {
    white-space: nowrap;
    background: var(--paper);
    box-shadow: 0 3px 0 var(--edge);
  }

  .side a[aria-current='page'] {
    background: var(--gold);
    color: #1d2a4d;
  }

  .side .side-play {
    display: none;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .lead {
    font-size: 17px;
  }

  .cta .btn {
    width: 100%;
  }

  .status {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager .next {
    grid-column: 1;
  }

  .foot .made {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}

/* reference tables: keep names on one line, the table scrolls instead */
.data td:nth-child(2) {
  white-space: nowrap;
}
