/* ============================================================
   PORTFOLIO — Theme A: Black / White / Red
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=IBM+Plex+Mono:wght@300;400;600&display=swap');

/* ── Tokens ── */
:root {
  --bg:        #0a0a0a;
  --bg2:       #111111;
  --bg3:       #181818;
  --fg:        #f0f0f0;
  --fg2:       #666666;
  --fg3:       #333333;
  --accent:    #e63946;
  --accent2:   #ff6b6b;
  --border:    rgba(240,240,240,0.08);
  --border2:   rgba(240,240,240,0.15);

  --font-mono:    'IBM Plex Mono', monospace;
  --font-display: 'Space Mono', monospace;

  --nav-h:   64px;
  --ease:    cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: none;
}

a { color: inherit; text-decoration: none; }
img, video { display: block; width: 100%; }

/* ── Custom cursor ── */
.cursor {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.1s var(--ease), width 0.3s var(--ease), height 0.3s var(--ease), background 0.3s;
  mix-blend-mode: normal;
}
.cursor-ring {
  width: 32px; height: 32px;
  border: 1px solid rgba(230,57,70,0.5);
  border-radius: 50%;
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: transform 0.18s var(--ease), width 0.3s var(--ease), height 0.3s var(--ease), border-color 0.3s;
}
body:has(a:hover) .cursor,
body:has(.grid-item:hover) .cursor { width: 14px; height: 14px; }
body:has(a:hover) .cursor-ring,
body:has(.grid-item:hover) .cursor-ring { width: 48px; height: 48px; border-color: var(--accent); }

/* ── Noise overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9000;
  opacity: 0.4;
}

/* ── Navigation ── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.nav-logo .dot { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
}
.nav-links a {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg2);
  transition: color 0.2s;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.nav-links a:hover { color: var(--fg); }
.nav-links a:hover::after { width: 100%; }

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg2);
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #2ecc71;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Hero ── */
.hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.hero-video {
  position: absolute;
  inset: 0;
  background: var(--bg2);
  overflow: hidden;
}
.hero-video video,
.hero-video .video-placeholder {
  width: 100%; height: 100%;
  object-fit: cover;
}
.video-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--fg3);
  text-transform: uppercase;
}

/* Scanline effect */
.hero-video::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.06) 2px,
    rgba(0,0,0,0.06) 4px
  );
  z-index: 1;
  pointer-events: none;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.1) 0%,
    rgba(0,0,0,0.0) 40%,
    rgba(10,10,10,0.85) 85%,
    var(--bg) 100%
  );
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  padding: 0 40px 48px;
}

.hero-tag {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.8s var(--ease) 0.2s forwards;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 80px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.9s var(--ease) 0.35s forwards;
}
.hero-title em {
  color: var(--accent);
  font-style: italic;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--fg2);
  opacity: 0;
  animation: fadeUp 0.8s var(--ease) 0.5s forwards;
}
.hero-meta span { color: var(--fg3); }

.hero-reel-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg);
  border: 1px solid var(--border2);
  padding: 10px 20px;
  transition: border-color 0.3s, color 0.3s;
  cursor: none;
}
.hero-reel-btn:hover { border-color: var(--accent); color: var(--accent); }
.reel-icon {
  width: 0; height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 7px solid currentColor;
}

/* Reel progress bar */
.reel-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 40px;
  border-top: 1px solid var(--border);
  background: rgba(10,10,10,0.9);
  position: relative;
  z-index: 3;
}
.reel-label { font-size: 9px; letter-spacing: 0.25em; color: var(--accent); text-transform: uppercase; white-space: nowrap; }
.reel-track { flex: 1; height: 1px; background: var(--border2); position: relative; cursor: none; }
.reel-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.1s linear; }
.reel-time { font-size: 9px; color: var(--fg2); letter-spacing: 0.1em; white-space: nowrap; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Work section ── */
.work-section { padding: 0 0 80px; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 40px 40px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1px;
}
.section-label {
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--fg2);
}
.section-label span { color: var(--accent); margin-right: 8px; }
.section-count {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--fg3);
}

/* ── Project Grid ── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
}

.grid-item {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg2);
  cursor: none;
}

.grid-thumb {
  width: 100%; height: 100%;
  background: var(--bg3);
  transition: transform 0.6s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}
.grid-item:hover .grid-thumb { transform: scale(1.04); }

.thumb-index {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 700;
  color: rgba(255,255,255,0.04);
  user-select: none;
}

/* Hover overlay */
.grid-info {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,0.82);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.grid-item:hover .grid-info { opacity: 1; transform: translateY(0); }
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.grid-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

/* Red accent bar on hover */
.grid-item::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width 0.4s var(--ease);
}
.grid-item:hover::after { width: 100%; }

.about-top {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  margin-bottom: 32px;
}

.about-headshot {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border2);
  filter: grayscale(100%) contrast(1.05);
  display: block;
}

/* ── About strip ── */
.about-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 60px 40px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 80px;
  align-items: start;
}

.about-label {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--fg2);
  text-transform: uppercase;
  padding-top: 4px;
}
.about-label span { color: var(--accent); display: block; margin-bottom: 4px; }

.about-text {
  font-size: 15px;
  line-height: 1.8;
  color: var(--fg);
  max-width: 560px;
}
.about-text strong { color: var(--accent); font-weight: 400; font-style: italic; }

.about-credits {
  display: flex;
  gap: 32px;
}
.credit-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--fg);
  text-transform: uppercase;
  position: relative;
  padding-left: 12px;
}
.credit-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Footer ── */
.footer {
  padding: 32px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
}
.footer-logo {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.footer-logo span { color: var(--accent); }

.footer-links {
  display: flex;
  gap: 24px;
  list-style: none;
}
.footer-links a {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg2);
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--accent); }

