@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Space+Mono:wght@400;700&display=swap');

@font-face {
  font-family: 'IvyPresto';
  src: url('font/Ivy-Presto-Headline-Light.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

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

:root {
  --bg: #000000;
  --panel-bg: #0a0a0a;
  --text: #ffffff;
  --text-bright: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.3);
  --text-mid: rgba(255, 255, 255, 0.6);
  --text-muted: #3a3a3a;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.3);
  --accent-pink: #FF2E9A;
  --accent-glow: rgba(255, 46, 154, 0.3);
  --accent-indigo: #AA55FF;
  --danger: #FF2E9A;
  --font: 'Share Tech Mono', 'Space Mono', 'Courier New', monospace;
  --font-display: 'Space Mono', monospace;

  /* Dot grid */
  --dot-size: 1.5px;
  --dot-spacing: 28px;
  --dot-accent: #ffffff;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  border-radius: 22px;
  background: var(--bg);
}


/* ─── Persistent Chromatic Aberration ─── */
.ca-text {
  text-shadow:
    -1px 0 0 rgba(255, 0, 50, 0.35),
     1px 0 0 rgba(0, 200, 255, 0.35);
}
.ca-text-strong {
  text-shadow:
    -1.5px 0 0 rgba(255, 0, 50, 0.5),
     1.5px 0 0 rgba(0, 200, 255, 0.5),
     0 0 12px var(--accent-glow);
}
.ca-border {
  box-shadow:
    -1px 0 0 rgba(255, 0, 50, 0.25),
     1px 0 0 rgba(0, 200, 255, 0.25);
}
.ca-border-strong {
  box-shadow:
    -2px 0 0 rgba(255, 0, 50, 0.35),
     2px 0 0 rgba(0, 200, 255, 0.35);
}

/* ─── CRT Overlay Layers ─── */
.crt-scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 2px,
    rgba(0, 0, 0, 0.18) 4px
  );
  pointer-events: none;
  z-index: 9990;
  border-radius: 22px;
}

.crt-noise {
  position: fixed;
  inset: 0;
  filter: url(#noise-filter);
  background: rgba(128, 128, 128, 0.5);
  opacity: 0.06;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 9991;
  animation: grain 0.3s steps(4) infinite;
  border-radius: 22px;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(-2px, 1px); }
  66% { transform: translate(1px, -1px); }
}

.crt-vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(0, 0, 0, 0.5) 80%,
    rgba(0, 0, 0, 0.85) 100%
  );
  pointer-events: none;
  z-index: 9992;
  border-radius: 22px;
}

/* ─── Glitch overlay (driven by debug.js) ─── */
.crt-glitch {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9993;
  opacity: 0;
  mix-blend-mode: screen;
}

.crt-glitch-shift {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9989;
  opacity: 0;
  overflow: hidden;
}

/* ─── CRT Screen Frame ─── */
.crt-warp {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9994;
  border-radius: 22px;
  box-shadow:
    inset 0 0 80px 40px rgba(0, 0, 0, 0.85),
    inset 0 0 160px 60px rgba(0, 0, 0, 0.4),
    inset 0 0 3px 1px rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.04);
}

/* ─── RGB Fringe on edges (persistent) ─── */
.crt-rgb-fringe {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9988;
  box-shadow:
    inset 2px 0 0 rgba(255, 0, 50, 0.06),
    inset -2px 0 0 rgba(0, 200, 255, 0.06),
    inset 0 2px 0 rgba(255, 0, 50, 0.04),
    inset 0 -2px 0 rgba(0, 200, 255, 0.04);
}

/* ─── Page ─── */
#page.home {
  width: 100%;
  height: 100%;
  text-shadow:
    -0.5px 0 0 rgba(255, 0, 50, 0.2),
     0.5px 0 0 rgba(0, 200, 255, 0.2),
     0 0 4px rgba(255, 255, 255, 0.3),
     0 0 12px rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  overflow: hidden;
  /* CRT barrel via perspective — moves visuals AND hit areas */
  perspective: 900px;
}
#page.home > * {
  transform: translateZ(18px);
  transform-style: preserve-3d;
}

