/* ═══════════════════════════════════════════════════════════
   main.css — CK-01 Community Kinderwagen
   Precision Dark · Bricolage Grotesque · Plus Jakarta Sans
   ═══════════════════════════════════════════════════════════ */

/* ── Custom Properties ─────────────────────────────────── */
:root {
  /* Palette (from skills/05-tailwind-conventions.md) */
  --void:    #080808;
  --surface: #111111;
  --raised:  #1A1A1A;
  --stroke:  #222222;
  --muted:   #555555;
  --hi:      #F5F5F5;
  --acid:    #A600FF;
  --ember:   #FF4D00;

  /* Typography */
  --font-display: 'Bricolage Grotesque', 'Georgia', serif;
  --font-sans:    'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Spacing */
  --section-py: clamp(5rem, 10vw, 9rem);
  --section-px: clamp(1.25rem, 5vw, 3rem);
}
/* ── Light Theme ─────────────────────────────────── */
[data-theme="light"] {
  --void:    #F5F5F5;
  --surface: #FFFFFF;
  --raised:  #EBEBEB;
  --stroke:  #D8D8D8;
  --muted:   #888888;
  --hi:      #111111;
}

/* Nav background adapts to theme */
[data-theme="light"] .site-nav {
  background: rgba(245, 245, 245, 0.92);
}

/* Feature- and principle-cards in light mode */
[data-theme="light"] .feature-card,
[data-theme="light"] .principle-card {
  background: var(--surface);
}
[data-theme="light"] .feature-grid,
[data-theme="light"] .principle-grid {
  background: var(--stroke);
}
/* ── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  background: var(--void);
  color: var(--hi);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* ── Layout Utilities ──────────────────────────────────── */
.container-wide {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--section-px);
}

.container-narrow {
  max-width: 42rem;
  margin-inline: auto;
  padding-inline: var(--section-px);
}

/* ── Type Utilities ────────────────────────────────────── */
.text-acid  { color: var(--acid); }
.text-void  { color: var(--void); }
.text-muted { color: var(--muted); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* System label: mono, uppercase, spaced */
.sys-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Scroll Reveal ─────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Navigation ────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 8, 8, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--stroke);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--hi);
  letter-spacing: -0.02em;
}

.nav-logo-mark {
  width: 1.75rem;
  height: 1.75rem;
  background: var(--acid);
  color: var(--void);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link--active { color: var(--hi); }

.nav-cta {
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--acid);
  color: var(--void);
  padding: 0.375rem 0.875rem;
  transition: opacity 0.2s;
}

.nav-cta:hover { opacity: 0.85; }

/* ── Nav-right: groups controls + toggle ────────────── */
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Controls row (color picker + theme toggle) */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* ── Accent color picker ─────────────────────────── */
.accent-picker-wrap {
  position: relative;
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
}

.accent-swatch {
  position: absolute;
  inset: 0;
  background: var(--acid);
  border: 1px solid var(--stroke);
  pointer-events: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.accent-picker-wrap:hover .accent-swatch,
.accent-picker-wrap:focus-within .accent-swatch {
  border-color: var(--hi);
  box-shadow: 0 0 0 2px var(--acid);
}

.accent-picker-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

/* ── Theme toggle button ─────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--muted);
  transition: color 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--hi); }

/* Sun shown in dark mode (click → go light) */
.theme-toggle .icon-sun  { display: block; }
.theme-toggle .icon-moon { display: none;  }

/* Moon shown in light mode (click → go dark) */
[data-theme="light"] .theme-toggle .icon-sun  { display: none;  }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ── Mobile hamburger ────────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 0.3125rem;
  padding: 0.25rem;
}

.nav-toggle span {
  display: block;
  width: 1.25rem;
  height: 1px;
  background: var(--hi);
  transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(0.25rem, 0.25rem);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(0.25rem, -0.25rem);
}

.nav-mobile {
  display: none;
  border-top: 1px solid var(--stroke);
  padding: 1rem var(--section-px);
}
.nav-mobile.is-open { display: block; }
.nav-mobile ul { display: flex; flex-direction: column; gap: 1rem; }

@media (max-width: 48rem) {
  .nav-links  { display: none; }
  .nav-toggle { display: flex; }
}

/* ── Hero Section ──────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  /* Fill exactly one viewport height, accounting for mobile browser chrome */
  height: 100dvh;          /* dvh collapses mobile toolbar — best option     */
  min-height: 100dvh;
  max-height: 100dvh;
  padding-block: clamp(3rem, 6vw, 5rem);  /* comfortable inner breathing room */
  border-bottom: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Constrain inner text so it doesn't overflow if font is huge */
.hero > .container-wide {
  position: relative;
  z-index: 3;
  overflow: hidden;
}

/* 3D background canvas fills the full hero area */
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ── Hero 3D Model Loader ──────────────────────────────────────────────── */

/* Overlay sits on the canvas, behind all hero content */
.hero-model-loader {
  position: absolute;
  inset: 0;
  z-index: 1;           /* above canvas (z:0), below lens overlays (z:1+) */
  pointer-events: none;

  /* Entrance — visible by default, hidden once model ready */
  opacity: 1;
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-model-loader.is-done {
  opacity: 0;
  visibility: hidden;
}

/* Subtle animated grid */
.hero-model-loader::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--stroke) 1px, transparent 1px),
    linear-gradient(90deg, var(--stroke) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: hml-grid-breathe 4s ease-in-out infinite;
}

@keyframes hml-grid-breathe {
  0%, 100% { opacity: 0.05; }
  50%       { opacity: 0.15; }
}

/* Engineering corner brackets */
.hml-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--acid);
  border-style: solid;
  opacity: 0.6;
}
.hml-corner--tl { top: 1rem;    left: 1rem;    border-width: 1px 0 0 1px; }
.hml-corner--tr { top: 1rem;    right: 1rem;   border-width: 1px 1px 0 0; }
.hml-corner--bl { bottom: 1rem; left: 1rem;    border-width: 0 0 1px 1px; }
.hml-corner--br { bottom: 1rem; right: 1rem;   border-width: 0 1px 1px 0; }

