/* ==========================================================================
   Archive Site — plain CSS design system
   Colors, type scale and spacing mirror the original tailwind.config.ts
   tokens 1:1, so re-skinning the whole site means editing the variables
   below rather than hunting through every page.

   Geist/Geist Mono are loaded via <link> tags in each page's <head>, not
   a CSS @import here — @import is discovered late (only after the
   browser has already downloaded and started parsing this file) and
   blocks rendering until it resolves, which is a real, measurable
   performance cost. A <link rel="preconnect"> + <link rel="stylesheet">
   pair in <head>, with &display=swap, lets the browser start the font
   request immediately in parallel and show fallback text right away
   instead of a blank flash while the font loads.
   ========================================================================== */

:root {
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --ink: #0A0A0A;
  --ink-rgb: 10, 10, 10;
  --muted: #6B6B68;
  --subtle: #9A9996;
  --border: #E3E2DE;
  --border-strong: #CFCEC9;

  /* One vibrant accent color, used as a flat/solid fill everywhere —
     no gradients anywhere in this file. "Glassy" surfaces are done with
     transparency + backdrop-blur on this single color, not by blending
     two colors together. A second color exists only for the rare case
     of a distinct status badge, and is never mixed with the first. */
  --vibrant: #6D5DF6;      /* violet — primary accent, buttons, hovers, focus */
  --vibrant-rgb: 109, 93, 246;
  --vibrant-2: #06B6D4;    /* cyan — used standalone only, e.g. one badge state */
  --vibrant-2-rgb: 6, 182, 212;
  --glass-bg: rgba(255, 255, 255, 0.94);
  --glass-border: rgba(255, 255, 255, 0.7);

  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --max-content: 1200px;
  --max-prose: 68ch;

  /* Soft rounding scale — corners throughout the site read as gently
     rounded rather than sharp rectangles. */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --ease-precise: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-quiet: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Fluid base font size: scales gently with the viewport instead of
     jumping at fixed breakpoints, so every rem-based size in this file
     (type, spacing, icons) scales proportionally across phones, tablets,
     laptops, and large desktops rather than looking identical/uniform
     at every device width. */
  font-size: clamp(15px, 0.75vw + 13px, 18px);
  /* Safety net: nothing on the page should ever be able to force
     horizontal scroll / push content edge-to-edge on a narrow screen,
     no matter what gets added later. */
  overflow-x: hidden;
  width: 100%;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  opacity: 1;
  transition: opacity 320ms var(--ease-smooth);
}
/* Subtle first-paint fade: pre-load.js removes this class right after
   the page's first frame paints, so every page fades in from 0 instead
   of popping in instantly. Skipped entirely for reduced-motion. */
body.pre-load { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
  body.pre-load { opacity: 1; }
}

/* Safety net: long unbroken strings (URLs, long titles/slugs typed into
   the CMS, etc.) wrap instead of forcing horizontal scroll on narrow
   screens. */
h1, h2, h3, h4, p, a, span, li, dt, dd { overflow-wrap: break-word; word-break: break-word; }

img { max-width: 100%; display: block; }

::selection { background: var(--ink); color: var(--bg); }

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

a { color: inherit; text-decoration: none; }

/* Layout ------------------------------------------------------------- */

.container-page {
  width: 100%;
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 24px;
}
@media (min-width: 768px) {
  .container-page { padding: 0 40px; }
}

.section { padding: 64px 0; }
@media (min-width: 768px) { .section { padding: 96px 0; } }

/* Matches Tailwind's py-16 md:py-24 / py-20 md:py-28 / py-16 md:py-20 pairs
   used throughout the original templates. */
.pad-1624 { padding: 64px 0; }
@media (min-width: 768px) { .pad-1624 { padding: 96px 0; } }
.pad-2028 { padding: 80px 0; }
@media (min-width: 768px) { .pad-2028 { padding: 112px 0; } }
.pad-1620 { padding: 64px 0; }
@media (min-width: 768px) { .pad-1620 { padding: 80px 0; } }

/* Type ----------------------------------------------------------------- */

h1, h2, h3, h4, p { margin: 0; }