/* ─── Phosphor Bloom (dirty glow) ─── */
.crt-bloom {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9987;
  border-radius: 22px;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 255, 255, 0.018) 0%,
    transparent 70%
  );
  mix-blend-mode: screen;
}

/* ─── Viewport ─── */
.home--viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  user-select: none;

  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, var(--dot-alpha, 0.5))
      clamp(0.4px, calc(var(--dot-size) * var(--dot-scale, 1)), 2.5px),
    transparent
      clamp(0.4px, calc(var(--dot-size) * var(--dot-scale, 1)), 2.5px)
  );
  background-size:
    calc(var(--dot-spacing) * var(--dot-scale, 1))
    calc(var(--dot-spacing) * var(--dot-scale, 1));
  background-position: var(--dot-ox, 0px) var(--dot-oy, 0px);
}

.home--viewport.is-dragging {
  cursor: grabbing;
}

/* ─── HUD ─── */
.home--hud {
  position: fixed;
  top: 28px;
  left: 28px;
  z-index: 9994;
  pointer-events: none;
  border-left: 2px solid var(--accent-pink);
  padding-left: 11px;
  box-shadow:
    -2px 0 0 rgba(255, 0, 50, 0.3),
     2px 0 0 rgba(0, 200, 255, 0.3),
     -6px 0 12px rgba(255, 46, 154, 0.15);
}

.home--hud__brand {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-bright);
  margin-bottom: 8px;
  line-height: 1;
  text-shadow:
    -1.2px 0 0 rgba(255, 0, 50, 0.5),
     1.2px 0 0 rgba(0, 200, 255, 0.5),
     0 0 8px rgba(255, 255, 255, 0.6),
     0 0 20px rgba(255, 255, 255, 0.15),
     0 0 40px rgba(255, 255, 255, 0.05);
}

.home--hud__version {
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 8px;
  letter-spacing: 0.1em;
}

.home--hud__rows {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  margin-bottom: 12px;
}

.home--hud__row {
  display: flex;
  align-items: center;
  font-size: 10px;
  line-height: 1;
  color: var(--text-mid);
  letter-spacing: 0.08em;
}

.home--hud__row + .home--hud__row::before {
  content: '//';
  color: rgba(255, 255, 255, 0.2);
  margin: 0 7px;
  font-size: 8px;
}

.home--hud__label { display: none; }

.home--hud__planes,
.home--hud__vp,
.home--hud__zoom {
  color: var(--text);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  text-shadow:
    -0.8px 0 0 rgba(255, 0, 50, 0.4),
     0.8px 0 0 rgba(0, 200, 255, 0.4),
     0 0 6px rgba(255, 255, 255, 0.5),
     0 0 16px rgba(255, 255, 255, 0.1);
}

.home--hud__title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-pink);
  line-height: 1;
  min-height: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-shadow:
    -1.5px 0 0 rgba(255, 0, 50, 0.5),
     1.5px 0 0 rgba(0, 200, 255, 0.5),
     0 0 8px var(--accent-pink),
     0 0 20px var(--accent-glow),
     0 0 40px var(--accent-glow);
}

.home--hud__title.visible {
  opacity: 1;
}

/* ─── Zoom Controls ─── */
.home--zoom-controls {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.home--zoom-btn {
  width: 30px;
  height: 30px;
  background: rgba(13, 12, 8, 0.8);
  border: 1px solid var(--border);
  color: var(--text-mid);
  font-size: 16px;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.home--zoom-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.home--zoom-btn:active {
  background: rgba(255, 255, 255, 0.15);
}

/* ─── Canvas ─── */
.home--canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* ─── Bento Grid ─── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(4, 280px);
  grid-auto-rows: 280px;
  gap: 4px;
  grid-auto-flow: dense;
  width: max-content;
  padding: 60px;
}

.grid-item {
  overflow: hidden;
  position: relative;
  background: var(--panel-bg);
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow:
    -1px 0 0 rgba(255, 0, 50, 0.15),
     1px 0 0 rgba(0, 200, 255, 0.15),
     0 0 6px rgba(255, 255, 255, 0.03),
     inset 0 0 30px rgba(0, 0, 0, 0.4);
}

.grid-item.size-landscape { grid-column: span 2; grid-row: span 1; }
.grid-item.size-portrait  { grid-column: span 1; grid-row: span 2; }
.grid-item.size-wide      { grid-column: span 3; grid-row: span 1; }
.grid-item.size-carre     { grid-column: span 1; grid-row: span 1; }

.grid-item canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ─── Project Label ─── */
.project-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: var(--accent-pink);
  color: #000;
  padding: 4px 10px;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s ease;
  box-shadow:
    -2px 0 0 rgba(255, 0, 50, 0.4),
     2px 0 0 rgba(0, 200, 255, 0.4),
     0 0 8px var(--accent-pink),
     0 0 20px var(--accent-glow);
}

