/* EloLeak design system: the TPI sepia editorial language (bg #f9f5ee, white
   cards, #d8cfbb rules, JetBrains Mono for numbers, dark mode) with the
   EloLeak brand accents: tournament-board green + the red leak square. */

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin.woff2") format("woff2");
}

:root {
  --bg: #f9f5ee;
  --card: #ffffff;
  --border: #d8cfbb;
  --hover: #efe7d6;
  --ink: #1a1a1a;
  --mute: #555555;
  --accent: #47702F;
  --accent-deep: #35521F;
  --good: #2a7a2a;
  --bad: #b34a1f;
  --leak: #A6472F;
  --sans: -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15130f; --card: #211e18; --border: #3a352b; --hover: #2a261e;
    --ink: #ece7da; --mute: #a39d8f; --accent: #8fbc5f; --accent-deep: #a8d178;
    --good: #6fbf6f; --bad: #e08a5f; --leak: #d98e76;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: 16px; line-height: 1.55; margin: 0; }
.nums, td.num, .pill, .eyebrow, .tile .v { font-family: var(--mono); }

h1, h2, h3 { line-height: 1.15; text-wrap: balance; margin: 0 0 12px;
  letter-spacing: -0.01em; }
h1 { font-size: 2.5rem; font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 12px; }
a { color: var(--accent-deep); }
.muted { color: var(--mute); }
.small { font-size: .85rem; }
.eyebrow { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin: 0 0 8px; }

.wrap { max-width: 64rem; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 46rem; }

/* --- header ------------------------------------------------------------- */
header.site { position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
header.site .bar { display: flex; align-items: center; justify-content: space-between;
  max-width: 64rem; margin: 0 auto; padding: 12px 20px; }
.wordmark { font-weight: 800; font-size: 1.1rem; text-decoration: none;
  color: var(--ink); display: flex; align-items: center; gap: 9px; }
.wordmark .sq { width: 14px; height: 14px; background: var(--leak);
  display: inline-block; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .wordmark .sq { animation: none; } }
header.site nav { display: flex; align-items: center; gap: 18px; }
header.site nav a { font-size: .85rem; text-decoration: none; color: var(--mute); }
header.site nav a:hover { color: var(--ink); }
header.site nav a.cta { background: var(--accent); color: #fff; font-weight: 700;
  padding: 8px 16px; border-radius: 8px; }
@media (max-width: 640px) { header.site nav a.plain { display: none; } }

/* --- hero ----------------------------------------------------------------- */
.hero { background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 22px 22px; border-bottom: 1px solid var(--border); }
.hero .inner { max-width: 64rem; margin: 0 auto; padding: 64px 20px 56px;
  display: grid; gap: 40px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 900px) { .hero .inner { grid-template-columns: 11fr 9fr; } }
.hero h1 { font-size: clamp(2.4rem, 5vw, 3.3rem); }
.hero .lede { font-size: 1.15rem; color: var(--mute); max-width: 32rem; }
.hero .micro { font-size: .8rem; color: var(--mute); margin-top: 10px;
  font-family: var(--mono); }

/* --- buttons --------------------------------------------------------------- */
button, .btn { font: inherit; font-weight: 700; font-size: 1rem;
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 12px 22px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--accent-deep); }
button.ghost, .btn.ghost { background: transparent; color: var(--ink);
  border: 1px solid var(--border); font-weight: 600; }
button.ghost:hover, .btn.ghost:hover { background: var(--hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
input:focus-visible, select:focus-visible, button:focus-visible,
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- cards + sections -------------------------------------------------------- */
section.block { padding: 52px 0; border-bottom: 1px solid var(--border); }
.card { background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 22px 24px; }
.card.pad-lg { padding: 30px 32px; }
.grid3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.n-badge { font-family: var(--mono); font-weight: 700; color: var(--accent);
  font-size: .95rem; }

/* --- stat tiles (the TPI "at a glance" strip) ---------------------------------- */
.tiles { display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); margin: 18px 0; }
.tile { background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; }
.tile .k { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--mute); font-family: var(--mono); margin-bottom: 4px; }
.tile .v { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.tile .s { font-size: .75rem; color: var(--mute); margin-top: 3px; }
.tile.good .v { color: var(--good); }
.tile.bad .v { color: var(--bad); }
.tile.accent .v { color: var(--accent-deep); }

/* --- mock report (landing hero visual) ------------------------------------------ */
.mockcard { background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 18px 50px -18px rgba(26, 26, 26, .25);
  padding: 20px 22px; }
.mockcard .mhead { display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 14px; }
.mockcard .mhead .t { font-weight: 800; }
.mockcard .tiles { margin: 0 0 14px; gap: 8px;
  grid-template-columns: repeat(3, 1fr); }
.mockcard .tile { padding: 10px 12px; border-radius: 8px; }
.mockcard .tile .v { font-size: 1.15rem; }
.leakline { display: flex; gap: 10px; align-items: baseline; font-size: .85rem;
  padding: 7px 0; border-bottom: 1px dashed var(--border); }
.leakline:last-child { border-bottom: none; }
.leakline .rank { font-family: var(--mono); font-weight: 700; color: var(--leak);
  min-width: 1.2rem; }
.leakline .pts { margin-left: auto; font-family: var(--mono); font-size: .72rem;
  color: var(--mute); white-space: nowrap; }

/* --- forms -------------------------------------------------------------------- */
form.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 10rem; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: .72rem;
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em;
  color: var(--mute); }
input[type=text], input[type=email], select { font: inherit; font-size: 1rem;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--ink); width: 100%; }
.check { display: flex; gap: 9px; align-items: baseline; font-size: .92rem; }
.check input { accent-color: var(--accent); }