.text-display {
  font-size: clamp(2.75rem, 6vw, 5.5rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 500;
}
.text-h1 { font-size: clamp(2.25rem, 4vw, 3.5rem); line-height: 1.05; letter-spacing: -0.025em; font-weight: 500; }
.text-h2 { font-size: clamp(1.5rem, 2.6vw, 2.25rem); line-height: 1.15; letter-spacing: -0.02em; font-weight: 500; }
.text-h3 { font-size: clamp(1.125rem, 1.6vw, 1.5rem); line-height: 1.25; letter-spacing: -0.01em; font-weight: 500; }
.text-body { font-size: 1.0625rem; line-height: 1.65; }
.text-small { font-size: 0.9375rem; line-height: 1.55; }
.text-caption { font-size: 0.8125rem; line-height: 1.4; }
.label-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.text-muted { color: var(--muted); }
.text-subtle { color: var(--subtle); }
.text-accent { color: var(--vibrant); }

/* Header / nav ----------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 250, 249, 0.9);
  backdrop-filter: blur(6px);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}

.header-left { display: flex; align-items: center; gap: 6px; }

/* Logo + brand name sit together, centered in the header, between the
   two nav dropdowns — swap the "logo" field in data/site.json for a
   real image path or data URL (uploadable from the CMS) and it renders
   instead of the generated monogram. */
.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 150ms;
}
.brand-group:hover { opacity: 0.85; }
.brand-group:hover .logo-mark { transform: scale(1.06) rotate(-2deg); }

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: rgba(var(--vibrant-rgb), 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 260ms var(--ease-smooth);
}
.logo-mark img { width: 100%; height: 100%; object-fit: cover; }
/* A real uploaded logo image gets its own plain treatment — no violet
   tile behind it (the generated-monogram fallback above is the only
   thing meant to sit on a colored chip). */
.logo-mark.has-image {
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border);
}

.nav-group { display: none; align-items: center; gap: 4px; }
@media (min-width: 768px) { .nav-group { display: flex; } }
.nav-group.right { justify-content: flex-end; }

.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgba(var(--ink-rgb),0.8);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 200ms var(--ease-quiet), background 200ms var(--ease-quiet);
}
.nav-dropdown-trigger:hover { color: var(--ink); background: rgba(var(--ink-rgb),0.04); }
.nav-dropdown.open .nav-dropdown-trigger { color: var(--vibrant); background: rgba(109,93,246,0.08); }
.nav-dropdown-trigger svg { transition: transform 260ms var(--ease-smooth); }
.nav-dropdown.open .nav-dropdown-trigger svg { transform: rotate(180deg); }

/* Panel stays in the DOM and always transitions (opacity/scale/translate)
   instead of an instant display:none/flex swap, so open + close both
   animate smoothly. Opens only on click now, not on hover. */
.nav-dropdown-panel {
  position: absolute;
  top: 100%;
  margin-top: 10px;
  width: 260px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px -12px rgba(20,10,50,0.18);
  padding: 8px;
  display: flex;
  flex-direction: column;
  z-index: 50;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 220ms var(--ease-smooth), transform 220ms var(--ease-smooth), visibility 220ms;
  transform-origin: top center;
}
.nav-dropdown.right .nav-dropdown-panel { right: 0; transform-origin: top right; }
.nav-dropdown.left .nav-dropdown-panel { left: 0; transform-origin: top left; }
.nav-dropdown.open .nav-dropdown-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}
.nav-dropdown-item { display: flex; flex-direction: column; gap: 1px; padding: 9px 12px; border-radius: var(--radius-sm); transition: background 180ms var(--ease-smooth), transform 180ms var(--ease-smooth); }
.nav-dropdown-item:hover { background: rgba(var(--vibrant-rgb), 0.08); transform: translateX(2px); }
.nav-dropdown-item .item-label { font-size: 0.9375rem; font-weight: 500; color: var(--ink); }
.nav-dropdown-item .item-desc { font-size: 0.8125rem; color: var(--muted); }