.grid-item:hover .project-label {
  opacity: 0.7;
}

/* ─── Crosshair ─── */
.home--cursor {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  pointer-events: none;
  z-index: 100;
  opacity: 0;
}

/* ─── Loading ─── */
.home--loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  background: var(--bg);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
  opacity: 1;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.home--loading.hidden {
  opacity: 0;
}

/* ─── Grid thumbnail ─── */
.grid-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

/* ─── Grid item hover overlay ─── */
.grid-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
  transition: background 0.35s ease;
}

.grid-item-overlay span {
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.25em;
  color: rgba(255, 255, 255, 0);
  text-transform: uppercase;
  transition: color 0.35s ease;
}

.grid-item:hover .grid-item-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.grid-item:hover .grid-item-overlay span {
  color: rgba(255, 255, 255, 0.9);
  text-shadow:
    -1px 0 0 rgba(255, 0, 50, 0.5),
     1px 0 0 rgba(0, 200, 255, 0.5),
     0 0 8px rgba(255, 255, 255, 0.7),
     0 0 20px rgba(255, 255, 255, 0.2);
}

/* ─── Panel Overlay ─── */
.panel-overlay { display: none; }

/* ── Video inline ── */
.grid-video,
.grid-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
}

/* Preview canvas : affichage 10fps en vue bento, masqué quand la cellule est active */
.grid-video-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 2;
  pointer-events: none;
}
.grid-item.is-active .grid-video-preview { display: none; }

/* ── Player overlay ── */
.grid-player {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 52px 12px 10px;
  background: linear-gradient(to top, rgba(10, 10, 8, 0.95) 0%, rgba(10, 10, 8, 0.5) 55%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 7px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 30;
}
.grid-item.is-active.player-visible .grid-player {
  opacity: 1;
  pointer-events: auto;
}

/* Progress — full width, amber fill */
.grid-progress {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  position: relative;
  transition: height 0.18s ease;
}
.grid-progress:hover { height: 4px; }
.grid-progress::before {
  content: '';
  position: absolute;
  inset: -8px 0;
}
.grid-progress-fill {
  height: 100%;
  background: var(--text);
  width: 0%;
  position: relative;
  pointer-events: none;
}
.grid-progress-fill::after {
  content: '';
  position: absolute;
  right: -4px; top: 50%;
  transform: translateY(-50%) scale(0);
  width: 9px; height: 9px;
  background: var(--text-bright);
  transition: transform 0.15s ease;
}
.grid-progress:hover .grid-progress-fill::after {
  transform: translateY(-50%) scale(1);
}

/* Controls row */
.grid-player-row {
  display: flex;
  align-items: center;
  gap: 3px;
}
.grid-player-spacer { flex: 1; }

/* Buttons — amber */
.grid-player-btn {
  background: none;
  border: none;
  color: var(--text-mid);
  cursor: pointer;
  padding: 3px 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s;
  line-height: 1;
}
.grid-player-btn:hover { color: var(--text-bright); }

/* Time — amber */
.grid-player-time {
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.grid-time-cur { color: var(--text); }
.grid-time-sep { color: rgba(255, 255, 255, 0.25); margin: 0 3px; font-size: 9px; font-family: var(--font); }
.grid-time-tot { color: var(--text-dim); }

/* Volume */
.grid-vol {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}
.grid-volume {
  -webkit-appearance: none;
  appearance: none;
  width: 46px;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
}
.grid-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px; height: 8px;
  background: var(--text);
  cursor: pointer;
  transition: transform 0.15s;
}
.grid-volume::-webkit-slider-thumb:hover { transform: scale(1.3); }
.grid-volume::-moz-range-thumb {
  width: 8px; height: 8px;
  background: var(--text);
  border: none;
  cursor: pointer;
}

/* ─── Project Panel ─── */
.project-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  background: var(--panel-bg);
  border-left: 2px solid var(--accent-pink);
  z-index: 9995;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  overflow: hidden;
  box-shadow:
    -3px 0 0 rgba(255, 0, 50, 0.3),
     3px 0 0 rgba(0, 200, 255, 0.3),
    -8px 0 25px rgba(255, 46, 154, 0.12),
    -20px 0 60px rgba(255, 46, 154, 0.05);
}

