@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg: #fbfbf9;
  --fg: #1b1b1b;
  --muted: #6e6e68;
  --line: #dcdcd6;
  --accent: #ff4a1c;
  --on-accent: #fbfbf9;
  --slab: #1b1b1b;
  --on-slab: #eeeeea;
  --slab-key: #ff8a63;
  --sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110;
    --fg: #eeeeea;
    --muted: #8b8b83;
    --line: #2c2c28;
    --accent: #ff5a2e;
    --on-accent: #111110;
    --slab: #08080a;
    --on-slab: #eeeeea;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

/* ───────── masthead ───────── */

.masthead {
  border-bottom: 3px solid var(--fg);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.masthead .brand {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
  box-shadow: none;
}
.masthead .brand:hover { color: var(--accent); }
.masthead .lang {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  box-shadow: none;
}
.masthead .lang:hover { color: var(--fg); }
.masthead .lang .sep { color: var(--accent); }

/* ───────── page grid ───────── */

.sheet {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 40px;
  max-width: 940px;
  padding: 44px 32px 88px;
}

.rail {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.75;
  color: var(--muted);
}
.rail .date { color: var(--accent); font-weight: 700; letter-spacing: 0.02em; }
.rail .kicker { margin-top: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.rail .facts {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.col { min-width: 0; }

/* ───────── typography ───────── */

h1 {
  font-size: 44px;
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.035em;
  margin: -6px 0 22px;
  text-wrap: balance;
}
h1 .hit {
  background: var(--accent);
  color: var(--on-accent);
  padding: 0 8px;
  display: inline-block;
  margin-top: 6px;
}
h2 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 46px 0 14px;
}
h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 26px 0 8px;
}
p { margin: 0 0 18px; max-width: 64ch; text-wrap: pretty; }

a {
  color: var(--fg);
  text-decoration: none;
  box-shadow: inset 0 -2px 0 var(--accent);
  transition: box-shadow 0.12s;
}
a:hover { box-shadow: inset 0 -9px 0 var(--accent); }

.lede {
  font-size: 17px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 34px;
  max-width: 58ch;
}
.fine { font-family: var(--mono); font-size: 11px; line-height: 1.6; color: var(--muted); max-width: 70ch; }

.pull {
  border-top: 3px solid var(--accent);
  margin: 36px 0;
  padding: 16px 0 0;
  font-size: 20px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: -0.015em;
  max-width: 48ch;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

/* ───────── code ───────── */

pre {
  background: var(--slab);
  color: var(--on-slab);
  padding: 18px 20px;
  margin: 26px 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  border: 0;
}
pre .k { color: var(--slab-key); }
code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--line);
  padding: 0.1em 0.32em;
}
pre code { background: none; padding: 0; font-size: inherit; color: inherit; }

/* ───────── tables ───────── */

.tw { overflow-x: auto; margin: 22px 0; }
table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
thead tr { background: var(--slab); color: var(--on-slab); }
th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
th.num, td.num { text-align: right; }
td { padding: 10px; border-bottom: 1px solid var(--line); }
tr.win td:first-child { font-weight: 700; }
td.hit { background: var(--accent); color: var(--on-accent); font-weight: 700; }

/* ───────── post list ───────── */

ul.posts { list-style: none; padding: 0; margin: 0; }
ul.posts li {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
ul.posts li:first-child { border-top: 1px solid var(--line); }
ul.posts .when {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  padding-top: 5px;
}
ul.posts h2 {
  font-family: var(--sans);
  font-size: 22px;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-transform: none;
  margin: 0 0 6px;
}
ul.posts h2 a { box-shadow: none; }
ul.posts h2 a:hover { box-shadow: inset 0 -3px 0 var(--accent); }
ul.posts p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); max-width: 62ch; }

/* ───────── footers ───────── */

.foot {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 3px solid var(--fg);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.foot a { color: var(--muted); box-shadow: none; }
.foot a:hover { color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }

.back {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 26px;
  color: var(--muted);
  box-shadow: none;
}
.back:hover { color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }

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

@media (max-width: 720px) {
  .masthead { padding: 15px 20px; }
  .sheet {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding: 28px 20px 60px;
  }
  .rail {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
  }
  .rail .kicker, .rail .facts { margin-top: 0; border-top: 0; padding-top: 0; }
  .rail .facts br { display: none; }
  h1 { font-size: 32px; }
  ul.posts li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  ul.posts .when { padding-top: 0; }
}