.brand {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  max-width: 32vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-right { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }

.mobile-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 0.9375rem;
  font-weight: 500;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 200ms var(--ease-smooth), color 200ms var(--ease-smooth);
}
.mobile-menu-btn:hover { border-color: var(--vibrant); color: var(--vibrant); }
#mobile-menu-btn { display: inline-flex; }
@media (min-width: 768px) { #mobile-menu-btn { display: none; } }

/* Mobile nav: a slide-in sidebar drawer from the right (not a
   full-screen swap) — a dimmed backdrop behind it closes the menu on
   tap, matching how most native apps and well-known sites handle small
   screens. */
.mobile-overlay {
  display: block;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 320ms;
}
.mobile-overlay.open { visibility: visible; pointer-events: auto; }
@media (min-width: 768px) { .mobile-overlay { display: none !important; } }

.mobile-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(10, 10, 10, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 320ms var(--ease-smooth);
}
.mobile-overlay.open .mobile-backdrop { opacity: 1; }

.mobile-sidebar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(85vw, 340px);
  max-width: 340px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  box-shadow: -16px 0 40px rgba(10, 10, 10, 0.15);
  transform: translateX(100%);
  transition: transform 340ms var(--ease-smooth);
  overflow-y: auto;
}
.mobile-overlay.open .mobile-sidebar { transform: translateX(0); }

.mobile-overlay-top { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.mobile-overlay-nav { flex: 1; padding-bottom: 40px; }
.mobile-section { padding: 20px 0; border-top: 1px solid var(--border); }
.mobile-section:first-child { border-top: none; }
.mobile-section ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mobile-section a {
  display: block; padding: 10px 0;
  font-size: clamp(1.0625rem, 1.6vw, 1.375rem);
  font-weight: 500; letter-spacing: -0.01em; color: var(--ink);
  transition: color 200ms var(--ease-smooth), transform 200ms var(--ease-smooth);
}
.mobile-section a:hover { color: var(--vibrant); transform: translateX(4px); }

@media (prefers-reduced-motion: reduce) {
  .mobile-backdrop, .mobile-sidebar { transition: none; }
}


/* Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 0.9375rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 260ms var(--ease-smooth), box-shadow 260ms var(--ease-smooth);
}
/* Primary buttons: solid vibrant color at glass-like translucency, with
   backdrop-blur — no gradient, just one color and transparency. */
.btn-primary {
  background: rgba(var(--vibrant-rgb), 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 1px 2px rgba(29, 24, 74, 0.15);
}
.btn-primary:hover {
  background: rgba(var(--vibrant-rgb), 0.98);
  box-shadow: 0 8px 24px -6px rgba(var(--vibrant-rgb), 0.5);
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--vibrant); color: var(--vibrant); box-shadow: 0 4px 16px -8px rgba(var(--vibrant-rgb),0.35); }
.btn-secondary:active { transform: scale(0.97); background: rgba(var(--vibrant-rgb), 0.06); }
.btn-ghost { background: transparent; color: var(--ink); border-radius: var(--radius-sm); }
.btn-ghost:hover { background: rgba(var(--ink-rgb),0.04); }
.btn-ghost:active { background: rgba(var(--ink-rgb),0.08); transform: scale(0.97); }
.btn-text { background: none; border: none; padding: 0; text-decoration: underline; text-underline-offset: 4px; }
.btn:disabled { opacity: 0.6; cursor: default; transform: none !important; box-shadow: none !important; }

/* Badge ----------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: transform 200ms var(--ease-smooth);
}
.badge[data-status="active"] { color: var(--vibrant-2); border-color: rgba(var(--vibrant-2-rgb), 0.35); background: rgba(var(--vibrant-2-rgb), 0.1); }
.badge[data-status="shipped"] { color: var(--vibrant); border-color: rgba(var(--vibrant-rgb),0.3); background: rgba(var(--vibrant-rgb),0.08); }
.badge[data-status="exploring"] { color: var(--muted); border-color: var(--border-strong); }
.badge[data-status="paused"], .badge[data-status="archived"] { color: var(--subtle); }


/* Cards ------------------------------------------------------------------ */

/* Card grid: the original renders every listing/related grid as a set of
   hairline "seams" — a colored grid background showing through a 1px gap
   between cards, with each card also carrying its own full border. This
   is intentional (not a bug) and is what gives the site its ledger-like
   look, so it's reproduced exactly rather than simplified to a plain
   gutter grid. */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1440px) { .card-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; } }