/* Horizontal scan line sweeps top → bottom */
.hml-scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--acid) 30%,
    var(--acid) 70%,
    transparent 100%
  );
  opacity: 0.35;
  top: 0;
  animation: hml-scan 2.4s linear infinite;
}

@keyframes hml-scan {
  0%   { top: 0%;   opacity: 0;    }
  5%   { opacity: 0.35; }
  95%  { opacity: 0.35; }
  100% { top: 100%; opacity: 0;    }
}

/* Centre readout */
.hml-inner {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: hml-enter 0.5s ease both;
}

@keyframes hml-enter {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);   }
}

.hml-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--acid);
  white-space: nowrap;
}

.hml-bar-rail {
  width: clamp(120px, 20vw, 200px);
  height: 1px;
  background: var(--stroke);
}

.hml-bar {
  height: 100%;
  width: 0%;
  background: var(--acid);
  transition: width 0.2s ease;
  box-shadow: 0 0 5px color-mix(in srgb, var(--acid) 60%, transparent);
}

.hml-pct {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  color: var(--muted);
}

/* ── Hero Lens / Loupe Cursor ──────────────────────────────────────────── */
.hero {
  /* Position — updated by JS on mousemove */
  --cx:                    50%;
  --cy:                    50%;

  /* Lens geometry — overridden by JS from render-config.js loupe block */
  --lens-r-inner:          80px;
  --lens-r-outer:          120px;

  /* Blur amounts */
  --lens-blur-outer:       10px;
  --lens-blur-ring:        2px;

  /* Glass overlay */
  --lens-glass-color:      rgba(8,8,8,0.20);
  --lens-glass-saturate:   0.7;
  --lens-glass-brightness: 0.85;

  /* Cursor coordinate read-out */
  --cursor-coords-x:       10px;
  --cursor-coords-y:       -28px;
  --cursor-coords-opacity: 0.65;
}

.hero.hero--lens-active { cursor: none; }

/* ── Outer glass layer: ALWAYS visible, covers entire hero by default.
      On hover (.hero--lens-active) the lens-cutout mask is applied,
      punching a clean hole where the mouse is. ── */
.hero-lens-blur-outer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: var(--lens-glass-color);
  backdrop-filter:         blur(var(--lens-blur-outer)) saturate(var(--lens-glass-saturate)) brightness(var(--lens-glass-brightness));
  -webkit-backdrop-filter: blur(var(--lens-blur-outer)) saturate(var(--lens-glass-saturate)) brightness(var(--lens-glass-brightness));
  /* No mask by default → full-screen glass */
  mask-image: none;
  -webkit-mask-image: none;
  transition: opacity 0.4s ease;
}

/* Apply lens cutout only while mouse is inside the hero */
.hero.hero--lens-active .hero-lens-blur-outer {
  mask-image: radial-gradient(
    circle var(--lens-r-outer) at var(--cx) var(--cy),
    transparent 0%,
    transparent calc(var(--lens-r-outer) - 1px),
    black       var(--lens-r-outer)
  );
  -webkit-mask-image: radial-gradient(
    circle var(--lens-r-outer) at var(--cx) var(--cy),
    transparent 0%,
    transparent calc(var(--lens-r-outer) - 1px),
    black       var(--lens-r-outer)
  );
}

/* ── Ring layer: only meaningful when lens is positioned → show on hover only ── */
.hero-lens-blur-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  backdrop-filter:         none;
  -webkit-backdrop-filter: none;
  transition: opacity 0.4s ease;
}

.hero.hero--lens-active .hero-lens-blur-ring {
  opacity: 1;
  backdrop-filter:         blur(var(--lens-blur-ring));
  -webkit-backdrop-filter: blur(var(--lens-blur-ring));
  mask-image: radial-gradient(
    circle at var(--cx) var(--cy),
    transparent                           0,
    transparent                           calc(var(--lens-r-inner) - 1px),
    black                                 var(--lens-r-inner),
    black                                 calc(var(--lens-r-outer) - 1px),
    transparent                           var(--lens-r-outer)
  );
  -webkit-mask-image: radial-gradient(
    circle at var(--cx) var(--cy),
    transparent                           0,
    transparent                           calc(var(--lens-r-inner) - 1px),
    black                                 var(--lens-r-inner),
    black                                 calc(var(--lens-r-outer) - 1px),
    transparent                           var(--lens-r-outer)
  );
}

/* Custom loupe cursor element */
.hero-cursor {
  position: absolute;
  top: 0; left: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  will-change: transform;
}

.hero-cursor.is-visible { opacity: 1; }

/* Center the 280×280 SVG on the cursor hot-point */
.hero-cursor-svg {
  position: absolute;
  top:  -140px;
  left: -140px;
  display: block;
  overflow: visible;
}

/* Coordinate readout — NE offset driven by CSS vars from render-config.js */
.hero-cursor-coords {
  position: absolute;
  left: var(--cursor-coords-x);
  top:  var(--cursor-coords-y);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  line-height: 1.45;
  letter-spacing: 0.1em;
  color: var(--acid);
  opacity: var(--cursor-coords-opacity);
  white-space: pre;    /* preserve line breaks in textContent */
}

.status-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--acid);
  margin-right: 0.5rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.hero-headline {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.5rem, 10vw, 8rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--hi);
  margin-bottom: 3rem;
}

.hero-spec {
  max-width: 32rem;
  margin-bottom: 3rem;
  padding-left: 1.5rem;
  border-left: 2px solid var(--acid);
}

.spec-coords {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--acid);
  margin-bottom: 0.75rem;
}

.spec-tagline {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--muted);
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ── Buttons ───────────────────────────────────────────── */
/* No border-radius — square corners are part of the design language */
.btn-primary {
  display: inline-block;
  background: var(--acid);
  color: var(--void);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.875rem 2rem;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.88; }

