/* ============================================================
   AMBIGUITY STUDIO — Global Design System
   ambiguity.studio
   ============================================================ */

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

/* ─── Variables ─────────────────────────────────────────────── */

:root {
  --bg:      #080808;
  --text:    #f0ece4;
  --muted:   #484440;
  --accent:  #dff23c;
  --line:    #161616;
  --overlay: rgba(8,8,8,0.94);
}

/* ─── Base ──────────────────────────────────────────────────── */

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Mono', 'Courier New', monospace;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: inherit;
}

/* ─── Grain Overlay ─────────────────────────────────────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 300px 300px;
}

/* ─── Navigation ─────────────────────────────────────────────── */

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 44px;
}

/* Right-side nav links hidden — overlay handles all navigation */
.nav-links {
  display: none;
}

nav::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(8,8,8,0.92) 0%, transparent 100%);
  z-index: -1;
}

.wordmark {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 19px;
  letter-spacing: 0.22em;
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
}

.nav-links a {
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

/* ─── Full-Screen Nav Overlay ───────────────────────────────── */

body.overlay-open {
  overflow: hidden;
}

#nav-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 52px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#nav-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.overlay-close {
  position: absolute;
  top: 26px;
  left: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.overlay-close:hover {
  color: var(--text);
}

.overlay-nav {
  display: flex;
  flex-direction: column;
}

/* Main items — Bebas Neue, large */
.overlay-link,
.overlay-group {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: clamp(64px, 10vw, 148px);
  letter-spacing: 0.04em;
  line-height: 0.88;
  color: var(--muted);
  text-decoration: none;
  display: block;
  padding: 5px 0;
  /* entrance state */
  opacity: 0;
  transform: translateY(18px);
}

.overlay-link:hover,
.overlay-group:hover .overlay-group-label {
  color: var(--text);
}

/* Entrance animation on open */
#nav-overlay.open [data-i] {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#nav-overlay.open [data-i="0"] { transition-delay: 0.06s; }
#nav-overlay.open [data-i="1"] { transition-delay: 0.13s; }
#nav-overlay.open [data-i="2"] { transition-delay: 0.20s; }

/* Sub-links under WORK */
.overlay-sub {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 0 18px;
  opacity: 0;
  transition: opacity 0.35s 0.32s;
}

#nav-overlay.open .overlay-sub {
  opacity: 1;
}

.overlay-sub-link {
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.overlay-sub-link:hover {
  color: var(--text);
}

.overlay-sub-sep {
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 11px;
  color: var(--line);
}

/* ─── Page Header (Originals, Work listing pages) ───────────── */

.page-header {
  padding: 140px 52px 72px;
  border-bottom: 1px solid var(--line);
}

.page-header h1 {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: clamp(48px, 7vw, 110px);
  letter-spacing: 0.04em;
  line-height: 0.92;
  color: var(--text);
}

.page-header .page-sub {
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 18px;
}

@media (max-width: 768px) {
  #nav-overlay {
    padding: 0 24px;
  }

  .overlay-close {
    left: 24px;
    top: 22px;
  }

  .overlay-link,
  .overlay-group {
    font-size: clamp(52px, 14vw, 88px);
  }

  .page-header {
    padding: 120px 24px 52px;
  }
}

/* ─── Homepage Grid ─────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.row-break {
  grid-column: 1 / -1;
  height: 1px;
  background: var(--line);
}

/* ─── Cards ─────────────────────────────────────────────────── */

.card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: block;
  text-decoration: none;
}

.card.full  { grid-column: 1 / -1; min-height: 70vh; }
.card.half  { min-height: 52vh; }
.card.short { min-height: 44vh; }

/* Labs uses both .full and .short: spans full width at short height */
.card.full.short { min-height: 44vh; }

.card.half  + .card.half  { border-left: 1px solid var(--line); }
.card.short + .card.short { border-left: 1px solid var(--line); }

