/* Self-hosted fonts (OFL) — no request to Google Fonts */
@font-face {
  font-family: 'Share Tech Mono';
  src: url('font/share-tech-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Space Mono';
  src: url('font/space-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Space Mono';
  src: url('font/space-mono-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IvyPresto';
  src: url('font/ivy-presto-headline-light.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

*, *::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;
}

/* ── 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);
}

.svg-defs { position: absolute; }

/* ─── Mémoire tile (bento) ─── */
.memoire-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
  border: 1px dashed var(--border-strong) !important;
  background: transparent !important;
  transition: border-color 0.3s, box-shadow 0.3s;
  -webkit-user-drag: none;
}
.memoire-tile:hover,
.memoire-tile:focus-visible {
  outline: none;
  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;
}
.memoire-tile__icon {
  width: 52px;
  height: 52px;
  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;
}
.memoire-tile:hover .memoire-tile__icon { transform: scale(1.08); }
.memoire-tile__icon svg { width: 100%; height: 100%; }
.memoire-tile__label {
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-mid);
  text-align: center;
  line-height: 1.6;
  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;
}
.memoire-tile__sub {
  display: block;
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
}
.memoire-tile:hover .memoire-tile__label { color: var(--accent-pink); }

/* ─── FX toggle + legal link (bottom-left) ─── */
.fx-toggle {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 9994;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  background: rgba(13, 12, 8, 0.8);
  border: 1px solid var(--border);
  color: var(--text-mid);
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.fx-toggle:hover,
.fx-toggle:focus-visible,
.fx-toggle[aria-expanded="true"] {
  outline: none;
  color: var(--text);
  border-color: var(--accent-pink);
  box-shadow: 0 0 12px var(--accent-glow);
}
.fx-toggle__dot {
  width: 8px;
  height: 8px;
  background: var(--accent-pink);
  box-shadow: 0 0 6px var(--accent-pink);
}
.debug-panel { bottom: 62px; }

.legal-link {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9994;
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-decoration: none;
}
.legal-link:hover,
.legal-link:focus-visible { color: var(--text); }

:focus-visible { outline: 1px solid var(--accent-pink); outline-offset: 2px; }

/* ─── 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
   ═══════════════════════════════════════════ */
/* Mobile-only elements, hidden on desktop */
.m-about-btn,
.m-footer,
.about-sheet,
.panel-hero-progress,
.sheet-grip { display: none; }

@media (max-width: 699px), (orientation: portrait) {

  /* ── Screen frame: lighter on a small screen ── */
  body, #page.home, .crt-scanlines, .crt-noise, .crt-vignette,
  .crt-warp, .crt-bloom { border-radius: 0; }
  .crt-warp { box-shadow: inset 0 0 40px 10px rgba(0, 0, 0, 0.6); border: none; }
  .crt-vignette { background: radial-gradient(ellipse at center, transparent 65%, rgba(0, 0, 0, 0.55) 100%); }

  /* ── Canvas becomes a native vertical scroll list ── */
  #page.home { perspective: none; }
  #page.home > * { transform: none; }

  .home--viewport {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    cursor: auto;
    user-select: auto;
    background-size: 28px 28px;
    background-position: 0 0;
    background-attachment: local;
  }

  .home--canvas {
    position: static;
    transform: none !important;
    will-change: auto;
  }

  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: none !important;
    grid-auto-rows: auto;
    grid-auto-flow: row dense;
    width: auto;
    gap: 10px;
    padding: calc(76px + env(safe-area-inset-top)) 12px 8px;
  }

  .media-grid > .grid-item {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    aspect-ratio: 16 / 9;
    transform: none !important;
    opacity: 1 !important;
    transition: border-color 0.2s;
  }
  .media-grid > .grid-item.size-portrait { grid-column: span 1 !important; aspect-ratio: 3 / 5; }
  .media-grid > .grid-item.size-carre    { grid-column: span 1 !important; aspect-ratio: 1; }
  .media-grid > .about-folder,
  .media-grid > .memoire-tile { order: -1; }
  .grid-item:active { border-color: var(--accent-pink); }

  /* Real <video> instead of the 10fps canvas preview; no hover/player chrome */
  .grid-video-preview,
  .grid-player,
  .grid-item-overlay { display: none !important; }

  .project-label {
    font-size: 11px;
    padding: 5px 10px;
    bottom: 10px;
    left: 10px;
  }
  /* No hover effects on mobile (a tap would leave them stuck on) */
  .grid-item:hover .project-label { opacity: 1; }
  .about-folder:hover,
  .memoire-tile:hover {
    border-color: var(--border-strong) !important;
    box-shadow: none !important;
  }
  .about-folder:hover .about-folder__icon,
  .memoire-tile:hover .memoire-tile__icon {
    transform: none;
    filter: drop-shadow(0 0 6px var(--accent-pink)) drop-shadow(0 0 20px var(--accent-glow));
  }
  .about-folder:hover .about-folder__label,
  .memoire-tile:hover .memoire-tile__label {
    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);
  }
  .panel-tag:hover { color: var(--text); border-color: transparent; }
  .about-sheet .panel-close:hover {
    color: var(--text);
    border-color: var(--border-strong);
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
    box-shadow: none;
  }
  .fx-toggle:hover:not(:focus-visible):not([aria-expanded="true"]) {
    color: var(--text-mid);
    border-color: var(--border);
    box-shadow: none;
  }

  .about-folder__label,
  .memoire-tile__label { font-size: 10px; }
  .memoire-tile__sub { font-size: 8px; }

  .m-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 28px 16px calc(92px + env(safe-area-inset-bottom));
    font-size: 10px;
    letter-spacing: 0.16em;
    color: var(--text-dim);
  }
  .m-footer a {
    color: var(--text-mid);
    text-decoration: none;
    padding: 12px 0;
  }

  /* ── Top bar ── */
  .home--hud {
    top: 0;
    left: 0;
    right: 0;
    padding: calc(16px + env(safe-area-inset-top)) 16px 26px;
    border-left: none;
    box-shadow: none;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.94) 55%, rgba(0, 0, 0, 0));
  }
  .home--hud__brand { margin: 0; font-size: 12px; line-height: 20px; }
  .home--hud__rows,
  .home--hud__title { display: none; }

  .m-about-btn {
    display: flex;
    align-items: center;
    position: fixed;
    top: calc(8px + env(safe-area-inset-top));
    right: 12px;
    z-index: 9994;
    height: 44px;
    padding: 0 14px;
    background: rgba(13, 12, 8, 0.85);
    border: 1px solid var(--accent-pink);
    color: var(--text);
    font-family: var(--font);
    font-size: 10px;
    letter-spacing: 0.18em;
    box-shadow: 0 0 10px var(--accent-glow);
  }

  .home--zoom-controls,
  .legal-link { display: none; }

  /* ── FX ── */
  .fx-toggle {
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 14px;
    height: 44px;
  }
  .debug-panel {
    left: 12px;
    right: 12px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    min-width: 0;
    padding: 16px;
  }
  .debug-row { margin-bottom: 14px; }
  .debug-row span:first-child { font-size: 10px; min-width: 88px; }
  .debug-val { font-size: 10px; }
  .debug-row input[type="range"] { height: 4px; }
  .debug-row input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; }
  .debug-row input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }
  .debug-row input[type="color"] { width: 44px; height: 28px; }

  /* ── Project panel & About: full-screen bottom sheets ── */
  .project-panel,
  .about-sheet {
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-left: none;
    box-shadow: none;
    transform: translateY(100%);
    transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  }
  .project-panel.is-open,
  .about-sheet.is-open { transform: translateY(0); }
  .about-sheet { border-top: 2px solid var(--accent-pink); }

  .about-sheet .panel-header {
    position: relative;
    padding: calc(18px + env(safe-area-inset-top)) 16px 12px;
  }
  .about-sheet .sheet-grip {
    display: block;
    position: absolute;
    top: calc(6px + env(safe-area-inset-top));
    left: 50%;
    width: 44px;
    height: 4px;
    margin-left: -22px;
    background: rgba(255, 255, 255, 0.25);
  }

  /* ── YouTube-style player page ── */
  .project-panel { background: #0f0f0f; }

  /* Controls float over the top of the video */
  .project-panel .panel-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    padding: calc(4px + env(safe-area-inset-top)) 4px 20px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
  }
  .project-panel .panel-header > * { pointer-events: auto; }

  .project-panel .panel-close,
  .project-panel .panel-nav-btn,
  .project-panel .panel-close:hover,
  .project-panel .panel-nav-btn:hover {
    width: 44px;
    height: 44px;
    border: none;
    background: none;
    box-shadow: none;
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  }
  /* close = chevron down, like the YouTube mini-player */
  .project-panel .panel-close { font-size: 0; }
  .project-panel .panel-close::before {
    content: '';
    width: 12px;
    height: 12px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: translateY(-3px) rotate(45deg);
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
  }
  .project-panel .panel-nav { margin-left: auto; gap: 0; }
  .project-panel .panel-counter { font-size: 11px; min-width: 48px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); }

  .panel-body {
    overscroll-behavior: contain;
    padding-top: env(safe-area-inset-top);
    background: #0f0f0f;
  }
  .panel-info {
    padding: 0 0 calc(40px + env(safe-area-inset-bottom));
    transition: transform 0.25s ease, opacity 0.25s ease;
  }
  .panel-info > :not(.panel-hero) { margin-left: 12px; margin-right: 12px; }

  /* Video pinned edge to edge at the top */
  .panel-hero {
    order: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    margin: 0 0 12px;
    border-radius: 0;
    flex-shrink: 0;
    background: #000;
  }
  .panel-hero-video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    object-position: center;
    background: #000;
  }
  .panel-hero-video:not([src]) { display: none; }
  .panel-hero-video[src] ~ .panel-thumb { display: none !important; }
  .panel-thumb {
    width: 100%;
    max-height: 56vh;
    object-fit: contain;
    border-radius: 0;
    background: #000;
  }

  .panel-hero-progress {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
  }
  .panel-hero-video:not([src]) ~ .panel-hero-progress { display: none; }
  #panel-hero-progress {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent-pink);
    box-shadow: 0 0 6px var(--accent-pink);
  }

  /* Title → meta → chips → description box → stills */
  .panel-title {
    order: 1;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: 1px;
    margin-top: 0;
    margin-bottom: 6px;
    text-shadow:
      -1px 0 0 rgba(255, 0, 50, 0.5),
       1px 0 0 rgba(0, 200, 255, 0.45),
       0 0 10px var(--accent-glow);
  }
  .panel-meta-row { order: 2; margin-bottom: 12px; }
  .panel-year, .panel-category, .panel-sep { font-size: 12px; letter-spacing: 0.06em; }

  .panel-tags {
    order: 3;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 8px;
    margin-bottom: 12px;
    margin-right: 0 !important;
    padding-right: 12px;
  }
  .panel-tags::-webkit-scrollbar { display: none; }
  .panel-tag {
    flex: none;
    display: flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    font-size: 11px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    box-shadow: none;
  }

  .panel-desc {
    order: 4;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-mid);
    white-space: pre-line;
    padding: 12px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.06);
  }
  .panel-desc:empty { display: none; }

  .panel-stills { order: 5; grid-template-columns: 1fr; gap: 8px; }
  .bh-figure, .bh-heading, .bh-text { grid-column: span 1; }
  .panel-still:last-child:nth-child(odd) { grid-column: span 1; }
  .bh-text__body, .bh-caption { font-size: 12px; }
  .panel-credits { order: 6; }


  /* ── About sheet ── */
  .about-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 9995;
    background: var(--panel-bg);
  }
  .about-sheet__title {
    margin-left: auto;
    font-size: 11px;
    letter-spacing: 0.22em;
    color: var(--accent-pink);
    text-shadow: 0 0 8px var(--accent-glow);
  }
  .about-sheet__body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 14px calc(40px + env(safe-area-inset-bottom));
  }
  .pcb-node--stack {
    position: static;
    transform: none;
    min-width: 0;
    max-width: none;
    margin-bottom: 12px;
    animation: none;
    opacity: 1;
  }
  .pcb-node--stack .pcb-node__label { margin: 0; font-weight: 400; }
  .pcb-node--stack .pcb-node__body { font-size: 12px; }
  .pcb-node--stack .pcb-key,
  .pcb-node--stack .pcb-val,
  .pcb-node--stack .pcb-bio,
  .pcb-node--stack .pcb-entry-title { font-size: 12px; }
  .pcb-node--stack .pcb-date,
  .pcb-node--stack .pcb-entry-type,
  .pcb-node--stack .pcb-skill-name { font-size: 11px; }
  .pcb-node--stack .pcb-val { overflow-wrap: anywhere; }
  .pcb-node--stack .pcb-skill-name { min-width: 0; flex: 0 0 52%; }
  .about-sheet__foot { white-space: normal; text-align: center; line-height: 1.8; margin-top: 20px; }
}

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