.btn-secondary {
  display: inline-block;
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: 0.875rem 2rem;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover { border-color: var(--hi); color: var(--hi); }

/* Used on acid background */
.btn-dark {
  background: var(--void);
  color: var(--acid);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.875rem 1.5rem;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.btn-dark:hover { opacity: 0.85; }

/* ── Section Common ────────────────────────────────────── */
.section-dark,
.section-surface {
  padding-block: var(--section-py);
  border-bottom: 1px solid var(--stroke);
}

.section-dark    { background-color: color-mix(in srgb, var(--void)    85%, transparent); }
.section-surface { background-color: color-mix(in srgb, var(--surface) 85%, transparent); }

.section-header { max-width: 42rem; margin-bottom: clamp(3rem, 6vw, 5rem); }

.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.25rem, 5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--hi);
}

.section-intro {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.75;
  color: var(--muted);
  max-width: 38rem;
}
.section-intro strong { color: var(--hi); font-weight: 600; }

/* ── Projekt Section ───────────────────────────────────── */
.projekt-intro {
  margin-bottom: clamp(3.5rem, 7vw, 6rem);
}

.projekt-intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}

.projekt-intro-copy {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 0.375rem;
  font-size: clamp(0.9375rem, 1.5vw, 1.0625rem);
  line-height: 1.75;
  color: var(--muted);
}
.projekt-intro-copy strong { color: var(--hi); font-weight: 600; }

.projekt-pillars {
  border-top: 1px solid var(--stroke);
}

.projekt-pillar {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  gap: 2rem;
  align-items: start;
  padding-block: 2.25rem;
  border-bottom: 1px solid var(--stroke);
  transition: padding-left 0.3s ease;
}
.projekt-pillar:hover { padding-left: 0.75rem; }

.projekt-pillar-num { padding-top: 0.2rem; }

.projekt-pillar .feature-ambition {
  margin-top: 0.25rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.projekt-pillar:hover .feature-ambition { color: var(--acid); border-color: var(--acid); }

.projekt-pillar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  letter-spacing: -0.02em;
  color: var(--hi);
  margin-bottom: 0.625rem;
}

.projekt-pillar-desc {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--muted);
}

@media (max-width: 48rem) {
  .projekt-intro-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .projekt-pillar {
    grid-template-columns: 2.5rem 1fr;
    grid-template-rows: auto auto;
  }
  .projekt-pillar .feature-ambition { grid-column: 2; }
}

/* ── Vision / Feature Grid ─────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1px;
  background: var(--stroke);
}

.feature-card {
  background: var(--void);
  padding: 2.5rem;
  border-top: 2px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
.feature-card:hover {
  border-top-color: var(--acid);
  background: var(--surface);
}

.feature-num { display: block; margin-bottom: 1.25rem; }
.feature-card:hover .feature-num { color: var(--acid); }

.feature-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--hi);
  margin-bottom: 1rem;
}

.feature-desc {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.feature-ambition {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--stroke);
  border: 1px solid var(--stroke);
  padding: 0.25rem 0.5rem;
  display: inline-block;
  transition: color 0.3s, border-color 0.3s;
}
.feature-card:hover .feature-ambition { color: var(--acid); border-color: var(--acid); }

/* ── Roadmap Timeline ──────────────────────────────────── */
.roadmap-timeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  position: relative;
}

.roadmap-timeline::before {
  content: '';
  position: absolute;
  top: 1.75rem;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--stroke);
}

.roadmap-step {
  padding: 0 2rem 2.5rem 0;
  position: relative;
}

/* Dot on the timeline */
.roadmap-step::before {
  content: '';
  display: block;
  width: 0.625rem;
  height: 0.625rem;
  background: var(--acid);
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.step-num { display: block; margin-bottom: 0.75rem; }

.step-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.015em;
  color: var(--hi);
  margin-bottom: 0.75rem;
}

.step-desc {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--muted);
}

/* Active phase marker */
.roadmap-step--active::before {
  background: var(--acid);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--acid) 25%, transparent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--acid) 25%, transparent); }
  50%       { box-shadow: 0 0 0 8px color-mix(in srgb, var(--acid) 10%, transparent); }
}

.step-status {
  display: inline-block;
  margin-left: 0.75rem;
  font-size: 0.65rem;
  color: var(--acid);
  vertical-align: middle;
  letter-spacing: 0.04em;
}

/* ── Participation / Principle Grid ────────────────────── */
.principle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1px;
  background: var(--stroke);
}

.principle-card {
  background: var(--void);
  padding: 2.5rem;
  border-top: 2px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
.principle-card:hover {
  border-top-color: var(--acid);
  background: var(--surface);
}

.principle-num { display: block; margin-bottom: 1.25rem; color: var(--muted); }
.principle-card:hover .principle-num { color: var(--acid); }

.principle-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--hi);
  margin-bottom: 1rem;
}

.principle-desc {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--muted);
}

/* ── Sustainability Metrics ────────────────────────────── */
.sus-metrics {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4rem;
  align-items: center;
}

.sus-score {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border-left: 2px solid var(--acid);
  padding-left: 2rem;
}

.score-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(5rem, 12vw, 10rem);
  line-height: 0.9;
  color: var(--acid);
  letter-spacing: -0.04em;
}

.score-unit { color: var(--muted); margin-top: 0.5rem; }

.sus-list   { display: flex; flex-direction: column; gap: 1rem; }

.sus-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9375rem;
  color: var(--muted);
  border-bottom: 1px solid var(--stroke);
  padding-bottom: 1rem;
  transition: color 0.2s;
}
.sus-item:hover { color: var(--hi); }

.sus-icon {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--acid);
  flex-shrink: 0;
}

@media (max-width: 48rem) {
  .sus-metrics { grid-template-columns: 1fr; gap: 2.5rem; }
}

