@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&display=swap');

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

/* Kill the blue/grey native tap highlight on mobile (Safari/Chrome) */
* { -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #080808;
  --surface: #101010;
  --surface2: #151515;
  --border: #1e1e1e;
  --border2: #2a2a2a;
  --text: #EDE9E0;
  --muted: #6A6462;
  --muted2: #474240;
  --accent: #1ECFB0;
  --accent-dim: rgba(30, 207, 176, 0.09);
  --nav-w: 200px;
}

/* Selection & scrollbar */
::selection { background: rgba(30, 207, 176, 0.18); color: var(--text); }
* { scrollbar-color: var(--border2) var(--bg); scrollbar-width: thin; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); }

/* No global smooth scroll: it made the browser *animate* every implicit
   scroll — including bringing a tapped/focused project card into view while
   you scroll on mobile, which felt like the view "re-centering" itself.
   Intentional smooth scrolls (nav, "View work") pass behavior:'smooth'
   explicitly in JS, so they still animate. */

/* -- TYPE SCALE -- */
h1 { font-size: 3rem;    line-height: 1.1; font-family: 'Inter', sans-serif; }
h2 { font-size: 1.8rem;  line-height: 1.2; font-family: 'Inter', sans-serif; }
h3 { font-size: 1.2rem;  line-height: 1.3; font-family: 'Inter', sans-serif; }
small { font-size: 0.85rem; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -- NAV -- */
nav {
  position: fixed;
  top: 0; left: 0;
  width: var(--nav-w);
  height: 100vh;
  padding: 48px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 0.5px solid var(--border);
  z-index: 200;
  background: var(--bg);
}

.nav-top .site-name {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
  text-decoration: none;
  display: block;
  margin-bottom: 48px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.nav-top .site-name:hover { opacity: 0.65; }

.nav-links { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.nav-links a {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.10em;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s;
  display: block;
  padding: 4px 0;
  cursor: pointer;
}
.nav-links a:hover { color: var(--text); }

.nav-bottom { display: flex; flex-direction: column; gap: 12px; }
.nav-bottom a {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav-bottom a:hover { color: var(--accent); }

/* -- PAGE SYSTEM -- */
.page { display: none; }
.page.active { display: block; }

/* -- MAIN -- */
main { margin-left: var(--nav-w); position: relative; z-index: 1; }

/* HERO */
#hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 48px 64px;
  border-bottom: 0.5px solid var(--border);
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(30,207,176,0.08), 0 2px 48px rgba(30,207,176,0.03);
}

/* Ambient accent glow — centre tracks mouse via --glow-x / --glow-y */
#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 70% 55% at var(--glow-x, 78%) var(--glow-y, 8%),
    rgba(30, 207, 176, 0.10) 0%,
    transparent 62%
  );
  pointer-events: none;
  z-index: 0;
}

/* Full-page interactive canvas — fixed, sits below all content */
#page-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
}

#hero.has-canvas .hero-bg { display: none; }

/* CSS-only animated background: drifting dot grid + pulsing node points */
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.hero-bg::before {
  content: '';
  position: absolute;
  inset: -10%;
  background-image: radial-gradient(circle, rgba(30,207,176,0.10) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 80% 70% at var(--grid-mx, 72%) var(--grid-my, 20%), black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at var(--grid-mx, 72%) var(--grid-my, 20%), black 0%, transparent 75%);
  animation: gridDrift 28s ease-in-out infinite alternate;
}
.hero-bg::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 0; height: 0;
  box-shadow:
    280px  60px 20px 3px rgba(30,207,176,0.30),
    620px 100px 14px 2px rgba(30,207,176,0.20),
    480px 200px 10px 1px rgba(30,207,176,0.25),
    820px  70px 16px 2px rgba(30,207,176,0.15),
    720px 250px 12px 1px rgba(30,207,176,0.22);
  animation: nodePulse 6s ease-in-out infinite alternate;
}
@keyframes gridDrift {
  from { transform: translate(0, 0); }
  to   { transform: translate(26px, 26px); }
}
@keyframes nodePulse {
  from { opacity: 0.4; }
  to   { opacity: 1; }
}

