/*
 * Gridbench site — one stylesheet for every page.
 *
 * Unlike the studio site, this one is SUPPOSED to look like the product. Someone
 * who saw the icon or a screenshot has to recognise the same thing here, so the
 * palette is the app's own, straight from docs/design/DESIGN.md.
 *
 * It has to serve two very different kinds of page: the hand-written landing and
 * challenge pages, and the legal pages generated from docs/*.md by
 * scripts/build-site-docs.mjs. The generated ones are plain prose — h2, p, table,
 * ul — with no classes to hook onto, so everything below the component section
 * styles bare elements and stays readable without them.
 */

:root {
  --deep: #020617;      /* palette.surfaceDeep — what the app paints behind everything */
  --card: #0f172a;
  --raised: #1e293b;
  --outline: #334155;
  --text: #f8fafc;
  --muted: #bccbb9;
  --faint: #94a3b8;

  /*
   * Two greens, and the split is deliberate rather than sloppy.
   *
   * #4BE277 is the app's primary — it fills the lit tiles, so the mark on this
   * page matches the icon exactly. #6FFF92 is one step brighter and is used only
   * for small uppercase type: at 10–14px the darker green loses too much against
   * near-black, and these labels carry the section structure.
   */
  --accent: #4be277;
  --accent-text: #6fff92;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--deep);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

/* ─────────────── header ─────────────── */

.bar {
  height: 64px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--outline);
  padding: 0 40px;
}

/*
 * The wordmark only. The mockup had settings and history buttons up here; on a
 * static page they are controls that do nothing, which is the same defect as a
 * link to nowhere, just quieter.
 */
.bar a {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--accent-text);
  text-decoration: none;
}

/* ─────────────── layout ─────────────── */

main {
  max-width: 1024px;
  margin: 0 auto;
  padding: 56px 40px 0;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -1.6px;
  max-width: 14ch;
}

h2 {
  margin: 0 0 24px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.96px;
  color: var(--text);
}

p { color: var(--muted); }
strong { color: var(--text); }
a { color: var(--accent-text); }

.lede {
  margin: 24px 0 0;
  font-size: 16px;
  color: var(--muted);
}

/* ─────────────── hero ─────────────── */

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 64px;
  margin-bottom: 96px;
}

.hero-copy { flex: 1 1 auto; min-width: 0; }

/*
 * The mark, drawn in CSS rather than fetched.
 *
 * It is the same nine squares as the app icon, so it costs no request, scales
 * with the layout, and cannot drift from the icon by being a stale export.
 */
.mark {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 17px;
  width: 256px;
  height: 256px;
  padding: 17px;
  background: var(--card);
  border: 1px solid var(--outline);
  border-radius: 2px;
}

.mark i {
  border-radius: 2px;
  background: var(--raised);
  border: 1px solid var(--outline);
}

.mark i.on {
  background: var(--accent);
  border-color: var(--accent);
}

/* ─────────────── call to action ─────────────── */

.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  padding: 12px 24px;
  background: var(--raised);
  border: 1px solid var(--outline);
  border-radius: 2px;
  color: var(--text);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  text-decoration: none;
}

a.cta:hover { border-color: var(--accent); }

/*
 * Pre-release state. The app is not on the App Store yet, so there is nothing to
 * link to — and a button that goes nowhere is worse than no button, on a page
 * whose visitors arrive specifically to install something.
 *
 * ⚠️ At release: swap this span for an <a> carrying Apple's official badge
 * asset. The badge artwork is Apple's and may not be redrawn or recoloured, so
 * this element is a placeholder, not a design.
 */
span.cta { color: var(--faint); cursor: default; }

/* ─────────────── focus pages: /c/ and /d/ ─────────────── */

/*
 * Both are reached from a link someone else shared, and both have exactly one
 * action. So they get a centred single column instead of the landing's two — the
 * page should end before it asks a second thing of anyone.
 */
main.focus {
  max-width: 672px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 40px;
  padding-top: 96px;
}

main.focus h1 { max-width: 18ch; }
main.focus .lede { max-width: 46ch; margin: 0; }
main.focus .cta { margin-top: 0; }

.pill {
  margin: 0;
  padding: 4px 12px;
  border: 1px solid var(--accent-text);
  border-radius: 2px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent-text);
}

/*
 * A real Daily result, not an illustration of one.
 *
 * Seven cells in a row, because that is what `outcomeGrid()` produces — the
 * mockup drew a 3x3 of nine, which would teach a shape nobody ever receives. All
 * four states appear, including the yellow one the mockup omitted: without it
 * the graphic implies a round is either won or lost, when the grid's whole point
 * is that it also encodes speed.
 */
.result {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--outline);
  border-radius: 2px;
}

.result i {
  width: 40px;
  height: 40px;
  border-radius: 2px;
  background: var(--raised);
  border: 1px solid var(--outline);
}

.result i.fast { background: var(--accent); border-color: var(--accent); }
.result i.slow { background: #facc15; border-color: #facc15; }
.result i.strike { background: #ef4444; border-color: #ef4444; }

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  margin: -24px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--faint);
}