/* ── Newsletter — Acid Section ─────────────────────────── */
.section-acid {
  background-color: color-mix(in srgb, var(--acid) 85%, transparent);
  padding-block: var(--section-py);
  border-bottom: 1px solid var(--void);
}

.newsletter-sub {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--void);
  opacity: 0.7;
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
  max-width: 30rem;
}

.newsletter-form { max-width: 36rem; }

.form-group {
  display: flex;
  border: 1px solid var(--void);
}

.form-input {
  flex: 1;
  padding: 0.875rem 1rem;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--void);
}
.form-input::placeholder { color: rgba(8, 8, 8, 0.4); }

.form-status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--void);
  margin-top: 0.75rem;
  min-height: 1.25rem;
}

/* ── Footer ────────────────────────────────────────────── */
.site-footer {
  background-color: color-mix(in srgb, var(--void) 85%, transparent);
  border-top: 1px solid var(--stroke);
}

.footer-body {
  padding-block: 4rem;
}

/* Top grid: brand · nav · status */
.footer-top {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 3rem 4rem;
  align-items: start;
  margin-bottom: 3rem;
}

.footer-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--hi);
  line-height: 1.25;
  margin-bottom: 1rem;
}

.footer-tagline {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

.footer-nav-label {
  margin-bottom: 1.25rem;
}

.footer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-link {
  font-size: 0.8125rem;
  color: var(--muted);
  transition: color 0.2s;
}
.footer-link:hover,
.footer-link:focus-visible { color: var(--hi); }

.footer-status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.footer-status-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--acid);
}

.footer-status-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Sponsor logos */
.footer-sponsors {
  border-top: 1px solid var(--stroke);
  padding-top: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-sponsors-label {
  margin-bottom: 1.5rem;
}

.footer-sponsor-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem 3rem;
}

.sponsor-logo {
  width: auto;
  opacity: 0.65;
  filter: grayscale(1) brightness(2);
  transition: opacity 0.25s, filter 0.25s;
}
.sponsor-logo:hover {
  opacity: 1;
  filter: grayscale(0) brightness(1);
}

/* Bottom bar */
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid var(--stroke);
  padding-top: 2rem;
  color: var(--stroke);
}

.footer-legal {
  display: flex;
  gap: 1.5rem;
}

@media (max-width: 56rem) {
  .footer-top {
    grid-template-columns: 1fr 1fr;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 40rem) {
  .footer-top {
    grid-template-columns: 1fr;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Codeberg Repository Section ──────────────────────── */
.codeberg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 2px;
  background: var(--stroke);
}

.codeberg-panel {
  background: var(--void);
  padding: 2.5rem;
}

[data-theme="light"] .codeberg-panel {
  background: var(--surface);
}

.codeberg-panel-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 0;
}

.codeberg-panel-header .cb-count {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--acid);
  letter-spacing: 0.1em;
}

/* Loading / empty / error state items */
.cb-loading,
.cb-empty,
.cb-error {
  padding: 1rem 0;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}
.cb-error { color: var(--ember); }

/* ── Branch list ─────────────────────────────────── */
.branch-list,
.issue-list {
  display: flex;
  flex-direction: column;
}

.branch-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--stroke);
}
.branch-item:last-child { border-bottom: none; }

.branch-icon {
  color: var(--muted);
  flex-shrink: 0;
}

.branch-name {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--hi);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s;
}
.branch-name:hover,
.branch-name:focus-visible { color: var(--acid); }

.branch-badge {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--void);
  background: var(--acid);
  padding: 0.125rem 0.4rem;
  flex-shrink: 0;
}

/* ── Issue list ──────────────────────────────────── */
.issue-item {
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  align-items: start;
  gap: 0.5rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--stroke);
}
.issue-item:last-child { border-bottom: none; }

.issue-num {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-top: 0.125rem;
}

.issue-body {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}

.issue-title {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--hi);
  transition: color 0.2s;
}
.issue-title:hover,
.issue-title:focus-visible { color: var(--acid); }

.issue-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.issue-label {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.125rem 0.4rem;
  border: 1px solid var(--label-color, var(--acid));
  color: var(--label-color, var(--acid));
}

/* ── Focus visible ─────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 3px;
}

/* ── Branch Cards ──────────────────────────────────────── */
.branch-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 1px;
  background: var(--stroke);
}

.branch-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--raised);
  text-decoration: none;
  transition: background 0.2s;
}
.branch-card:hover,
.branch-card:focus-visible { background: var(--surface); outline-offset: -2px; }

[data-theme="light"] .branch-card { background: var(--surface); }
[data-theme="light"] .branch-card:hover { background: var(--raised); }

.branch-card-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--hi);
  transition: color 0.2s;
  min-width: 0;
}
.branch-card-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.branch-card:hover .branch-card-name,
.branch-card:focus-visible .branch-card-name { color: var(--acid); }

.branch-card-meta {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Issue Cards ───────────────────────────────────────── */
.issue-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--stroke);
}

.issue-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--raised);
  transition: background 0.2s;
}
.issue-card:hover { background: var(--surface); }

[data-theme="light"] .issue-card { background: var(--surface); }
[data-theme="light"] .issue-card:hover { background: var(--raised); }

.issue-card-header {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
}

.issue-card-title {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--hi);
  transition: color 0.2s;
  flex: 1;
}
.issue-card-title:hover,
.issue-card-title:focus-visible { color: var(--acid); }

.issue-card-meta {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Panel footer / "show all" link ───────────────────── */
.codeberg-panel-footer {
  padding-top: 1rem;
  margin-top: 1px;
  border-top: 1px solid var(--stroke);
  min-height: 2.25rem;
  display: flex;
  align-items: center;
}

.cb-more-link {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--acid);
  transition: opacity 0.2s;
}
.cb-more-link:hover,
.cb-more-link:focus-visible { opacity: 0.65; }