.project-panel.is-open {
  transform: translateX(0);
}

/* Panel header */
.panel-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  background: rgba(13, 12, 8, 0.95);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-close {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s, text-shadow 0.2s;
  font-family: var(--font);
  text-shadow:
    -1px 0 0 rgba(255, 0, 50, 0.4),
     1px 0 0 rgba(0, 200, 255, 0.4),
     0 0 6px rgba(255, 255, 255, 0.4);
  box-shadow:
    -1px 0 0 rgba(255, 0, 50, 0.2),
     1px 0 0 rgba(0, 200, 255, 0.2);
}
.panel-close:hover {
  color: var(--accent-pink);
  border-color: var(--accent-pink);
  text-shadow:
    0 0 8px var(--accent-pink),
    0 0 20px var(--accent-glow);
  box-shadow:
    0 0 8px var(--accent-glow),
    -1px 0 0 rgba(255, 0, 50, 0.3),
     1px 0 0 rgba(0, 200, 255, 0.3);
}

.panel-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-nav-btn {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s, text-shadow 0.2s;
  text-shadow:
    -1px 0 0 rgba(255, 0, 50, 0.4),
     1px 0 0 rgba(0, 200, 255, 0.4),
     0 0 6px rgba(255, 255, 255, 0.4);
  box-shadow:
    -1px 0 0 rgba(255, 0, 50, 0.2),
     1px 0 0 rgba(0, 200, 255, 0.2);
}
.panel-nav-btn:hover {
  border-color: var(--accent-pink);
  color: var(--accent-pink);
  text-shadow:
    0 0 8px var(--accent-pink),
    0 0 20px var(--accent-glow);
  box-shadow:
    0 0 8px var(--accent-glow),
    -1px 0 0 rgba(255, 0, 50, 0.3),
     1px 0 0 rgba(0, 200, 255, 0.3);
}

.panel-counter {
  font-family: var(--font);
  font-size: 10px;
  color: var(--text);
  letter-spacing: 0.12em;
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  text-shadow:
    -1px 0 0 rgba(255, 0, 50, 0.35),
     1px 0 0 rgba(0, 200, 255, 0.35),
     0 0 6px rgba(255, 255, 255, 0.4);
}

/* Panel body */
.panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
}
.panel-body::-webkit-scrollbar { display: none; }

.panel-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.panel-media.portrait { aspect-ratio: 3 / 4; max-height: 75vh; width: auto; }

#panel-video,
#panel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.panel-media.no-media::after {
  content: 'SYSTEM OFFLINE';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  text-shadow:
    -1.5px 0 0 rgba(255, 0, 50, 0.5),
     1.5px 0 0 rgba(0, 200, 255, 0.5),
     0 0 6px rgba(255, 255, 255, 0.2);
}

