/* ===========================================================================
 * Datacenter Tycoon — /docs
 * ---------------------------------------------------------------------------
 * Standalone. Nothing here is imported by the game and nothing here imports
 * the game: `styles.css` sets `overflow: hidden` on <body> because the game is
 * a canvas that must never scroll, and a docs page must.
 *
 * The hexes below are COPIED from styles.css §0b, which itself mirrors
 * src/art/palette.js. Same names, same values. If the palette moves, move it
 * here too — CSS cannot import the JS module and this file is not served with
 * the game's stylesheet.
 *
 * The design rule inherited from the game: colour TEMPERATURE carries meaning.
 * `token` lime is reserved for on-chain amounts, `hot` for what is destroyed,
 * `cool` for what is locked and coming back. Brightness carries nothing.
 *
 * Committed to dark. Every colour is set explicitly, <body> included, so a
 * viewer in light mode gets the intended page rather than a transparent one.
 * ========================================================================= */

:root {
  color-scheme: dark;

  /* neutrals */
  --ink:        #141522;
  --night0:     #0b0d1c;
  --night1:     #171a30;
  --night2:     #2a2e4d;
  --floor0:     #22243a;
  --steel0:     #2c3450;
  --steel1:     #4a5573;
  --steel3:     #a3aec4;
  --metal1:     #8b95ad;
  --white:      #f2f6fb;

  /* meaning */
  --token1:     #c3f53a;   /* on-chain amounts, and nothing else */
  --led1:       #2fbf62;   /* compute */
  --fiber1:     #17b3ad;   /* network */
  --cool2:      #3aa0c9;   /* cloud, and collateral coming back */
  --cool3:      #7fd6e8;
  --amber1:     #d68a1c;   /* ai */
  --amber2:     #ffcb56;
  --copper1:    #a3623a;   /* silicon */
  --copper2:    #dd9a5e;
  --hot1:       #c02f38;   /* destroyed */
  --hot2:       #f97846;
  --danger1:    #e8386f;
  --accent1:    #9d81f0;
  --sky1:       #5f96d8;

  /* roles */
  --bg:         var(--night0);
  --surface:    var(--night1);
  --surface-2:  var(--floor0);
  --line:       var(--steel0);
  --line-hi:    var(--steel1);
  --text:       var(--white);
  --text-dim:   var(--steel3);
  --text-mute:  var(--metal1);

  --b: 2px;                            /* the one border width */
  --drop: 2px 2px 0 var(--ink);        /* the only shadow: a hard block */
  --font: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
          "DejaVu Sans Mono", "Liberation Mono", monospace;
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  /* The page never scrolls sideways. Anything genuinely wide lives inside a
     .scroll and scrolls itself. */
  overflow-x: hidden;
}

@media (max-width: 640px) { body { font-size: 14px; } }

/* --------------------------------------------------------------------------
 * Nav
 * ------------------------------------------------------------------------ */

.nav {
  border-bottom: var(--b) solid var(--line);
  background: var(--surface);
}

.nav-in {
  max-width: 880px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
}

.nav-brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}
.nav-brand span { color: var(--token1); }

.nav a {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: var(--b) solid transparent;
  padding-bottom: 2px;
  font-size: 0.9em;
}
.nav a:hover { color: var(--text); border-bottom-color: var(--line-hi); }
.nav a[aria-current="page"] { color: var(--token1); border-bottom-color: var(--token1); }
.nav a.play { color: var(--cool3); }
.nav a.play:hover { border-bottom-color: var(--cool3); }

/* --------------------------------------------------------------------------
 * Page
 * ------------------------------------------------------------------------ */

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 72px;
}

h1 {
  font-size: 1.9em;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}

h2 {
  font-size: 1.15em;
  letter-spacing: -0.01em;
  margin: 52px 0 14px;
  padding-bottom: 8px;
  border-bottom: var(--b) solid var(--line);
}

h3 {
  font-size: 1em;
  margin: 30px 0 8px;
  color: var(--cool3);
}

p { margin: 0 0 14px; }

.lede {
  color: var(--text-dim);
  font-size: 1.05em;
  margin-bottom: 26px;
}

a { color: var(--cool3); }
a:hover { color: var(--white); }

ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin-bottom: 8px; }
li::marker { color: var(--text-mute); }

strong { color: var(--white); font-weight: 700; }
em { color: var(--text-dim); font-style: normal; }

code {
  background: var(--surface-2);
  border: var(--b) solid var(--line);
  padding: 0 4px;
  font-size: 0.88em;
  color: var(--cool3);
  overflow-wrap: anywhere;
}

hr { border: 0; border-top: var(--b) solid var(--line); margin: 40px 0; }

/* --------------------------------------------------------------------------
 * Meaning colours
 * ------------------------------------------------------------------------ */