[hidden] { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   Repository Page — Interactions
   ═══════════════════════════════════════════════════════════ */

/* ── Repo Toolbar ──────────────────────────────────────────
   Sticky bar between the hero and the content sections.    */
.repo-toolbar {
  position: sticky;
  top: 3.5rem; /* sits just below .site-nav */
  z-index: 80;
  background: rgba(8, 8, 8, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--stroke);
}
[data-theme="light"] .repo-toolbar {
  background: rgba(245, 245, 245, 0.95);
}

.repo-toolbar-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 3rem;
}

/* ── Search ────────────────────────────────────────────── */
.repo-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  max-width: 28rem;
  border: 1px solid var(--stroke);
  background: var(--raised);
  padding: 0 0.75rem;
  height: 2rem;
  transition: border-color 0.2s;
}
.repo-search-wrap:focus-within {
  border-color: var(--acid);
}

.repo-search-icon { color: var(--muted); flex-shrink: 0; }

.repo-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--hi);
  min-width: 0;
}
.repo-search-input::placeholder { color: var(--muted); }
.repo-search-input::-webkit-search-cancel-button { display: none; }

.repo-search-kbd {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--stroke);
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.repo-search-wrap:focus-within .repo-search-kbd { opacity: 0; }

.repo-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-left: auto;
}

.repo-stats {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.repo-toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--muted);
  border: 1px solid var(--stroke);
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.repo-toolbar-btn:hover { color: var(--acid); border-color: var(--acid); }
.repo-toolbar-btn svg { transition: transform 0.3s ease; }
.repo-toolbar-btn.is-spinning svg {
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── cb-count in repo block headers ───────────────────── */
.repo-block-header .cb-count {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  color: var(--acid);
  margin-right: auto;
}

/* ── Issue Controls ────────────────────────────────────── */
.issue-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ctrl-group {
  display: flex;
  border: 1px solid var(--stroke);
  overflow: hidden;
}

.ctrl-btn {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.375rem 0.625rem;
  background: var(--raised);
  border-right: 1px solid var(--stroke);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.ctrl-btn:last-child { border-right: none; }
.ctrl-btn:hover { color: var(--hi); background: var(--surface); }
.ctrl-btn.is-active { color: var(--void); background: var(--acid); }

.ctrl-btn--icon {
  padding: 0.375rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Label Filter Pills ────────────────────────────────── */
.label-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 1.5rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--stroke);
}

.label-filter-pill {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--label-color, var(--acid));
  color: var(--label-color, var(--acid));
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.label-filter-pill:hover {
  background: color-mix(in srgb, var(--label-color, var(--acid)) 15%, transparent);
}
.label-filter-pill.is-active {
  background: var(--label-color, var(--acid));
  color: var(--void);
}

/* ── Issue card: interactive label buttons ─────────────── */
.issue-card .issue-label {
  cursor: pointer;
  background: transparent;
  transition: background 0.15s, color 0.15s;
}
.issue-card .issue-label:hover {
  background: color-mix(in srgb, var(--label-color, var(--acid)) 15%, transparent);
}
.issue-card .issue-label.is-active {
  background: var(--label-color, var(--acid));
  color: var(--void);
}

/* ── Issue list / compact view ─────────────────────────── */
.issue-cards--list {
  grid-template-columns: 1fr !important;
}
.issue-cards--list .issue-card {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  flex-wrap: nowrap;
}
.issue-cards--list .issue-card-header { flex-shrink: 0; }
.issue-cards--list h3.issue-card-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  font-size: 0.8125rem;
}
.issue-cards--list .issue-card-preview,
.issue-cards--list .issue-labels { display: none; }
.issue-cards--list .issue-card-footer { flex-shrink: 0; flex-wrap: nowrap; }
.issue-cards--list .issue-card-footer .issue-card-author { display: none; }
.issue-cards--list .issue-card-meta { white-space: nowrap; }

/* ── Branch: copy-to-clipboard button ─────────────────── */
.branch-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  border: 1px solid transparent;
}
.branch-card:hover .branch-copy-btn,
.branch-card:focus-within .branch-copy-btn { opacity: 1; }
.branch-copy-btn:hover { color: var(--acid); border-color: var(--stroke); }
.branch-copy-btn.copy-success { color: #4ade80 !important; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 40rem) {
  .ctrl-group--sort { display: none; }
  .repo-stats        { display: none; }
}
@media (max-width: 28rem) {
  .ctrl-group--state .ctrl-btn { font-size: 0.5rem; padding: 0.3rem 0.45rem; }
}

/* ═══════════════════════════════════════════════════════════
   Issue Detail Drawer
   ═══════════════════════════════════════════════════════════ */

.issue-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.issue-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.issue-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 201;
  width: min(46rem, 100vw);
  background: var(--void);
  border-left: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
[data-theme="light"] .issue-drawer { background: var(--bg); }
.issue-drawer.is-open { transform: translateX(0); }

.issue-drawer-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.issue-drawer-header {
  padding: 1.5rem 2rem 1.25rem;
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
}
.issue-drawer-top-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.875rem;
}

.issue-drawer-state {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.175rem 0.45rem;
  border: 1px solid;
}
.issue-drawer-state[data-state="open"]   { color: var(--acid); border-color: var(--acid); }
.issue-drawer-state[data-state="closed"] { color: var(--muted); border-color: var(--stroke); }

.issue-drawer-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.issue-drawer-ext,
.issue-drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--muted);
  border: 1px solid var(--stroke);
  transition: color 0.2s, border-color 0.2s;
  cursor: pointer;
  text-decoration: none;
}
.issue-drawer-ext:hover,
.issue-drawer-close:hover { color: var(--acid); border-color: var(--acid); }

.issue-drawer-title {
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--hi);
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.issue-drawer-byline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  min-height: 1.5rem;
}
.drawer-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--raised);
  flex-shrink: 0;
  object-fit: cover;
}
.drawer-author-name {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  color: var(--hi);
}
.drawer-author-date {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}
.drawer-author-date::before { content: '·'; margin-right: 0.4rem; }