.hero-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.hero-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 48px 0 40px;
}

.hero-tagline-main {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: clamp(2rem, 5.5vw, 5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text);
  max-width: 14ch;
}

.hero-actions { margin-top: 40px; }

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: transparent;
  border: 0.5px solid var(--accent);
  padding: 14px 28px;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.22s ease-out, color 0.22s ease-out;
}
.hero-cta:hover {
  background: var(--accent);
  color: var(--bg);
}
.hero-cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.hero-name-strip {
  overflow: hidden;
  white-space: nowrap;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 300;
  line-height: 1;
  color: var(--muted2);
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}
.hero-name-strip .scroll-track em {
  color: var(--muted2);
  text-shadow: none;
  padding-right: 60px;
}

.scroll-track {
  display: inline-block;
  animation: marquee 20s linear infinite;
}
.scroll-track em {
  font-style: italic;
  color: var(--accent);
  padding-right: 80px;
  text-shadow: 0 0 60px rgba(30, 207, 176, 0.3);
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* -- WORK -- */
#work {
  padding: 96px 64px;
  border-bottom: 0.5px solid var(--border);
  background-image: radial-gradient(ellipse 55% 40% at 2% 6%, rgba(30,207,176,0.09) 0%, transparent 100%);
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 64px;
}
.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-transform: uppercase;
  opacity: 0.7;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.section-label::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: pulse-dot 2.8s ease-in-out infinite;
}
.section-title {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  color: var(--text);
  letter-spacing: -0.03em;
}
.section-title::after {
  content: '';
  display: block;
  width: 28px;
  height: 1px;
  background: var(--accent);
  margin-top: 10px;
  opacity: 0.38;
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.project-card {
  background: var(--surface);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  display: block;
  border: 0.5px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  transform-style: preserve-3d;
  will-change: transform;
}
.project-card:hover {
  border-color: rgba(30, 207, 176, 0.28);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 0.5px rgba(30, 207, 176, 0.12);
}

/* Tilt shine overlay */
.project-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--shine-x, 50%) var(--shine-y, 50%),
    rgba(255,255,255,0.06) 0%,
    transparent 65%
  );
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s;
}
.project-card.is-tilting::after { opacity: 1; }

/* Hero word reveal */
.word-wrap {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  line-height: 1.15;
}
.word {
  display: inline-block;
}
.project-card.featured { grid-column: span 2; }

.project-thumb {
  aspect-ratio: 16/9;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-card.featured .project-thumb { aspect-ratio: 21/9; }

.project-thumb img,
.project-thumb video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Base grade: slight desaturation + contrast to unify across cards */
  filter: brightness(0.88) contrast(1.08) saturate(0.72);
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 0.55s ease;
}
.project-card:hover .project-thumb img,
.project-card:hover .project-thumb video {
  transform: scale(1.04);
  filter: brightness(1) contrast(1.02) saturate(0.92);
}

/* Colour-grade multiply layer — turns whites/highlights dark and
   shifts the palette toward the portfolio's dark cool tone (#1a2232).
   multiply: result = image × overlay, so white → overlay colour,
   black → black, midtones get tinted. Eases off on hover. */
.project-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #1a2232;
  mix-blend-mode: multiply;
  opacity: 0.62;
  pointer-events: none;
  transition: opacity 0.55s ease;
}
.project-card:hover .project-thumb::before { opacity: 0.22; }

.project-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(to top, rgba(8,8,8,0.6) 0%, rgba(8,8,8,0.12) 45%, transparent 68%);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
.project-card:hover .project-thumb::after { opacity: 0.78; }

.project-thumb-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #2a2a2a;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

