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

}
