/**
 * The Daily Synthesis - Cyberpunk Miami Vice Theme
 * "sync signals that matter"
 */

/* =========================================
   COLOR PALETTE
   ========================================= */

:root {
  /* Primary Neons */
  --zine-cyan: #25E1ED;
  --zine-cyan-rgb: 37, 225, 237;
  --zine-magenta: #ED1E79;
  --zine-magenta-rgb: 237, 30, 121;
  --zine-yellow: #FFEB0B;
  --zine-yellow-rgb: 255, 235, 11;
  --zine-pink: #FF6EC7;
  --zine-pink-rgb: 255, 110, 199;
  --zine-orange: #FF6B35;
  --zine-orange-rgb: 255, 107, 53;

  /* Dark Base */
  --zine-black: #000000;
  --zine-deep-blue: #00060E;
  --zine-deep-blue-rgb: 0, 6, 14;
  --zine-dark-purple: #0a0a1a;

  /* Section Colors (from existing systems) */
  --zine-papers: #667eea;
  --zine-papers-end: #764ba2;
  --zine-funding: #9333ea;
  --zine-funding-end: #ec4899;
  --zine-comics: #ec4899;
  --zine-signals: #06b6d4;
  --zine-debates: #fbbf24;

  /* Text - Light mode defaults */
  --zine-text: #1a1a2e;
  --zine-text-dim: #4a5568;
  --zine-text-dimmer: #a0aec0;

  /* Card/Glass - Light mode defaults */
  --zine-card-bg: rgba(255, 255, 255, 0.9);
  --zine-card-border: rgba(0, 0, 0, 0.08);

  /* Glow */
  --glow-soft: 0 0 10px;
  --glow-medium: 0 0 20px;
  --glow-strong: 0 0 40px;

  /* Layout */
  --zine-sidebar-width: clamp(196px, 18vw, 228px);
  --zine-content-max: 1180px;
  --zine-spread-pad-inline: clamp(1.25rem, 3.8vw, 5rem);
  --zine-spread-pad-top: clamp(3.5rem, 7vh, 5.5rem);
  --zine-spread-pad-bottom: clamp(2.5rem, 5vh, 4rem);
  --zine-section-gap: clamp(1rem, 2.2vw, 1.8rem);
}

/* Dark mode variable overrides */
body.dark-mode.zine-body {
  --zine-text: #ffffff;
  --zine-text-dim: rgba(255, 255, 255, 0.7);
  --zine-text-dimmer: rgba(255, 255, 255, 0.4);
  --zine-card-bg: rgba(0, 6, 14, 0.8);
  --zine-card-border: rgba(37, 225, 237, 0.3);
}

/* =========================================
   BASE LAYOUT
   ========================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.zine-body {
  background: #fafafa;
  font-family: 'Source Sans 3', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--zine-text);
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
}

body.dark-mode.zine-body {
  background: linear-gradient(135deg, var(--zine-black) 0%, var(--zine-deep-blue) 100%);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* =========================================
   SIDEBAR NAVIGATION
   ========================================= */

.zine-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--zine-sidebar-width);
  height: 100dvh;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

body.dark-mode.zine-body .zine-sidebar {
  background: rgba(0, 6, 14, 0.95);
  border-right-color: rgba(var(--zine-cyan-rgb), 0.3);
}

.zine-sidebar-header {
  padding: max(1.5rem, env(safe-area-inset-top, 1.5rem)) 1rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.dark-mode.zine-body .zine-sidebar-header {
  border-bottom-color: rgba(var(--zine-cyan-rgb), 0.2);
}

.zine-sidebar-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #1a1a2e;
}

body.dark-mode.zine-body .zine-sidebar-title {
  font-family: 'Orbitron', monospace;
  color: var(--zine-cyan);
  text-shadow: 0 0 10px rgba(var(--zine-cyan-rgb), 0.5);
}

.zine-sidebar-subtitle {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: #7c3aed;
}

body.dark-mode.zine-body .zine-sidebar-subtitle {
  font-family: 'Orbitron', monospace;
  font-weight: 500;
  color: var(--zine-magenta);
  text-shadow: 0 0 10px rgba(var(--zine-magenta-rgb), 0.5);
}