.thumb-papiro    { background: #0d0b09; }
.thumb-proxymity { background: #080d12; }
.thumb-pompei    { background: #100c08; }
.thumb-musica    { background: #080d10; }
.thumb-neurals   { background: #0a080d; }
.thumb-bioconnect{ background: #090d0a; }
.thumb-magic     { background: #0d0909; }
.thumb-weare     { background: #0a0a0d; }
.thumb-cavendish { background: #0c0a08; }
.thumb-lineapelle{ background: #0d0b08; }

.project-info {
  padding: 24px 28px 28px;
  border-top: 0.5px solid var(--border);
}
.project-cat {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.7;
}
.project-year {
  margin-left: auto;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.project-title {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  line-height: 1.2;
}
.project-card.featured .project-title { font-size: 1.8rem; }

.project-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 16px;
  max-width: 540px;
}
.project-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-tag {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 0.5px solid var(--border2);
  padding: 3px 8px;
  text-transform: uppercase;
}

/* Live badge — animated pulse dot to reinforce "live/active" */
.badge-live {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--accent);
  border: 0.5px solid var(--accent);
  padding: 3px 8px 3px 22px;
  text-transform: uppercase;
  position: relative;
}
.badge-live::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
  50%       { opacity: 0.2; transform: translateY(-50%) scale(0.65); }
}

.project-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* -- ABOUT -- */
#about {
  padding: 96px 64px;
  border-bottom: 0.5px solid var(--border);
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 72px;
  align-items: start;
  background-image: radial-gradient(ellipse 50% 45% at 98% 94%, rgba(30,207,176,0.08) 0%, transparent 100%);
}
.about-photo {
  aspect-ratio: 3/4;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: flex-end;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
/* Subtle colour-grade — cools the warm orange background without killing the photo */
.about-photo::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #1a2232;
  mix-blend-mode: multiply;
  opacity: 0.28;
  pointer-events: none;
}
.about-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  filter: brightness(0.96) contrast(1.04) saturate(0.82);
}
.about-photo-placeholder {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #2a2a2a;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}
.about-content { padding-top: 16px; }
.about-content p {
  font-size: 15px;
  font-weight: 300;
  color: #9e9890;
  line-height: 1.85;
  margin-bottom: 20px;
}
.about-content p strong { color: var(--text); font-weight: 400; }
.about-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 0.5px solid rgba(30, 207, 176, 0.35);
  transition: border-color 0.2s, opacity 0.2s;
}
.about-link:hover { border-color: var(--accent); opacity: 0.75; }

.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  margin-top: 40px;
}
.skill-block {
  background: var(--surface);
  border: 0.5px solid var(--border);
  padding: 20px;
  transition: border-color 0.25s;
}
.skill-block:hover { border-color: var(--border2); }
.skill-block-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
  opacity: 0.75;
}
.skill-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-pill {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--surface2);
  border: 0.5px solid var(--border2);
  padding: 5px 12px;
  border-radius: 2px;
}

/* -- CONTACT -- */
#contact {
  padding: 96px 64px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 96px;
  align-items: center;
  background-image: radial-gradient(ellipse 55% 50% at 97% 5%, rgba(30,207,176,0.09) 0%, transparent 100%);
}
.contact-heading {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(40px, 6vw, 80px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text);
}
.contact-heading em { font-style: italic; color: var(--accent); }
.contact-links { display: flex; flex-direction: column; gap: 24px; }
.contact-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  border-bottom: 0.5px solid var(--border);
  padding-bottom: 24px;
  transition: border-color 0.25s;
}
.contact-link:last-child { border-bottom: none; padding-bottom: 0; }
.contact-link:hover { border-color: rgba(30, 207, 176, 0.3); }
.contact-link-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}
.contact-link-value {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 22px;
  color: var(--text);
  transition: color 0.2s;
}
.contact-link:hover .contact-link-value { color: var(--accent); }

/* ═══════════════════════════════════════
   PROJECT DETAIL PAGE
═══════════════════════════════════════ */
#page-project {
  min-height: 100vh;
}

.proj-back {
  position: fixed;
  top: 0; left: var(--nav-w);
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 64px;
  border-bottom: 0.5px solid var(--border);
  background: rgba(8,8,8,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 150;
  cursor: pointer;
  gap: 12px;
  text-decoration: none;
}
.proj-back-arrow {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.2s, transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.proj-back:hover .proj-back-arrow { color: var(--accent); transform: translateX(-4px); }
.proj-back-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  transition: color 0.2s;
}
.proj-back:hover .proj-back-label { color: var(--text); }

.proj-hero {
  padding-top: 56px;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}

.proj-hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.30;
}

