/* PickleEngine landing page. No build step, no external requests. */

:root {
  color-scheme: dark light;
  --bg: #0b0d0a;
  --bg-raised: #12150f;
  --line: #262b20;
  --line-strong: #3a4130;
  --text: #e9ecdf;
  --muted: #a4ab97;
  --accent: #c3ee4b;
  --accent-ink: #10140a;
  --accent-soft: rgba(195, 238, 75, 0.1);
  --grid: rgba(195, 238, 75, 0.045);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 68rem;
  --pad: clamp(1.1rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6ef;
    --bg-raised: #ffffff;
    --line: #dcdfd0;
    --line-strong: #b9bea8;
    --text: #161a10;
    --muted: #535a45;
    --accent: #3c6400;
    --accent-ink: #ffffff;
    --accent-soft: rgba(60, 100, 0, 0.08);
    --grid: rgba(60, 100, 0, 0.06);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--sans);
  text-rendering: optimizeLegibility;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }

a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute; left: var(--pad); top: -4rem;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.5rem 0.9rem; font-weight: 600; text-decoration: none; z-index: 10;
}
.skip:focus { top: 0.75rem; }

code, .mono { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--accent-soft); padding: 0.08em 0.35em; border-radius: 3px; overflow-wrap: anywhere; }

/* ---------- top bar ---------- */

.top {
  border-bottom: 1px solid var(--line);
}
.top .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 3.5rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font: 600 0.95rem/1 var(--mono); letter-spacing: 0.01em;
  color: var(--text); text-decoration: none;
}
.brand svg { width: 1.35rem; height: 1.35rem; flex: none; }
.top nav { display: flex; gap: 1.35rem; font-size: 0.9rem; }
.top nav a { color: var(--muted); text-decoration: none; padding: 0.4rem 0; }
.top nav a:hover { color: var(--text); }
.top nav a.nav-fund { color: var(--accent); font-weight: 600; }
@media (max-width: 40rem) { .top nav a.opt { display: none; } }

/* ---------- hero ---------- */

.hero {
  position: relative;
  border-bottom: 1px solid var(--line);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 2.5rem 2.5rem;
  background-position: center top;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 20% 0%, transparent 30%, var(--bg) 85%);
}
.hero .wrap { position: relative; z-index: 1; padding-top: clamp(3rem, 9vw, 6.5rem); padding-bottom: clamp(2.5rem, 7vw, 5rem); }

.eyebrow {
  font: 500 0.78rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 1.1rem;
}

h1 {
  font-size: clamp(2.6rem, 9.5vw, 5.75rem);
  line-height: 0.98; letter-spacing: -0.035em; font-weight: 700;
  margin: 0 0 1.4rem;
}
h1 span { color: var(--accent); }

.lede {
  font-size: clamp(1.1rem, 2.3vw, 1.4rem); line-height: 1.5;
  max-width: 40rem; margin: 0 0 2.2rem; color: var(--text);
}

.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem 1.4rem; }
.cta-note { color: var(--muted); font-size: 0.9rem; max-width: 22rem; margin: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 650; font-size: 1.02rem; line-height: 1.2;
  padding: 0.9rem 1.35rem; border-radius: 0.5rem;
  text-decoration: none; border: 1px solid var(--accent);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 22px -8px var(--accent); }
.btn:active { transform: translateY(0); }
.btn svg { width: 1.15rem; height: 1.15rem; flex: none; }

.stats {
  list-style: none; margin: clamp(2.5rem, 6vw, 4rem) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line-strong); border-radius: 0.6rem;
  background: var(--bg-raised); overflow: hidden;
}
.stats li { padding: 1.15rem 1.25rem 1.2rem; border-left: 1px solid var(--line); min-width: 0; }
.stats li:first-child { border-left: 0; }
.stats .num {
  display: block; font: 600 clamp(1.5rem, 3.4vw, 2.2rem)/1.1 var(--mono);
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.stats .unit { font-size: 0.5em; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 0.25em; }
.stats .label { display: block; margin-top: 0.5rem; font-size: 0.86rem; line-height: 1.4; color: var(--muted); }
.stats .delta { color: var(--accent); font-family: var(--mono); font-size: 0.95em; white-space: nowrap; }
@media (max-width: 52rem) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats li:nth-child(3) { border-left: 0; }
  .stats li:nth-child(n+3) { border-top: 1px solid var(--line); }
}
.stats-note { color: var(--muted); font-size: 0.86rem; margin: 0.9rem 0 0; }

/* ---------- sections ---------- */

section { padding: clamp(3rem, 8vw, 5.5rem) 0; border-bottom: 1px solid var(--line); }

