/*
 * 2048 Diner — public pages.
 *
 * The palette is the game's own, lifted from docs/design/style-bible.html so the website and the
 * app read as one product. The construction is neubrutalist: flat fills, a heavy ink outline, and a
 * hard offset shadow that collapses when you press something. Corners stay generously round rather
 * than square, which is what keeps it playful and what ties it back to the game's chunky chrome.
 *
 * These pages carry a privacy notice that promises no third-party tracking, so both typefaces are
 * self-hosted. Nothing here reaches another origin.
 */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque-var.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "Nunito Sans Var";
  src: url("/fonts/nunito-sans-var.woff2") format("woff2-variations");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Game palette. Names match the style bible so a change there is traceable to here. */
  --chrome: #5433be;
  --chrome-hi: #6e4fd8;
  --chrome-lo: #4526ab;
  --edge: #a78bff;
  --reward: #ffc63d;
  --active: #ff4d94;
  --go: #2ed39a;
  --social: #56b8f5;
  --banner: #ff9a2e;

  /* The outline and shadow colour. Reads as black, but it is the deepest indigo in the game. */
  --ink: #170f38;
  --ink-soft: #4a4173;

  --page: #f4f1ff;
  --raised: #ffffff;
  --sunken: #ece8fb;

  --display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  /* Rounded terminals, to match the SF Pro Rounded the game itself is set in. The pairing is the
     point: a chunky display face over a warm humanist body, rather than a neutral grotesque that
     would have let the page read as any product's website. */
  --body: "Nunito Sans Var", system-ui, -apple-system, "Segoe UI", sans-serif;

  --border: 3px;
  --radius: 16px;
  --lift: 6px;

  --measure: 68ch;

  /* The whole world is built on one shadow. Offset and colour never vary; only distance does. */
  --shadow: var(--lift) var(--lift) 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
}

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

html {
  background: var(--page);
  /* The scrollbar is part of the page. Left default it is the one grey thing on an indigo site. */
  scrollbar-color: var(--chrome) var(--sunken);
}

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background:
    /* A faint dot grid. It gives the flat fills something to sit on without adding a gradient. */
    radial-gradient(circle at center, rgba(84, 51, 190, 0.13) 1.5px, transparent 1.6px)
      0 0 / 26px 26px,
    var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--reward);
  color: var(--ink);
}

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

/* ---------------------------------------------------------------- type ---- */

h1, h2, h3, .brand-word {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
  text-wrap: balance;
  margin: 0;
}

h1 { font-size: clamp(2.6rem, 7vw, 4.25rem); line-height: 1.12; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.15rem); letter-spacing: -0.025em; }
h3 { font-size: 1.2rem; letter-spacing: -0.02em; }

p, li { text-wrap: pretty; }

a {
  color: var(--chrome-lo);
  font-weight: 600;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
}

a:hover { color: var(--active); }

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
  background: var(--sunken);
  border: 1px solid var(--edge);
  border-radius: 5px;
  padding: 0.1em 0.36em;
}

/* -------------------------------------------------------------- shell ----- */

.shell {
  width: min(100% - 2rem, 78rem);
  margin-inline: auto;
}

.site-header {
  padding: 1.5rem 0 0.5rem;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
}

/* The tile is the app icon's logic in two characters — the same chunky outlined block. */
.brand-tile {
  display: block;
  width: 3rem;
  height: 3rem;
  border: var(--border) solid var(--ink);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  object-fit: cover;
  transform: rotate(-3deg);
}

.brand-word {
  font-size: 1.45rem;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: var(--border) solid var(--ink);
  border-radius: 999px;
  background: var(--raised);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 140ms cubic-bezier(0.2, 0.9, 0.3, 1), box-shadow 140ms;
}

.nav-links a:hover {
  background: var(--edge);
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-sm);
}

.nav-links a[aria-current="page"] {
  background: var(--chrome);
  color: #fff;
}

/* --------------------------------------------------------------- hero ----- */

main { padding-bottom: 4rem; }

.hero {
  margin: 2.5rem 0 3rem;
  max-width: 46ch;
}

.hero h1 {
  /* One authored flourish: the last word of the title carries a highlight block. */
  margin-bottom: 1rem;
}

.hero .lede {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 54ch;
}

.mark {
  display: inline-block;
  padding: 0.04em 0.3em 0.1em;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--reward);
  transform: rotate(-1.2deg);
}

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

.panel {
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  background: var(--raised);
  box-shadow: var(--shadow);
  padding: clamp(1.4rem, 3.5vw, 2.4rem);
}

.panel + .panel { margin-top: 2rem; }

.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }

/* Long-form legal copy. The measure is what makes these readable at all. */
.prose { max-width: var(--measure); }

.prose h2 {
  margin-top: 2.6rem;
  margin-bottom: 0.85rem;
}

.prose h2:first-child { margin-top: 0; }

