/* ===========================
   DENYA SONATA PORTFOLIO CSS
   retro terminal · pixel art
   =========================== */

:root {
  --bg-dark:    #050a05;
  --bg-mid:     #0a120a;
  --bg-panel:   #0d1a0d;
  --bg-card:    #0f1f0f;
  --green:      #00ff41;
  --green-dim:  #00cc33;
  --green-dark: #004d14;
  --blue:       #00cfff;
  --blue-dim:   #0099cc;
  --blue-dark:  #003344;
  --white:      #e8f5e8;
  --gray:       #557755;
  --border:     #1a3320;
  --border-glow:#00ff4133;
  --font-pixel: 'Press Start 2P', monospace;
  --font-vt:    'VT323', monospace;
  --font-mono:  'Share Tech Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
  /* smooth scroll only if no motion preference */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  background: var(--bg-dark);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  overflow-x: hidden;
  cursor: default;
  user-select: none;
  -webkit-user-drag: none;
  -moz-user-drag: none;
  -ms-user-drag: none;
  -webkit-touch-callout: none;
  /* prevent subpixel layout shifts */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video {
  -webkit-user-drag: none;
  -moz-user-drag: none;
  -ms-user-drag: none;
}

/* SCANLINES OVERLAY */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  /* GPU-composited: opacity + will-change so it never causes layout */
  will-change: opacity;
  contain: strict;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
}

/* ========== BOOT SCREEN ========== */
#boot-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  /* use opacity + pointer-events for GPU-composited fade — no layout reflow */
  transition: opacity 0.5s ease;
  will-change: opacity;
  contain: layout style;
}

#boot-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.boot-content {
  max-width: 600px;
  width: 90%;
  font-family: var(--font-mono);
}

.boot-logo {
  font-family: var(--font-pixel);
  font-size: 48px;
  color: var(--green);
  text-shadow: 0 0 20px var(--green), 0 0 40px var(--green-dim);
  margin-bottom: 32px;
  letter-spacing: 8px;
  animation: glitch 4s infinite;
  /* compositor-only: text-shadow already triggers paint but contain limits damage */
  contain: layout;
}

.boot-line {
  color: var(--green-dim);
  font-size: 13px;
  margin-bottom: 6px;
  opacity: 0;
  /* translate instead of translateX to stay on compositor thread */
  transform: translate3d(-10px, 0, 0);
  transition: opacity 0.3s, transform 0.3s;
  will-change: opacity, transform;
}

.boot-line.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.boot-line .ok { color: var(--green); font-weight: bold; }

.boot-progress-wrap {
  margin-top: 24px;
  height: 4px;
  background: var(--border);
  border: 1px solid var(--border);
  overflow: hidden;
  contain: strict;
}

.boot-progress-bar {
  height: 100%;
  background: var(--green);
  width: 0%;
  /* width transition triggers layout but it's isolated in the contain:strict above */
  transition: width 2.5s ease;
  box-shadow: 0 0 8px var(--green);
}

.boot-skip {
  display: none;
  margin-top: 24px;
  color: var(--gray);
  font-size: 11px;
  animation: blink 1s step-end infinite;
}

/* ========== NAVIGATION ========== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(5, 10, 5, 0.95);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 100;
  backdrop-filter: blur(4px);
  /* promote to own layer so scrolling doesn't repaint it */
  will-change: transform;
  contain: layout style;
}

.nav-logo {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--green);
  white-space: nowrap;
}

.pixel-bracket { color: var(--green-dim); }
.nav-name { color: var(--green); margin: 0 4px; }

.nav-links { display: flex; gap: 24px; }

.nav-link {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--gray);
  text-decoration: none;
  letter-spacing: 1px;
  transition: color 0.2s;
  position: relative;
  /* avoid triggering layout on hover */
  display: inline-block;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--green);
  /* width transition — isolated to pseudo-element, low cost */
  transition: width 0.2s;
  will-change: width;
}

.nav-link:hover { color: var(--green); }
.nav-link:hover::after { width: 100%; }

.nav-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--gray);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  will-change: opacity, transform;
}

/* ========== HERO ========== */
.hero {
  min-height: 100vh;
  padding: 80px 80px 60px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 60px;
  position: relative;
  overflow: hidden;
  contain: layout;
}

.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.4;
  /* static bg, no will-change needed */
  pointer-events: none;
}

.hero-content { position: relative; z-index: 2; }