.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend b { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend b.fast { background: var(--accent); }
.legend b.slow { background: #facc15; }
.legend b.strike { background: #ef4444; }
.legend b.missed { background: var(--raised); border: 1px solid var(--outline); }

/*
 * The single instruction on a focus page.
 *
 * Left-aligned and monospaced while everything around it is centred prose,
 * because it is the one thing on the page to be *followed* rather than read. The
 * accent sits on the top edge only — a full accent border would make it shout
 * over the heading it is subordinate to.
 */
.note {
  width: 100%;
  padding: 24px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--outline);
  border-top: 2px solid var(--accent);
  border-radius: 2px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.7px;
  color: #dce1fb;
}

.note p { margin: 0; color: inherit; }

/* ─────────────── the measures list ─────────────── */

.measures { margin-bottom: 96px; }

.measures dl { margin: 0; }

.measures div {
  display: flex;
  align-items: baseline;
  gap: 64px;
  padding: 16px 0;
}

.measures dt {
  flex: none;
  width: 192px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--accent-text);
}

.measures dd { margin: 0; color: var(--muted); }

/* ─────────────── cards ─────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 64px;
  margin-bottom: 96px;
}

.card {
  padding: 32px;
  background: var(--card);
  border: 1px solid var(--outline);
  border-radius: 2px;
}

/* One card carries the accent so the pair is not two identical boxes. */
.card.lead { border-top: 2px solid var(--accent); }

.card h3 {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text);
}

.card p { margin: 0; font-size: 14px; line-height: 1.5; }

/* ─────────────── disclaimer ─────────────── */

/*
 * Quiet, but present on every page that describes what the app does. It is not
 * legal boilerplate bolted on — the positioning in CLAUDE.md forbids health
 * claims, and this is where the page says so out loud.
 */
.disclaimer {
  max-width: 672px;
  margin: 0 auto 48px;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  opacity: 0.6;
}

/* ─────────────── footer ─────────────── */

footer {
  margin-top: 96px;
  padding: 32px 20px;
  border-top: 1px solid var(--outline);
  text-align: center;
  opacity: 0.6;
}

footer a,
footer span {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  margin: 0 16px;
}

footer a:hover { color: var(--accent-text); }
footer .copyright { display: block; margin-top: 16px; }

/* ─────────────── prose: the generated legal pages ─────────────── */

/*
 * These have no classes — the generator emits plain markdown output — so the
 * rules below have to work on bare elements. They deliberately narrow the column:
 * the landing runs to 1024px, but a privacy policy read end to end needs a
 * measure a person can actually follow.
 */
main.prose { max-width: 720px; padding-bottom: 48px; }

main.prose h1 { max-width: none; margin-bottom: 32px; }
main.prose h2 { margin: 48px 0 16px; font-size: 20px; letter-spacing: -0.4px; }
main.prose p,
main.prose li { color: var(--muted); }
main.prose li { margin-bottom: 8px; }
main.prose blockquote {
  margin: 24px 0;
  padding-left: 20px;
  border-left: 2px solid var(--outline);
}

main.prose table { border-collapse: collapse; width: 100%; margin: 24px 0; font-size: 14px; }
main.prose th,
main.prose td {
  text-align: left;
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--outline);
  vertical-align: top;
}
main.prose th { color: var(--text); font-weight: 600; }
main.prose td { color: var(--muted); }

main.prose footer { text-align: left; margin-top: 64px; }
main.prose footer a { margin: 0 16px 0 0; }

/* ─────────────── narrow screens ─────────────── */

/*
 * A phone is where a shared /c/ link gets opened, so the single-column fallback
 * is the common case rather than the edge one. Nothing reorders: the sequence is
 * already what someone should read top to bottom.
 */
@media (max-width: 860px) {
  .bar { padding: 0 20px; }
  main { padding: 40px 20px 0; }
  h1 { font-size: 26px; letter-spacing: -1px; max-width: none; }
  h2 { font-size: 20px; }

  .hero { flex-direction: column; align-items: flex-start; gap: 32px; margin-bottom: 48px; }
  /*
   * Deliberately small here. At full width the mark eats the whole first screen,
   * and on /c/ that pushes the one instruction that matters below the fold — for
   * a visitor who arrived from a friend's chat on a phone, which is the common
   * case rather than the edge one.
   */
  .mark { width: 160px; height: 160px; gap: 6.6%; padding: 6.6%; }

  .measures div { flex-direction: column; gap: 6px; padding: 14px 0; }
  .measures dt { width: auto; }

  .cards { grid-template-columns: 1fr; gap: 24px; margin-bottom: 64px; }
  .card { padding: 24px; }

  main.focus { padding-top: 56px; gap: 32px; }
  /* Seven cells plus gutters have to survive a 375pt phone with the page's own
     20px padding — the strip is the point of the page, so it shrinks rather
     than wraps or scrolls. */
  .result { gap: 6px; padding: 10px; }
  .result i { width: 36px; height: 36px; }
  .note { padding: 20px; }

  footer { margin-top: 64px; }
  footer a, footer span { display: inline-block; margin: 4px 10px; }
}