.zine-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.zine-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: 0;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  text-align: left;
  color: var(--zine-text-dim);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

body.dark-mode.zine-body .zine-sidebar-item {
  font-family: 'Share Tech Mono', monospace;
}

.zine-sidebar-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--zine-text);
}

body.dark-mode.zine-body .zine-sidebar-item:hover {
  background: rgba(var(--zine-cyan-rgb), 0.1);
}

.zine-sidebar-item.active {
  background: rgba(0, 0, 0, 0.06);
  border-left-color: #1a1a2e;
  color: #1a1a2e;
}

.zine-sidebar-item:focus-visible {
  outline: 2px solid rgba(26, 26, 46, 0.7);
  outline-offset: -2px;
}

body.dark-mode.zine-body .zine-sidebar-item.active {
  background: rgba(var(--zine-cyan-rgb), 0.15);
  border-left-color: var(--zine-cyan);
  color: var(--zine-cyan);
}

body.dark-mode.zine-body .zine-sidebar-item:focus-visible {
  outline-color: rgba(var(--zine-cyan-rgb), 0.7);
}

.zine-sidebar-icon {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
}

.zine-sidebar-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.zine-sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.7rem;
  color: var(--zine-text-dimmer);
  text-align: center;
}

body.dark-mode.zine-body .zine-sidebar-footer {
  border-top-color: rgba(var(--zine-cyan-rgb), 0.2);
  font-family: 'Share Tech Mono', monospace;
}

/* Mobile hamburger */
.zine-hamburger {
  display: none;
  position: fixed;
  top: max(1rem, env(safe-area-inset-top, 1rem));
  left: 1rem;
  z-index: 250;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 8px;
}

body.dark-mode.zine-body .zine-hamburger {
  background: rgba(0, 6, 14, 0.9);
  border-color: rgba(var(--zine-cyan-rgb), 0.5);
}

.zine-hamburger-line {
  width: 100%;
  height: 2px;
  background: #1a1a2e;
  transition: all 0.3s ease;
}

body.dark-mode.zine-body .zine-hamburger-line {
  background: var(--zine-cyan);
}

.zine-hamburger.active .zine-hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.zine-hamburger.active .zine-hamburger-line:nth-child(2) {
  opacity: 0;
}

.zine-hamburger.active .zine-hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Sidebar backdrop for mobile */
.zine-sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.zine-sidebar-backdrop.visible {
  opacity: 1;
}

/* =========================================
   VERTICAL SCROLL CONTAINER
   ========================================= */

#zineContainer {
  margin-left: var(--zine-sidebar-width);
  width: calc(100% - var(--zine-sidebar-width));
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
  scroll-padding-block: 1rem;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

body.dark-mode.zine-body #zineContainer {
  scrollbar-color: rgba(var(--zine-cyan-rgb), 0.5) transparent;
}

#zineContainer::-webkit-scrollbar {
  width: 6px;
}

#zineContainer::-webkit-scrollbar-track {
  background: transparent;
}

#zineContainer::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

body.dark-mode.zine-body #zineContainer::-webkit-scrollbar-thumb {
  background: rgba(var(--zine-cyan-rgb), 0.5);
}

/* =========================================
   SPREAD (SECTION)
   ========================================= */

.zine-spread {
  width: 100%;
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  padding: var(--zine-spread-pad-top) var(--zine-spread-pad-inline) var(--zine-spread-pad-bottom);
  gap: var(--zine-section-gap);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  scroll-margin-top: 0;
}

.zine-spread-inner {
  width: min(var(--zine-content-max), 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--zine-section-gap);
  z-index: 10;
}

.zine-spread--cover,
.zine-spread--colophon {
  justify-content: center;
}

/* =========================================
   BACKGROUND CANVAS
   ========================================= */

#backgroundCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#backgroundCanvas canvas {
  pointer-events: auto;
  touch-action: none;
}

/* =========================================
   CRT SCANLINES OVERLAY
   ========================================= */

.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(0, 0, 0, 0.03) 51%
  );
  background-size: 100% 4px;
  opacity: 0;
  display: none;
}

body.dark-mode.zine-body .crt-overlay {
  display: block;
  opacity: 0.3;
}

