/* =========================================================
   TOKENS
========================================================= */
:root {
  --paper: #fafafa;
  --paper-warm: #f4f4f5;
  --surface: #ffffff;
  --ink: #18181b;
  --ink-soft: #3f3f46;
  --muted: #5f5f66;
  --line: #d4d4d8;
  --line-soft: #e4e4e7;
  --accent: #1d4ed8;
  --accent-soft: #dbeafe;
  --success: #16a34a;
  --field: #ffffff;
  --radius-sm: 6px;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color-scheme: light;
}
html.dark {
  --paper: #0c0c0e;
  --paper-warm: #131316;
  --surface: #16161a;
  --ink: #f5f5f6;
  --ink-soft: #c7c7cb;
  --muted: #868690;
  --line: #26262b;
  --line-soft: #1d1d21;
  --accent: #3b82f6;
  --accent-soft: #172554;
  --success: #4ade80;
  --field: #000000;
  color-scheme: dark;
}

/* =========================================================
   BASE
========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body {
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "ss02";
  letter-spacing: -0.005em;
}
body {
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.625;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; }
svg { flex-shrink: 0; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
strong { font-weight: 400; color: var(--ink); }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border-width: 0;
}
.skip-link {
  position: absolute; left: 16px; top: 16px; z-index: 200;
  background: var(--ink); color: var(--paper);
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12px;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* =========================================================
   PRIMITIVES
========================================================= */
.eyebrow {
  display: flex; align-items: center; gap: 12px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.22em; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.eyebrow::before { content: attr(data-num); }
.eyebrow-rule { width: 24px; height: 1px; background: var(--line); }

h1, h2, h3 { color: var(--ink); text-wrap: balance; }
.h1 {
  font-size: clamp(2.5rem, 5vw, 4.625rem);
  line-height: 1.02; letter-spacing: -0.02em; font-weight: 800;
}
.h1 .block { display: block; }
.h2 { font-size: 28px; line-height: 1.05; letter-spacing: -0.02em; font-weight: 700; }
.lead { font-size: 14px; color: var(--ink-soft); max-width: 58ch; text-wrap: pretty; }
.lead a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.lead a:hover { color: var(--accent); }

.divider { height: 1px; background: var(--line); margin: 64px 0; }

.section-head { display: grid; gap: 24px; align-items: start; margin-top: 24px; }
.section-head .lead { font-size: 13px; }

.arrow-slide .arrow { width: 11px; height: 11px; transition: transform 200ms ease; }
.arrow-slide:hover .arrow, .arrow-slide:focus-visible .arrow { transform: translateX(2px); }

.btn-primary {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--paper);
  padding: 12px 20px; border-radius: var(--radius-sm); font-size: 13px;
  transition: background-color 150ms, color 150ms;
}
.btn-primary:hover { background: var(--accent); color: #fff; }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 12px; color: var(--ink-soft);
  transition: background-color 150ms, color 150ms;
}
.btn-secondary:hover { color: var(--ink); background: var(--line-soft); }

.icon-square {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink); transition: background-color 150ms;
}
.icon-square:hover { background: var(--line-soft); }
.icon-square svg { width: 13px; height: 13px; }

