/* AXIOM — the site's one stylesheet.
 *
 * Two palettes, both lifted from Source/Theme.cpp so the page and the thing
 * it is selling are visibly the same product: PAPER for a light viewer and
 * GRAPHITE — the app's own default — for a dark one. Change them in
 * Theme.cpp first, then here.
 *
 * No framework and no web fonts. The page is a few screens of text and
 * three images; a CSS bundle to lay that out would outweigh the content, and
 * system fonts render instantly on a phone on a bad connection, which is
 * where a store link is usually opened.
 */

:root {
  --bg:        #f4f1e8;   /* Theme.cpp PAPER.bg */
  --panel:     #fffdf8;
  --tile:      #faf8f2;
  --line:      #cec6b4;
  --ink:       #201e1a;
  --ink-dim:   #767062;
  --accent:    #b85e20;
  --accent-lo: #8f4716;
  --on-accent: #fffaf2;
  --good:      #247050;
  --bad:       #a42c38;
  --radius:    16px;
  --maxw:      920px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #1b1f24;   /* Theme.cpp GRAPHITE, the app's default skin */
    --panel:   #242931;
    --tile:    #2e343d;
    --line:    #4a5462;
    --ink:     #edf2f7;
    --ink-dim: #929eac;
    --accent:  #35e0d4;
    --accent-lo: #7ff0e8;
    --on-accent: #0a1a1c;
    --good:    #8adc54;
    --bad:     #ff6b81;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  /* The app's own ruled ground, at a weight that is texture rather than
     pattern. 44px matches the gap Style's paper ground uses. */
  background-image: repeating-linear-gradient(
      to bottom,
      transparent 0, transparent 43px,
      color-mix(in srgb, var(--line) 26%, transparent) 43px,
      color-mix(in srgb, var(--line) 26%, transparent) 44px);
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); }
a:hover { color: var(--accent-lo); }

/* Digits in a grid have to line up, and the board below is nothing but
   digits in a grid. */
.board, .tnum { font-variant-numeric: tabular-nums; }

/* ── Header ───────────────────────────────────────────────────────────── */

.site-header {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(140%) blur(8px);
}
.bar { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.brandmark { display: flex; align-items: center; gap: 12px; }
.brandmark img { width: 42px; height: 42px; border-radius: 10px; display: block; }
.brandmark .name {
  display: block; font-weight: 800; font-size: 18px;
  color: var(--ink); text-decoration: none; letter-spacing: .6px;
}
.brandmark .badge { font-size: 12px; color: var(--ink-dim); text-decoration: none; }
.site-nav { margin-left: auto; display: flex; gap: 18px; font-size: 15px; }
.site-nav a { text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }

/* ── Hero ─────────────────────────────────────────────────────────────── */

.hero { padding: 56px 0 36px; text-align: center; }
.hero h1 {
  margin: 0 0 10px; font-size: clamp(32px, 6vw, 48px);
  letter-spacing: -.5px; line-height: 1.12; text-wrap: balance;
}
.hero .sub {
  margin: 0 auto 28px; max-width: 34em;
  font-size: clamp(17px, 2.4vw, 20px); color: var(--ink-dim);
}

.stores {
  display: flex; gap: 16px; justify-content: center;
  align-items: center; flex-wrap: wrap;
}

/* The official badges. Both stores publish exact artwork and forbid
   redrawing it, so these are sized by HEIGHT only and never restyled.
   Apple's badge carries its own padding, which is why the two look aligned
   at one height despite different aspect ratios. */
.store-badge { display: inline-flex; line-height: 0; }
.store-badge img { height: 54px; width: auto; display: block; }
@media (max-width: 420px) { .store-badge img { height: 46px; } }

/* ── The board, drawn in CSS ───────────────────────────────────────────
 *
 * One real Axiom board, solved. It costs no image and it says what the game
 * is faster than a paragraph does. The arithmetic is correct in all four
 * directions — see the comment in index.html before changing a digit.
 */

.demo { display: flex; justify-content: center; margin: 10px 0 6px; }
.board {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 6px;
  align-items: center; justify-items: center;
}
.board .c, .board .t {
  width: 54px; height: 54px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 22px;
}
.board .c {                         /* a cell holding a number */
  background: var(--tile); border: 2px solid var(--line); color: var(--ink);
}
.board .c.lit {                     /* the tile just placed */
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--tile));
}
.board .t {                         /* the target chip at the end of a run */
  background: var(--accent); color: var(--on-accent);
  border: 2px solid var(--accent);
}
.board .o {                         /* an operator between two cells */
  color: var(--ink-dim); font-weight: 700; font-size: 19px;
  width: 20px; height: 20px; display: grid; place-items: center;
}
.board .eq { color: var(--ink-dim); font-weight: 700; font-size: 17px; }
.board .gap { width: 20px; height: 20px; }
@media (max-width: 420px) {
  .board .c, .board .t { width: 46px; height: 46px; font-size: 19px; }
}
.caption {
  text-align: center; color: var(--ink-dim);
  font-size: 15px; margin: 2px 0 26px;
}

/* ── Shots ────────────────────────────────────────────────────────────── */

.shots {
  display: grid; gap: 16px; padding: 18px 0 8px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.shots img {
  width: 100%; height: auto; display: block;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--tile);
}

/* ── Content ──────────────────────────────────────────────────────────── */

section { padding: 34px 0; }
h2 { font-size: clamp(22px, 3.6vw, 28px); margin: 0 0 12px; letter-spacing: -.2px; text-wrap: balance; }
h3 { font-size: 19px; margin: 26px 0 6px; }
p  { margin: 0 0 14px; max-width: 68ch; }

.cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p  { margin: 0; color: var(--ink-dim); font-size: 15px; max-width: none; }

/* The chapter list. A table of ten rows is the honest shape for it: the
   chapters ARE ordered, by difficulty, and the number carries that. */
.chapters { display: grid; gap: 10px; }
.chapter {
  display: grid; grid-template-columns: 2.4em 1fr; gap: 14px;
  align-items: baseline;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 16px;
}
.chapter .no {
  font-weight: 800; color: var(--accent);
  font-variant-numeric: tabular-nums; font-size: 15px;
}
.chapter h3 { margin: 0 0 2px; font-size: 16px; }
.chapter p  { margin: 0; color: var(--ink-dim); font-size: 15px; max-width: none; }

.note {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 14px 18px; color: var(--ink-dim);
}

ul { margin: 0 0 14px; padding-left: 22px; max-width: 68ch; }
li { margin: 4px 0; }

/* ── Footer ───────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--line); margin-top: 20px;
  padding: 26px 0 40px; color: var(--ink-dim); font-size: 14px;
}
.site-footer a { color: var(--ink-dim); }

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

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