@media (prefers-reduced-motion: reduce) {
  .crt-overlay {
    display: none;
  }

  #zineContainer {
    scroll-behavior: auto;
    scroll-snap-type: none;
  }

  .zine-spread {
    scroll-snap-stop: normal;
  }
}

/* =========================================
   TYPOGRAPHY
   ========================================= */

/* Display - Editorial for light, Orbitron for dark */
.zine-display {
  font-family: 'Playfair Display', Georgia, serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.dark-mode.zine-body .zine-display {
  font-family: 'Orbitron', 'Share Tech Mono', monospace;
  letter-spacing: 0.1em;
}

/* Mono - Share Tech Mono for data */
.zine-mono {
  font-family: 'Source Sans 3', sans-serif;
}

body.dark-mode.zine-body .zine-mono {
  font-family: 'Share Tech Mono', 'Roboto Mono', monospace;
}

/* Body - Source Sans 3 for light, Inter for dark */
.zine-body-text {
  font-family: 'Source Sans 3', -apple-system, sans-serif;
  line-height: 1.6;
}

body.dark-mode.zine-body .zine-body-text {
  font-family: 'Inter', -apple-system, sans-serif;
}

/* Retro - Press Start 2P for accents */
.zine-retro {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7em;
  letter-spacing: 0.05em;
}

/* =========================================
   NEON GLOW TEXT
   ========================================= */

/* Light mode: accent colors without glow */
.neon-cyan {
  color: #0891b2;
}

.neon-magenta {
  color: #c026d3;
}

.neon-yellow {
  color: #ca8a04;
}

.neon-pink {
  color: #db2777;
}

/* Dark mode: full neon glow */
body.dark-mode.zine-body .neon-cyan {
  color: var(--zine-cyan);
  text-shadow:
    0 0 10px rgba(var(--zine-cyan-rgb), 0.8),
    0 0 20px rgba(var(--zine-cyan-rgb), 0.6),
    0 0 40px rgba(var(--zine-cyan-rgb), 0.4);
}

body.dark-mode.zine-body .neon-magenta {
  color: var(--zine-magenta);
  text-shadow:
    0 0 10px rgba(var(--zine-magenta-rgb), 0.8),
    0 0 20px rgba(var(--zine-magenta-rgb), 0.6),
    0 0 40px rgba(var(--zine-magenta-rgb), 0.4);
}

body.dark-mode.zine-body .neon-yellow {
  color: var(--zine-yellow);
  text-shadow:
    0 0 10px rgba(var(--zine-yellow-rgb), 0.8),
    0 0 20px rgba(var(--zine-yellow-rgb), 0.6),
    0 0 40px rgba(var(--zine-yellow-rgb), 0.4);
}

body.dark-mode.zine-body .neon-pink {
  color: var(--zine-pink);
  text-shadow:
    0 0 10px rgba(var(--zine-pink-rgb), 0.8),
    0 0 20px rgba(var(--zine-pink-rgb), 0.6),
    0 0 40px rgba(var(--zine-pink-rgb), 0.4);
}

/* =========================================
   GLITCH EFFECT
   ========================================= */

/* Glitch disabled in light mode */
.glitch-text {
  position: relative;
}

.glitch-text::before,
.glitch-text::after {
  display: none;
}

/* Dark mode: enable glitch */
body.dark-mode.zine-body .glitch-text::before,
body.dark-mode.zine-body .glitch-text::after {
  content: attr(data-text);
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
}

body.dark-mode.zine-body .glitch-text::before {
  animation: glitch-1 0.3s infinite linear alternate-reverse;
  color: var(--zine-cyan);
  text-shadow: -2px 0 var(--zine-magenta);
  clip-path: inset(0 0 70% 0);
}

body.dark-mode.zine-body .glitch-text::after {
  animation: glitch-2 0.3s infinite linear alternate-reverse;
  color: var(--zine-magenta);
  text-shadow: 2px 0 var(--zine-cyan);
  clip-path: inset(70% 0 0 0);
}

@keyframes glitch-1 {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

@keyframes glitch-2 {
  0% { transform: translate(0); }
  20% { transform: translate(2px, -2px); }
  40% { transform: translate(2px, 2px); }
  60% { transform: translate(-2px, -2px); }
  80% { transform: translate(-2px, 2px); }
  100% { transform: translate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .glitch-text::before,
  .glitch-text::after {
    animation: none;
    display: none;
  }
}

/* =========================================
   GLASS CARDS (Glassmorphic)
   ========================================= */

.zine-card {
  background: var(--zine-card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--zine-card-border);
  border-radius: 8px;
  padding: 1.5rem;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

body.dark-mode.zine-body .zine-card {
  box-shadow:
    0 0 20px rgba(var(--zine-cyan-rgb), 0.1),
    inset 0 0 40px rgba(var(--zine-cyan-rgb), 0.02);
}

/* HUD Corner Brackets - dark mode only */
.zine-card::before,
.zine-card::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
  z-index: 10;
  display: none;
}

body.dark-mode.zine-body .zine-card::before,
body.dark-mode.zine-body .zine-card::after {
  display: block;
}

body.dark-mode.zine-body .zine-card::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--zine-cyan);
  border-left: 2px solid var(--zine-cyan);
  box-shadow: -2px -2px 10px rgba(var(--zine-cyan-rgb), 0.5);
}

body.dark-mode.zine-body .zine-card::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--zine-cyan);
  border-right: 2px solid var(--zine-cyan);
  box-shadow: 2px 2px 10px rgba(var(--zine-cyan-rgb), 0.5);
}