.prose h3 {
  margin-top: 1.9rem;
  margin-bottom: 0.5rem;
}

.prose p, .prose ul, .prose ol { margin: 0 0 1.1rem; }

.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: 0.5rem; }
.prose li::marker { color: var(--chrome); font-weight: 700; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.4rem;
  font-size: 0.97rem;
}

.prose th, .prose td {
  border: 2px solid var(--ink);
  padding: 0.6rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--sunken);
  font-family: var(--display);
  font-weight: 700;
}

/* A callout that has to be read. Full outline, not a border-left stripe. */
.notice {
  border: var(--border) solid var(--ink);
  border-radius: 12px;
  background: var(--reward);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.15rem;
  margin: 1.5rem 0;
  font-weight: 500;
}

.notice strong { font-weight: 800; }

/* ---------------------------------------------------------- document ----- */

/*
 * Privacy and Terms are long. The reading column stays at its measure and the space beside it
 * carries a contents rail that tracks position, because the reader's real question on a legal
 * document is "where is the part about me" rather than "what does paragraph one say".
 */
.doc-layout {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 64rem) {
  .doc-layout {
    grid-template-columns: minmax(0, 1fr) 15rem;
    align-items: start;
  }
}

.toc {
  position: sticky;
  top: 1.5rem;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  background: var(--raised);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  font-size: 0.94rem;
}

.toc h2 {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
  color: var(--ink-soft);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
}

.toc a {
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  color: var(--ink-soft);
  font-weight: 500;
  text-decoration: none;
  line-height: 1.35;
}

.toc a:hover {
  background: var(--sunken);
  color: var(--ink);
}

.toc a[aria-current="true"] {
  background: var(--chrome);
  color: #fff;
  font-weight: 700;
}

@media (max-width: 63.99rem) {
  .toc { display: none; }
}

/* A document heading does not need the landing page's display scale. */
.hero-doc h1 { font-size: clamp(2.2rem, 5vw, 3.1rem); }
.hero-doc { max-width: 40ch; margin-bottom: 2.5rem; }

/* Anchored headings must not land under the sticky rail. */
.prose h2 { scroll-margin-top: 1.5rem; }

/* ------------------------------------------------------------ landing ----- */

.hero-wide { max-width: 60ch; }

.cta-row { margin: 1.75rem 0 0; }

.cta-note {
  margin: 0.9rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/*
 * Deliberately uneven. Three identical cards in a row is the template this world exists to avoid,
 * so the first panel takes the full width and the other two split beneath it, each with its own
 * fill and its own slight tilt.
 */
.tiles {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(2, 1fr);
  margin: 0 0 2.5rem;
}

.tile {
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.3rem, 3vw, 2rem);
}

.tile h2 { margin-bottom: 0.6rem; }
.tile p { margin: 0; }

.tile-a {
  grid-column: 1 / -1;
  background: var(--reward);
  transform: rotate(-0.5deg);
}

.tile-b {
  background: var(--social);
  transform: rotate(0.6deg);
}

.tile-c {
  background: var(--active);
  transform: rotate(-0.4deg);
}

.panel-flush { max-width: 46rem; }
.panel-lede { color: var(--ink-soft); margin-bottom: 1.5rem; }

@media (max-width: 40rem) {
  .tiles { grid-template-columns: 1fr; }
  .tile { transform: none; }
}

/* --------------------------------------------------------------- cta ------ */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.5rem;
  border: var(--border) solid var(--ink);
  border-radius: 999px;
  background: var(--chrome);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 140ms cubic-bezier(0.2, 0.9, 0.3, 1), box-shadow 140ms;
}

.button:hover {
  color: #fff;
  background: var(--chrome-hi);
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--ink);
}

/* Pressing collapses the shadow: the surface is meeting the page. */
.button:active {
  transform: translate(var(--lift), var(--lift));
  box-shadow: 0 0 0 var(--ink);
}

.button svg { flex: none; }

/* A secondary action sits beside the primary one without competing for the same weight. */
.button.secondary {
  background: var(--raised);
  color: var(--ink);
}

.button.secondary:hover {
  background: var(--edge);
  color: var(--ink);
}

/* The revision date. Quiet, but it is the first thing a reader checks on a legal document. */
.updated {
  display: inline-block;
  margin: 1.5rem 0 0;
  padding: 0.35rem 0.85rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--sunken);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
}

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

.site-footer {
  border-top: var(--border) solid var(--ink);
  background: var(--chrome);
  color: #fff;
  padding: 2.5rem 0;
  margin-top: 4rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  justify-content: space-between;
}

.site-footer p { margin: 0; font-weight: 500; }

.site-footer a {
  color: #fff;
  text-decoration-color: var(--edge);
}

.site-footer a:hover { color: var(--reward); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-weight: 600;
}

/* ------------------------------------------------------------- motion ----- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