.hero-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--blue);
  margin-bottom: 24px;
  animation: typeIn 0.5s ease both;
  animation-delay: 0.2s;
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 16px;
}

.title-line {
  font-family: var(--font-pixel);
  font-size: clamp(28px, 5vw, 52px);
  color: var(--white);
  line-height: 1.3;
  animation: slideUp 0.6s ease both;
  will-change: opacity, transform;
}

.title-line.accent {
  color: var(--green);
  text-shadow: 0 0 20px var(--green-dim);
  animation-delay: 0.15s;
}

.hero-sub {
  font-family: var(--font-vt);
  font-size: 22px;
  color: var(--blue);
  margin-bottom: 20px;
  letter-spacing: 2px;
  animation: slideUp 0.6s ease both;
  animation-delay: 0.3s;
  will-change: opacity, transform;
}

.hero-desc {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 36px;
  /* reserve height so typewriter doesn't cause layout shifts */
  min-height: 40px;
  animation: slideUp 0.6s ease both;
  animation-delay: 0.45s;
  will-change: opacity, transform;
  contain: layout;
}

.cursor-prefix { color: var(--green); margin-right: 8px; }
.blink-cursor { color: var(--green); animation: blink 0.8s step-end infinite; }

.hero-ctas {
  display: flex;
  gap: 16px;
  animation: slideUp 0.6s ease both;
  animation-delay: 0.6s;
  will-change: opacity, transform;
}

.btn {
  font-family: var(--font-pixel);
  font-size: 8px;
  padding: 14px 20px;
  text-decoration: none;
  letter-spacing: 1px;
  /* only transition box-shadow + color: compositor-friendly */
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  cursor: crosshair;
  display: inline-block;
}

.btn-primary {
  background: var(--green);
  color: var(--bg-dark);
  border: 2px solid var(--green);
}

.btn-primary:hover {
  background: transparent;
  color: var(--green);
  box-shadow: 0 0 14px rgba(0, 255, 65, 0.25), inset 0 0 8px rgba(0, 255, 65, 0.15);
}

.btn-secondary {
  background: transparent;
  color: var(--green);
  border: 2px solid var(--green-dark);
}

.btn-secondary:hover {
  border-color: var(--green);
  box-shadow: 0 0 12px var(--green-dark);
}

/* HERO DECO */
.hero-deco {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  animation: slideUp 0.8s ease both;
  animation-delay: 0.4s;
  will-change: opacity, transform;
}

.deco-frame {
  border: 2px solid var(--green-dark);
  position: relative;
  max-width: 360px;
  width: 100%;
  cursor: crosshair;
}

.deco-frame::before {
  content: '';
  position: absolute;
  inset: -6px;
  border: 1px solid var(--border);
  pointer-events: none;
}

.deco-inner {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  /* isolate children from document repaints */
  isolation: isolate;
}

.deco-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(0,255,65,0.08) 1px, transparent 1px),
    linear-gradient(rgba(0,255,65,0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.26;
  pointer-events: none;
  animation: decoGridMove 3s linear infinite;
  will-change: background-position;
}

.deco-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.8) contrast(1.1);
  /* only transform + filter: compositor-only, no layout */
  transition: filter 0.3s, box-shadow 0.3s, transform 0.3s;
  border: 1px solid rgba(0, 255, 65, 0.12);
  box-shadow: 0 0 18px rgba(0, 255, 65, 0.12);
  will-change: filter, transform;
}

.deco-inner:hover img {
  filter: saturate(1.1) contrast(1.1);
  box-shadow: 0 0 24px rgba(0, 255, 65, 0.25);
}

.deco-label {
  background: var(--bg-dark);
  border-top: 1px solid var(--green-dark);
  padding: 6px 12px;
  font-size: 10px;
  color: var(--green-dim);
  text-align: center;
}

/* ========== SECTIONS ========== */
.section {
  padding: 80px 80px;
  border-top: 1px solid var(--border);
  contain: layout;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
}

.section-tag {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--green);
  white-space: nowrap;
}

.section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ========== ABOUT ========== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.terminal-box {
  border: 1px solid var(--green-dark);
  background: var(--bg-panel);
  contain: layout style;
}