/* Card variants by section - dark mode brackets */
body.dark-mode.zine-body .zine-card--papers::before,
body.dark-mode.zine-body .zine-card--papers::after {
  border-color: var(--zine-papers);
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

body.dark-mode.zine-body .zine-card--funding::before,
body.dark-mode.zine-body .zine-card--funding::after {
  border-color: var(--zine-funding);
  box-shadow: 0 0 10px rgba(147, 51, 234, 0.5);
}

body.dark-mode.zine-body .zine-card--comics::before,
body.dark-mode.zine-body .zine-card--comics::after {
  border-color: var(--zine-comics);
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
}

body.dark-mode.zine-body .zine-card--signals::before,
body.dark-mode.zine-body .zine-card--signals::after {
  border-color: var(--zine-signals);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

body.dark-mode.zine-body .zine-card--debates::before,
body.dark-mode.zine-body .zine-card--debates::after {
  border-color: var(--zine-debates);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

/* Light mode card variant accents (left border) */
.zine-card--papers { border-left: 3px solid var(--zine-papers); }
.zine-card--funding { border-left: 3px solid var(--zine-funding); }
.zine-card--comics { border-left: 3px solid var(--zine-comics); }
.zine-card--signals { border-left: 3px solid var(--zine-signals); }
.zine-card--debates { border-left: 3px solid var(--zine-debates); }

body.dark-mode.zine-body .zine-card--papers,
body.dark-mode.zine-body .zine-card--funding,
body.dark-mode.zine-body .zine-card--comics,
body.dark-mode.zine-body .zine-card--signals,
body.dark-mode.zine-body .zine-card--debates {
  border-left: 1px solid var(--zine-card-border);
}

/* =========================================
   NAVIGATION (Legacy - now using sidebar)
   ========================================= */

/* Bottom nav hidden - using sidebar instead */
.zine-nav {
  display: none;
}

/* =========================================
   SPREAD INDICATOR
   ========================================= */

.zine-spread-indicator {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.8rem;
  color: var(--zine-text-dim);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.dark-mode.zine-body .zine-spread-indicator {
  font-family: 'Share Tech Mono', monospace;
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(var(--zine-cyan-rgb), 0.3);
}

/* =========================================
   COVER SPREAD
   ========================================= */

.zine-cover {
  text-align: center;
}

.zine-cover-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2rem, 8vw, 5rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  color: #1a1a2e;
}

body.dark-mode.zine-body .zine-cover-title {
  font-family: 'Orbitron', monospace;
  letter-spacing: 0.15em;
  color: var(--zine-text);
}

.zine-cover-tagline {
  font-family: 'Source Sans 3', sans-serif;
  font-size: clamp(0.8rem, 2vw, 1.2rem);
  color: var(--zine-text-dim);
  text-transform: lowercase;
  letter-spacing: 0.1em;
  margin-bottom: 2rem;
}

body.dark-mode.zine-body .zine-cover-tagline {
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 0.2em;
}

.zine-cover-date {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 3rem;
}

body.dark-mode.zine-body .zine-cover-date {
  font-family: 'Share Tech Mono', monospace;
  font-weight: 400;
  color: var(--zine-cyan);
}

.zine-cover-cosmic {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.zine-cosmic-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.9rem;
  color: var(--zine-text-dim);
}

body.dark-mode.zine-body .zine-cosmic-item {
  font-family: 'Share Tech Mono', monospace;
}

.zine-cosmic-emoji {
  font-size: 1.5rem;
}

/* =========================================
   SECTION HEADERS
   ========================================= */

.zine-section-header {
  margin-bottom: 2rem;
}

.zine-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  color: #1a1a2e;
}

body.dark-mode.zine-body .zine-section-title {
  font-family: 'Orbitron', monospace;
  letter-spacing: 0.1em;
  color: var(--zine-text);
}

.zine-section-title--papers { color: var(--zine-papers); }
.zine-section-title--funding { color: var(--zine-funding); }
.zine-section-title--comics { color: var(--zine-comics); }
.zine-section-title--debates { color: var(--zine-debates); }

.zine-section-subtitle {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.9rem;
  color: var(--zine-text-dim);
  text-transform: lowercase;
  letter-spacing: 0.08em;
}

body.dark-mode.zine-body .zine-section-subtitle {
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 0.15em;
}

/* =========================================
   CONTENT CARDS
   ========================================= */

.zine-content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}

.zine-content-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.zine-content-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark-mode.zine-body .zine-content-card:hover {
  box-shadow:
    0 0 30px rgba(var(--zine-cyan-rgb), 0.2),
    inset 0 0 50px rgba(var(--zine-cyan-rgb), 0.03);
}

.zine-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.zine-card-source {
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

body.dark-mode.zine-body .zine-card-source {
  font-family: 'Share Tech Mono', monospace;
}

/* Light mode source pills */
.zine-card-source--papers {
  background: rgba(102, 126, 234, 0.1);
  color: #4a5ad8;
}

.zine-card-source--funding {
  background: rgba(147, 51, 234, 0.1);
  color: #7c3aed;
}

.zine-card-source--comics {
  background: rgba(236, 72, 153, 0.1);
  color: #db2777;
}

.zine-card-source--signals {
  background: rgba(6, 182, 212, 0.1);
  color: #0891b2;
}

.zine-card-source--debates {
  background: rgba(251, 191, 36, 0.1);
  color: #ca8a04;
}

/* Dark mode source pills */
body.dark-mode.zine-body .zine-card-source--papers {
  background: rgba(102, 126, 234, 0.3);
  color: #a5b4fc;
}

body.dark-mode.zine-body .zine-card-source--funding {
  background: rgba(147, 51, 234, 0.3);
  color: #c4b5fd;
}

body.dark-mode.zine-body .zine-card-source--comics {
  background: rgba(236, 72, 153, 0.3);
  color: #f9a8d4;
}

body.dark-mode.zine-body .zine-card-source--signals {
  background: rgba(6, 182, 212, 0.3);
  color: #67e8f9;
}

body.dark-mode.zine-body .zine-card-source--debates {
  background: rgba(251, 191, 36, 0.3);
  color: #fde68a;
}

.zine-card-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--zine-text);
}