.content-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  min-width: 0;
  min-height: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 260ms var(--ease-smooth), transform 260ms var(--ease-smooth), box-shadow 260ms var(--ease-smooth);
  will-change: transform;
}
.content-card:hover {
  border-color: rgba(109, 93, 246, 0.35);
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -18px rgba(109, 93, 246, 0.35), 0 4px 10px -6px rgba(6, 182, 212, 0.2);
}
.content-card:active {
  border-color: rgba(109, 93, 246, 0.45);
  transform: translateY(-1px) scale(0.99);
  box-shadow: 0 6px 16px -10px rgba(109, 93, 246, 0.4);
}
.content-card.large { min-height: 280px; padding: 32px; }
.content-card .card-top { display: flex; flex-direction: column; gap: 12px; }
.content-card .card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.content-card h3 { color: var(--ink); }
.content-card .card-summary { color: var(--muted); font-size: 0.8125rem; }
.content-card.large .card-summary { font-size: 0.9375rem; }
.content-card .card-bottom {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--subtle);
}
.content-card .card-bottom > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.content-card .arrow { display: inline-flex; flex-shrink: 0; color: var(--muted); transition: transform 260ms var(--ease-smooth), color 260ms var(--ease-smooth); }
.content-card:hover .arrow { transform: translate(3px, -3px); color: var(--vibrant); }

.empty-grid {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
}

/* Hero --------------------------------------------------------------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 48px;
  padding: 80px 0;
  isolation: isolate;
  overflow: hidden; /* keeps the decorative color blobs from ever causing horizontal scroll */
}
@media (min-width: 768px) { .hero { grid-template-columns: 1.3fr 0.7fr; padding: 128px 0; } }
.hero-copy { display: flex; flex-direction: column; gap: 24px; }
.hero-copy .text-display { max-width: 42rem; }
.hero-copy .text-body { max-width: 32rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 8px; }
.hero-mark { display: none; justify-self: center; }
@media (min-width: 768px) { .hero-mark { display: flex; } }
.converge-mark { animation: converge-rotate 40s linear infinite, converge-pulse 6s ease-in-out infinite; transform-origin: center; }
@keyframes converge-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes converge-pulse { 0%, 100% { opacity: 0.85; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .converge-mark { animation: none; } }

/* Homepage sections, right after the hero, in order: two plain
   placeholder heading+paragraph sections (fill in real copy whenever
   you're ready), then a live, auto-updating stats row last. All three
   are text-align: center with content constrained and margin-auto'd,
   rather than the left-aligned layout the rest of the page uses. */
.centered-section { border-top: 1px solid var(--border); text-align: center; }
.centered-inner { max-width: 42rem; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.centered-inner .text-body { max-width: 38rem; }

.stats-section { border-top: 1px solid var(--border); }
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px 64px;
  text-align: center;
}
@media (max-width: 480px) { .stats-grid { gap: 28px 32px; } }
.stat-item { display: flex; flex-direction: column; gap: 6px; min-width: 100px; }
.stat-number {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--vibrant);
}
.stat-label { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* Soft floating color shape behind the hero — a solid single color
   circle softened with a blur filter (not a gradient) for a glassy glow.
   Purely decorative, sits behind all hero content (z-index -1), kept to
   the upper area only, and is disabled entirely under
   prefers-reduced-motion. */
.hero-blob {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.3;
  pointer-events: none;
}
.hero-blob-1 {
  width: 360px; height: 360px;
  top: -80px; right: 8%;
  background: var(--vibrant-2);
  animation: blob-float-1 16s ease-in-out infinite;
}
@keyframes blob-float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-24px, 30px) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-blob { display: none; }
}

/* Editorial / featured sections -------------------------------------- */

