/* ============================================
   CRT TV Landing Page — Global Reset & Variables
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #050505;
  --tv-bezel: #1a1a1a;
  --tv-bezel-light: #2e2e2e;
  --tv-bezel-dark: #0a0a0a;
  --screen-glow: rgba(180, 200, 255, 0.08);
  --text-glow: rgba(255, 255, 255, 0.85);
  --scanline: rgba(0, 0, 0, 0.35);
  --font-serif: "Cormorant Garamond", "Times New Roman", serif;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: #fff;
  font-family: var(--font-serif);
}

body {
  position: relative;
  cursor: default;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.85) 100%), url('tv-background.png') no-repeat center center;
  background-size: cover;
}

/* ============================================
   Dark Room Ambience
   ============================================ */
.room-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 45%, rgba(30, 40, 80, 0.15) 0%, transparent 70%),
    radial-gradient(ellipse 100% 100% at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.9) 100%);
  pointer-events: none;
  z-index: 0;
}

/* Dust particle canvas */
#dust-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
}

/* ============================================
   Scene Layout
   ============================================ */
.scene {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.5rem;
}

.tv-wrapper {
  perspective: 1200px;
  width: min(90vw, 720px);
}

/* Subtle floating animation */
.tv-float {
  animation: tv-float 6s ease-in-out infinite;
  transform-style: preserve-3d;
}

@keyframes tv-float {
  0%, 100% { transform: translateY(0px) rotateX(0deg); }
  50%      { transform: translateY(-8px) rotateX(1deg); }
}

/* ============================================
   TV Frame — Realistic depth & bezel
   ============================================ */
.tv-frame {
  position: relative;
  padding: 28px 28px 48px;
  background: linear-gradient(145deg, var(--tv-bezel-light) 0%, var(--tv-bezel) 40%, var(--tv-bezel-dark) 100%);
  border-radius: 32px;
  box-shadow:
    /* Outer depth */
    0 30px 80px rgba(0, 0, 0, 0.9),
    0 10px 30px rgba(0, 0, 0, 0.6),
    /* Inner bezel inset */
    inset 0 2px 4px rgba(255, 255, 255, 0.08),
    inset 0 -4px 12px rgba(0, 0, 0, 0.6),
    /* Breathing glow */
    0 0 60px var(--screen-glow);
  animation: tv-breathe 4s ease-in-out infinite;
}

@keyframes tv-breathe {
  0%, 100% { box-shadow: 0 30px 80px rgba(0,0,0,0.9), 0 10px 30px rgba(0,0,0,0.6), inset 0 2px 4px rgba(255,255,255,0.08), inset 0 -4px 12px rgba(0,0,0,0.6), 0 0 40px rgba(120,140,200,0.06); }
  50%      { box-shadow: 0 30px 80px rgba(0,0,0,0.9), 0 10px 30px rgba(0,0,0,0.6), inset 0 2px 4px rgba(255,255,255,0.08), inset 0 -4px 12px rgba(0,0,0,0.6), 0 0 80px rgba(120,140,200,0.14); }
}

/* Glass reflection on bezel */
.tv-glass-reflection {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  height: 40%;
  border-radius: 20px 20px 50% 50%;
  background: linear-gradient(160deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.03) 40%, transparent 70%);
  pointer-events: none !important;
  z-index: 8;
  display: none !important;
}

/* TV controls */
.tv-controls {
  position: absolute;
  bottom: 14px;
  right: 28px;
  display: flex;
  gap: 10px;
}

.control-knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #555, #111);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.2), 0 2px 4px rgba(0,0,0,0.5);
}

.control-knob.small {
  width: 12px;
  height: 12px;
}

.tv-shadow {
  width: 70%;
  height: 20px;
  margin: 8px auto 0;
  background: radial-gradient(ellipse, rgba(0,0,0,0.6) 0%, transparent 70%);
  filter: blur(4px);
}

/* ============================================
   CRT Screen — Barrel distortion & curvature
   ============================================ */
.tv-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  /* Barrel distortion via border-radius + transform */
  transform: perspective(600px) rotateX(2deg);
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.9),
    inset 0 0 20px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(100, 130, 200, 0.05);
  /* Screen curvature illusion */
  border: 3px solid #0d0d0d;
}

/* Chromatic aberration on screen edges */
.tv-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 3px 0 8px rgba(255, 0, 80, 0.06),
    inset -3px 0 8px rgba(0, 180, 255, 0.06);
  pointer-events: none;
  z-index: 8;
}