.terminal-topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--green-dark);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tb-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tb-dot.red    { background: #ff5555; }
.tb-dot.yellow { background: #ffcc00; }
.tb-dot.green  { background: var(--green); }

.tb-title {
  margin-left: auto;
  font-size: 11px;
  color: var(--gray);
  font-family: var(--font-mono);
}

.terminal-body {
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
}

.t-label {
  color: var(--green);
  margin-right: 8px;
}

.t-desc { color: var(--gray); }

.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.stat-card {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 20px;
  text-align: center;
  /* border-color transition only: no layout */
  transition: border-color 0.2s;
  contain: layout style;
}

.stat-card:hover { border-color: var(--green-dark); }

.stat-num {
  font-family: var(--font-pixel);
  font-size: 24px;
  color: var(--green);
  text-shadow: 0 0 12px var(--green-dim);
  display: block;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 10px;
  color: var(--gray);
  font-family: var(--font-pixel);
  letter-spacing: 1px;
}

/* ========== GALLERY ========== */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: var(--font-pixel);
  font-size: 8px;
  padding: 8px 14px;
  background: transparent;
  color: var(--gray);
  border: 1px solid var(--border);
  cursor: crosshair;
  letter-spacing: 1px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  /* Prevent layout shift from focus ring */
  outline-offset: 2px;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--green-dark);
  color: var(--green);
  border-color: var(--green-dim);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  /* contain to prevent gallery filter changes from reflowing nav */
  contain: layout;
}

.gallery-item {
  cursor: crosshair;
  /* use transform instead of margin/top for hover lift */
  transition: transform 0.2s;
  will-change: transform;
  contain: layout style;
}

.gallery-item:hover { transform: translate3d(0, -4px, 0); }

.gallery-item.hidden { display: none; }

.gallery-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: zoom-in;
  /* isolate so overlay opacity doesn't cause outer repaints */
  isolation: isolate;
}

.zoom-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(0, 255, 65, 0.25);
  background: rgba(0, 0, 0, 0.55);
  color: var(--green);
  font-family: var(--font-pixel);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  z-index: 2;
  pointer-events: auto;
}

.sv-preview-wrap .zoom-btn {
  top: 12px;
  right: 12px;
}

.sv-preview-wrap .zoom-btn:hover {
  background: rgba(0, 255, 65, 0.22);
}

.zoom-btn:hover {
  background: rgba(0, 255, 65, 0.15);
  transform: translateY(-1px);
}

.anim-preview {
  cursor: zoom-in;
}

.gallery-img-wrap.loading,
.anim-preview.loading,
.sv-preview-wrap.loading {
  position: relative;
}

.gallery-img-wrap.loading::before,
.anim-preview.loading::before,
.sv-preview-wrap.loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.gallery-img-wrap.loading::after,
.anim-preview.loading::after,
.sv-preview-wrap.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--green);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spinner 0.85s linear infinite;
  pointer-events: none;
}

.gallery-img-wrap.loading img,
.anim-preview.loading video,
.sv-preview-wrap.loading img,
.sv-preview-wrap.loading video {
  opacity: 0.25;
}

@keyframes spinner {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.gallery-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.75);
  /* filter + transform: compositor-only */
  transition: filter 0.2s, transform 0.2s;
  will-change: filter, transform;
  image-rendering: auto;
}

.gallery-item:hover .gallery-img-wrap img {
  filter: saturate(1.1) contrast(1.05);
  transform: scale3d(1.04, 1.04, 1);
}

.gallery-img-wrap.img-error::after {
  content: 'IMAGE NOT FOUND';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--gray);
  font-family: var(--font-pixel);
  text-align: center;
  padding: 8px;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  /* opacity only: GPU composited, zero layout cost */
  opacity: 0;
  transition: opacity 0.2s;
  will-change: opacity;
}

.gallery-img-wrap:hover .gallery-overlay { opacity: 1; }

.overlay-title {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--green);
  text-align: center;
  padding: 0 8px;
  line-height: 1.6;
}

.overlay-tag {
  font-size: 10px;
  color: var(--blue);
  border: 1px solid var(--blue-dark);
  padding: 2px 8px;
}

