/* Guess Grid — guessgrid.rmurphy.dev
   One stylesheet, system fonts, no frameworks. Colours are the app's own. */

:root {
  --bg: #ffffff;
  --surface: #f2f2f7;
  --surface-raised: #ffffff;
  --text: #1c2430;
  --muted: #5b6472;
  --rule: #d9dce3;
  --accent: #2b7d47;          /* links, buttons: 5.1:1 on white */
  --accent-strong: #236a3b;
  --on-accent: #ffffff;
  --tile-red: #c24a42;
  --tile-amber: #dea121;
  --tile-green: #2b7d47;
  --ink-on-amber: #1c2430;
  --bar-muted: #808080;       /* 3.5:1 on --surface */
  --bar-accent: #2b7d47;
  --shadow: 0 18px 40px rgba(28, 36, 48, 0.16);
  --radius: 14px;
  --measure: 40rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216;
    --surface: #1a1e24;
    --surface-raised: #232830;
    --text: #eef1f5;
    --muted: #a5adb9;
    --rule: #2f3540;
    --accent: #5cc08a;
    --accent-strong: #7fd3a4;
    --on-accent: #0f1216;
    --bar-muted: #8a8f98;
    --bar-accent: #5cc08a;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216;
  --surface: #1a1e24;
  --surface-raised: #232830;
  --text: #eef1f5;
  --muted: #a5adb9;
  --rule: #2f3540;
  --accent: #5cc08a;
  --accent-strong: #7fd3a4;
  --on-accent: #0f1216;
  --bar-muted: #8a8f98;
  --bar-accent: #5cc08a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img, video, svg { display: block; max-width: 100%; height: auto; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.3rem, 6vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3.8vw, 2.4rem); font-weight: 750; }
h3 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: var(--on-accent); padding: 0.6rem 1rem; z-index: 10;
}
.skip:focus { left: 1rem; top: 1rem; }

.wrap { width: min(72rem, 100% - 2rem); margin-inline: auto; }
.narrow { width: min(var(--measure), 100% - 2rem); margin-inline: auto; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap { display: flex; align-items: center; gap: 1rem; min-height: 3.75rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--text); text-decoration: none; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.site-header nav { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; font-size: 0.95rem; }
.site-header nav a { white-space: nowrap; }
.site-header nav a:not(.button) { color: var(--muted); text-decoration: none; }
.site-header nav a:not(.button):hover, .site-header nav a[aria-current="page"] { color: var(--text); }

.button {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--accent); color: var(--on-accent);
  padding: 0.8rem 1.35rem; border-radius: 999px;
  font-weight: 650; text-decoration: none; line-height: 1.2;
}
.button:hover { background: var(--accent-strong); color: var(--on-accent); }
.button.small { padding: 0.5rem 0.95rem; font-size: 0.9rem; }
.button svg { width: 1.1em; height: 1.1em; fill: currentColor; }

/* Apple's badge, unmodified: 48px tall (minimum 40), with at least a
   quarter of its height clear on every side. */
.badge { display: inline-block; padding: 12px 0; margin: -12px 0; line-height: 0; }
.badge img { height: 48px; width: auto; }

/* Hero */
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(2rem, 5vw, 4rem); }
.hero .wrap { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero .lede { font-size: clamp(1.15rem, 2.2vw, 1.35rem); color: var(--muted); max-width: 32rem; }
.hero .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; margin-top: 1.75rem; }
.hero .note { font-size: 0.95rem; color: var(--muted); }
.eyebrow { font-weight: 650; color: var(--accent); margin-bottom: 0.75rem; letter-spacing: 0.01em; }

/* Phone-shaped media: rounded, bordered, never a drawn device. */
.phone {
  width: min(100%, 300px);
  margin-inline: auto;
  border-radius: 38px;
  border: 1px solid var(--rule);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--surface);
  aspect-ratio: 600 / 1304;
}
.phone video, .phone img { width: 100%; height: 100%; object-fit: cover; }
.video-note { text-align: center; font-size: 0.85rem; color: var(--muted); margin-top: 0.9rem; }

/* Sections */
section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
section.alt { background: var(--surface); }
.section-head { max-width: 42rem; margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }
.section-head p { color: var(--muted); font-size: 1.1rem; }

.feature { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.feature.flip > :first-child { order: 2; }
.feature ul { padding-left: 1.2rem; margin: 0 0 1em; }
.feature li { margin-bottom: 0.4rem; }

.screens { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1rem, 3vw, 2rem); }
.screens figure { margin: 0; }
.screens .phone { width: 100%; border-radius: 28px; }
.screens figcaption { font-size: 0.95rem; color: var(--muted); margin-top: 0.9rem; }
.screens figcaption strong { color: var(--text); display: block; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 3vw, 1.75rem); }
.pair .phone { width: 100%; border-radius: 28px; }