.proj-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 28%, rgba(8,8,8,0.5) 65%, transparent 100%);
  z-index: 1;
}

.proj-hero-content {
  position: relative;
  z-index: 2;
  padding: 64px;
  padding-top: 80px;
}

.proj-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0.75;
}

.proj-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(52px, 8vw, 110px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 32px;
}

.proj-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* BODY */
.proj-body {
  padding: 80px 64px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 80px;
  align-items: start;
  border-bottom: 0.5px solid var(--border);
}

.proj-description h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 30px;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.proj-description p {
  font-size: 15px;
  font-weight: 300;
  color: #9e9890;
  line-height: 1.85;
  margin-bottom: 20px;
}

.proj-description p strong { color: var(--text); font-weight: 400; }

.proj-sidebar { display: flex; flex-direction: column; gap: 32px; }

.proj-sidebar-block {}

.proj-sidebar-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
  opacity: 0.6;
}

.proj-sidebar-value {
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
}

.proj-tools-list { display: flex; flex-wrap: wrap; gap: 6px; }

.proj-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-decoration: none;
  border: 0.5px solid rgba(30, 207, 176, 0.4);
  padding: 8px 16px;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  margin-top: 8px;
}
.proj-ext-link:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* MEDIA SECTION */
.proj-media {
  padding: 80px 64px;
}

.proj-media-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 0.5px solid var(--border);
}

.image-gallery + .proj-media-title,
.video-grid + .proj-media-title {
  margin-top: 56px;
}

/* VIDEO GRID */
.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  margin-bottom: 48px;
}

.video-grid.two-col { grid-template-columns: 1fr 1fr; }

.video-wrapper {
  position: relative;
  background: var(--surface);
  border: 0.5px solid var(--border);
  overflow: hidden;
}

.video-wrapper.ratio-16-9 { aspect-ratio: 16/9; }
.video-wrapper.ratio-21-9 { aspect-ratio: 21/9; }
.video-wrapper.ratio-4-3  { aspect-ratio: 4/3; }

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Vimeo / YouTube embed */
.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* YouTube facade */
.yt-facade {
  cursor: pointer;
  transition: filter 0.2s;
}
.yt-facade:hover { filter: brightness(0.85); }
.yt-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: none;
  border: none;
  cursor: pointer;
  width: 72px;
  height: 50px;
  padding: 0;
  transition: transform 0.15s;
}
.yt-facade:hover .yt-play { transform: translate(-50%, -50%) scale(1.1); }
.yt-play svg { width: 72px; height: 50px; display: block; }

.video-caption {
  padding: 12px 16px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-top: 0.5px solid var(--border);
  background: var(--surface);
}

/* VIDEO PLACEHOLDER */
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.video-placeholder-icon {
  width: 48px;
  height: 48px;
  border: 0.5px solid var(--border2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-placeholder-icon svg {
  width: 16px;
  height: 16px;
  fill: var(--muted2);
  margin-left: 3px;
}

.video-placeholder-text {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted2);
  text-transform: uppercase;
  text-align: center;
  line-height: 1.7;
}

.video-add-hint {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-family: 'DM Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--muted2);
  text-transform: uppercase;
  background: var(--surface);
  border: 0.5px solid var(--border);
  padding: 4px 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.video-wrapper:hover .video-add-hint { opacity: 1; }

/* IMAGE GALLERY */
.image-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.image-gallery.two-col   { grid-template-columns: 1fr 1fr; }
.image-gallery.three-col { grid-template-columns: 1fr 1fr 1fr; }
.image-gallery.four-col  { grid-template-columns: repeat(4, 1fr); }

.gallery-item {
  background: var(--surface);
  border: 0.5px solid var(--border);
  position: relative;
  overflow: hidden;
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item.wide { grid-column: span 2; }

.gallery-item img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.gallery-item:hover img { transform: scale(1.03); }

.gallery-item::after {
  content: '\2197';
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  background: rgba(8, 8, 8, 0.72);
  border: 0.5px solid var(--border2);
  font-size: 13px;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  backdrop-filter: blur(4px);
}
.gallery-item:hover::after { opacity: 1; }
@media (hover: none) {
  .gallery-item::after { opacity: 0.65; }
}

.gallery-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
}

.gallery-placeholder span {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted2);
  text-transform: uppercase;
  text-align: center;
  padding: 0 16px;
  line-height: 1.7;
}

.gallery-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 8px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.07em;
  color: var(--text);
  background: rgba(8,8,8,0.78);
  opacity: 0;
  transition: opacity 0.25s;
}
.gallery-item:hover .gallery-caption { opacity: 1; }