body.dark-mode.zine-body .zine-card-title {
  font-family: 'Share Tech Mono', monospace;
  font-weight: 400;
}

.zine-card-summary {
  font-size: 0.9rem;
  color: var(--zine-text-dim);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.zine-card-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.zine-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.zine-tag {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.04);
  color: var(--zine-text-dim);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.dark-mode.zine-body .zine-tag {
  font-family: 'Share Tech Mono', monospace;
  background: rgba(var(--zine-cyan-rgb), 0.15);
  color: var(--zine-cyan);
  border-color: rgba(var(--zine-cyan-rgb), 0.3);
}

/* =========================================
   TOC (TABLE OF CONTENTS)
   ========================================= */

.zine-toc-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.zine-toc-list > li {
  list-style: none;
}

.zine-toc-item {
  width: 100%;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-left: 3px solid #1a1a2e;
  border-radius: 6px;
  appearance: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

body.dark-mode.zine-body .zine-toc-item {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(var(--zine-cyan-rgb), 0.2);
  border-left-color: var(--zine-cyan);
}

.zine-toc-item:hover {
  background: rgba(0, 0, 0, 0.06);
  border-left-color: #7c3aed;
  transform: translateY(-1px);
}

body.dark-mode.zine-body .zine-toc-item:hover {
  background: rgba(var(--zine-cyan-rgb), 0.1);
  border-left-color: var(--zine-magenta);
}

.zine-toc-item:focus-visible {
  outline: 2px solid rgba(26, 26, 46, 0.65);
  outline-offset: 2px;
}

body.dark-mode.zine-body .zine-toc-item:focus-visible {
  outline-color: rgba(var(--zine-cyan-rgb), 0.75);
}

.zine-toc-number {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #7c3aed;
  margin-bottom: 0.25rem;
}

body.dark-mode.zine-body .zine-toc-number {
  font-family: 'Orbitron', monospace;
  font-weight: 400;
  color: var(--zine-cyan);
}

.zine-toc-title {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--zine-text);
}

body.dark-mode.zine-body .zine-toc-title {
  font-family: 'Share Tech Mono', monospace;
  font-weight: 400;
}

.zine-toc-icon {
  width: 1.1rem;
  text-align: center;
  color: var(--zine-text-dim);
}

/* =========================================
   GAME OF LIFE
   ========================================= */

.zine-gol-container {
  width: 100%;
  height: 60vh;
  min-height: 300px;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

body.dark-mode.zine-body .zine-gol-container {
  border-color: rgba(var(--zine-cyan-rgb), 0.3);
}

.zine-gol-container canvas {
  touch-action: none;
}

.zine-gol-controls {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.zine-gol-btn {
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  color: #1a1a2e;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

body.dark-mode.zine-body .zine-gol-btn {
  background: rgba(var(--zine-cyan-rgb), 0.1);
  border-color: rgba(var(--zine-cyan-rgb), 0.5);
  color: var(--zine-cyan);
  font-family: 'Share Tech Mono', monospace;
}

.zine-gol-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

body.dark-mode.zine-body .zine-gol-btn:hover {
  background: rgba(var(--zine-cyan-rgb), 0.2);
  box-shadow: 0 0 10px rgba(var(--zine-cyan-rgb), 0.3);
}

.zine-gol-btn.active {
  background: rgba(0, 0, 0, 0.1);
  border-color: #1a1a2e;
}

body.dark-mode.zine-body .zine-gol-btn.active {
  background: rgba(var(--zine-cyan-rgb), 0.3);
  border-color: var(--zine-cyan);
}

/* =========================================
   PLACEHOLDER PANELS
   ========================================= */

.zine-placeholder {
  max-width: min(820px, 100%);
  margin: 0 auto;
}

.zine-placeholder-copy {
  color: var(--zine-text-dim);
  text-align: center;
  padding: 3rem;
}

/* =========================================
   COSMIC PANEL
   ========================================= */

.zine-cosmic-panel {
  max-width: min(860px, 100%);
  margin: 0 auto;
}

.zine-cosmic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(1rem, 2.5vw, 2rem);
  margin-bottom: 2rem;
}

.zine-cosmic-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
}

.zine-cosmic-symbol {
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 1;
}

.zine-cosmic-value {
  font-size: 1.1rem;
  color: var(--zine-text);
}

.zine-cosmic-label {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--zine-text-dim);
}

.zine-cosmic-note {
  text-align: center;
  color: var(--zine-text-dim);
  font-style: italic;
  line-height: 1.6;
}

/* =========================================
   ABOUT SPREAD
   ========================================= */

.zine-about {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3rem;
  align-items: center;
}

.zine-about-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  object-fit: cover;
}