.footer-copy {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg3);
}

.grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease);
}
.grid-item:hover .grid-thumb img { transform: scale(1.04); }

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

/* ── Project page ── */
.project-hero {
  padding-top: var(--nav-h);
  position: relative;
  height: 65vh;
  min-height: 420px;
  overflow: hidden;
  background: var(--bg2);
}
.project-hero video,
.project-hero .video-placeholder {
  width: 100%; height: 100%;
  object-fit: cover;
}
.project-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, var(--bg) 100%);
}

.project-body { max-width: 1200px; margin: 0 auto; padding: 40px 40px 80px; }

.project-header { margin-bottom: 48px; border-bottom: 1px solid var(--border); padding-bottom: 32px; }
.project-category {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.project-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.project-meta-row {
  display: flex;
  gap: 40px;
}
.meta-item { }
.meta-key {
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--fg2);
  margin-bottom: 4px;
}
.meta-val {
  font-size: 13px;
  color: var(--fg);
}

.project-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 60px;
  align-items: start;
}
.project-description {
  font-size: 15px;
  line-height: 1.9;
  color: rgba(240,240,240,0.8);
}
.project-description p + p { margin-top: 1.2em; }

.project-credits { }
.credits-title {
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--fg2);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 16px;
}
.credit-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.credit-role { color: var(--fg2); }
.credit-name { color: var(--fg); }

.project-gallery {
  margin-top: 60px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
}
.gallery-item {
  aspect-ratio: 16/9;
  background: var(--bg3);
  overflow: hidden;
}
.gallery-item:first-child { grid-column: span 2; aspect-ratio: 21/9; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg2);
  margin-bottom: 32px;
  transition: color 0.2s;
  cursor: none;
}
.back-link:hover { color: var(--accent); }
.back-arrow { font-size: 14px; transition: transform 0.2s; }
.back-link:hover .back-arrow { transform: translateX(-3px); }

/* ── Glitch tagline ── */
.glitch-tagline {
  min-height: 1.1em;
  position: relative;
}

.glitch-tagline .tagline-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.glitch-tagline .tagline-word.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Glitch flicker on the whole line */
@keyframes glitch-flicker {
  0%   { opacity: 1; clip-path: inset(0 0 100% 0); }
  8%   { clip-path: inset(15% 0 60% 0); transform: translateX(-3px); }
  16%  { clip-path: inset(40% 0 30% 0); transform: translateX(3px); }
  24%  { clip-path: inset(70% 0 5% 0);  transform: translateX(-2px); }
  32%  { clip-path: inset(0 0 0 0);     transform: translateX(0); opacity: 1; }
  100% { opacity: 1; clip-path: inset(0 0 0 0); }
}

@keyframes glitch-rgb {
  0%   { text-shadow: none; }
  20%  { text-shadow: -2px 0 var(--accent), 2px 0 #00d4ff; }
  40%  { text-shadow: 2px 0 var(--accent), -2px 0 #fff; }
  60%  { text-shadow: none; }
  80%  { text-shadow: -1px 0 var(--accent); }
  100% { text-shadow: none; }
}

.glitch-tagline.is-glitching {
  animation: glitch-flicker 0.45s var(--ease) forwards,
             glitch-rgb 0.45s steps(1) forwards;
}

/* Rotating tagline on non-hero pages */
.page-tagline {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  font-style: italic;
  letter-spacing: 0.08em;
  color: var(--fg2);
  min-height: 1.4em;
  transition: opacity 0.4s var(--ease);
}
.page-tagline.fading { opacity: 0; }

/* ── Lightbox ── */
.gallery-item {
  cursor: none;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.96);
  z-index: 9000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.lightbox.active { display: flex; }

.lb-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1400px;
  max-height: 85vh;
  padding: 0 80px;
}

.lb-img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  display: block;
}

.lb-video {
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 16/9;
  background: #000;
  display: block;
}

.lb-close {
  position: fixed;
  top: 24px;
  right: 32px;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--fg2);
  font-family: var(--font-mono);
  font-size: 14px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  transition: border-color 0.2s, color 0.2s;
  z-index: 9010;
}
.lb-close:hover { border-color: var(--accent); color: var(--accent); }

.lb-prev,
.lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--fg2);
  font-family: var(--font-mono);
  font-size: 18px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  transition: border-color 0.2s, color 0.2s;
  z-index: 9010;
}
.lb-prev { left: 24px; }
.lb-next { right: 24px; }
.lb-prev:hover,
.lb-next:hover { border-color: var(--accent); color: var(--accent); }

.lb-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--fg2);
  text-transform: uppercase;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .nav { padding: 0 20px; }
  .nav-status { display: none; }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .about-strip { grid-template-columns: 1fr; gap: 24px; }
  .hero-content { padding: 0 20px 36px; }
  .reel-bar { padding: 12px 20px; }
  .section-header { padding: 32px 20px 20px; }
  .footer { padding: 24px 20px; flex-wrap: wrap; gap: 12px; }
  .project-layout { grid-template-columns: 1fr; gap: 40px; }
  .project-gallery { grid-template-columns: 1fr; }
  .project-gallery .gallery-item:first-child { grid-column: span 1; aspect-ratio: 16/9; }
}

@media (max-width: 600px) {
  .project-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 32px; }
  body { cursor: auto; }
  .cursor, .cursor-ring { display: none; }
}