.featured-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 768px) { .featured-grid { grid-template-columns: 1fr 1fr; } }
.featured-grid .support-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.featured-main-link, .support-item-link {
  display: flex;
  height: 100%;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: background 320ms var(--ease-smooth), transform 320ms var(--ease-smooth), border-color 320ms var(--ease-smooth), box-shadow 320ms var(--ease-smooth);
  position: relative;
  overflow: hidden;
}
.featured-main-link::before, .support-item-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(var(--vibrant-rgb), 0.06);
  opacity: 0;
  transition: opacity 320ms var(--ease-smooth);
  pointer-events: none;
}
.featured-main-link:hover, .support-item-link:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--vibrant-rgb), 0.35);
  box-shadow: 0 16px 32px -18px rgba(var(--vibrant-rgb), 0.35);
}
.featured-main-link:hover::before, .support-item-link:hover::before { opacity: 1; }
.featured-main-link { border-radius: var(--radius-lg); }
@media (min-width: 768px) { .featured-main-link { padding: 40px; } }
.featured-main-link h3 { max-width: 28rem; }
.support-item-link { padding: 24px; gap: 16px; border-radius: var(--radius-md); }

.editorial {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: center;
  padding: 80px 0;
  border-top: 1px solid var(--border);
}
@media (min-width: 768px) { .editorial { grid-template-columns: 1.15fr 0.85fr; padding: 112px 0; } .editorial.reverse { grid-template-columns: 0.85fr 1.15fr; } }
@media (min-width: 1024px) { .editorial { gap: 80px; } }
.editorial.reverse .editorial-visual { order: -1; }
@media (min-width: 768px) { .editorial.reverse .editorial-copy { order: 2; } .editorial.reverse .editorial-visual { order: 1; } }
.editorial-copy { display: flex; flex-direction: column; gap: 16px; max-width: 44ch; }
.visual-placeholder {
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  background: rgba(var(--vibrant-rgb), 0.05);
}

/* Newsletter --------------------------------------------------------- */