body.dark-mode.zine-body .zine-about-photo {
  border-color: var(--zine-cyan);
  box-shadow:
    0 0 20px rgba(var(--zine-cyan-rgb), 0.4),
    0 0 40px rgba(var(--zine-cyan-rgb), 0.2);
}

.zine-about-content h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

body.dark-mode.zine-body .zine-about-content h2 {
  font-family: 'Orbitron', monospace;
}

.zine-about-title {
  font-family: 'Source Sans 3', sans-serif;
  color: #7c3aed;
  font-size: 1rem;
  margin-bottom: 1rem;
}

body.dark-mode.zine-body .zine-about-title {
  font-family: 'Share Tech Mono', monospace;
  color: var(--zine-cyan);
}

.zine-about-bio {
  color: var(--zine-text-dim);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.zine-about-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.zine-about-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  color: #1a1a2e;
  text-decoration: none;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

body.dark-mode.zine-body .zine-about-link {
  background: rgba(var(--zine-cyan-rgb), 0.1);
  border-color: rgba(var(--zine-cyan-rgb), 0.5);
  color: var(--zine-cyan);
  font-family: 'Share Tech Mono', monospace;
}

.zine-about-link:hover {
  background: rgba(0, 0, 0, 0.08);
}

body.dark-mode.zine-body .zine-about-link:hover {
  background: rgba(var(--zine-cyan-rgb), 0.2);
  box-shadow: 0 0 10px rgba(var(--zine-cyan-rgb), 0.3);
}

/* =========================================
   COLOPHON
   ========================================= */

.zine-colophon {
  text-align: center;
}

.zine-colophon-title {
  margin-bottom: 2rem;
}

.zine-colophon-credits {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.9rem;
  color: var(--zine-text-dim);
  margin-bottom: 2rem;
  line-height: 1.8;
}

body.dark-mode.zine-body .zine-colophon-credits {
  font-family: 'Share Tech Mono', monospace;
}

.zine-export-btn {
  padding: 1rem 2rem;
  background: #1a1a2e;
  border: 2px solid #1a1a2e;
  border-radius: 4px;
  color: #ffffff;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.dark-mode.zine-body .zine-export-btn {
  background: linear-gradient(135deg, rgba(var(--zine-cyan-rgb), 0.2), rgba(var(--zine-magenta-rgb), 0.2));
  border-color: var(--zine-cyan);
  border-radius: 8px;
  color: var(--zine-cyan);
  font-family: 'Orbitron', monospace;
  font-weight: 400;
}

.zine-export-btn:hover {
  background: #2d2d4a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

body.dark-mode.zine-body .zine-export-btn:hover {
  background: linear-gradient(135deg, rgba(var(--zine-cyan-rgb), 0.3), rgba(var(--zine-magenta-rgb), 0.3));
  box-shadow:
    0 0 20px rgba(var(--zine-cyan-rgb), 0.5),
    0 0 40px rgba(var(--zine-cyan-rgb), 0.3);
}

.zine-export-btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.zine-export-btn--disabled:hover {
  transform: none;
  box-shadow: none;
}

.zine-colophon-url {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--zine-text-dimmer);
}

/* =========================================
   COMICS CAROUSEL
   ========================================= */

.zine-comics-carousel {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding: 1rem 0;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--zine-comics) transparent;
}