/* ============================================
   Power-On Sequence Elements
   ============================================ */
.power-line {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 2px;
  background: #fff;
  transform: translate(-50%, -50%);
  opacity: 0;
  z-index: 5;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 0 30px rgba(255, 255, 255, 0.5);
  transition: none;
}

.power-line.expand-h {
  opacity: 1;
  animation: expand-horizontal 0.4s ease-out forwards;
}

.power-line.expand-v {
  animation: expand-vertical 0.15s ease-in forwards;
}

@keyframes expand-horizontal {
  from { width: 0; height: 2px; }
  to   { width: 100%; height: 2px; }
}

@keyframes expand-vertical {
  from { width: 100%; height: 2px; }
  to   { width: 100%; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; background: #fff; }
}

/* Static canvas */
.static-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  display: none;
  z-index: 10; /* Put above the hero text (z-index: 9) to layer noise over it */
  pointer-events: none;
  mix-blend-mode: screen;
}

.static-canvas.active {
  display: block;
  opacity: 0.45; /* Semi-transparent so text is visible underneath */
}

.static-canvas.fade-out {
  animation: static-fade 1.5s ease-out forwards;
}

@keyframes static-fade {
  from { opacity: 0.45; }
  to   { opacity: 0; }
}

/* ============================================
   CRT Overlay Effects
   ============================================ */
.crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
}

/* Scanlines */
.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    var(--scanline) 2px,
    var(--scanline) 4px
  );
  opacity: 0.35;
}

/* RGB color separation */
.rgb-split {
  background:
    linear-gradient(90deg, rgba(255,0,0,0.03) 0%, transparent 30%),
    linear-gradient(270deg, rgba(0,255,255,0.03) 0%, transparent 30%);
  mix-blend-mode: screen;
}

/* Analog noise overlay (CSS) */
.noise {
  opacity: 0.06;
  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='1'/%3E%3C/svg%3E");
  animation: noise-shift 0.5s steps(2) infinite;
}

@keyframes noise-shift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2px, 1px); }
  50%  { transform: translate(1px, -1px); }
  75%  { transform: translate(-1px, 2px); }
  100% { transform: translate(0, 0); }
}

/* Film grain */
.grain {
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.75' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* VHS glitch */
.vhs-glitch {
  position: absolute;
  inset: 0;
  pointer-events: none !important;
  z-index: 8;
  opacity: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.03) 2px,
    rgba(255, 255, 255, 0.03) 4px
  );
  transition: opacity 0.1s;
}

.vhs-glitch.glitch-active {
  opacity: 1;
  animation: vhs-shift 0.1s steps(3) infinite;
}

@keyframes vhs-shift {
  0%   { transform: translateX(0) skewX(0deg); }
  33%  { transform: translateX(-4px) skewX(-1deg); }
  66%  { transform: translateX(4px) skewX(1deg); }
  100% { transform: translateX(0) skewX(0deg); }
}

/* Screen flicker */
.screen-flicker {
  position: absolute;
  inset: 0;
  pointer-events: none !important;
  z-index: 8;
  background: rgba(255, 255, 255, 0);
  transition: background 0.05s;
}

.screen-flicker.active {
  background: rgba(255, 255, 255, 0.04);
}

/* Screen distortion during static phase */
.tv-screen.distort {
  animation: screen-warp 0.15s ease-in-out infinite alternate;
}

@keyframes screen-warp {
  from { transform: perspective(600px) rotateX(2deg) scaleX(1.002); }
  to   { transform: perspective(600px) rotateX(2deg) scaleX(0.998) skewX(0.3deg); }
}

/* ============================================
   TV Screen Content Layout
   ============================================ */
.screen-content-wrapper {
  position: absolute;
  inset: 0;
  z-index: 9;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
}

.screen-content-wrapper.visible {
  opacity: 1;
  pointer-events: auto;
}

.screen-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
  transform: scale(0.95);
}

.screen-slide.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* ============================================
   Welcome Slide (Slide 1) Styling
   ============================================ */
.name-box {
  background: #ffffff;
  padding: 1rem 2.2rem;
  border-radius: 4px;
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.7),
    inset 0 1px 2px rgba(255, 255, 255, 0.2);
  margin-bottom: 1rem;
  transform: perspective(400px) rotateX(1deg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: box-float 4s ease-in-out infinite;
}