.newsletter-section { border-top: 1px solid var(--border); padding: 80px 0; }
@media (min-width: 768px) { .newsletter-section { padding: 112px 0; } }
.newsletter-section .inner { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; }
.newsletter-form { display: flex; width: 100%; max-width: 28rem; flex-direction: column; gap: 12px; }
@media (min-width: 640px) { .newsletter-form { flex-direction: row; } }
.newsletter-form input[type="email"] {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  /* Fixed 16px, not the fluid rem scale: iOS Safari auto-zooms the whole
     page when a focused input computes under 16px, which feels janky on
     phones. Locking this one value keeps focus smooth at every size. */
  font-size: 16px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 200ms var(--ease-smooth), box-shadow 200ms var(--ease-smooth);
}
.newsletter-form input[type="email"]:focus {
  border-color: var(--vibrant);
  box-shadow: 0 0 0 3px rgba(109,93,246,0.15);
  outline: none;
}
.newsletter-form input[type="email"]::placeholder { color: var(--subtle); }
.newsletter-form input[type="email"].invalid {
  border-color: #b3261e;
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.12);
}
.newsletter-form input[type="email"].invalid:focus {
  border-color: #b3261e;
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.15);
}
.newsletter-form input[type="email"].shake { animation: newsletter-shake 340ms var(--ease-smooth); }
@keyframes newsletter-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .newsletter-form input[type="email"].shake { animation: none; }
}
.newsletter-form button { flex-shrink: 0; }
.newsletter-success { display: none; align-items: center; gap: 8px; font-size: 0.9375rem; color: var(--vibrant); }
.newsletter-error { display: none; margin-top: 8px; font-size: 0.8125rem; color: #b3261e; }

.newsletter-popup {
  display: flex;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 280ms var(--ease-smooth), visibility 280ms;
}
@media (min-width: 768px) { .newsletter-popup { align-items: center; } }
.newsletter-popup.open { opacity: 1; visibility: visible; pointer-events: auto; }
.newsletter-popup-backdrop {
  position: absolute; inset: 0;
  background: rgba(20,10,40,0.35);
  backdrop-filter: blur(4px);
}
.newsletter-popup-dialog {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 28rem;
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 24px 70px rgba(30,15,60,0.25);
  transform: translateY(12px) scale(0.98);
  transition: transform 320ms var(--ease-smooth);
}
.newsletter-popup.open .newsletter-popup-dialog { transform: translateY(0) scale(1); }
.newsletter-popup-close {
  position: absolute; top: 16px; right: 16px;
  padding: 6px; border-radius: var(--radius-sm); border: none; background: none;
  color: var(--muted); cursor: pointer;
  transition: background 200ms var(--ease-smooth), color 200ms var(--ease-smooth);
}
.newsletter-popup-close:hover { background: rgba(109,93,246,0.1); color: var(--vibrant); }
.newsletter-popup .newsletter-form input[type="email"] { background: var(--bg); }
.newsletter-popup .newsletter-form { flex-direction: column; max-width: none; }

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

.site-footer { border-top: 1px solid var(--border); }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 32px;
  row-gap: 48px;
  padding: 64px 0;
}
@media (min-width: 560px) { .footer-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .footer-grid { grid-template-columns: repeat(6, 1fr); } }
.footer-brand { grid-column: span 2 / span 2; display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 560px) and (max-width: 767px) { .footer-brand { grid-column: span 3 / span 3; } }
.footer-brand-name { font-family: var(--font-mono); font-size: 0.9375rem; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
.footer-col { display: flex; flex-direction: column; gap: 12px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col a { font-size: 0.9375rem; color: var(--muted); transition: color 150ms; }
.footer-col a:hover { color: var(--ink); }
.footer-bottom {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 0.8125rem;
  color: var(--subtle);
}
@media (min-width: 768px) { .footer-bottom { flex-direction: row; align-items: center; justify-content: space-between; } }
.footer-social { display: flex; gap: 20px; }
.footer-social a { transition: color 150ms; }
.footer-social a:hover { color: var(--ink); }

/* Prose / detail pages --------------------------------------------------- */

.prose-content { max-width: var(--max-prose); font-size: 1.0625rem; line-height: 1.65; color: rgba(var(--ink-rgb),0.9); }
.prose-content > * + * { margin-top: 1.4em; }
.prose-content h2 { font-size: clamp(1.5rem, 2.6vw, 2.25rem); font-weight: 500; margin-top: 2.5em; margin-bottom: 0.3em; letter-spacing: -0.02em; }
.prose-content h3 { font-size: clamp(1.125rem, 1.6vw, 1.5rem); font-weight: 500; margin-top: 1.8em; margin-bottom: 0.2em; letter-spacing: -0.01em; }
.prose-content a { color: var(--vibrant); text-decoration: underline; text-decoration-color: rgba(var(--vibrant-rgb),0.35); text-underline-offset: 4px; }
.prose-content a:hover { text-decoration-color: var(--vibrant); }
.prose-content ul, .prose-content ol { padding-left: 1.3em; }
.prose-content li + li { margin-top: 0.4em; }
.prose-content blockquote { border-left: 2px solid var(--vibrant); padding-left: 1.2em; font-style: italic; color: var(--muted); }
.prose-content code { font-family: var(--font-mono); font-size: 0.9em; background: rgba(var(--ink-rgb),0.06); padding: 2px 6px; border-radius: var(--radius-sm); }
.prose-content img { border-radius: var(--radius-md); border: 1px solid var(--border); }

.entry-header { padding: 64px 0 32px; border-bottom: 1px solid var(--border); }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--subtle); }

.copy-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: none;
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 200ms var(--ease-smooth), color 200ms var(--ease-smooth), background 200ms var(--ease-smooth);
}
.copy-link-btn:hover { border-color: var(--vibrant); color: var(--vibrant); }
.copy-link-btn.copied { border-color: var(--vibrant); color: var(--vibrant); background: rgba(var(--vibrant-rgb), 0.08); }
.entry-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.entry-tag { border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 2px 8px; font-size: 0.75rem; color: var(--muted); font-family: var(--font-mono); }
.entry-body { padding: 48px 0; }
.related-section { border-top: 1px solid var(--border); padding: 48px 0 80px; }