/* Panel player controls */
.panel-player {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 10px 16px 13px;
  background: linear-gradient(to top, rgba(10, 10, 8, 0.85), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.panel-media:hover .panel-player { opacity: 1; }

.panel-progress {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  margin-bottom: 10px;
}
.panel-progress-fill {
  height: 100%;
  background: var(--text);
  width: 0%;
  pointer-events: none;
}

.panel-player-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.panel-player-btn {
  background: none;
  border: none;
  color: var(--text-mid);
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
  padding: 0;
  text-transform: uppercase;
  transition: color 0.2s;
}
.panel-player-btn:hover { color: var(--text-bright); }

.panel-time {
  font-family: var(--font);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-left: auto;
}

/* ── Panel Info ── */
.panel-info {
  padding: 28px 26px 48px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Panel hero (video + thumb wrapper) */
.panel-hero {
  position: relative;
  width: 100%;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}
.panel-hero-video {
  display: none;           /* hidden on desktop, shown on mobile */
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.panel-thumb {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  object-fit: cover;
}
.panel-thumb[src=""] { display: none; }

.panel-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.panel-year,
.panel-category {
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.panel-sep { color: rgba(255, 255, 255, 0.15); font-size: 9px; }

.panel-title {
  font-family: 'IvyPresto', serif;
  font-size: clamp(28px, 3vw, 44px);
  font-weight: normal;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-pink);
  line-height: 1.05;
  margin-bottom: 20px;
  text-shadow:
    -2px 0 0 rgba(255, 0, 50, 0.55),
     2px 0 0 rgba(0, 200, 255, 0.5),
     0 0 6px var(--accent-pink),
     0 0 20px var(--accent-glow),
     0 0 50px var(--accent-glow),
     0 0 80px rgba(255, 46, 154, 0.08);
}

.panel-desc {
  font-family: var(--font);
  font-size: 11px;
  line-height: 1.85;
  color: var(--text-mid);
  margin-bottom: 24px;
}

.panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 32px;
}

.panel-tag {
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 4px 10px;
  transition: border-color 0.2s, color 0.2s;
  text-shadow:
    -0.5px 0 0 rgba(255, 0, 50, 0.2),
     0.5px 0 0 rgba(0, 200, 255, 0.2);
  box-shadow:
    -1px 0 0 rgba(255, 0, 50, 0.12),
     1px 0 0 rgba(0, 200, 255, 0.12);
}
.panel-tag:hover { border-color: var(--border-strong); color: var(--text); }

/* Stills */
.panel-stills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 32px;
}
.panel-stills:empty { display: none; }

.panel-still {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.panel-still:last-child:nth-child(odd) {
  grid-column: span 2;
}

/* ── Behance-style blocks ── */
.bh-figure {
  grid-column: span 2;
  margin: 0;
}
.bh-figure .panel-still {
  border-radius: 2px;
}
.bh-caption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  padding: 8px 0 4px;
  letter-spacing: 0.03em;
  line-height: 1.5;
}

.bh-heading {
  grid-column: span 2;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent, #ff2e9a);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 32px 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 46, 154, 0.25);
}

.bh-text {
  grid-column: span 2;
  padding: 24px 0;
}
.bh-text__title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.bh-text__body {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.9;
  margin: 0;
  max-width: 600px;
}

/* Credits */
.panel-credits {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.panel-credit-name {
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.panel-credit-dot { color: rgba(255, 255, 255, 0.15); font-size: 9px; }
.panel-credit-views {
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ── Canvas zoom transition ── */
.home--canvas.is-zooming {
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

/* ── Grid items transitions ── */
.grid-item {
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1),
              opacity   0.6s ease;
}

.grid-item.is-active .project-label    { opacity: 0; }
.grid-item.is-active .grid-item-overlay { opacity: 0; pointer-events: none; }

/* ─── Debug Panel ─── */
.debug-panel {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 10000;
  background: rgba(10, 10, 8, 0.92);
  border: 1px solid var(--border-strong);
  padding: 14px 16px;
  font-family: var(--font);
  min-width: 240px;
  display: none;
  backdrop-filter: blur(6px);
}
.debug-panel.is-visible { display: block; }

.debug-title {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text);
  margin-bottom: 12px;
  text-shadow:
    -1px 0 0 rgba(255, 0, 50, 0.4),
     1px 0 0 rgba(0, 200, 255, 0.4),
     0 0 6px rgba(255, 255, 255, 0.5),
     0 0 16px rgba(255, 255, 255, 0.12);
}

.debug-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  cursor: default;
}
.debug-row:last-child { margin-bottom: 0; }

.debug-row span:first-child {
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--text-mid);
  min-width: 75px;
  flex-shrink: 0;
}

.debug-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
}
.debug-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px; height: 8px;
  background: var(--text);
  cursor: pointer;
}
.debug-row input[type="range"]::-moz-range-thumb {
  width: 8px; height: 8px;
  background: var(--text);
  border: none;
  cursor: pointer;
}