@keyframes box-float {
  0%, 100% { transform: perspective(400px) rotateX(1deg) translateY(0); }
  50%      { transform: perspective(400px) rotateX(1deg) translateY(-4px); }
}

.hero-name-text {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.8vw, 2.3rem);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  color: #000000;
  text-transform: uppercase;
  margin: 0;
}

.hero-description {
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 2.5vw, 1.2rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 2.2rem;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
  text-transform: lowercase;
}

/* ============================================
   Tactile Retro TV Switch Button Styling
   ============================================ */
.tv-switch-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(to bottom, #2a2a2a, #151515);
  border: 2px solid #333;
  border-radius: 30px;
  color: #c0c0c0;
  font-family: var(--font-serif);
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.8rem 1.8rem;
  cursor: pointer;
  box-shadow: 
    0 4px 6px rgba(0, 0, 0, 0.6),
    inset 0 1px 1px rgba(255, 255, 255, 0.1),
    0 0 10px rgba(0, 0, 0, 0.8);
  transition: all 0.2s ease;
  user-select: none;
}

.tv-switch-btn:hover {
  color: #ffffff;
  border-color: #555;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.6),
    inset 0 1px 1px rgba(255, 255, 255, 0.2),
    0 0 15px rgba(255, 255, 255, 0.1);
  transform: translateY(1px);
}

.tv-switch-btn:active {
  background: linear-gradient(to bottom, #121212, #222222);
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.8),
    inset 0 2px 4px rgba(0, 0, 0, 0.9);
  transform: translateY(3px);
}

.switch-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3333; /* Red light for idle/off */
  box-shadow: 
    0 0 6px #ff3333,
    inset 0 1px 2px rgba(255, 255, 255, 0.4);
  transition: all 0.2s ease;
}

.tv-switch-btn:hover .switch-indicator,
.tv-switch-btn:active .switch-indicator {
  background: #33ff33; /* Green light when interactive */
  box-shadow: 
    0 0 8px #33ff33,
    0 0 15px #33ff33,
    inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.tv-switch-btn.small {
  padding: 0.5rem 1.2rem;
  font-size: 0.75rem;
  border-radius: 20px;
}

/* ============================================
   Slide 2: Portfolio Dashboard Layout
   ============================================ */
.portfolio-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0.5rem;
  justify-content: space-between;
}

/* Header & footer styles */
.portfolio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 0.6rem;
  margin-bottom: 0.8rem;
}

.portfolio-header .logo {
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text-glow);
  font-size: 1.1rem;
}

.portfolio-nav {
  display: flex;
  gap: 15px;
}

.nav-link {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  padding: 2px 4px;
  position: relative;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: #fff;
}

.nav-link.active {
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: #fff;
  transition: width 0.2s ease;
}

.nav-link.active::after {
  width: 100%;
}

.portfolio-body {
  flex-grow: 1;
  overflow-y: auto;
  text-align: left;
  padding: 0.5rem;
  display: flex;
  align-items: center;
}

.portfolio-section {
  display: none;
  width: 100%;
  animation: section-fade-in 0.3s ease-out forwards;
}

.portfolio-section.active {
  display: block;
}

@keyframes section-fade-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.portfolio-section h2 {
  font-size: 1.3rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
  border-left: 3px solid #fff;
  padding-left: 8px;
  color: var(--text-glow);
  text-transform: uppercase;
}

.portfolio-section p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1rem;
}

.skills-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  list-style: none;
  padding: 0;
}

.skills-list li {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 8px;
}

.skills-list li::before {
  content: "■";
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.5);
}

.project-item {
  margin-bottom: 0.8rem;
}

.project-item h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fff;
  margin-bottom: 0.2rem;
}

.project-item p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.contact-links {
  display: flex;
  gap: 15px;
}

.contact-links a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: underline;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.contact-links a:hover {
  color: var(--text-glow);
}

.portfolio-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 0.6rem;
  display: flex;
  justify-content: flex-start;
  gap: 12px;
}

/* ============================================
   Start Overlay (autoplay fallback)
   ============================================ */
.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
  transition: opacity 0.6s ease;
}

.start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.start-overlay p {
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.8; }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 480px) {
  .tv-frame {
    padding: 18px 18px 36px;
    border-radius: 22px;
  }

  .name-line {
    letter-spacing: 0.2em;
    text-indent: 0.2em;
  }

  .retro-audio-player {
    display: none;
  }
}

/* ============================================
   TV Bezel Controls Styling
   ============================================ */