/* Buttons: inner span shifts on hover, matching the original Button component */
.btn-inner { display: inline-flex; align-items: center; gap: 8px; transition: transform 220ms var(--ease-precise); }
.btn:hover .btn-inner { transform: translateX(2px); }

/* Index page (archive-index.html) — compact divided lists, not cards */
.index-section { border-top: 1px solid var(--border); padding: 40px 0; }
.index-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.index-section-head a { font-size: clamp(1.125rem, 1.6vw, 1.5rem); font-weight: 500; letter-spacing: -0.01em; color: var(--ink); transition: color 150ms; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.index-section-head a:hover { color: var(--vibrant); }
.index-section-head .count { flex-shrink: 0; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--subtle); }
.index-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.index-list li { border-bottom: 1px solid var(--border); }
.index-list li:last-child { border-bottom: none; }
.index-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  transition: background 200ms var(--ease-smooth), padding 200ms var(--ease-smooth);
}
.index-list a:hover { background: rgba(var(--vibrant-rgb), 0.06); padding-left: 12px; padding-right: 12px; }
.index-list .title { font-size: 0.9375rem; color: var(--ink); transition: transform 200ms var(--ease-smooth); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.index-list a:hover .title { transform: translateX(2px); }
.index-list .meta { flex-shrink: 0; display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--subtle); }
.index-list .meta svg { color: var(--muted); transition: transform 260ms var(--ease-smooth), color 260ms var(--ease-smooth); }
.index-list a:hover .meta svg { transform: translate(2px,-2px); color: var(--vibrant); }
@media (max-width: 480px) {
  .index-list a { flex-wrap: wrap; }
  .index-list .title { white-space: normal; overflow: visible; text-overflow: clip; flex: 1 1 100%; }
}

/* Glossary --------------------------------------------------------------- */
.glossary-jumpnav { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.glossary-jumpnav a {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted);
  transition: background 200ms var(--ease-smooth), color 200ms var(--ease-smooth), transform 200ms var(--ease-smooth);
}
.glossary-jumpnav a:hover { background: rgba(var(--vibrant-rgb), 0.9); color: #fff; transform: translateY(-2px); }
.glossary-letter-section { border-bottom: 1px solid var(--border); padding: 40px 0; scroll-margin-top: 96px; }
.glossary-letter-mark { font-family: var(--font-mono); font-size: clamp(1.125rem, 1.6vw, 1.5rem); font-weight: 500; color: var(--subtle); margin-bottom: 24px; }
.glossary-dl { display: grid; grid-template-columns: 1fr; column-gap: 40px; row-gap: 32px; }
@media (min-width: 768px) { .glossary-dl { grid-template-columns: 1fr 1fr; } }
.glossary-dl dt a { font-size: clamp(1.125rem, 1.6vw, 1.5rem); font-weight: 500; letter-spacing: -0.01em; color: var(--ink); transition: color 150ms; }
.glossary-dl dt a:hover { color: var(--vibrant); }
.glossary-dl dd { margin: 8px 0 0; font-size: 0.9375rem; color: var(--muted); }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 500; color: var(--muted); margin-bottom: 32px; transition: color 150ms; }
.back-link:hover { color: var(--ink); }

/* PDF viewer --------------------------------------------------------------- */
.pdf-viewer { margin: 40px 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.pdf-viewer-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--border); padding: 12px 20px; }
.pdf-viewer-bar span { overflow-wrap: break-word; min-width: 0; }
.pdf-viewer-bar span { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); }
.pdf-viewer-bar a { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 500; color: var(--vibrant); transition: color 200ms var(--ease-smooth); }
.pdf-viewer-bar a:hover { color: var(--vibrant-2); }
.pdf-viewer object { display: block; width: 100%; height: 640px; }
@media (max-width: 480px) { .pdf-viewer object { height: 420px; } }

/* Utility ------------------------------------------------------------- */