.debug-sep {
  height: 1px;
  background: var(--border);
  margin: 6px 0 8px;
}

.debug-row input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 16px;
  border: 1px solid rgba(255,255,255,0.15);
  background: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.debug-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.debug-row input[type="color"]::-webkit-color-swatch { border: none; }

.debug-val {
  font-size: 8px;
  color: var(--text-dim);
  min-width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ─── About Folder (bento grid) ─── */
.about-folder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px dashed var(--border-strong) !important;
  background: transparent !important;
  transition: border-color 0.3s, box-shadow 0.3s;
  /* Position set dynamically by JS to always stay centered */
}
.about-folder:hover {
  border-color: var(--accent-pink) !important;
  box-shadow:
    0 0 15px var(--accent-glow),
    0 0 40px rgba(255, 46, 154, 0.08),
    inset 0 0 30px rgba(255, 46, 154, 0.04) !important;
}
.about-folder__icon {
  width: 56px;
  height: 56px;
  color: var(--accent-pink);
  filter: drop-shadow(0 0 6px var(--accent-pink)) drop-shadow(0 0 20px var(--accent-glow));
  transition: transform 0.3s, filter 0.3s;
}
.about-folder:hover .about-folder__icon {
  transform: scale(1.08);
  filter: drop-shadow(0 0 10px var(--accent-pink)) drop-shadow(0 0 30px var(--accent-glow));
}
.about-folder__icon svg {
  width: 100%;
  height: 100%;
}
.about-folder__label {
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-mid);
  text-shadow:
    -0.8px 0 0 rgba(255, 0, 50, 0.3),
     0.8px 0 0 rgba(0, 200, 255, 0.3),
     0 0 6px rgba(255, 255, 255, 0.3);
  transition: color 0.3s;
}
.about-folder:hover .about-folder__label {
  color: var(--accent-pink);
  text-shadow:
    0 0 8px var(--accent-pink),
    0 0 20px var(--accent-glow);
}

/* ─── PCB Circuit Board Layout ─── */
.about-folder { position: relative; overflow: visible !important; }

.pcb-layout {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 60;
}


/* Nodes */
.pcb-node {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(5, 5, 5, 0.94);
  border: 1px solid rgba(255, 46, 154, 0.35);
  padding: 16px 20px;
  min-width: 220px;
  max-width: 320px;
  pointer-events: auto;
  z-index: 2;
  font-family: var(--font);
  box-shadow:
    0 0 1px var(--accent-pink),
    0 0 8px var(--accent-glow),
    -1.5px 0 0 rgba(255, 0, 50, 0.15),
     1.5px 0 0 rgba(0, 200, 255, 0.15),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  animation: pcb-node-in 0.4s ease forwards;
}
@keyframes pcb-node-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.pcb-closing .pcb-node {
  animation: pcb-node-out 0.3s ease forwards;
}
@keyframes pcb-node-out {
  to { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
}

/* Node header */
.pcb-node__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 46, 154, 0.25);
}
.pcb-node__dot {
  width: 6px;
  height: 6px;
  background: var(--accent-pink);
  border-radius: 50%;
  box-shadow: 0 0 4px var(--accent-pink), 0 0 10px var(--accent-glow);
  flex-shrink: 0;
}
.pcb-node__label {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--accent-pink);
  text-shadow:
    0 0 6px var(--accent-pink),
    0 0 14px var(--accent-glow),
    -1px 0 0 rgba(255, 0, 50, 0.4),
     1px 0 0 rgba(0, 200, 255, 0.4);
}

/* Node body content */
.pcb-node__body {
  font-size: 11px;
  line-height: 1.7;
}