.tv-controls {
  position: absolute;
  bottom: 14px;
  right: 28px;
  display: flex;
  gap: 15px;
  align-items: flex-end;
  z-index: 105; /* Lift above overlays and reflections to guarantee clickability */
  pointer-events: auto; /* Force pointer events */
}

.bezel-control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}

.control-label {
  font-family: monospace;
  font-size: 7px;
  font-weight: bold;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.35);
  text-shadow: 0 -1px 0 #000;
  user-select: none;
}

.control-knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #555, #111);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.2), 0 2px 4px rgba(0,0,0,0.5);
  border: 1px solid #0d0d0d;
}

.sound-toggle-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #0a0a0a;
  background: radial-gradient(circle at 35% 35%, #555, #151515);
  box-shadow: 
    inset 0 1px 2px rgba(255, 255, 255, 0.25),
    0 2px 4px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto; /* Force pointer events */
}

/* Expand tiny hit target for easier clickability */
.sound-toggle-btn::after {
  content: "";
  position: absolute;
  top: -12px;
  left: -12px;
  right: -12px;
  bottom: -12px;
}

.sound-toggle-btn:hover {
  background: radial-gradient(circle at 35% 35%, #666, #202020);
}

.sound-toggle-btn:active {
  transform: scale(0.92);
}

.knob-line {
  position: absolute;
  top: 2px;
  left: calc(50% - 1px);
  width: 2px;
  height: 5px;
  background: #ff5500;
  border-radius: 1px;
  transform-origin: bottom center;
  transition: transform 0.3s ease;
}

/* Rotary rotate state when active */
.sound-toggle-btn.active {
  transform: rotate(45deg);
}

/* Bezel indicator LED */
.bezel-led-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #202020;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.8);
  position: absolute;
  bottom: -9px;
  left: calc(50% - 2.5px);
  transition: all 0.3s ease;
}

.bezel-led-dot.active {
  background: #ff3b30;
  box-shadow: 
    0 0 6px #ff3b30,
    0 0 10px #ff3b30,
    inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* ============================================
   Logo styling (Floating & CRT Header)
   ============================================ */
.site-logo-container {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 100;
  pointer-events: none;
}

.site-logo {
  height: 40px;
  width: auto;
  opacity: 0.85;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}

.header-logo-img {
  height: 24px;
  width: auto;
  vertical-align: middle;
  filter: brightness(0) invert(1) drop-shadow(0 0 3px currentColor);
}

@media (max-width: 768px) {
  .site-logo-container {
    top: 12px;
    left: 12px;
  }
  .site-logo {
    height: 30px;
  }
}

/* ============================================
   RIGHT-SIDE SLIDE-OUT NAV DRAWER
   ============================================ */
.side-nav {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0;
}

/* The hamburger toggle tab on the right edge */
.side-nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 80px;
  background: rgba(20, 10, 10, 0.85);
  border: 1px solid rgba(180, 30, 30, 0.5);
  border-right: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  padding: 0 8px;
  backdrop-filter: blur(8px);
  transition: background 0.2s, border-color 0.2s;
  order: 2; /* toggle sits to the right of the panel */
}

.side-nav-toggle:hover {
  background: rgba(40, 15, 15, 0.95);
  border-color: rgba(220, 50, 50, 0.7);
}

.side-nav-toggle span {
  display: block;
  width: 14px;
  height: 2px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

/* Open state — X icon */
.side-nav.open .side-nav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.side-nav.open .side-nav-toggle span:nth-child(2) {
  opacity: 0;
}
.side-nav.open .side-nav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* The panel that slides out */
.side-nav-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 16px;
  background: rgba(15, 5, 5, 0.92);
  border: 1px solid rgba(180, 30, 30, 0.45);
  border-right: none;
  border-radius: 10px 0 0 10px;
  backdrop-filter: blur(12px);
  order: 1;
  /* Hidden by default — slides off to the right */
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s ease;
  min-width: 140px;
}