.zine-comics-carousel::-webkit-scrollbar {
  height: 6px;
}

.zine-comics-carousel::-webkit-scrollbar-track {
  background: transparent;
}

.zine-comics-carousel::-webkit-scrollbar-thumb {
  background: var(--zine-comics);
  border-radius: 3px;
}

.zine-comic-card {
  flex: 0 0 min(320px, 86vw);
  scroll-snap-align: center;
}

.zine-comic-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.zine-comic-thumbnail {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.zine-comic-title {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--zine-comics);
  margin-bottom: 0.5rem;
}

body.dark-mode.zine-body .zine-comic-title {
  font-family: 'Share Tech Mono', monospace;
  font-weight: 400;
}

.zine-comic-summary {
  font-size: 0.85rem;
  color: var(--zine-text-dim);
  line-height: 1.4;
}

/* =========================================
   FUNDING STATS
   ========================================= */

.zine-funding-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.zine-funding-summary {
  margin-bottom: 1.5rem;
}

.zine-funding-amount {
  font-size: 1.2rem;
  line-height: 1;
}

.zine-stat {
  text-align: center;
  padding: 1.5rem;
}

.zine-stat-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--zine-funding);
}

body.dark-mode.zine-body .zine-stat-value {
  font-family: 'Orbitron', monospace;
  font-weight: 400;
  text-shadow: 0 0 20px rgba(147, 51, 234, 0.5);
}