/* Scrollable body */
.issue-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--stroke) transparent;
}
.issue-drawer-description { margin-bottom: 2.5rem; }

.issue-drawer-comments-heading {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 1.5rem;
}

.issue-comment {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 2rem;
}
.issue-comment:last-child { border-bottom: none; margin-bottom: 0; }
.issue-comment-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.issue-comment-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--raised);
  flex-shrink: 0;
  object-fit: cover;
}
.issue-comment-meta { display: flex; flex-direction: column; gap: 0.125rem; }
.issue-comment-author {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--hi);
}
.issue-comment-date {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ── Inline Markdown render ────────────────────────────── */
.issue-md {
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--text);
  word-break: break-word;
}
.issue-md p { margin-bottom: 0.875em; }
.issue-md p:last-child { margin-bottom: 0; }
.issue-md h1,.issue-md h2,.issue-md h3,
.issue-md h4,.issue-md h5,.issue-md h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--hi);
  margin: 1.5em 0 0.5em;
}
.issue-md h1 { font-size: 1.25em; }
.issue-md h2 { font-size: 1.125em; }
.issue-md h3 { font-size: 1em; }
.issue-md code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--raised);
  padding: 0.125em 0.375em;
  border: 1px solid var(--stroke);
}
.issue-md pre {
  background: var(--raised);
  border: 1px solid var(--stroke);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1em 0;
}
.issue-md pre code { background: none; border: none; padding: 0; font-size: 0.8125rem; }
.issue-md ul,.issue-md ol { padding-left: 1.5rem; margin-bottom: 0.875em; }
.issue-md li { margin-bottom: 0.25em; }
.issue-md strong { font-weight: 600; color: var(--hi); }
.issue-md em { font-style: italic; }
.issue-md del { text-decoration: line-through; color: var(--muted); }
.issue-md a { color: var(--acid); text-underline-offset: 2px; text-decoration: underline; }
.issue-md a:hover { text-decoration: none; }
.issue-md blockquote {
  border-left: 3px solid var(--stroke);
  margin: 1em 0;
  padding: 0.25em 1em;
  color: var(--muted);
}
.issue-md hr { border: none; border-top: 1px solid var(--stroke); margin: 1.5em 0; }

/* ── Issue card improvements ─────────────────────────────── */
.issue-card { cursor: pointer; }
.issue-card:hover h3.issue-card-title { color: var(--acid); }
h3.issue-card-title { flex: none; font-weight: 600; }

.issue-card-preview {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.issue-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
}
.issue-card-author {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.issue-card-ext {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--muted);
  border: 1px solid var(--stroke);
  margin-left: auto;
  opacity: 0;
  flex-shrink: 0;
  transition: opacity 0.2s, color 0.2s, border-color 0.2s;
}
.issue-card:hover .issue-card-ext { opacity: 1; }
.issue-card-ext:hover { color: var(--acid); border-color: var(--acid); }

/* ═══════════════════════════════════════════════════════════
   Intro Loader
   First-visit / hourly splash screen with breathing RZZ logo
   ═══════════════════════════════════════════════════════════ */

/* Gate: hide loader immediately for return visits */
.no-intro #intro-loader { display: none !important; }

.intro-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--void);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Exit transition */
  transition: opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

.intro-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── Animated grid background ──────────────────────────── */
.loader-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--stroke) 1px, transparent 1px),
    linear-gradient(90deg, var(--stroke) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: loader-grid-breathe 5s ease-in-out infinite;
}

@keyframes loader-grid-breathe {
  0%, 100% { opacity: 0.25; }
  50%       { opacity: 0.45; }
}

/* ── Engineering corner markers ────────────────────────── */
.loader-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--acid);
  border-style: solid;
  opacity: 0.55;
}
.loader-corner--tl { top: 1.5rem; left: 1.5rem;  border-width: 1px 0 0 1px; }
.loader-corner--tr { top: 1.5rem; right: 1.5rem; border-width: 1px 1px 0 0; }
.loader-corner--bl { bottom: 1.5rem; left: 1.5rem;  border-width: 0 0 1px 1px; }
.loader-corner--br { bottom: 1.5rem; right: 1.5rem; border-width: 0 1px 1px 0; }

/* ── Centred content stack ─────────────────────────────── */
.loader-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  text-align: center;
  /* Fade-in on entry */
  animation: loader-enter 0.6s ease both;
}

@keyframes loader-enter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Logo wrap + breathing animation ──────────────────── */
.loader-logo-wrap {
  position: relative;
  width: 128px;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Expanding ring pulses */
.loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--acid);
  animation: loader-ring-expand 3s ease-out infinite;
}
.loader-ring--2 { animation-delay: 1.5s; }

@keyframes loader-ring-expand {
  0%   { opacity: 0.6; transform: scale(0.75); }
  100% { opacity: 0;   transform: scale(1.55); }
}

/* The logo itself: slow breathing */
.loader-logo {
  position: relative;
  z-index: 1;
  width: 72px;
  height: auto;
  animation: loader-breathe 3.2s ease-in-out infinite;
}

@keyframes loader-breathe {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0px transparent);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 18px rgba(202, 255, 0, 0.45));
    opacity: 1;
  }
}

/* ── Copy block ────────────────────────────────────────── */
.loader-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.loader-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--acid);
}

.loader-tagline {
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 3.5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--hi);
}

/* ── Progress bar ──────────────────────────────────────── */
.loader-bar-rail {
  width: clamp(160px, 30vw, 240px);
  height: 1px;
  background: var(--stroke);
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  width: 0%;
  background: var(--acid);
  transition: width 0.25s ease;
  box-shadow: 0 0 6px rgba(202, 255, 0, 0.5);
}