/* ═══════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════ */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 8, 0.96);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  cursor: zoom-out;
  padding: 24px;
}
#lightbox.open {
  opacity: 1;
  visibility: visible;
}
#lightbox-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(90vw, 1200px);
  max-height: 90vh;
  pointer-events: none;
}
#lightbox-img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  display: block;
  border: 0.5px solid var(--border2);
  transform: scale(0.96);
  transition: transform 0.25s ease;
  pointer-events: auto;
}
#lightbox.open #lightbox-img { transform: scale(1); }
#lightbox-caption {
  margin-top: 14px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-align: center;
  text-transform: uppercase;
  min-height: 1em;
}
#lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  background: none;
  border: 0.5px solid var(--border2);
  color: var(--text);
  font-size: 16px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  z-index: 1;
}
#lightbox-close:hover { border-color: var(--accent); color: var(--accent); }

/* PROJECT NAV */
.proj-nav {
  padding: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 0.5px solid var(--border);
}

.proj-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
}

.proj-nav-btn.next { text-align: right; }

.proj-nav-direction {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.proj-nav-name {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: 24px;
  color: var(--text);
  transition: color 0.2s;
  letter-spacing: -0.01em;
}

.proj-nav-btn:hover .proj-nav-name { color: var(--accent); }

/* -- SCROLL REVEAL --
   cubic-bezier(0.22, 1, 0.36, 1) — "spring-out" curve,
   fast start then eases cleanly to rest. */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* -- PAGE TRANSITION -- */
.page.active { animation: pageFade 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.page.active.no-anim { animation: none; opacity: 1; transform: none; }
@keyframes pageFade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -- KEYBOARD FOCUS -- */
:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}
.project-card:focus-visible { outline-offset: -1px; }

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: none;
}

/* ═══════════════════════════════════════
   PRELOADER
═══════════════════════════════════════ */
#preloader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
}

#preloader::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(30,207,176,0.09) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 65% 65% at 50% 50%, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 65% 65% at 50% 50%, black 0%, transparent 75%);
  pointer-events: none;
  animation: gridDrift 28s ease-in-out infinite alternate;
}

body:has(#preloader) { overflow: hidden; cursor: none; }

.preloader-terminal {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.14em;
  line-height: 2.4;
  position: relative;
  z-index: 1;
}

.preloader-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
}

.pl-prompt { color: var(--accent); user-select: none; }

#pl-l1, #pl-l2, #pl-l3 { color: var(--text); min-width: 1px; }

.pl-cursor { color: var(--accent); opacity: 0; }
.pl-cursor.active { opacity: 1; animation: cursorBlink 0.65s step-end infinite; }

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ═══════════════════════════════════════
   CUSTOM CURSOR
═══════════════════════════════════════ */
@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }
  a, button, [onclick], [role="button"] { cursor: none; }
}

#cursor-dot {
  display: block;
  position: fixed;
  top: 0; left: 0;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10001;
  will-change: transform;
}

#cursor-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0; left: 0;
  width: 32px; height: 32px;
  border: 1px solid rgba(30, 207, 176, 0.60);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  will-change: transform;
  overflow: hidden;
  transition: width  0.35s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              background  0.25s ease,
              border-color 0.25s ease,
              opacity 0.3s ease;
}

.cursor-ring-label {
  font-family: 'DM Mono', monospace;
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--text);
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  position: absolute;
  pointer-events: none;
  user-select: none;
}