.terms {
  margin-top: 1.25rem; padding: 1rem 1.2rem;
  border-radius: var(--radius); background: var(--surface-raised);
  border: 1px solid var(--rule); font-size: 0.98rem;
}
section.alt .terms { background: var(--bg); }

.points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.points > div { padding: 1.4rem; border-radius: var(--radius); background: var(--surface); }
.points h3 { margin-bottom: 0.35rem; }
.points p { color: var(--muted); margin: 0; }

.cta { text-align: center; }
.cta p { color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding: 2.5rem 0 3rem; font-size: 0.92rem; color: var(--muted); }
.site-footer .wrap { display: grid; gap: 1rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.site-footer p { margin: 0; max-width: 46rem; }

/* Tiles, as the app draws them: colour plus an icon, never colour alone. */
.tiles { display: flex; gap: 6px; margin: 0.35rem 0; }
.tile {
  --size: 2.6rem;
  width: var(--size); height: var(--size); border-radius: 7px;
  display: grid; place-items: center; position: relative;
  font-weight: 750; font-size: 1.2rem; color: #fff; letter-spacing: 0;
  background: var(--tile-red);
}
.tile.a { background: var(--tile-amber); color: var(--ink-on-amber); }
.tile.g { background: var(--tile-green); }
.tile.blank { background: transparent; color: var(--text); border: 2px solid var(--rule); }
.tile::after { position: absolute; top: 1px; right: 4px; font-size: 0.62rem; font-weight: 800; }
.tile.r::after { content: "✕"; }
.tile.a::after { content: "⇆"; }
.tile.g::after { content: "✓"; }
.tile-row { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; margin: 0.6rem 0; }
.tile-row .label { font-size: 0.95rem; color: var(--muted); }

/* Article (how the ranking works) */
.article { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(3rem, 7vw, 5rem); }
.article h1 { font-size: clamp(2.1rem, 5vw, 3rem); }
.article h2 { font-size: clamp(1.45rem, 3vw, 1.85rem); margin-top: 2.6em; }
.article .lede { font-size: 1.2rem; color: var(--muted); }
.article ol.toc { padding-left: 1.3rem; color: var(--muted); }
.article ol.toc a { color: var(--text); }
.panel {
  background: var(--surface); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; margin: 1.5rem 0;
}
.panel > :last-child { margin-bottom: 0; }
.formula {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 1.02rem; background: var(--surface); border-radius: 10px;
  padding: 1rem 1.2rem; overflow-x: auto; white-space: nowrap;
}
.mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }
.groups { display: grid; gap: 0.5rem; margin: 0.75rem 0 1.25rem; padding: 0; list-style: none; }
.groups li { display: flex; flex-wrap: wrap; gap: 0.4rem 0.75rem; align-items: center; }
.chip {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 0.92rem;
  padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--surface-raised);
  border: 1px solid var(--rule);
}

table { border-collapse: collapse; width: 100%; margin: 1.25rem 0; font-size: 0.98rem; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 650; color: var(--muted); font-size: 0.9rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.best td { font-weight: 650; }
.table-wrap { overflow-x: auto; }

/* Split bars */
.splits { margin: 1.5rem 0; display: grid; gap: 1.2rem; }
.split .caption { font-size: 0.95rem; margin-bottom: 0.35rem; }
.split .caption strong { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }
.split svg { width: 100%; height: 16px; }
.split .seg { fill: var(--bar-muted); }
.split.accent .seg { fill: var(--bar-accent); }
.legend-note { font-size: 0.9rem; color: var(--muted); }

.callout { border-left: 4px solid var(--accent); padding: 0.2rem 0 0.2rem 1rem; margin: 1.5rem 0; }

@media (max-width: 860px) {
  .hero .wrap, .feature { grid-template-columns: 1fr; }
  .feature.flip > :first-child { order: 0; }
  .points { grid-template-columns: 1fr; }
  .site-header nav a.hide-sm { display: none; }
}
@media (max-width: 560px) {
  .site-header nav a.hide-xs { display: none; }
}
@media (max-width: 640px) {
  .screens { grid-template-columns: 1fr; max-width: 300px; margin-inline: auto; }
  .tile { --size: 2.2rem; font-size: 1.05rem; }
  th, td { padding: 0.5rem 0.45rem; font-size: 0.9rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