/* =========================================================
   SHELL
========================================================= */
.shell { display: flex; flex-direction: column; min-height: 100vh; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }
.wordmark { font-size: 14px; color: #000; }
html.dark .wordmark { color: #fff; }
.wordmark .caret::after {
  content: ""; display: inline-block; width: 0.55em; height: 0.92em; margin-left: 0.12em;
  background: currentColor; transform: translateY(0.12em);
  animation: blink 1.1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

.filters { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line); }
.filters-inner { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.filter-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.filter-nav::-webkit-scrollbar { display: none; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0;
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; color: var(--ink-soft);
  transition: background-color 150ms, color 150ms;
}
.nav-btn:hover { color: var(--ink); background: var(--line-soft); }
.nav-btn[aria-pressed="true"] { color: var(--ink); background: var(--line-soft); }
.nav-num { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.field-label { display: block; margin-bottom: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); }
.field {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--field); padding: 10px 14px; font-size: 14px; color: var(--ink);
  font-family: inherit; transition: border-color 150ms;
}
.field::placeholder { color: var(--muted); }
.field:focus { outline: none; border-color: var(--accent); }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.filters .field { padding: 8px 12px; font-size: 13px; }

.theme-toggle svg { display: none; }
.theme-toggle .icon-moon { display: block; }
html.dark .theme-toggle .icon-moon { display: none; }
html.dark .theme-toggle .icon-sun { display: block; }

.page { padding-top: 48px; padding-bottom: 48px; }
.results { margin-top: 24px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* =========================================================
   STATS
========================================================= */
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  margin-top: 40px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
}
.stat { background: var(--paper); padding: 20px 24px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stat strong { font-size: 34px; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }

/* =========================================================
   GROUPS + CARDS
========================================================= */
.group + .group { margin-top: 64px; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1px;
  margin-top: 40px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
}
.card {
  background: var(--paper); outline: 1px solid var(--line);
  padding: 28px; display: flex; flex-direction: column; gap: 10px;
  transition: background-color 150ms;
}
.card:hover { background: var(--paper-warm); }
.card-meta { font-size: 10px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); }
.card-title { font-size: 15px; line-height: 1.35; font-weight: 400; letter-spacing: -0.01em; }
.card-title a:hover { color: var(--accent); }
.card-desc { font-size: 12px; color: var(--ink-soft); flex: 1; }
.card-desc code { font-family: inherit; font-size: 11px; background: var(--paper-warm); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; }
.card-tags { font-size: 11px; color: var(--muted); }
.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px;
}
.card-date { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-link { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 12px; color: var(--ink); }
.card-link:hover { color: var(--accent); }

.empty {
  margin-top: 40px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper-warm); padding: 24px; font-size: 14px; max-width: 52ch;
}
.empty p { color: var(--ink-soft); }
.empty button { margin-top: 12px; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.empty button:hover { color: var(--accent); }

/* =========================================================
   CLOSING CTA
========================================================= */
.perks {
  display: grid; gap: 1px; margin-top: 40px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
}
.perk { display: flex; gap: 12px; align-items: flex-start; background: var(--paper); padding: 20px 24px; font-size: 13px; color: var(--ink-soft); }
.perk svg { width: 11px; height: 11px; color: var(--success); margin-top: 5px; }
.perk-fill { display: none; background: var(--paper); }
.cta-actions { margin-top: 32px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.cta-note { font-size: 11px; color: var(--muted); }

/* =========================================================
   FOOTER
========================================================= */
footer { border-top: 1px solid var(--line); margin-top: auto; }
.footer-inner { padding-top: 40px; padding-bottom: 40px; display: grid; gap: 32px; }
.footer-brand p { margin-top: 8px; font-size: 12px; color: var(--muted); max-width: 32ch; }
.footer-col .footer-heading { font-size: 10px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); font-weight: 400; margin-bottom: 12px; }
.footer-col a { display: block; font-size: 12px; color: var(--ink-soft); padding: 3px 0; }
.footer-col a:hover { color: var(--ink); }
.footer-bar { border-top: 1px solid var(--line); padding-top: 16px; padding-bottom: 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }

/* =========================================================
   GLOBE
========================================================= */
.hero {
  position: relative; overflow: hidden;
  height: clamp(280px, 48vh, 520px);
  border-bottom: 1px solid var(--line);
  cursor: grab; touch-action: pan-y;
}
.hero.dragging { cursor: grabbing; user-select: none; }
#hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
}
.globe-labels { position: absolute; inset: 0; pointer-events: none; }
.globe-label {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  font-size: 11px; color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 4px 10px; min-height: 28px; display: inline-flex; align-items: center; will-change: transform, opacity;
  transition: color 150ms, border-color 150ms;
}
.globe-label:hover, .globe-label:focus-visible { color: var(--ink); border-color: var(--accent); }
@media (max-width: 639px) { .globe-labels { display: none; } }

/* =========================================================
   SUGGEST FORM
========================================================= */
.suggest { margin-top: 40px; max-width: 672px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); padding: 32px; }
.suggest-grid { display: grid; gap: 20px; }
.suggest-field { min-width: 0; }
fieldset { border: 0; }
.opt { text-transform: none; letter-spacing: -0.005em; margin-left: 6px; }
textarea.field { resize: vertical; min-height: 44px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; padding: 8px 14px; font-size: 12px; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--radius-sm); transition: background-color 150ms, color 150ms;
}
.chip:hover span { background: var(--line-soft); color: var(--ink); }
.chip input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip input:focus-visible + span { border-color: var(--accent); }
.suggest-actions { margin-top: 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.suggest-msg { min-height: 1.25rem; font-size: 12px; color: var(--accent); }
.suggest-msg.ok { color: var(--success); }
.suggest-done { margin-top: 40px; max-width: 52ch; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper-warm); padding: 24px; font-size: 14px; color: var(--ink-soft); }
.suggest-done strong { display: block; margin-bottom: 4px; }

/* =========================================================
   RESPONSIVE
========================================================= */
@media (min-width: 640px) {
  .wrap { padding-left: 40px; padding-right: 40px; }
  .filters-inner { flex-direction: row; align-items: center; }
  .filters .search-wrap { margin-left: auto; width: 260px; }
  .h2 { font-size: 36px; }
  .section-head { grid-template-columns: 1.2fr 1fr; gap: 40px; }
  .lead { font-size: 16px; }
  .perks { grid-template-columns: 1fr 1fr; }
  .perk-fill { display: block; }
  .suggest-grid { grid-template-columns: 1fr 1fr; }
  .suggest-span { grid-column: 1 / -1; }
  .footer-inner { grid-template-columns: 1.5fr 1fr; }
}
@media (min-width: 1024px) {
  .wrap { padding-left: 56px; padding-right: 56px; }
  .page { padding-top: 64px; padding-bottom: 64px; }
  .divider { margin: 96px 0; }
  .section-head { gap: 64px; }
  .h2 { font-size: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wordmark .caret::after { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