/* Rows (key/val) */
.pcb-row {
  display: flex;
  gap: 12px;
  margin-bottom: 5px;
}
.pcb-key {
  color: var(--text-dim);
  min-width: 80px;
  flex-shrink: 0;
  letter-spacing: 0.08em;
  font-size: 10px;
  text-shadow:
    -0.5px 0 0 rgba(255, 0, 50, 0.2),
     0.5px 0 0 rgba(0, 200, 255, 0.2);
}
.pcb-val {
  color: var(--text);
  letter-spacing: 0.04em;
  font-size: 10px;
  text-shadow:
    0 0 4px rgba(255, 255, 255, 0.3),
    -0.5px 0 0 rgba(255, 0, 50, 0.15),
     0.5px 0 0 rgba(0, 200, 255, 0.15);
}
.pcb-val--online {
  color: #00ff88;
  text-shadow:
    0 0 6px rgba(0, 255, 136, 0.5),
    0 0 16px rgba(0, 255, 136, 0.15);
}

/* Bio */
.pcb-bio {
  font-size: 10px;
  line-height: 1.8;
  color: var(--text-mid);
  margin: 0;
  letter-spacing: 0.02em;
  text-shadow:
    -0.5px 0 0 rgba(255, 0, 50, 0.12),
     0.5px 0 0 rgba(0, 200, 255, 0.12);
}

/* Entries (experience, formation) */
.pcb-entry {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}
.pcb-date {
  color: var(--accent-pink);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-shadow: 0 0 4px var(--accent-glow);
}
.pcb-entry-title {
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow:
    -0.6px 0 0 rgba(255, 0, 50, 0.25),
     0.6px 0 0 rgba(0, 200, 255, 0.25),
     0 0 3px rgba(255, 255, 255, 0.25);
}
.pcb-entry-type {
  color: var(--text-dim);
  font-size: 9px;
  letter-spacing: 0.06em;
}

/* Skills */
.pcb-skill {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.pcb-skill-name {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  min-width: 130px;
  flex-shrink: 0;
  text-shadow:
    -0.5px 0 0 rgba(255, 0, 50, 0.2),
     0.5px 0 0 rgba(0, 200, 255, 0.2);
}
.pcb-skill-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}
.pcb-skill-fill {
  height: 100%;
  background: var(--accent-pink);
  box-shadow:
    0 0 4px var(--accent-pink),
    0 0 10px var(--accent-glow);
}

/* Footer node */
.pcb-footer-node {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  min-width: auto;
  padding: 0;
}
.pcb-footer-text {
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  text-shadow:
    -0.5px 0 0 rgba(255, 0, 50, 0.2),
     0.5px 0 0 rgba(0, 200, 255, 0.2),
     0 0 4px rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  display: none;
}

/* ═══════════════════════════════════════════
   MOBILE — fullscreen panel with video header
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Panel takes full screen */
  .project-panel {
    width: 100vw;
    border-left: none;
    border-top: 2px solid var(--accent-pink);
    box-shadow: none;
  }

  /* Hero video visible on mobile */
  .panel-hero-video {
    display: block;
  }

  /* Hide thumb when video is playing (mobile shows video instead) */
  .panel-hero-video[src] ~ .panel-thumb {
    display: none !important;
  }

  /* Hero sticks to top like an app header */
  .panel-hero {
    margin-bottom: 0;
    border-radius: 0;
    flex-shrink: 0;
  }
  .panel-hero-video {
    aspect-ratio: 16 / 9;
    width: 100%;
    background: #000;
  }

  /* Panel info scrollable below */
  .panel-info {
    padding: 20px 18px 40px;
  }

  /* Bigger close button for touch */
  .panel-close {
    width: 40px;
    height: 40px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .panel-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  /* Title sizing for mobile */
  .panel-title {
    font-size: clamp(24px, 6vw, 36px);
  }

  /* Stills/behance full width */
  .panel-stills {
    grid-template-columns: 1fr;
  }
  .bh-figure,
  .bh-heading,
  .bh-text {
    grid-column: span 1;
  }
  .panel-still:last-child:nth-child(odd) {
    grid-column: span 1;
  }

  /* HUD compact */
  .home--hud {
    top: 10px;
    left: 14px;
    font-size: 7px;
  }

  /* Zoom controls bottom-right */
  .home--zoom-controls {
    bottom: 14px;
    right: 14px;
  }
  .home--zoom-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}