.side-nav.open .side-nav-panel {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.side-nav-label {
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: rgba(200, 60, 60, 0.8);
  font-family: 'Share Tech Mono', monospace;
  margin: 0 0 8px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(180, 30, 30, 0.3);
}

.side-nav-link {
  display: block;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  font-family: 'Special Elite', serif;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}

.side-nav-link:hover {
  color: #fff;
  background: rgba(180, 30, 30, 0.18);
  border-color: rgba(180, 30, 30, 0.4);
}

.side-nav-link.active {
  color: #fff;
  background: rgba(180, 30, 30, 0.25);
  border-color: rgba(220, 50, 50, 0.5);
  text-shadow: 0 0 8px rgba(255,100,100,0.4);
}

/* ============================================
   FLOATING SOUND TOGGLE BUTTON
   ============================================ */
.float-sound-btn {
  position: fixed;
  bottom: 28px;
  right: 20px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 5, 5, 0.88);
  border: 1px solid rgba(180, 30, 30, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.float-sound-btn:hover {
  background: rgba(40, 10, 10, 0.95);
  border-color: rgba(220, 50, 50, 0.8);
  transform: scale(1.08);
}

.float-sound-btn svg {
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.2s;
}

.float-sound-btn:hover svg {
  color: #fff;
}

/* Show/hide the correct icon */
.float-sound-btn .icon-sound-off {
  display: none;
}
.float-sound-btn.muted .icon-sound-on {
  display: none;
}
.float-sound-btn.muted .icon-sound-off {
  display: block;
}
.float-sound-btn.muted {
  border-color: rgba(100, 100, 100, 0.5);
}
.float-sound-btn.muted svg {
  color: rgba(255, 255, 255, 0.35);
}

/* ============================================
   NAV ARROW HINT
   ============================================ */
.nav-arrow-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  order: 0; /* sits left of the toggle */
  margin-right: 4px;
  padding: 5px 10px 5px 12px;
  background: rgba(12, 5, 5, 0.82);
  border: 1px solid rgba(180, 30, 30, 0.45);
  border-right: none;
  border-radius: 20px 0 0 20px;
  backdrop-filter: blur(8px);
  cursor: default;
  pointer-events: none;
  animation: hint-bounce 1.4s ease-in-out infinite;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.nav-hint-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  text-transform: uppercase;
}

.nav-arrow-hint svg {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

/* Bounce toward the toggle (rightward nudge) */
@keyframes hint-bounce {
  0%, 100% { transform: translateX(0);   opacity: 0.85; }
  50%       { transform: translateX(6px); opacity: 1;    }
}

/* Fade out when dismissed */
.nav-arrow-hint.dismissed {
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
}

/* ============================================
   MOBILE — Portrait TV Layout (≤ 640px)
   ============================================ */
@media (max-width: 640px) {

  /* Allow vertical scroll on mobile */
  html, body {
    overflow: auto;
    height: auto;
    min-height: 100%;
  }

  /* ---- Main scene: vertically and horizontally centered ---- */
  .scene {
    width: 100%;
    min-height: 100svh;
    display: flex;
    align-items: center; /* Center the TV vertically */
    justify-content: center;
    padding: 10px;
    overflow: visible;
  }

  /* ★ CRITICAL: force the content wrapper visible on mobile.
     JS power-on sequence may not fire; this CSS is the fallback. */
  .screen-content-wrapper {
    opacity: 1 !important;
    pointer-events: auto !important;
    transition: none !important;
  }

  /* Make sure the active slide is shown */
  .screen-slide.active {
    display: flex !important;
    opacity: 1 !important;
    transform: scale(1) !important;
    pointer-events: auto !important;
  }

  /* Style name box and intro slide for portrait screens */
  .screen-slide#slide-intro {
    padding: 1rem;
    gap: 15px;
  }
  .name-box {
    padding: 0.8rem 1.2rem !important;
    width: 90%;
    max-width: 280px;
  }
  .hero-name-text {
    font-size: 1.4rem !important;
  }
  .hero-description {
    font-size: 0.85rem !important;
  }

  /* ---- TV wrapper: full-width portrait ---- */
  .tv-wrapper {
    width: 100%;
    max-width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch; /* Prevents flex children from collapsing to 0 width */
  }

  /* ---- TV float: force full width on mobile ---- */
  .tv-float {
    width: 100% !important;
    animation: none !important; /* disable floating animation on mobile */
    transform: none !important;
  }

  /* ---- TV frame: portrait, full-width phone card ---- */
  .tv-frame {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    padding: 12px 12px 48px;
    box-shadow:
      0 8px 40px rgba(0,0,0,0.85),
      inset 0 2px 4px rgba(255,255,255,0.06),
      0 0 40px var(--screen-glow);
    animation: none; /* save CPU on mobile */
    margin: 0;
  }

  /* ---- CRT Screen: tall portrait aspect ratio ---- */
  .tv-screen {
    aspect-ratio: 9 / 14;   /* portrait, like a phone */
    width: 100%;
    border-radius: 10px;
  }

  /* ---- Screen content wrapper ---- */
  .screen-content-wrapper {
    border-radius: 10px;
  }

  /* ---- TV shadow: hide on mobile ---- */
  .tv-shadow { display: none; }

  /* ---- Portfolio layout inside TV ---- */
  .portfolio-layout {
    padding: 0.6rem 0.5rem;
    gap: 0;
  }

  .portfolio-header {
    padding-bottom: 0.4rem;
    margin-bottom: 0.5rem;
  }

  .header-logo-img {
    height: 24px;
  }

  /* ---- Body sections scroll inside TV ---- */
  .portfolio-body {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
  }

  /* ---- Section headings ---- */
  .section-title {
    font-size: 1.1rem;
  }

  /* ---- About text ---- */
  .about-text,
  .portfolio-body p {
    font-size: 0.88rem;
    line-height: 1.6;
  }

  /* ---- Footer nav buttons: horizontal scroll ---- */
  .portfolio-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding-top: 8px;
  }

  .tv-switch-btn.small {
    font-size: 0.7rem;
    padding: 4px 10px;
  }

  /* ---- TV bezel controls ---- */
  .tv-controls {
    bottom: 10px;
    right: 16px;
  }

  .control-label { font-size: 0.45rem; }

  /* ---- Side nav: move toggle to bottom-right area ---- */
  .side-nav {
    top: auto;
    bottom: 70px;
    transform: none;
  }

  /* ---- Floating sound btn: stay bottom-right but higher ---- */
  .float-sound-btn {
    bottom: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
  }

  /* ---- Nav arrow hint: hide on mobile (touch is obvious) ---- */
  .nav-arrow-hint { display: none; }

  /* ---- Scanlines: lighter on mobile for readability ---- */
  .tv-screen::before {
    background: repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 3px,
      rgba(0,0,0,0.12) 3px,
      rgba(0,0,0,0.12) 4px
    );
  }
}