/* ── Status text ───────────────────────────────────────── */
.loader-status {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Light theme adaptation ────────────────────────────── */
[data-theme="light"] .intro-loader {
  background: var(--void); /* keep loader always dark */
}


/* ═══════════════════════════════════════════════════════════
   Journal Page
   ═══════════════════════════════════════════════════════════ */

/* ── Hero ─────────────────────────────────────────────────── */
.journal-hero {
  padding-block: 1.75rem;
  border-bottom: 1px solid var(--stroke);
}

.journal-hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.journal-hero-left {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.journal-hero-left .back-link {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s;
  white-space: nowrap;
}
.journal-hero-left .back-link:hover { color: var(--acid); }

.journal-hero-left .sys-label {
  white-space: nowrap;
}

.journal-hero-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--hi);
  white-space: nowrap;
}

.journal-hero-right {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-shrink: 0;
}

.journal-hero-right .cb-count {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.journal-refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--muted);
  border: 1px solid var(--stroke);
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.journal-refresh-btn:hover:not(:disabled) {
  color: var(--acid);
  border-color: var(--acid);
}
.journal-refresh-btn:disabled { opacity: 0.45; cursor: not-allowed; }

@keyframes journal-spin {
  to { transform: rotate(360deg); }
}

/* ── Reader: two-column layout ────────────────────────────── */
.journal-reader-section {
  padding-block: 0;
}

.journal-reader-layout {
  display: grid;
  grid-template-columns: 1fr 21rem;
  align-items: start;
  max-width: 90rem;
  margin-inline: auto;
  padding-inline: var(--section-px);
}

/* ── Article stream (left column) ────────────────────────── */
.journal-stream {
  padding-block: clamp(3rem, 6vw, 5rem);
  padding-right: clamp(2rem, 4vw, 4rem);
  border-right: 1px solid var(--stroke);
  min-height: 60vh;
}

/* ═══════════════════════════════════════════════════════════
   bg-grid — Page Background Grid
   Vercel · Linear · Raycast inspired depth layer
   ─────────────────────────────────────────────────────────
   HTML (place as first child of <body>):

   <div class="bg-grid" aria-hidden="true">
     <div class="bg-grid__glow bg-grid__glow--1"></div>
     <div class="bg-grid__glow bg-grid__glow--2"></div>
   </div>

   React/Next.js equivalent:

   export const BgGrid = () => (
     <div className="bg-grid" aria-hidden="true">
       <div className="bg-grid__glow bg-grid__glow--1" />
       <div className="bg-grid__glow bg-grid__glow--2" />
     </div>
   );
   ═══════════════════════════════════════════════════════════ */

/* ── 1 · Grid lines on section backgrounds ─────────────── */
/*
  Five stacked background-images form the crosshatch:
    1 · Intersection dot  — 1 px circle at every 40 px node
    2 · Fine horizontal   — 40 px pitch, ~4 % white opacity
    3 · Fine vertical     — 40 px pitch, ~4 % white opacity
    4 · Major horizontal  — 200 px pitch  (5-cell span), ~6 %
    5 · Major vertical    — 200 px pitch, ~6 %

  background-attachment: fixed makes all sections share the
  same viewport coordinate system → seamless grid across
  every section boundary with no offset discontinuities.

  The section background shorthands above are changed to
  background-color so they don't reset background-image.
*/
.hero,
.section-dark,
.section-surface,
.section-acid,
.site-footer {
  position: relative;          /* stacking context above fixed .bg-grid */
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.09) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.042) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.042) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.062) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.062) 1px, transparent 1px);
  background-size:
    40px  40px,
    40px  40px,
    40px  40px,
    200px 200px,
    200px 200px;
  background-attachment: fixed;
}

/* ── 2 · Fixed glow container ───────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ── 3 · Ambient glow orbs ──────────────────────────────── */
.bg-grid__glow {
  position: absolute;
  pointer-events: none;
}

/*
  Glow 1 — acid / purple — upper-center
  Provides a warm focal point above the fold and reacts
  automatically to the user's --acid accent-color choice.
*/
.bg-grid__glow--1 {
  top: -18%;
  left: 50%;
  transform: translateX(-50%);
  width: 80vw;
  max-width: 1000px;
  height: 65vh;
  background: radial-gradient(
    ellipse at 50% 38%,
    color-mix(in srgb, var(--acid) 13%, transparent)  0%,
    color-mix(in srgb, var(--acid)  4%, transparent) 44%,
    transparent 70%
  );
}

/*
  Glow 2 — ember / orange — lower-right
  Asymmetric warmth counter-balances the acid glow,
  adding visual tension across the diagonal axis.
*/
.bg-grid__glow--2 {
  bottom: -8%;
  right: -10%;
  width: 55vw;
  max-width: 700px;
  height: 50vh;
  background: radial-gradient(
    ellipse at 65% 60%,
    color-mix(in srgb, var(--ember) 9%, transparent)  0%,
    color-mix(in srgb, var(--ember) 3%, transparent) 42%,
    transparent 68%
  );
}

/* ── 4 · Edge vignette ──────────────────────────────────── */
/*
  Radial gradient fades both glow orbs into the void color
  at all four viewport edges, creating a "lit from within"
  depth effect without hard boundaries.
*/
.bg-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 120% 105% at 50% 50%,
    transparent 28%,
    color-mix(in srgb, var(--void) 38%, transparent) 56%,
    color-mix(in srgb, var(--void) 80%, transparent) 78%,
    var(--void) 100%
  );
}

/* ── 5 · Light-mode grid — dark lines on light background ── */
/*
  In light mode the white-line grid is invisible.
  Override with dark (--hi = #111) lines at the same opacity
  levels, and swap the glow orbs to subtler dark-tinted radials.
*/
[data-theme="light"] .hero,
[data-theme="light"] .section-dark,
[data-theme="light"] .section-surface,
[data-theme="light"] .section-acid,
[data-theme="light"] .site-footer {
  background-image:
    radial-gradient(circle, rgba(0, 0, 0, 0.10) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.07) 1px, transparent 1px);
}