/* --- tables ---------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 14px 0; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
th { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--mute); background: var(--hover); }
td.num { font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.worst td { background: color-mix(in srgb, var(--leak) 8%, var(--card)); }
tr:hover td { background: var(--hover); }
tr.worst:hover td { background: color-mix(in srgb, var(--leak) 14%, var(--card)); }

/* --- pills + prose ------------------------------------------------------------------ */
.pill { display: inline-block; font-size: .7rem; padding: 3px 10px;
  border: 1px solid var(--border); border-radius: 99px; color: var(--mute);
  letter-spacing: .04em; background: var(--card); }
.pill.good { color: var(--good); border-color: var(--good); }
.pill.bad { color: var(--bad); border-color: var(--bad); }
.prose-block { border-left: 3px solid var(--accent); background: var(--card);
  border-radius: 0 10px 10px 0; padding: 12px 18px; margin: 12px 0 18px;
  font-size: 1rem; }
.prose-block p { margin: 0; }

.leak-rank { list-style: none; padding: 0; margin: 14px 0; counter-reset: leak; }
.leak-rank li { display: flex; gap: 12px; padding: 11px 16px; align-items: baseline;
  background: var(--card); border: 1px solid var(--border); border-top: none; }
.leak-rank li:first-child { border-top: 1px solid var(--border);
  border-radius: 10px 10px 0 0; }
.leak-rank li:last-child { border-radius: 0 0 10px 10px; }
.leak-rank li::before { counter-increment: leak; content: counter(leak);
  font-family: var(--mono); font-weight: 700; color: #fff; background: var(--leak);
  min-width: 1.5rem; height: 1.5rem; border-radius: 6px; display: inline-flex;
  align-items: center; justify-content: center; font-size: .8rem; }
.leak-rank li:first-child::before { background: var(--leak); }
.leak-rank li:nth-child(n+3)::before { background: var(--mute); }
.leak-rank .pts { margin-left: auto; font-family: var(--mono); font-size: .72rem;
  color: var(--mute); white-space: nowrap; }

/* --- progress + folds ------------------------------------------------------------------ */
.progress { height: 10px; background: var(--hover); border: 1px solid var(--border);
  border-radius: 99px; overflow: hidden; margin: 12px 0; }
.progress > div { height: 100%; background: var(--accent); transition: width .6s ease; }
details.fold { border: 1px solid var(--border); background: var(--card);
  border-radius: 10px; padding: 12px 16px; margin: 10px 0; }
details.fold summary { cursor: pointer; font-weight: 600; font-size: .95rem;
  list-style: none; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::after { content: "+"; float: right; color: var(--mute);
  font-family: var(--mono); }
details.fold[open] summary::after { content: "–"; }

/* --- CSS chessboard (puzzles from your own blunders) ------------------------------ */
.board { display: grid; grid-template-columns: repeat(8, 1fr); width: 100%;
  max-width: 340px; border: 2px solid var(--border); border-radius: 8px;
  overflow: hidden; box-shadow: 0 6px 18px -8px rgba(26,26,26,.25);
  transition: box-shadow .2s ease; }
.board .sq { aspect-ratio: 1; display: flex; align-items: center;
  justify-content: center; font-size: clamp(1.3rem, 4.5vw, 2rem); line-height: 1;
  color: #1a1a1a; user-select: none; }
.board .sq img { width: 88%; height: 88%; display: block; pointer-events: none; }
.pz .board .sq { cursor: pointer; }
.pz .board .sq[data-side]:hover { outline: 2px solid var(--accent-deep);
  outline-offset: -2px; }
.board .sq.l { background: #f0e6cf; }
.board .sq.d { background: #b7a87f; }
.board .sq.sel { outline: 3px solid var(--accent); outline-offset: -3px;
  background: color-mix(in srgb, var(--accent) 25%, #f0e6cf); }
.board.ok { box-shadow: 0 0 0 3px var(--good), 0 6px 18px -8px rgba(26,26,26,.25); }
.board.no { animation: shake .35s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); }
  25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) { .board.no { animation: none; } }
.pz-fb { min-height: 1.2em; margin: 6px 0 0; font-weight: 600; }
.pz-fb.good { color: var(--good); }
.pz-fb.bad { color: var(--bad); }

/* --- progress charts ------------------------------------------------------------ */
.chart-card { background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; }
.chart-card .chart { height: 220px; width: 100%; }
.trend-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.trend-chips .pill { font-size: .74rem; }
.puzzle-grid { display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); margin: 14px 0; }
.puzzle { background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; }
.puzzle .meta { font-family: var(--mono); font-size: .7rem; color: var(--mute);
  letter-spacing: .05em; margin-bottom: 8px; text-transform: uppercase; }
.puzzle details { margin-top: 10px; }
.puzzle details summary { cursor: pointer; font-size: .88rem; font-weight: 600;
  color: var(--accent-deep); list-style: none; }
.puzzle details summary::-webkit-details-marker { display: none; }

.shot { width: 100%; height: auto; display: block; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 14px 40px -16px rgba(26,26,26,.3); }

/* --- footer -------------------------------------------------------------------------------- */
footer.site { padding: 28px 0 48px; font-size: .78rem; color: var(--mute);
  font-family: var(--mono); }
footer.site a { color: var(--mute); }