.gallery-meta {
  padding: 8px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.meta-title {
  font-size: 11px;
  color: var(--white);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-sub { font-size: 10px; color: var(--gray); }

.credit { font-size: 9px; color: var(--gray); }

.meta-cat {
  font-family: var(--font-pixel);
  font-size: 7px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.cat-oc       { color: var(--green);  border: 1px solid var(--green-dark); }
.cat-fanart   { color: var(--blue);   border: 1px solid var(--blue-dark); }
.cat-comm     { color: #ffcc00; border: 1px solid #664400; }

/* ========== ANIMATIONS ========== */
.anim-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.anim-tab {
  font-family: var(--font-pixel);
  font-size: 8px;
  padding: 12px 20px;
  background: transparent;
  color: var(--gray);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: crosshair;
  letter-spacing: 1px;
  transition: color 0.2s, border-bottom-color 0.2s;
  margin-bottom: -1px;
}

.anim-tab:hover { color: var(--green); }

.anim-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.anim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  contain: layout;
}

.anim-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s;
  will-change: transform;
  contain: layout style;
}

.anim-card:hover {
  border-color: var(--green-dark);
  transform: translate3d(0, -4px, 0);
}

.anim-card.wide { grid-column: span 2; }

.anim-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-dark);
  overflow: hidden;
  cursor: crosshair;
  contain: strict;
}

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

.anim-info {
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.anim-title {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--white);
  line-height: 1.6;
}

.anim-tag {
  font-size: 10px;
  color: var(--blue);
  border: 1px solid var(--blue-dark);
  padding: 2px 8px;
  flex-shrink: 0;
}

/* ========== COLLAB ========== */
.collab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  contain: layout;
}

.collab-card { cursor: crosshair; }
.collab-card .gallery-img-wrap { aspect-ratio: 4/3; }

/* ========== CONTACT ========== */
.contact-wrap {
  max-width: 600px;
}

.contact-terminal .terminal-body { font-size: 14px; }

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-link {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--green);
  text-decoration: none;
  letter-spacing: 1px;
  transition: color 0.2s, text-shadow 0.2s;
}

.contact-link:hover {
  color: var(--blue);
  text-shadow: 0 0 8px var(--blue-dim);
}

/* ========== FOOTER ========== */
.footer {
  padding: 24px 80px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--gray);
  background: var(--bg-mid);
  contain: layout style;
}

.footer-left {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--green);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}

.footer-license {
  color: var(--gray);
  text-decoration: underline;
  transition: color 0.2s;
}
.footer-license:hover { color: var(--green); }

/* ========== LIGHTBOX ========== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  /* will-change promotes to own layer for zero-cost open/close */
  will-change: opacity;
  contain: layout style;
}

.lightbox.hidden { display: none; }

.lightbox-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
  cursor: crosshair;
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border: 2px solid var(--green-dark);
}

.lb-close {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--green);
  cursor: crosshair;
  letter-spacing: 2px;
}

.lb-label {
  font-size: 12px;
  color: var(--gray);
}

/* ========== UTILS ========== */
.hidden { display: none !important; }

/* ========== SCROLL REVEAL ========== */
.stat-card,
.section-header,
.terminal-box,
.steam-viewer {
  opacity: 0;
  /* translate3d keeps animation on compositor thread — never triggers layout */
  transform: translate3d(0, 20px, 0);
  transition: opacity 0.5s ease, transform 0.5s ease;
  will-change: opacity, transform;
}

.stat-card.revealed,
.section-header.revealed,
.terminal-box.revealed,
.steam-viewer.revealed {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  /* remove will-change after animation to free GPU memory */
  will-change: auto;
}

/* ========== STEAM VIEWER ========== */
.steam-viewer {
  width: 100%;
  margin-bottom: 0;
  contain: layout;
}

.sv-main {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  position: relative;
  margin-bottom: 8px;
  contain: layout style;
}

.sv-preview-wrap {
  flex: 1;
  position: relative;
  min-height: 320px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* isolate so image transitions don't repaint parent */
  isolation: isolate;
}

.sv-big-img {
  width: 100%;
  height: 100%;
  max-height: 520px;
  object-fit: contain;
  display: block;
  /* smooth crossfade: opacity only — compositor-only */
  transition: opacity 0.15s ease;
  will-change: opacity;
}

.sv-big-video {
  width: 100%;
  max-height: 520px;
  display: block;
  background: #000;
  cursor: crosshair;
}

.sv-img-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 14px;
  background: rgba(0,0,0,0.75);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--white);
  letter-spacing: 1px;
  /* contain prevents label text changes from reflowing viewer */
  contain: layout style;
}

.sv-arrow {
  width: 44px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.7);
  color: var(--gray);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: crosshair;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  border: none;
  z-index: 2;
}

.sv-arrow:hover {
  background: var(--green-dark);
  color: var(--green);
}

