/* pitchperfect -- soccer-themed static site, nav styled after the
   microprediction sites (humpday / schur). */
:root {
  --pitch: #2f8f4e;
  --pitch-stripe: #2a8347;
  --pitch-line: rgba(255, 255, 255, 0.85);
  --blue: #1f6feb;
  --red: #e5484d;
  --ink: #14241b;
  --muted: #5b6b62;
  --bg: #f6f8f6;
  --card: #ffffff;
  --accent: #1a7f4b;
  --border: #dde5df;
}

* { box-sizing: border-box; }

/* Reserve the scrollbar gutter on every page so the nav (and content) don't
   shift horizontally when navigating between short and tall pages. */
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1.5rem;
  background: #0e2a1b;
  color: #fff;
  border-bottom: 3px solid var(--accent);
  flex-wrap: wrap;
}
header.nav .brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  color: #fff;
}
header.nav .brand .pp-ball { margin-right: 0.4rem; }
header.nav nav { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-left: auto; }
header.nav nav a { color: #cfe9d8; font-size: 0.93rem; }
header.nav nav a:hover { color: #fff; text-decoration: none; }

main { max-width: 1040px; margin: 0 auto; padding: 1.5rem; }

h1 { font-size: 2rem; margin: 0.4rem 0 0.2rem; }
h2 { font-size: 1.35rem; margin-top: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 70ch; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.55rem 1.05rem;
  border-radius: 6px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.btn:hover { background: #15683d; text-decoration: none; }
.btn.secondary { background: #eef3ef; color: var(--ink); border: 1px solid var(--border); }
.btn.secondary:hover { background: #e3ebe5; }

code, .mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }
pre { background: #0e2a1b; color: #d7f0e0; padding: 1rem; border-radius: 8px; overflow-x: auto; }
pre code { color: inherit; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1.25rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

footer { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 2rem 1rem; border-top: 1px solid var(--border); margin-top: 2rem; }

/* --- interactive demo --- */
.demo-wrap { display: grid; grid-template-columns: 1fr 280px; gap: 1.25rem; align-items: start; }
@media (max-width: 880px) { .demo-wrap { grid-template-columns: 1fr; } }

.pitch-box { position: relative; }
canvas#pitch { width: 100%; height: auto; border-radius: 10px; box-shadow: 0 2px 14px rgba(0,0,0,0.12); cursor: grab; touch-action: none; }
canvas#pitch.dragging { cursor: grabbing; }

.panel { display: flex; flex-direction: column; gap: 1rem; }
.panel .card { padding: 0.9rem 1rem; }

.meter { height: 30px; border-radius: 6px; background: linear-gradient(90deg, var(--red), #eee 50%, var(--blue)); position: relative; overflow: hidden; border: 1px solid var(--border); }
.meter .needle { position: absolute; top: -3px; width: 3px; height: 36px; background: #111; left: 50%; transition: left 0.08s ease-out; }
.vrow { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--muted); margin-top: 0.35rem; }
.vbig { font-size: 1.9rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.vbig small { font-size: 0.8rem; color: var(--muted); font-weight: 500; display: block; }

label.field { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem; }
select, .controls .btn { width: 100%; }
select { padding: 0.5rem; border-radius: 6px; border: 1px solid var(--border); background: #fff; font-size: 0.95rem; }
.controls { display: flex; flex-direction: column; gap: 0.5rem; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; border: none; background: #fff; padding: 0.5rem; cursor: pointer; font-size: 0.9rem; }
.seg button.active { background: var(--accent); color: #fff; }
.hint { font-size: 0.82rem; color: var(--muted); }
.legend { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--muted); }
.legend .bar { height: 10px; flex: 1; border-radius: 5px; background: linear-gradient(90deg, #2b3a8f, #2f8f4e, #f4e04d, #e5484d); }
.badge { display: inline-block; font-size: 0.72rem; background: #eef3ef; color: var(--accent); padding: 0.15rem 0.5rem; border-radius: 999px; border: 1px solid var(--border); }

.probe-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.probe-table th, .probe-table td { text-align: right; padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.probe-table td:first-child, .probe-table th:first-child { text-align: left; color: var(--muted); }
.probe-table th.bl { color: var(--blue); }
.probe-table th.rd { color: var(--red); }