.watt { color: var(--token1); font-weight: 700; }   /* on-chain $WATT */
.burn { color: var(--hot2); font-weight: 700; }     /* gone to 0x…dEaD */
.lock { color: var(--cool3); font-weight: 700; }    /* escrowed, redeemable */
.eth  { color: var(--accent1); font-weight: 700; }  /* paid in ETH */

/* --------------------------------------------------------------------------
 * Callouts
 * ------------------------------------------------------------------------ */

.note {
  border: var(--b) solid var(--line);
  border-left-width: 6px;
  background: var(--surface);
  padding: 14px 16px;
  margin: 0 0 22px;
  box-shadow: var(--drop);
}
.note > :last-child { margin-bottom: 0; }
.note b { display: block; margin-bottom: 6px; letter-spacing: 0.04em; font-size: 0.85em; text-transform: uppercase; }

.note.warn { border-left-color: var(--amber1); }
.note.warn b { color: var(--amber2); }
.note.stop { border-left-color: var(--danger1); }
.note.stop b { color: var(--danger1); }
.note.ok   { border-left-color: var(--token1); }
.note.ok b { color: var(--token1); }

/* --------------------------------------------------------------------------
 * Steps
 * ------------------------------------------------------------------------ */

.steps { list-style: none; padding: 0; margin: 0 0 24px; counter-reset: step; }

.steps > li {
  counter-increment: step;
  border: var(--b) solid var(--line);
  background: var(--surface);
  padding: 14px 16px 14px 52px;
  margin: 0 0 10px;
  position: relative;
  box-shadow: var(--drop);
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 13px;
  width: 24px;
  height: 24px;
  line-height: 22px;
  text-align: center;
  border: var(--b) solid var(--line-hi);
  color: var(--token1);
  font-weight: 700;
  font-size: 0.85em;
}
.steps h3 { margin: 0 0 6px; color: var(--white); font-size: 1em; }
.steps p:last-child { margin-bottom: 0; }
.steps .cost {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: var(--b) solid var(--line);
  font-size: 0.88em;
  color: var(--text-mute);
}

/* --------------------------------------------------------------------------
 * Tables — always inside .scroll
 * ------------------------------------------------------------------------ */

.scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: var(--b) solid var(--line);
  box-shadow: var(--drop);
  margin: 0 0 24px;
  max-width: 100%;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: 0.88em;
  background: var(--surface);
}

th, td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: var(--b) solid var(--line);
  white-space: nowrap;
}

thead th {
  background: var(--surface-2);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.9em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--night2); }

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

tr.group td {
  background: var(--surface-2);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.9em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tfoot td {
  background: var(--surface-2);
  font-weight: 700;
  border-top: var(--b) solid var(--line-hi);
}

caption {
  caption-side: bottom;
  text-align: left;
  padding: 10px 12px;
  color: var(--text-mute);
  font-size: 0.85em;
  background: var(--surface-2);
  border-top: var(--b) solid var(--line);
  white-space: normal;
}

/* --------------------------------------------------------------------------
 * Tags
 * ------------------------------------------------------------------------ */

.tag {
  display: inline-block;
  border: var(--b) solid currentColor;
  padding: 0 5px;
  font-size: 0.82em;
  line-height: 1.5;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.tag.compute { color: var(--led1); }
.tag.network { color: var(--fiber1); }
.tag.cloud   { color: var(--cool2); }
.tag.ai      { color: var(--amber1); }
.tag.silicon { color: var(--copper2); }
.tag.base     { color: var(--metal1); }
.tag.advanced { color: var(--sky1); }
.tag.apex     { color: var(--amber2); }

/* --------------------------------------------------------------------------
 * Worked arithmetic
 * ------------------------------------------------------------------------ */

.calc {
  border: var(--b) solid var(--line);
  background: var(--surface-2);
  padding: 14px 16px;
  margin: 0 0 22px;
  overflow-x: auto;
  box-shadow: var(--drop);
}
.calc dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; }
.calc dt { color: var(--text-dim); white-space: nowrap; }
.calc dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc dt.total, .calc dd.total {
  border-top: var(--b) solid var(--line-hi);
  padding-top: 6px;
  margin-top: 4px;
  color: var(--white);
  font-weight: 700;
}
.calc .cap { margin: 10px 0 0; font-size: 0.85em; color: var(--text-mute); }

/* --------------------------------------------------------------------------
 * Footer
 * ------------------------------------------------------------------------ */

footer {
  border-top: var(--b) solid var(--line);
  background: var(--surface);
  color: var(--text-mute);
  font-size: 0.85em;
}
footer .nav-in { padding: 18px 20px 28px; display: block; }
footer p { margin: 0 0 6px; }
footer a { color: var(--text-dim); }

/* Skip the sticky header on short screens — it eats a phone. */
@media (max-width: 640px) {
  thead th { position: static; }
  main { padding: 24px 16px 56px; }
  .nav-in { padding: 12px 16px; }
  h1 { font-size: 1.5em; }
  .steps > li { padding-left: 16px; padding-top: 40px; }
  .steps > li::before { top: 10px; }
}