/* ============================================
   MOBILE — Projects page specifics (≤ 640px)
   ============================================ */
@media (max-width: 640px) {

  /* Welcome text inside TV */
  .projects-welcome-text {
    font-size: 1.05rem;
    margin-bottom: 10px;
  }
  .projects-welcome-sub {
    font-size: 0.78rem;
    line-height: 1.55;
  }
  .projects-welcome-hint {
    font-size: 0.65rem;
  }

  /* Domain picker: 2-column pill grid at bottom */
  .domain-picker {
    bottom: 10px;
    width: calc(100% - 24px);
    left: 12px;
    transform: none;
  }
  .domain-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }
  .domain-pill {
    justify-content: center;
    font-size: 0.72rem;
    padding: 6px 8px;
  }
  .domain-picker-label {
    font-size: 0.55rem;
  }

  /* Carousel: full-width single card */
  .carousel-container {
    height: auto;
    padding: 0 32px;
  }
  .carousel-perspective {
    width: 100%;
  }
  .carousel-cube {
    width: 100%;
    height: 240px;
  }
  .carousel-arrow {
    width: 24px;
    height: 24px;
    font-size: 1.2rem;
  }
  .carousel-arrow.left { left: 2px; }
  .carousel-arrow.right { right: 2px; }

  /* Project card text */
  .project-card h3 {
    font-size: 1rem !important;
  }
  .project-card p {
    font-size: 0.73rem !important;
    -webkit-line-clamp: 2;
  }
  .card-img-wrapper {
    height: 80px;
  }
  .tech-tag {
    font-size: 0.6rem !important;
    padding: 1px 5px !important;
  }
}

/* ============================================
   MOBILE — Contact page specifics (≤ 640px)
   ============================================ */
@media (max-width: 640px) {

  /* Stack left + right columns vertically */
  .contact-layout {
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
  }

  .contact-details,
  .contact-feedback {
    flex: unset;
    width: 100%;
  }

  .contact-details h2,
  .contact-feedback h2 {
    font-size: 1rem;
    margin-bottom: 6px;
  }

  .contact-list .label {
    font-size: 0.58rem;
  }
  .contact-list .value {
    font-size: 0.75rem;
  }
  .contact-list a.value.link {
    font-size: 0.72rem;
  }

  #comment-input {
    height: 56px;
    font-size: 0.7rem;
  }
  .submit-btn {
    font-size: 0.65rem;
    padding: 5px;
  }
  .suggestion-note {
    font-size: 0.62rem;
  }
}