:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #05040a;
  color: #fff;
  font-synthesis: none;
  --pink: #ff3ead;
  --cyan: #52f4ff;
  --lime: #c7ff48;
  --panel: rgba(8, 7, 15, 0.82);
  --ink: rgba(255, 255, 255, 0.74);
  --ink-dim: rgba(255, 255, 255, 0.52);
  --rule: rgba(255, 255, 255, 0.12);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 12% -4%, rgba(82, 244, 255, 0.16), transparent 34%),
    radial-gradient(circle at 88% 6%, rgba(255, 62, 173, 0.14), transparent 36%),
    #05040a;
  background-attachment: fixed;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

a {
  color: var(--cyan);
  text-decoration-color: rgba(82, 244, 255, 0.4);
  text-underline-offset: 3px;
}

a:hover { text-decoration-color: var(--cyan); }

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translate(-50%, -150%);
  z-index: 20;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--cyan);
  color: #05040a;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus { transform: translate(-50%, 0); }

/* ---------- Shell ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 14px max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
  background: rgba(5, 4, 10, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.wordmark i {
  display: block;
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--cyan);
}

.wordmark i:nth-child(2) { height: 22px; background: var(--pink); }
.wordmark i:nth-child(3) { height: 11px; background: var(--lime); }

.wordmark span { margin-left: 2px; white-space: nowrap; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  font-size: 15px;
}

.site-nav a { white-space: nowrap; }

.site-nav a { color: var(--ink); text-decoration: none; }
.site-nav a:hover { color: #fff; }
.site-nav a[aria-current="page"] { color: #fff; }

.nav-cta {
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--cyan), var(--pink));
  color: #05040a !important;
  font-weight: 650;
}

.shell {
  width: min(100% - 40px, 760px);
  margin-inline: auto;
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-dim);
}

.breadcrumbs li { display: flex; gap: 8px; }
.breadcrumbs li + li::before { content: "/"; color: rgba(255, 255, 255, 0.24); }

/* ---------- Page + article headers ---------- */

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
}

.page-header { padding: 34px 0 8px; }

.page-header h1,
.article-header h1 {
  margin: 0 0 14px;
  color: #fff;
  font-size: clamp(2rem, 6vw, 3.05rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 750;
}

.dek {
  margin: 0;
  font-size: clamp(1.05rem, 2.4vw, 1.2rem);
  color: rgba(255, 255, 255, 0.66);
}

.article-header {
  padding: 30px 0 26px;
  border-bottom: 1px solid var(--rule);
}

.article-meta {
  margin: 20px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 14px;
  color: var(--ink-dim);
}

.article-meta > * { display: flex; gap: 8px; }
.article-meta > * + *::before { content: "·"; color: rgba(255, 255, 255, 0.24); }

/* ---------- Post list ---------- */

.post-list {
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 18px;
}

.post-card {
  position: relative;
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: var(--panel);
  transition: border-color 180ms ease, transform 180ms ease;
}

.post-card:hover {
  border-color: rgba(82, 244, 255, 0.45);
  transform: translateY(-2px);
}

.post-card h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #fff;
}

.post-card h2 a {
  color: inherit;
  text-decoration: none;
}

.post-card h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
}

.post-card p { margin: 0 0 14px; }

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-tags li {
  padding: 4px 11px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-dim);
}

/* ---------- Prose ---------- */

.prose { padding: 8px 0 20px; }

.prose h2 {
  margin: 52px 0 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  color: #fff;
  font-size: clamp(1.45rem, 3.6vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.prose h3 {
  margin: 34px 0 10px;
  color: #fff;
  font-size: 1.16rem;
  letter-spacing: -0.015em;
}

.prose h4 {
  margin: 26px 0 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
}

.prose p { margin: 0 0 18px; }

.prose ul, .prose ol { margin: 0 0 18px; padding-left: 22px; }
.prose li { margin-bottom: 9px; }
.prose li::marker { color: var(--pink); }

.prose strong { color: #fff; font-weight: 650; }

.prose figure { margin: 24px 0; }

.prose figcaption {
  margin-top: 10px;
  font-size: 14px;
  color: var(--ink-dim);
}

/* ---------- Code ---------- */

code {
  font-family: var(--mono);
  font-size: 0.88em;
}

:not(pre) > code {
  padding: 2px 6px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--lime);
  white-space: nowrap;
}

pre {
  margin: 0 0 20px;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-left: 2px solid var(--cyan);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.42);
  font-size: 13.5px;
  line-height: 1.62;
  tab-size: 2;
}

pre code {
  color: rgba(255, 255, 255, 0.86);
  white-space: pre;
}

.code-label {
  margin: 24px 0 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* ---------- Tables ---------- */

.table-scroll {
  margin: 0 0 20px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14.5px;
}

/* A <caption> is laid out at the table's full width, so inside a horizontally
   scrolling container long text is clipped and only readable by scrolling. The
   note sits above the scroll box instead and is tied to the table with
   aria-describedby. */
.table-note {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--ink-dim);
}

th, td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

thead th {
  position: sticky;
  top: 0;
  background: #0b0913;
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody th {
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }

.rank-good { color: var(--lime); }
.rank-mid { color: #ffd166; }
.rank-poor { color: var(--pink); }

/* ---------- Leaderboard ---------- */

/* auto-fit rather than a fixed count, so the tiles reflow on any width instead
   of relying on one breakpoint being right. */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 30px 0 22px;
}

.stat {
  padding: 18px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--panel);
  text-align: center;
}

.stat strong {
  display: block;
  color: #fff;
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}


.leaderboard-status {
  margin: 0 0 20px;
  padding: 22px;
  border: 1px dashed var(--rule);
  border-radius: 14px;
  text-align: center;
  color: var(--ink-dim);
}

.rank-cell {
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

thead th:nth-child(n + 4) { text-align: right; }

#leaderboardBody td small {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-dim);
}

/* ---------- Callouts ---------- */

.callout {
  margin: 24px 0;
  padding: 18px 20px;
  border: 1px solid rgba(82, 244, 255, 0.3);
  border-radius: 14px;
  background: rgba(82, 244, 255, 0.06);
}

.callout > :last-child { margin-bottom: 0; }

.callout p:first-child strong { color: var(--cyan); }

.callout.warn {
  border-color: rgba(255, 62, 173, 0.34);
  background: rgba(255, 62, 173, 0.07);
}

.callout.warn p:first-child strong { color: var(--pink); }

/* ---------- Table of contents ---------- */

.toc {
  margin: 28px 0 8px;
  padding: 20px 24px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--panel);
}

.toc h2 {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  font-size: 15px;
}

.toc li { margin-bottom: 6px; }

/* ---------- End-of-article CTA ---------- */

.article-cta {
  margin: 46px 0 10px;
  padding: 26px;
  border: 1px solid rgba(255, 62, 173, 0.3);
  border-radius: 18px;
  background: linear-gradient(140deg, rgba(255, 62, 173, 0.12), rgba(82, 244, 255, 0.08));
  text-align: center;
}

.article-cta h2 {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  color: #fff;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.article-cta p { margin: 0 0 18px; }

.button {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--cyan), var(--pink));
  color: #05040a;
  font-weight: 650;
  text-decoration: none;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 56px;
  padding: 28px 0 44px;
  border-top: 1px solid var(--rule);
  font-size: 14.5px;
  color: var(--ink-dim);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 12px;
}

.site-footer p { margin: 0; }