.sec-head { display: grid; grid-template-columns: 4.5rem 1fr; gap: 0 1rem; align-items: baseline; margin-bottom: 2rem; }
.sec-num { font: 500 0.8rem/1 var(--mono); color: var(--accent); letter-spacing: 0.08em; }
h2 { font-size: clamp(1.55rem, 3.6vw, 2.25rem); line-height: 1.15; letter-spacing: -0.02em; margin: 0; font-weight: 650; }
.sec-head p { grid-column: 2; margin: 0.7rem 0 0; color: var(--muted); max-width: 42rem; }
.body { margin-left: 5.5rem; }
@media (max-width: 52rem) {
  .sec-head { grid-template-columns: 1fr; }
  .sec-num { margin-bottom: 0.7rem; }
  .sec-head p { grid-column: 1; }
  .body { margin-left: 0; }
}

.body > p { max-width: 42rem; margin: 0 0 1.1rem; }
.body > p.formula { max-width: 46rem; margin: 1.5rem 0 0; }
.small { font-size: 0.9rem; color: var(--muted); }

/* differences */
.diff { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 0.6rem; overflow: hidden; }
.diff li { background: var(--bg); padding: 1.4rem 1.5rem 1.5rem; }
.diff h3 { font-size: 1.05rem; line-height: 1.3; margin: 0 0 0.5rem; font-weight: 650; }
.diff p { margin: 0; color: var(--muted); font-size: 0.97rem; line-height: 1.6; }
.diff strong { color: var(--text); font-weight: 600; }
@media (max-width: 46rem) { .diff { grid-template-columns: 1fr; } }

/* tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 0.6rem; background: var(--bg-raised); max-width: 46rem; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
caption { caption-side: top; text-align: left; padding: 0.9rem 1.1rem; font-size: 0.86rem; color: var(--muted); border-bottom: 1px solid var(--line); }
th, td { padding: 0.62rem 1.1rem; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
thead th { font: 500 0.74rem/1.3 var(--mono); letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line-strong); }
th:first-child, td:first-child { text-align: left; }
tbody th { font-weight: 500; }
td { font-family: var(--mono); font-size: 0.95rem; }
td.new { font-weight: 700; color: var(--text); }
td.old { color: var(--muted); }
td.up { color: var(--accent); }
tr.key th, tr.key td { background: var(--accent-soft); }
tr.key th { font-weight: 700; }
tr.group th { font: 500 0.72rem/1.3 var(--mono); letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); padding-top: 1rem; text-align: left; }
@media (max-width: 30rem) {
  th, td { padding: 0.55rem 0.32rem; }
  th:first-child, td:first-child { padding-left: 0.7rem; }
  th:last-child, td:last-child { padding-right: 0.7rem; }
  caption { padding: 0.8rem; }
  td { font-size: 0.78rem; }
  tbody th { font-size: 0.86rem; }
  thead th { font-size: 0.64rem; letter-spacing: 0.03em; white-space: normal; vertical-align: bottom; }
  .formula { font-size: 0.8rem; padding: 0.9rem 0.8rem; }
}

.notes { max-width: 46rem; margin: 1.5rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.93rem; }
.notes li { padding-left: 1.1rem; position: relative; margin-bottom: 0.55rem; }
.notes li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 0.45rem; height: 1px; background: var(--line-strong); }
.notes strong { color: var(--text); font-weight: 600; }

/* money */
.formula {
  max-width: 46rem; margin: 1.5rem 0 0; padding: 1rem 1.1rem; overflow-x: auto;
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 0 0.4rem 0.4rem 0;
  background: var(--bg-raised); font: 0.9rem/1.7 var(--mono);
}
.formula code { background: none; padding: 0; font-size: 1em; overflow-wrap: normal; }
.formula-label { display: block; font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.body > .money-cta { margin: 2.25rem 0 0; }

/* loop */
.loop { list-style: none; counter-reset: step; margin: 2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.loop li { counter-increment: step; border: 1px solid var(--line); border-radius: 0.5rem; padding: 1rem 1.05rem 1.1rem; background: var(--bg-raised); font-size: 0.93rem; line-height: 1.5; color: var(--muted); }
.loop li::before { content: "0" counter(step); display: block; font: 500 0.78rem/1 var(--mono); color: var(--accent); margin-bottom: 0.7rem; letter-spacing: 0.08em; }
.loop strong { display: block; color: var(--text); font-weight: 650; margin-bottom: 0.25rem; }
@media (max-width: 56rem) { .loop { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 30rem) { .loop { grid-template-columns: 1fr; } }

/* footer */
footer { padding: 2.5rem 0 3.5rem; color: var(--muted); font-size: 0.9rem; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; }
footer p { margin: 0; }

/* 404 */
.lost { min-height: 70vh; display: grid; align-content: center; }
.lost h1 { font-family: var(--mono); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
  .btn:hover { transform: none; }
}

@media print {
  .hero { background: none; }
  .btn { border: 1px solid #000; }
}