.mt-2{margin-top:8px;} .mt-4{margin-top:16px;} .mt-6{margin-top:24px;} .mt-8{margin-top:32px;} .mt-10{margin-top:40px;} .mt-14{margin-top:56px;} .mt-16{margin-top:64px;}
.mb-4{margin-bottom:16px;}
.flex{display:flex;} .items-center{align-items:center;} .gap-2{gap:8px;} .gap-3{gap:12px;} .flex-wrap{flex-wrap:wrap;}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -100px; left: 16px; z-index: 100;
  background: rgba(var(--vibrant-rgb), 0.92); backdrop-filter: blur(6px); color: #fff; padding: 10px 16px; border-radius: var(--radius-md);
  transition: top 150ms;
}
.skip-link:focus { top: 16px; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s var(--ease-precise), transform 0.6s var(--ease-precise); }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* Staggered fade-in for grids of cards, matching Math.min(i*0.04, 0.2) in the original ContentGrid */
.card-grid > *:nth-child(2) { transition-delay: 40ms; }
.card-grid > *:nth-child(3) { transition-delay: 80ms; }
.card-grid > *:nth-child(4) { transition-delay: 120ms; }
.card-grid > *:nth-child(5) { transition-delay: 160ms; }
.card-grid > *:nth-child(n+6) { transition-delay: 200ms; }

.empty-state { padding: 48px 0; color: var(--muted); }

.loading-hint { padding: 48px 0; color: var(--subtle); font-family: var(--font-mono); font-size: 0.875rem; }

/* Search trigger button (opens the ⌘K command palette) --------------------- */

.search-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 200ms var(--ease-smooth), color 200ms var(--ease-smooth);
}
.search-trigger-btn:hover { border-color: var(--vibrant); color: var(--vibrant); }
.search-trigger-btn:active { transform: scale(0.95); }
.search-trigger-hint {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}
@media (max-width: 560px) { .search-trigger-hint { display: none; } }

/* Command palette (⌘K search) ----------------------------------------------- */

.cmdk-overlay {
  display: flex;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 70;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms var(--ease-smooth), visibility 220ms;
}
.cmdk-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }
.cmdk-backdrop {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(10, 10, 10, 0.5);
  backdrop-filter: blur(2px);
}
.cmdk-dialog {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 560px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(10, 10, 10, 0.25);
  overflow: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: transform 220ms var(--ease-smooth);
}
.cmdk-overlay.open .cmdk-dialog { transform: translateY(0) scale(1); }
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  flex-shrink: 0;
}
.cmdk-input-row input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-size: 16px;
  color: var(--ink);
  font-family: var(--font-sans);
}
.cmdk-input-row input::placeholder { color: var(--subtle); }
.cmdk-esc {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}
.cmdk-results { overflow-y: auto; padding: 8px; }
.cmdk-empty { padding: 28px 12px; text-align: center; color: var(--subtle); font-size: 0.875rem; }
.cmdk-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: background 120ms var(--ease-smooth);
}
.cmdk-item:hover, .cmdk-item.active { background: rgba(var(--vibrant-rgb), 0.08); }
.cmdk-item-kind { font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--vibrant); }
.cmdk-item-title { font-size: 0.9375rem; font-weight: 500; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item-subtitle { font-size: 0.8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Reading progress bar (entry pages only) ------------------------------------ */

.reading-progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--vibrant);
  z-index: 45;
  transition: width 100ms linear;
  pointer-events: none;
}

/* Toast notifications --------------------------------------------------------- */

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: 360px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 16px 40px rgba(10, 10, 10, 0.18);
  font-size: 0.875rem;
  color: var(--ink);
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 320ms var(--ease-smooth), opacity 320ms var(--ease-smooth);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.error { border-color: rgba(179, 38, 30, 0.35); }
.toast.success { border-color: rgba(var(--vibrant-rgb), 0.35); }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast.error .toast-icon { color: #b3261e; }
.toast.success .toast-icon { color: var(--vibrant); }
.toast-message { flex: 1; min-width: 0; line-height: 1.4; overflow-wrap: break-word; }
.toast-close { flex-shrink: 0; background: none; border: none; cursor: pointer; color: var(--subtle); padding: 2px; }
.toast-close:hover { color: var(--ink); }
@media (max-width: 480px) {
  #toast-container { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

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