/* FILMSTRIP */
.sv-strip-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dark) var(--bg-card);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  /* scroll perf: own layer */
  will-change: scroll-position;
  contain: strict;
}

.sv-strip-wrap::-webkit-scrollbar { height: 4px; }
.sv-strip-wrap::-webkit-scrollbar-track { background: var(--bg-dark); }
.sv-strip-wrap::-webkit-scrollbar-thumb { background: var(--green-dark); }

.sv-strip {
  display: flex;
  gap: 4px;
  padding: 4px;
  width: max-content;
}

.sv-thumb {
  width: 116px;
  height: 66px;
  flex-shrink: 0;
  cursor: crosshair;
  border: 2px solid transparent;
  overflow: hidden;
  background: var(--bg-dark);
  /* border-color only: no layout */
  transition: border-color 0.1s;
  position: relative;
  contain: strict;
}

.sv-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  image-rendering: auto;
  filter: saturate(0.6) contrast(0.98);
  /* no transition: thumbs don't need it, saves overhead */
}

.sv-thumb.active { border-color: var(--green); }
.sv-thumb:hover  { border-color: var(--green-dim); }

/* video thumbs */
.sv-thumb-vid {
  width: 140px;
  height: 66px;
}

.sv-thumb-vid-inner {
  width: 100%;
  height: 100%;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  transition: background 0.15s;
}

.sv-play-icon {
  font-size: 16px;
  color: var(--green);
}

.sv-thumb-vid.active .sv-thumb-vid-inner { background: var(--green-dark); }

.sv-thumb-title {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--gray);
  text-align: center;
  line-height: 1.5;
  word-break: break-word;
}

.sv-thumb-vid.active .sv-thumb-title { color: var(--green); }

/* ── VIDEO LOOP COUNTER ── */
.sv-vid-loops {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--green);
  background: rgba(0,0,0,0.7);
  padding: 3px 7px;
  border: 1px solid var(--green-dark);
  pointer-events: none;
  contain: strict;
}

/* ── VIDEO UNMUTE HINT ── */
.sv-unmute-hint {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--green);
  background: rgba(0,0,0,0.75);
  padding: 3px 7px;
  border: 1px solid var(--green-dark);
  pointer-events: none;
  letter-spacing: 1px;
  contain: strict;
}

/* ── HERO DECO CYCLER ── */
.deco-flip-hint {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--green);
  text-align: center;
  padding: 5px 0;
  border-top: 1px solid var(--green-dark);
  background: var(--bg-dark);
  letter-spacing: 1px;
  animation: blink 1.2s step-end infinite;
  transition: opacity 0.4s;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.8) contrast(1.1);
  /* opacity-only transition: compositor-friendly */
  transition: opacity 0.2s ease;
  will-change: opacity;
}

.hero-img.deco-flip { opacity: 0; }

/* ========== KEYFRAMES ========== */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale3d(1, 1, 1); }
  50% { opacity: 0.5; transform: scale3d(0.8, 0.8, 1); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translate3d(0, 20px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes typeIn {
  from { opacity: 0; letter-spacing: -4px; }
  to   { opacity: 1; letter-spacing: normal; }
}

@keyframes glitch {
  0%, 95%, 100% {
    text-shadow: 0 0 20px var(--green), 0 0 40px var(--green-dim);
    transform: translate3d(0, 0, 0);
  }
  96% { transform: translate3d(-2px, 1px, 0); text-shadow: -2px 0 var(--blue), 2px 0 #ff0; }
  97% { transform: translate3d(2px, -1px, 0); text-shadow: 2px 0 var(--blue), -2px 0 #ff0; }
  98% { transform: translate3d(0, 0, 0); }
}

@keyframes decoGridMove {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 24px 24px, -24px -24px; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 80px 32px 60px; }
  .hero-deco { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .section { padding: 60px 32px; }
  .footer { flex-direction: column; gap: 12px; text-align: center; padding: 20px 32px; }
  .nav { padding: 0 20px; }
  .nav-links { gap: 12px; }
  .nav-link { font-size: 7px; }
  .anim-card.wide { grid-column: span 1; }
}

@media (max-width: 600px) {
  .nav-links { display: none; }
  .hero-title .title-line { font-size: 22px; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .sv-thumb { width: 92px; height: 52px; }
  .sv-thumb-vid { width: 110px; height: 52px; }
}
