/* KesPrep -- one stylesheet for the whole site: the landing page (/) and the
   product (/app) share these exact tokens and classes, copied verbatim from
   the landing page Design artifact, so the two never look like different
   products again. "Look: black and white like the board and the evaluation
   bar. One signal colour (red) is used only where a mistake is shown." */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500..800&family=Instrument+Sans:wght@400..600&family=JetBrains+Mono:wght@400..500&display=swap');

:root {
  --paper: #F3F5F6;
  --ink: #0F1417;
  --muted: #4C5861;
  --line: #D3D9DD;
  --red: #C8321A;
  --red-on-dark: #FF6B4A;
  --night: #0F1417;
  --night-muted: #A9B4BC;
  --sq-light: #E4E8EB;
  --sq-dark: #9FAAB3;
  color-scheme: light;
}
html { background: var(--paper); min-height: 100%; scroll-behavior: smooth; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.55;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 {
  font-family: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.h1 { font-weight: 800; font-size: clamp(32px, 6.2vw, 56px); line-height: 1.04; letter-spacing: -0.03em; }
.h2 { font-weight: 700; font-size: clamp(24px, 4vw, 32px); line-height: 1.1; }
.h3 { font-weight: 700; font-size: 20px; line-height: 1.25; }
.lead { font-size: clamp(16px, 1.6vw, 19px); color: var(--muted); max-width: 52ch; }
.eyebrow { font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 500; font-size: 13px; line-height: 1.3; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.bignum { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: clamp(48px, 9vw, 96px); line-height: 0.92; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.wrap { max-width: 1200px; margin: 0 auto; padding-left: clamp(16px, 4vw, 40px); padding-right: clamp(16px, 4vw, 40px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; box-sizing: border-box;
  border: 1.5px solid var(--ink); border-radius: 10px;
  font-family: 'Instrument Sans', system-ui, sans-serif; font-weight: 600; font-size: 16px; line-height: 1;
  text-decoration: none; cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover:not(:disabled) { background: #26323A; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); transform: translateY(-1px); }
.btn-sm { min-height: 42px; padding: 0 16px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:focus-visible, .field:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.field {
  box-sizing: border-box; min-height: 48px; min-width: 0; padding: 0 16px;
  border: 1.5px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink);
  font-family: 'Instrument Sans', system-ui, sans-serif; font-weight: 500; font-size: 16px;
}
.field::placeholder { color: #6A767F; }
.navlink {
  color: var(--ink); text-decoration: none; padding: 6px 0;
  background: linear-gradient(var(--ink), var(--ink)) 0 100% / 0 1.5px no-repeat;
  transition: background-size 0.25s ease;
}
.navlink:hover { background-size: 100% 1.5px; }
.textlink { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.textlink:hover { text-decoration-thickness: 2px; }
.tag { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; letter-spacing: 0.04em; border: 1px solid var(--muted); color: var(--muted); border-radius: 999px; padding: 1px 9px; white-space: nowrap; }

details { border-top: 1px solid var(--line); }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  cursor: pointer; list-style: none; padding: 22px 0;
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 22px; letter-spacing: -0.01em;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-family: 'JetBrains Mono', monospace; font-weight: 400; font-size: 22px; }
details[open] summary::after { content: "\2013"; }
.dbody { padding: 0 0 24px; max-width: 68ch; color: var(--muted); display: flex; flex-direction: column; gap: 12px; }

.error { color: var(--red); font-size: 15px; margin-top: 12px; display: none; }
.error.show { display: block; }
.hidden { display: none; }

/* The KesPrep mark: identical everywhere -- landing header, app header, footer. */
.mark { display: block; box-sizing: border-box; border: 2px solid var(--ink); background: repeating-conic-gradient(var(--ink) 0 25%, transparent 0 50%); flex: none; }

@keyframes rise { from { transform: translateY(10px); } to { transform: translateY(0); } }
.rise { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.rise-2 { animation-delay: 0.12s; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .rise, .btn, .navlink { animation: none; transition: none; } }

/* ----------------------------------------------------------------------- */
/* The app shell (/app): same tokens and classes above, arranged as a       */
/* sidebar + content layout instead of a scrolling marketing page.          */
/* ----------------------------------------------------------------------- */

.app-header {
  display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
}
.app-body { display: flex; align-items: flex-start; }
.sidebar { width: 200px; flex: none; padding: 28px 0; display: none; }
.sidebar-link {
  display: flex; align-items: center; gap: 8px; padding: 9px clamp(16px, 3vw, 32px);
  color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500;
  border-left: 2px solid transparent;
}
.sidebar-link:hover { color: var(--ink); background: #FFFFFF; }
.sidebar-link.active { color: var(--ink); border-left-color: var(--ink); font-weight: 600; background: #FFFFFF; }
.sidebar-link .tag { margin-left: auto; }
.app-main { flex: 1; min-width: 0; padding: 40px clamp(16px, 3vw, 40px) 72px; }
.app-main-inner { max-width: 760px; }

/* Onboarding, inside the app shell */
.app-welcome { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 6vh; }
.app-welcome .mark { width: 40px; height: 40px; border-width: 3px; margin-bottom: 18px; }
.app-welcome .h1 { font-size: clamp(28px, 5vw, 38px); }
.app-welcome .lead { margin-top: 10px; }
.app-welcome-card { width: min(520px, 100%); margin-top: 28px; text-align: left; display: flex; flex-direction: column; gap: 14px; }

.progress-track { width: 100%; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 22px; }
.progress-fill { height: 100%; background: var(--ink); width: 3%; transition: width 0.4s ease; }

/* A panel: a flat, bordered block -- no shadow, same radius language as .field/.btn. */
.panel { border: 1px solid var(--line); border-radius: 10px; padding: 20px clamp(18px, 3vw, 26px); background: #fff; }
.panel-accent { border-left: 3px solid var(--ink); }
.panel-title { font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.swatch { display: inline-block; width: 20px; height: 4px; border-radius: 2px; flex: none; margin-top: 7px; }
.swatch-bad { background: var(--red); }
.swatch-good { background: var(--ink); }

.facts { display: flex; flex-wrap: wrap; gap: 10px 40px; }

.rule-list { display: flex; flex-direction: column; }
.rule-row { display: flex; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.rule-row:first-child { border-top: none; }
a.rule-row { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 4px; padding-left: 0; }
a.rule-row:hover .title { text-decoration: underline; text-underline-offset: 3px; }
.rule-row .title { font-weight: 600; font-size: 15px; }
.rule-row .detail { color: var(--muted); font-size: 14px; flex: 1; min-width: 0; }
.rule-row .num { font-size: 14px; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }

.band { background: var(--night); color: var(--paper); border-radius: 10px; padding: 26px clamp(18px, 4vw, 30px); }
.band .eyebrow { color: var(--night-muted); }
.band p { color: var(--night-muted); max-width: 44ch; margin-top: 12px; }

.app-footer { border-top: 1px solid var(--line); margin-top: 48px; padding-top: 22px; padding-bottom: 8px; font-size: 14px; color: var(--muted); }

/* Views: one page section shown at a time (see app.js's router). */
.view { display: block; }

/* Games table: plain rows on the page background, the same rule-list look as the rest of the app. */
.data-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.data-table th {
  text-align: left; font-family: 'Instrument Sans', sans-serif; font-weight: 600; font-size: 13px;
  color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #FFFFFF; }
.data-table .num { text-align: right; font-family: 'JetBrains Mono', monospace; }

/* Result labels: wins in ink, losses in red, draws muted. Same colours as the swatches above. */
.result-win { color: var(--ink); font-weight: 600; }
.result-loss { color: var(--red); font-weight: 600; }
.result-draw { color: var(--muted); font-weight: 600; }

@media (min-width: 900px) { .sidebar { display: block; } }
@media (max-width: 900px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