#cursor-ring.state-view {
  width: 68px; height: 68px;
  background: rgba(30, 207, 176, 0.07);
  border-color: var(--accent);
}
#cursor-ring.state-view .cursor-ring-label { opacity: 1; }

#cursor-ring.state-link {
  width: 14px; height: 14px;
  background: var(--accent);
  border-color: var(--accent);
}

@media (hover: none), (pointer: coarse) {
  #cursor-dot, #cursor-ring { display: none !important; }
  body { cursor: auto; }

  /* Scroll-activated state — mirrors :hover for touch devices */
  .project-card.is-active .project-thumb img,
  .project-card.is-active .project-thumb video {
    filter: brightness(1) contrast(1.02) saturate(0.92);
  }
  .project-card.is-active .project-thumb::before { opacity: 0.22; }
  .project-card.is-active .project-thumb::after  { opacity: 0.78; }
  .project-card.is-active { border-color: rgba(30, 207, 176, 0.28); }
}

/* ═══════════════════════════════════════
   PAGE TRANSITION OVERLAY
═══════════════════════════════════════ */
#transition-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9998;
  pointer-events: none;
  transform: translateY(100%);
  will-change: transform;
}

body.page-transitioning .page.active { animation: none; }

/* ═══════════════════════════════════════
   SPRING BUTTONS
═══════════════════════════════════════ */
.hero-cta,
.proj-nav-btn,
.proj-ext-link {
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-track { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .page.active { animation: none; }
  .badge-live::before { animation: none; }
  .section-label::before { animation: none; }
  .hero-bg::before, .hero-bg::after { animation: none; }
  .fade-in { opacity: 1; transform: none; transition: none; }
  .pl-cursor.active { animation: none; }
  #preloader::before { animation: none; }
}

/* Disable Chrome's scroll anchoring: it adjusts scroll position when
   composited layers (will-change:transform + .reveal translateY) animate,
   causing the "snap to card" glitch on Android. */
html, body { overflow-anchor: none; }
/* Prevent overscroll bounce/snap at page edges on Android Chrome */
body { overscroll-behavior-y: none; }

/* -- MOBILE -- */
@media (max-width: 900px) {
  :root { --nav-w: 0px; }
  nav {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    align-items: center;
    padding: 20px 24px;
    border-right: none;
    border-bottom: 0.5px solid var(--border);
    flex-wrap: wrap;
    gap: 16px;
  }
  .nav-links { flex-direction: row; gap: 20px; }
  .nav-bottom { flex-direction: row; }
  main { margin-left: 0; }
  #hero { padding: 32px 24px; min-height: 100svh; }
  #hero::before { display: none; }
  .hero-bg { display: none; }
  #work, #about, #contact { padding: 64px 24px; }
  #about, #contact { grid-template-columns: 1fr; gap: 48px; }
  .about-photo { aspect-ratio: 4/5; max-width: 360px; }
  /* Tablet: keep 2-col grid, tighter gap */
  .project-grid { gap: 16px; }
  .skills-grid { grid-template-columns: 1fr; }
  .proj-back { left: 0; padding: 0 24px; }
  .proj-hero-content, .proj-body, .proj-media, .proj-nav { padding: 48px 24px; }
  .proj-body { grid-template-columns: 1fr; gap: 48px; }
  .image-gallery, .image-gallery.three-col { grid-template-columns: 1fr 1fr; }
  .image-gallery.four-col { grid-template-columns: 1fr 1fr; }
  .video-grid.two-col { grid-template-columns: 1fr; }
  .proj-title { font-size: clamp(40px, 10vw, 72px); }
  /* No translateY on mobile: prevents scroll anchoring interference on Android. */
  .reveal       { transform: none; }
  .reveal.visible { transform: none; }
  .fade-in      { transform: none; }
  .fade-in.visible { transform: none; }
}

@media (max-width: 600px) {
  .project-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .project-card.featured { grid-column: span 1; }
  .project-card.featured .project-thumb { aspect-ratio: 16/9; }
  .project-card.featured .project-title { font-size: 1.4rem; }
  .project-info { padding: 18px 20px 22px; }
}