.card-bg {
  position: absolute;
  inset: 0;
  transition: transform 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card:hover .card-bg { transform: scale(1.04); }

/* Project atmosphere gradients */
.card[data-id="wk"] .card-bg {
  background:
    radial-gradient(ellipse at 22% 72%, #1e4d32 0%, transparent 52%),
    radial-gradient(ellipse at 72% 28%, #0d2a1c 0%, transparent 48%),
    radial-gradient(ellipse at 50% 50%, #0a1a10 0%, transparent 70%),
    #050a07;
}

.card[data-id="emergency"] .card-bg {
  background:
    radial-gradient(ellipse at 28% 65%, #420d0d 0%, transparent 52%),
    radial-gradient(ellipse at 68% 28%, #220505 0%, transparent 48%),
    radial-gradient(ellipse at 85% 80%, #180303 0%, transparent 40%),
    #080303;
}

.card[data-id="smashkey"] .card-bg {
  background:
    radial-gradient(ellipse at 60% 50%, #0c1a40 0%, transparent 52%),
    radial-gradient(ellipse at 25% 28%, #060e28 0%, transparent 48%),
    #030508;
}

.card[data-id="labs"] .card-bg {
  background:
    radial-gradient(ellipse at 38% 55%, #1c0840 0%, transparent 48%),
    radial-gradient(ellipse at 72% 32%, #100525 0%, transparent 52%),
    radial-gradient(ellipse at 18% 78%, #080d20 0%, transparent 42%),
    #050308;
}

.card[data-id="archive"] .card-bg {
  background:
    radial-gradient(ellipse at 38% 62%, #281800 0%, transparent 52%),
    radial-gradient(ellipse at 68% 30%, #180e00 0%, transparent 48%),
    #080502;
}

.card[data-id="sandbox"] .card-bg {
  background: #090909;
}

/* Card image/video inside .card-bg */
.card-bg img,
.card-bg video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ─── Card Content ──────────────────────────────────────────── */

.card-content {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(8,8,8,0.94) 0%,
    rgba(8,8,8,0.35) 38%,
    transparent 65%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 34px 42px;
}

.card.full .card-content { padding: 46px 52px; }

.tag {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 11px;
  transition: color 0.2s;
}

.card:hover .tag { color: var(--accent); }

.title {
  font-family: 'Bebas Neue', Impact, sans-serif;
  letter-spacing: 0.035em;
  line-height: 0.92;
  color: var(--text);
  margin-bottom: 14px;
}

.card.full  .title { font-size: clamp(52px, 6.5vw, 88px); }
.card.half  .title { font-size: clamp(34px, 4vw, 58px); }
.card.short .title { font-size: clamp(30px, 3.5vw, 50px); }

.tagline {
  font-size: 11px;
  color: rgba(240,236,228,0.42);
  line-height: 1.75;
  max-width: 520px;
  opacity: 0;
  transform: translateY(9px);
  transition: opacity 0.28s 0.04s, transform 0.28s 0.04s;
}

.card:hover .tagline {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Sandbox Card Special State ────────────────────────────── */

.sandbox-shell {
  position: absolute;
  inset: 20px;
  border: 1px dashed #1c1c1c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.sandbox-shell .s-label {
  font-size: 9px;
  letter-spacing: 0.35em;
  color: #252520;
  text-transform: uppercase;
}

.sandbox-shell .s-title {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 34px;
  letter-spacing: 0.06em;
  color: #202018;
}

/* ─── Project Pages — Hero ──────────────────────────────────── */

.project-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
}

/* Atmospheric gradients for project heroes */
.project-hero[data-id="wk"] .hero-bg {
  background:
    radial-gradient(ellipse at 22% 72%, #1e4d32 0%, transparent 52%),
    radial-gradient(ellipse at 72% 28%, #0d2a1c 0%, transparent 48%),
    radial-gradient(ellipse at 50% 50%, #0a1a10 0%, transparent 70%),
    #050a07;
}

.project-hero[data-id="emergency"] .hero-bg {
  background:
    radial-gradient(ellipse at 28% 65%, #420d0d 0%, transparent 52%),
    radial-gradient(ellipse at 68% 28%, #220505 0%, transparent 48%),
    radial-gradient(ellipse at 85% 80%, #180303 0%, transparent 40%),
    #080303;
}

.project-hero[data-id="smashkey"] .hero-bg {
  background:
    radial-gradient(ellipse at 60% 50%, #0c1a40 0%, transparent 52%),
    radial-gradient(ellipse at 25% 28%, #060e28 0%, transparent 48%),
    #030508;
}

.project-hero[data-id="labs"] .hero-bg {
  background:
    radial-gradient(ellipse at 38% 55%, #1c0840 0%, transparent 48%),
    radial-gradient(ellipse at 72% 32%, #100525 0%, transparent 52%),
    radial-gradient(ellipse at 18% 78%, #080d20 0%, transparent 42%),
    #050308;
}

.project-hero[data-id="archive"] .hero-bg {
  background:
    radial-gradient(ellipse at 38% 62%, #281800 0%, transparent 52%),
    radial-gradient(ellipse at 68% 30%, #180e00 0%, transparent 48%),
    #080502;
}

.project-hero[data-id="sandbox"] .hero-bg {
  background: #090909;
}

/* Hero image/video */
.hero-bg img,
.hero-bg video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Cloudflare Stream hero iframe */
.stream-hero {
  position: absolute;
  inset: 0;
}

.stream-hero iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Hero gradient overlay */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(8,8,8,0.97) 0%,
    rgba(8,8,8,0.45) 38%,
    rgba(8,8,8,0.12) 70%,
    transparent 100%
  );
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 52px 72px;
  width: 100%;
}

.hero-content .tag {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero-content h1 {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: clamp(48px, 7vw, 110px);
  letter-spacing: 0.04em;
  line-height: 0.92;
  color: var(--text);
}

/* ─── Project Pages — Body ──────────────────────────────────── */

.project-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.project-desc {
  padding: 72px 52px;
}

.project-desc p {
  font-size: 13px;
  font-weight: 300;
  line-height: 1.75;
  color: var(--text);
  max-width: 560px;
}

.pipeline-notes {
  padding: 72px 52px;
  border-left: 1px solid var(--line);
}

.pipeline-label {
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 26px;
}

.pipeline-list {
  list-style: none;
}

.pipeline-list li {
  font-size: 11px;
  font-weight: 300;
  line-height: 1.75;
  color: var(--muted);
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.pipeline-list li:last-child {
  border-bottom: none;
}

/* No pipeline — desc spans full width */
.project-body.no-pipeline {
  grid-template-columns: 1fr;
}

.project-body.no-pipeline .project-desc {
  padding: 72px 52px;
  max-width: 820px;
}

/* ─── Project Pages — Gallery ───────────────────────────────── */

.project-gallery {
  padding: 72px 52px;
  border-bottom: 1px solid var(--line);
}

.gallery-label {
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 36px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
}

.gallery-item {
  background: var(--bg);
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Cloudflare Stream gallery clip */
.stream-clip {
  background: var(--bg);
  aspect-ratio: 16 / 9;
}

.stream-clip iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Placeholder when gallery is empty */
.gallery-empty {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--muted);
  text-transform: uppercase;
  padding: 60px 0;
  opacity: 0.5;
}

/* ─── Project Pages — Demo Showcase ────────────────────────── */

.project-demo {
  border-bottom: 1px solid var(--line);
}

.demo-header {
  padding: 52px 52px 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.demo-header .pipeline-label {
  margin-bottom: 0;
}

.demo-header .demo-note {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}

.demo-video-wrap {
  margin: 32px 52px 52px;
  aspect-ratio: 16 / 9;
  background: #050505;
  position: relative;
  overflow: hidden;
}

.demo-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.demo-placeholder {
  position: absolute;
  inset: 0;
  border: 1px dashed #1c1c1c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.demo-placeholder-label {
  font-size: 9px;
  letter-spacing: 0.35em;
  color: #252520;
  text-transform: uppercase;
}

/* ─── Scenarios Row ─────────────────────────────────────────── */

.project-scenarios {
  border-bottom: 1px solid var(--line);
  padding: 52px;
}

.scenarios-list {
  display: flex;
  gap: 0;
  list-style: none;
  border: 1px solid var(--line);
}

.scenario-item {
  flex: 1;
  padding: 26px 32px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scenario-item:last-child {
  border-right: none;
}

.scenario-name {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--text);
}

.scenario-status {
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.scenario-item.playable .scenario-status {
  color: var(--accent);
}

@media (max-width: 768px) {
  .demo-header {
    padding: 40px 24px 0;
    flex-direction: column;
    gap: 8px;
  }

  .demo-video-wrap {
    margin: 24px 24px 40px;
  }

  .project-scenarios {
    padding: 40px 24px;
  }

  .scenarios-list {
    flex-direction: column;
  }

  .scenario-item {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .scenario-item:last-child {
    border-bottom: none;
  }
}

/* ─── Project Pages — CTA ───────────────────────────────────── */

.project-cta {
  padding: 72px 52px;
  border-bottom: 1px solid var(--line);
}

.cta-btn {
  display: inline-block;
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--muted);
  padding: 16px 36px;
  transition: border-color 0.2s, color 0.2s;
}

.cta-btn:hover {
  border-color: var(--text);
  color: var(--accent);
}

/* CTA placed inline under a description paragraph */
.cta-btn.desc-cta {
  margin-top: 36px;
}

/* ─── Sandbox Page ──────────────────────────────────────────── */

.sandbox-page-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}

.sandbox-page-shell {
  border: 1px dashed #1c1c1c;
  padding: 80px 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.sandbox-page-shell .s-label {
  font-size: 10px;
  letter-spacing: 0.4em;
  color: #2e2e28;
  text-transform: uppercase;
}

.sandbox-page-shell .s-title {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: clamp(48px, 7vw, 110px);
  letter-spacing: 0.04em;
  line-height: 0.92;
  color: #1e1e18;
}

.sandbox-page-shell .s-rule {
  width: 1px;
  height: 40px;
  background: #1c1c1c;
}

.sandbox-body {
  padding: 72px 52px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 80px;
  border-bottom: 1px solid var(--line);
}

.sandbox-desc p {
  font-size: 13px;
  font-weight: 300;
  line-height: 1.75;
  color: var(--text);
  max-width: 560px;
}

.sandbox-slots {
  border-left: 1px solid var(--line);
  padding-left: 52px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.slot {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 20px;
}

.slot:last-child {
  border-bottom: none;
}

.slot-num {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 28px;
  letter-spacing: 0.04em;
  color: var(--line);
}

.slot-status {
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Footer ────────────────────────────────────────────────── */

footer {
  padding: 36px 52px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
}

.footer-mark {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 13px;
  letter-spacing: 0.25em;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 30px;
  list-style: none;
}

.footer-links a {
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--text); }

/* ─── Responsive ────────────────────────────────────────────── */

@media (max-width: 768px) {

  /* Nav */
  nav {
    padding: 18px 24px;
  }

  .nav-links {
    gap: 24px;
  }

  /* Homepage grid — single column */
  .grid {
    grid-template-columns: 1fr;
  }

  .card.full,
  .card.half,
  .card.short {
    grid-column: 1 / -1;
  }

  .card.half + .card.half,
  .card.short + .card.short {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .card.full  { min-height: 60vh; }
  .card.half  { min-height: 50vh; }
  .card.short { min-height: 44vh; }

  .card.full .card-content { padding: 32px 24px; }
  .card-content             { padding: 28px 24px; }

  /* Project pages */
  .hero-content {
    padding: 0 24px 52px;
  }

  .project-body,
  .sandbox-body {
    grid-template-columns: 1fr;
  }

  .project-desc {
    padding: 52px 24px;
  }

  .pipeline-notes {
    padding: 52px 24px;
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .project-gallery,
  .project-cta {
    padding: 52px 24px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .sandbox-body {
    padding: 52px 24px;
  }

  .sandbox-slots {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 40px;
    margin-top: 0;
  }

  .sandbox-page-shell {
    padding: 60px 40px;
  }

  /* Footer */
  footer {
    padding: 28px 24px;
    flex-direction: column;
    gap: 20px;
    align-items: flex-start;
  }

}

/* ─── The Vault — reel grid ─────────────────────────────────── */
/* Used on /archive. A grid of Cloudflare Stream cards: each loops
   muted as a silent preview, click opens the full piece in a
   lightbox. Preview players mount only when scrolled into view. */

.reel-section {
  border-bottom: 1px solid var(--line);
  padding: 72px 52px;
}

.reel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}

.reel-head .gallery-label {
  margin-bottom: 0;
}

.reel-count {
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.reel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

/* Wall variant — no heading, no padding, no frame. The tiles ARE the
   page: edge to edge, starting at the top. Two columns, not three:
   stretching three across to fill the viewport height forces each tile
   nearly square, which cover-crops the sides off 16:9 footage. Two
   columns at true 16:9 still fill the screen and lose no framing.
   Used on /archive. */
.reel-section.wall {
  padding: 0;
  border-bottom: none;
}

.reel-section.wall .reel-grid {
  border: none;
  grid-template-columns: repeat(2, 1fr);
}

/* The wall page uses nav.reel-bar, which is solid and in the flow, so it
   needs neither the gradient scrim nor the link list. */
body:has(.reel-section.wall) .nav-links {
  display: none;
}

/* The identity block now lives inside nav.reel-bar — see the Reel bar
   section below. The old stacked-over-the-video version was removed on
   2026-09-04: it sat on top of the top row of tiles and was hard to read
   over bright footage. */

.reel-card {
  position: relative;
  display: block;
  background: var(--bg);
  text-decoration: none;
  overflow: hidden;
  cursor: pointer;
}

/* The explicit display:block above beats the [hidden] attribute's default
   UA style, so hiding a card from JS needs this or nothing disappears. */
.reel-card[hidden] {
  display: none !important;
}

/* ─── Reel bar ───────────────────────────────────────────────
   One thin solid strip: name and contact left, category tabs right. It sits
   in the flow rather than floating over the wall — a translucent bar over
   moving video was unreadable, and it covered the top row of tiles. */

nav.reel-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 52px;
  padding: 0 22px;
  background: #080808;
  border-bottom: 1px solid var(--line);
}

nav.reel-bar::after { content: none; }   /* kill the inherited gradient scrim */

.reel-bar .reel-identity {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.reel-bar .reel-name {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 17px;
  letter-spacing: 0.2em;
  line-height: 1;
  color: #fff;
  text-transform: uppercase;
  white-space: nowrap;
}

.reel-bar .reel-mail {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(240, 236, 228, 0.55);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.25s ease;
}

.reel-bar .reel-mail:hover { color: var(--accent); }

.reel-tabbar {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.reel-tabbar::-webkit-scrollbar { display: none; }

.reel-tab {
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  color: rgba(240, 236, 228, 0.45);
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.reel-tab:hover { color: #fff; }

.reel-tab.active {
  color: #fff;
  border-bottom-color: #fff;
}

@media (max-width: 620px) {
  /* Two rows rather than dropping the email. The contact detail is the
     point of the page — it does not get hidden to save space. */
  nav.reel-bar {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 9px 12px 0;
  }
  .reel-bar .reel-identity { gap: 10px; }
  .reel-bar .reel-name { font-size: 15px; letter-spacing: 0.16em; }
  .reel-bar .reel-mail { font-size: 9px; }
  .reel-tabbar { margin-top: 7px; }
  .reel-tab {
    font-size: 9px;
    letter-spacing: 0.12em;
    padding: 6px 8px;
  }
}

@media (max-width: 380px) {
  .reel-bar .reel-identity { flex-direction: column; align-items: flex-start; gap: 3px; }
}

/* Shown when a playlist link cannot be resolved. Better than silently
   showing the whole library to someone sent a link to four pieces. */
.reel-gone {
  padding: 22vh 52px 0;
  max-width: 620px;
}

.reel-gone-title {
  font-family: 'Bebas Neue', 'Arial Narrow', sans-serif;
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--text);
  margin-bottom: 18px;
}

.reel-gone p {
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
  margin-bottom: 26px;
}

.reel-gone a {
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s ease;
}

.reel-gone a:hover { color: var(--accent); }
.reel-gone a::after { content: ' \2192'; }

/* Shown at the end of a playlist, linking back to the full wall. */
.reel-showall {
  display: block;
  padding: 40px 52px 56px;
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s ease;
}

.reel-showall:hover { color: var(--accent); }

.reel-showall::after {
  content: ' \2192';
}

.reel-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0d0d0d;
  container-type: size;
}

/* Cover-crop a 16:9 player inside any card aspect ratio. */
.reel-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100cqw, 177.78cqh);
  height: max(56.25cqw, 100cqh);
  transform: translate(-50%, -50%) scale(1.01);
  pointer-events: none;
}

.reel-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Still frame sits under the player so there is no black flash. */
.reel-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.62;
  transition: opacity 0.5s ease;
}

.reel-card:hover .reel-poster { opacity: 0.85; }
.reel-card.is-playing .reel-poster { opacity: 0; }

.reel-meta {
  position: absolute;
  inset: auto 0 0 0;
  padding: 44px 24px 22px;
  /* Deep enough to hold small text over a bright frame — the tag is
     9px and washes out against anything lighter without it. */
  background: linear-gradient(to top,
    rgba(8,8,8,0.97) 0%,
    rgba(8,8,8,0.88) 38%,
    rgba(8,8,8,0.55) 70%,
    transparent 100%);
  pointer-events: none;
}

.reel-meta .tag {
  margin-bottom: 8px;
}

.reel-card:hover .reel-meta .tag { color: var(--accent); }

.reel-title {
  font-family: 'Bebas Neue', 'Arial Narrow', sans-serif;
  font-size: clamp(20px, 1.9vw, 28px);
  letter-spacing: 0.035em;
  line-height: 0.92;
  color: var(--text);
}

/* Empty slot — a piece not uploaded yet. */
.reel-card.is-empty {
  cursor: default;
  pointer-events: none;
}

.reel-slot {
  position: absolute;
  inset: 14px;
  border: 1px dashed #262626;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-slot span {
  font-size: 9px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #3d3a35;
}

/* ─── Lightbox ──────────────────────────────────────────────── */

.reel-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8,8,8,0.97);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 64px 52px;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.reel-lightbox.open {
  display: flex;
  opacity: 1;
}

.reel-lightbox-stage {
  width: 100%;
  max-width: 1400px;
  aspect-ratio: 16 / 9;
  background: #050505;
  position: relative;
  z-index: 1;
}

.reel-lightbox-stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.reel-lightbox-caption {
  position: absolute;
  top: -30px;
  left: 0;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  /* Not --muted: that reads fine over the page, but vanishes against the
     near-black lightbox backdrop. */
  color: rgba(240, 236, 228, 0.82);
}

/* A plain word at 10px was too easy to miss against a bright frame. This is
   a proper target: a circle with an X, always readable, never hunted for. */
.reel-lightbox-close {
  position: absolute;
  top: 22px;
  right: 26px;
  /* Above the stage: on a wide window the 16:9 player reaches under this
     corner, and the stage comes later in the DOM, so without a z-index the
     video paints over the button and eats the clicks. */
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(8, 8, 8, 0.72);
  border: 1px solid rgba(240, 236, 228, 0.35);
  color: rgba(240, 236, 228, 0.95);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.reel-lightbox-close:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #080808;
}

.reel-lightbox-close svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* While a playlist is resolving, keep the wall out of sight — otherwise all
   85 cards paint first and you watch the wrong videos flash past before it
   settles. Only applied when a playlist is actually requested. */
.reel-filtering .reel-grid { visibility: hidden; }

@media (max-width: 768px) {
  .reel-lightbox-close { top: 14px; right: 14px; width: 40px; height: 40px; }
}

body.reel-open { overflow: hidden; }

@media (max-width: 1100px) {
  .reel-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .reel-section { padding: 52px 24px; }
  .reel-grid { grid-template-columns: 1fr; }
  /* Needed explicitly: the .wall rule is more specific than the bare
     .reel-grid above, so it would otherwise keep two columns on a phone. */
  .reel-section.wall .reel-grid { grid-template-columns: 1fr; }
  /* Side by side, both halves wrap into two lines at phone width. */
  .reel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .reel-meta { padding: 18px; }
  .reel-lightbox { padding: 72px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .reel-poster,
  .reel-card.is-playing .reel-poster { opacity: 0.85; }
}