.zine-stat-label {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.8rem;
  color: var(--zine-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.dark-mode.zine-body .zine-stat-label {
  font-family: 'Share Tech Mono', monospace;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 1024px) {
  :root {
    --zine-spread-pad-inline: clamp(1.1rem, 3.4vw, 2.5rem);
    --zine-spread-pad-top: clamp(3rem, 6vh, 4rem);
    --zine-content-max: 980px;
  }
}

@media (max-width: 768px) {
  /* Sidebar hidden on mobile by default */
  .zine-sidebar {
    transform: translateX(-100%);
  }

  .zine-sidebar.open {
    transform: translateX(0);
  }

  /* Hamburger visible on mobile */
  .zine-hamburger {
    display: flex;
  }

  /* Backdrop visible when sidebar open */
  .zine-sidebar-backdrop.visible {
    display: block;
  }

  /* Container takes full width on mobile */
  #zineContainer {
    margin-left: 0;
    width: 100%;
  }

  /* Disable canvas touch on mobile so hamburger/sidebar work */
  #backgroundCanvas canvas {
    pointer-events: none;
    touch-action: auto;
  }

  .zine-spread {
    padding:
      calc(3.8rem + env(safe-area-inset-top, 0px))
      max(1rem, env(safe-area-inset-left, 1rem))
      max(1.5rem, env(safe-area-inset-bottom, 1.5rem))
      max(1rem, env(safe-area-inset-right, 1rem));
    min-height: auto;
  }

  .zine-about {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .zine-about-photo {
    margin: 0 auto;
  }

  .zine-about-links {
    justify-content: center;
  }

  .zine-cover-cosmic {
    flex-direction: column;
    align-items: center;
  }

  .zine-content-grid {
    grid-template-columns: 1fr;
  }

  /* Spread indicator repositioned for mobile */
  .zine-spread-indicator {
    top: auto;
    bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
    right: 1rem;
    will-change: transform;
    contain: layout style;
  }

  /* Mobile performance: disable CRT overlay + add GPU hints */
  .crt-overlay { display: none !important; }
  .zine-hamburger { will-change: transform; contain: layout style; }
  .zine-sidebar { will-change: transform; contain: layout style; }
}

@media (max-width: 600px) {
  .zine-content-grid { grid-template-columns: 1fr; gap: 1rem; }
  .zine-toc-list { grid-template-columns: 1fr; }
  .zine-funding-stats { grid-template-columns: repeat(2, 1fr); }
  .zine-about-photo { width: 150px; height: 150px; }
  .zine-card { padding: 1.25rem; }
  .zine-section-title { font-size: clamp(1.3rem, 5vw, 2rem); }
}

@media (max-width: 480px) {
  .zine-spread {
    padding:
      calc(3.8rem + env(safe-area-inset-top, 0px))
      max(0.85rem, env(safe-area-inset-left, 0.85rem))
      max(1.2rem, env(safe-area-inset-bottom, 1.2rem))
      max(0.85rem, env(safe-area-inset-right, 0.85rem));
  }

  .zine-cover-title {
    letter-spacing: 0.05em;
  }

  .zine-gol-controls {
    gap: 0.5rem;
  }

  .zine-gol-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
  }

  .zine-comic-card {
    flex: 0 0 280px;
  }
}

/* =========================================
   PRINT STYLES
   ========================================= */

@media print {
  .crt-overlay,
  .zine-nav,
  .zine-spread-indicator,
  .zine-sidebar,
  .zine-hamburger,
  .zine-sidebar-backdrop,
  #backgroundCanvas {
    display: none !important;
  }

  body.zine-body {
    background: white;
    color: black;
    overflow: visible;
    height: auto;
  }

  #zineContainer {
    display: block;
    overflow: visible;
    margin-left: 0;
    width: 100%;
  }

  .zine-spread {
    break-after: page;
    height: auto;
    min-height: 100vh;
    padding: 2rem;
  }

  .zine-card {
    background: white;
    border: 1px solid #ccc;
    box-shadow: none;
  }

  .zine-card::before,
  .zine-card::after {
    display: none;
  }

  .neon-cyan,
  .neon-magenta,
  .neon-yellow,
  .neon-pink {
    text-shadow: none;
  }

  .glitch-text::before,
  .glitch-text::after {
    display: none;
  }
}