/* Glow orbs: soften in light mode so they don't drown the UI */
[data-theme="light"] .bg-grid__glow--1 {
  background: radial-gradient(
    ellipse at 50% 38%,
    color-mix(in srgb, var(--acid) 8%, transparent)  0%,
    color-mix(in srgb, var(--acid) 2%, transparent) 44%,
    transparent 70%
  );
}
[data-theme="light"] .bg-grid__glow--2 {
  background: radial-gradient(
    ellipse at 65% 60%,
    color-mix(in srgb, var(--ember) 5%, transparent)  0%,
    color-mix(in srgb, var(--ember) 2%, transparent) 42%,
    transparent 68%
  );
}

/* Edge vignette: fade to light --void (#F5F5F5) in light mode */
[data-theme="light"] .bg-grid::after {
  background: radial-gradient(
    ellipse 120% 105% at 50% 50%,
    transparent 28%,
    color-mix(in srgb, var(--void) 38%, transparent) 56%,
    color-mix(in srgb, var(--void) 80%, transparent) 78%,
    var(--void) 100%
  );
}

.stream-article {
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

.stream-article-header {
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.stream-article-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--acid);
  margin-bottom: 0.75rem;
}

.stream-article-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--hi);
  margin-bottom: 0.875rem;
}

.stream-article-ext {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.stream-article-ext:hover { color: var(--acid); }

/* ── Markdown content inside stream article ───────────────── */
.stream-article-body .issue-md {
  font-size: 1.0625rem;
  line-height: 1.85;
  max-width: 68ch;
}
.stream-article-body .issue-md h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-top: 2.5em;
  margin-bottom: 0.75em;
}
.stream-article-body .issue-md h2 {
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 2.5vw, 1.625rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2em;
  margin-bottom: 0.625em;
}
.stream-article-body .issue-md h3 {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 600;
  margin-top: 1.75em;
  margin-bottom: 0.5em;
}
.stream-article-body .issue-md h4,
.stream-article-body .issue-md h5,
.stream-article-body .issue-md h6 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
.stream-article-body .issue-md p { margin-bottom: 1.25em; }
.stream-article-body .issue-md blockquote {
  border-left: 3px solid var(--acid);
  padding: 0.5em 1.25em;
  color: var(--muted);
  margin: 1.5em 0;
}
.stream-article-body .issue-md code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}
.stream-article-body .issue-md pre { font-size: 0.9375rem; }
.stream-article-body .issue-md ul,
.stream-article-body .issue-md ol {
  padding-left: 1.5em;
  margin-bottom: 1.25em;
  list-style: revert;
}
.stream-article-body .issue-md li { margin-bottom: 0.375em; }
.stream-article-body .issue-md a {
  color: var(--acid);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.stream-article-body .issue-md a:hover { opacity: 0.8; }
.stream-article-body .issue-md hr {
  border: none;
  border-top: 1px solid var(--stroke);
  margin: 2em 0;
}

/* Divider between articles */
.stream-divider {
  border: none;
  border-top: 1px solid var(--stroke);
  margin: 0;
}

/* ── Timeline panel (right column) ───────────────────────── */
.journal-timeline-panel {
  position: sticky;
  top: 3.5rem;
  max-height: calc(100vh - 3.5rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding: clamp(2rem, 4vw, 3.5rem) 0 clamp(2rem, 4vw, 3.5rem) clamp(1.5rem, 3vw, 2.5rem);
  scrollbar-width: none;
}
.journal-timeline-panel::-webkit-scrollbar { display: none; }

.journal-timeline-inner {
  position: relative;
  padding-left: 1.375rem;
}

/* Vertical connecting line */
.journal-timeline-inner::before {
  content: '';
  position: absolute;
  left: 0.25rem;
  top: 0.875rem;
  bottom: 0.875rem;
  width: 1px;
  background: var(--stroke);
}

/* ── Individual timeline entry ────────────────────────────── */
.timeline-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  width: 100%;
  padding: 0.625rem 0;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: opacity 0.3s;
}
.timeline-item:not(.is-active) { opacity: 0.4; }
.timeline-item:hover:not(.is-active) { opacity: 0.75; }

.timeline-dot {
  position: absolute;
  left: -1.125rem;
  top: 0.9rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--stroke);
  border: 1.5px solid var(--stroke);
  flex-shrink: 0;
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
.timeline-item.is-active .timeline-dot {
  background: var(--acid);
  border-color: var(--acid);
  transform: scale(1.3);
}

.timeline-item-content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.timeline-item-date {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s;
  white-space: nowrap;
}
.timeline-item.is-active .timeline-item-date { color: var(--acid); }

.timeline-item-title {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--muted);
  transition: color 0.3s;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.timeline-item.is-active .timeline-item-title { color: var(--hi); }
.timeline-item:hover .timeline-item-title { color: var(--hi); }

/* ── Empty / error states ─────────────────────────────────── */
.journal-empty,
.journal-error {
  font-size: 0.9375rem;
  color: var(--muted);
  padding: 3rem 0;
}
.journal-empty code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--raised);
  padding: 0.1em 0.4em;
  border: 1px solid var(--stroke);
}
.journal-error-block {
  padding: 3rem 0;
  color: var(--muted);
}

/* ── Mobile: stack timeline above articles ────────────────── */
@media (max-width: 55rem) {
  .journal-reader-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .journal-stream {
    padding-right: 0;
    border-right: none;
    order: 2;
  }

  .journal-timeline-panel {
    order: 1;
    position: static;
    max-height: none;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--stroke);
  }

  .journal-timeline-inner {
    display: flex;
    flex-direction: row;
    gap: 0;
    padding-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .journal-timeline-inner::-webkit-scrollbar { display: none; }
  .journal-timeline-inner::before { display: none; }

  .timeline-item {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    min-width: 8.5rem;
    flex-shrink: 0;
    border-left: 2px solid var(--stroke);
    opacity: 1;
  }
  .timeline-item.is-active { border-left-color: var(--acid); }
  .timeline-dot { display: none; }
  .timeline-item-content { gap: 0.125rem; }
}


