/* ============================================
   DARK MOTION — CSS
   ============================================ */

/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  overflow-x: hidden;
}

/* ============================================
   LOADER
   ============================================ */
.loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Hide ALL page content until loader finishes */
body:not(.loaded) .nav,
body:not(.loaded) .hero,
body:not(.loaded) .section,
body:not(.loaded) .footer {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.loader-inner {
  text-align: center;
  width: 200px;
}

.loader-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 3px;
  margin-bottom: 24px;
}

.loader-logo span {
  background: linear-gradient(90deg, #ffffff, var(--accent), var(--accent-mid), #ffffff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.loader-bar-track {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.loader-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ffffff, var(--accent), var(--accent-mid), #ffffff);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.loader-text {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 12px;
}

:root {
  --bg: #000000;
  --bg-secondary: #050505;
  --text: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-tertiary: rgba(255, 255, 255, 0.3);
  --accent: #DFA6DD;
  --accent-glow: rgba(223, 166, 221, 0.3);
  --accent-mid: #BCD1F1;
  --accent-red: #FD3D3D;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.06);
  --radius: 16px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  scroll-behavior: auto; /* Lenis handles smooth scroll */
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* Pure black during video playback — only video visible */
body.video-playing {
  background: #000;
}

body.video-playing .nav,
body.video-playing .hero-content {
  opacity: 0;
  pointer-events: none;
}

body.video-playing .blur-blob {
  opacity: 0;
}


/* ============================================
   NAVIGATION
   ============================================ */
.nav {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 14px 32px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  width: fit-content;
  max-width: calc(100vw - 32px);
  overflow-x: auto;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 48px;
}

.nav-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 2px;
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  transition: color var(--transition);
}

.nav-logo:hover { color: var(--text-secondary); }

.nav-logo span {
  color: var(--accent);
}

.nav-logo svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-link {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: color var(--transition);
}

.nav-link:hover {
  color: var(--text);
}

/* Orientation toggle button */
.nav-orientation-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  padding: 3px 6px;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  flex-shrink: 0;
  margin-left: -8px; /* pull closer to links */
}

.nav-orientation-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.nav-orientation-btn svg {
  width: 14px;
  height: 14px;
}

/* Default: show vertical icon → user sees "lock orientation" */
.nav-orientation-btn .icon-vertical { display: block; }
.nav-orientation-btn .icon-horizon { display: none; }

/* Orientation locked: show horizon icon → user sees "unlock" */
body.orientation-locked .nav-orientation-btn .icon-vertical { display: none; }
body.orientation-locked .nav-orientation-btn .icon-horizon { display: block; }

/* Active highlight — accent glow so user knows horizon mode is ON */
body.orientation-locked .nav-orientation-btn {
  color: var(--accent);
  background: rgba(223, 166, 221, 0.2);
  border-color: rgba(223, 166, 221, 0.45);
  box-shadow: 0 0 10px rgba(223, 166, 221, 0.25);
  transition: none;  /* kill transition so iOS compositor can't fade it during scroll */
  transform: translateZ(0);  /* promote to own GPU layer, prevent backdrop-filter clipping */
}
body.orientation-locked .nav-orientation-btn:hover {
  background: rgba(223, 166, 221, 0.28);
  border-color: rgba(223, 166, 221, 0.6);
  box-shadow: 0 0 16px rgba(223, 166, 221, 0.4);
}

/* Light theme button */
body.light .nav-orientation-btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}
body.light .nav-orientation-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.15);
}

/* Light theme active highlight */
body.light.orientation-locked .nav-orientation-btn {
  color: var(--accent);
  background: rgba(102, 187, 106, 0.2);
  border-color: rgba(102, 187, 106, 0.45);
  box-shadow: 0 0 10px rgba(102, 187, 106, 0.3);
  transition: none;
  transform: translateZ(0);
}
body.light.orientation-locked .nav-orientation-btn:hover {
  background: rgba(102, 187, 106, 0.28);
  border-color: rgba(102, 187, 106, 0.6);
  box-shadow: 0 0 16px rgba(102, 187, 106, 0.45);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding-bottom: 80px;
  background: #000;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 24px;
}

.hero-subtitle {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -3px;
  margin-bottom: 40px;
  position: relative;
}

/* Title background bloom — fades in behind characters */
.hero-title::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  width: 500px;
  height: 200px;
  background: radial-gradient(ellipse at center, rgba(223, 166, 221, 0.45), transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  filter: blur(50px);
  border-radius: 50%;
  transition: opacity 1.2s ease, transform 1.5s ease;
}

.hero-title.bloom-active::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.5);
  transition: opacity 0.6s ease, transform 1.2s ease;
}

.hero-title .line-reveal {
  overflow: hidden;
}

.hero-title .line-reveal span {
  display: inline-block;
}

.title-line {
  overflow: hidden;
  display: block;
}

.title-line [data-char] {
  display: inline-block;
  opacity: 0;
  transform: translateY(80px) rotateX(-40deg) scale(0.8);
  filter: blur(8px);
  transform-origin: bottom center;
  will-change: transform, opacity, filter;
}

/* Xiaoshi — plain white */
.hero-title .title-line:first-child [data-char] {
  color: #ffffff;
}

/* Journey — split two-segment: "Jour" white, "ney" pink */
.hero-title .title-line:last-child [data-char]:nth-child(-n+4) {
  color: #ffffff;
}
.hero-title .title-line:last-child [data-char]:nth-child(n+5) {
  background: linear-gradient(90deg, #ffffff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-cta {
  margin-top: 48px;
}

/* ============================================
   TERMINAL CARD — hero replacement
   ============================================ */
.terminal-card {
  width: calc(100vw * 2 / 3);
  max-width: 90vw;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  backdrop-filter: blur(40px) saturate(1.5);
  -webkit-backdrop-filter: blur(40px) saturate(1.5);
  overflow: hidden;
  opacity: 0;
  contain: layout style;
}

/* Mobile terminal adjustments */
@media (max-width: 520px) {
  .terminal-card {
    max-width: 95vw;
    border-radius: 8px;
  }

  .terminal-dots {
    padding: 12px 14px;
  }

  .terminal-body {
    padding: 14px 12px;
    font-size: 0.75rem;
    line-height: 1.8;
  }

  .terminal-arm-wrap .robot-arm {
    max-width: 280px;
  }

  .terminal-line.arm-params {
    font-size: 0.65rem;
    word-break: break-all;
  }
}

.terminal-dots {
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.terminal-body {
  padding: 18px 20px;
  min-height: 120px;
  overflow-x: hidden;
  font-family: 'Space Grotesk', monospace;
  font-size: 0.85rem;
  line-height: 2;
  color: rgba(255, 255, 255, 0.7);
  /* Prevent horizontal scroll */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.terminal-body::-webkit-scrollbar {
  width: 4px;
}

.terminal-body::-webkit-scrollbar-track {
  background: transparent;
}

.terminal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

body.light .terminal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

.terminal-line {
  white-space: nowrap;
  overflow: hidden;
  min-height: 1.6em;
}

.terminal-line .prompt {
  color: var(--accent);
}

.terminal-line .cmd {
  color: rgba(255, 255, 255, 0.9);
}

.terminal-line .check {
  color: #28c840;
}

.terminal-line .val {
  color: var(--accent-mid);
}

.terminal-cursor {
  display: inline-block;
  color: var(--accent);
  animation: cursorBlink 1s step-end infinite;
  margin-left: 0;
  font-size: 0.85em;
  vertical-align: text-bottom;
  pointer-events: none;
}

.terminal-history {
  min-height: 1.6em;
}

.terminal-input-line {
  display: flex;
  align-items: center;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: inherit;
  font-family: 'Space Grotesk', monospace;
  font-size: inherit;
  line-height: inherit;
  caret-color: transparent;
  padding: 0;
  min-width: 0;
}

.terminal-input::placeholder {
  color: rgba(255,255,255,0.15);
  font-style: italic;
}

body.light .terminal-input::placeholder {
  color: rgba(0,0,0,0.15);
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Light theme terminal */
body.light .terminal-card {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light .terminal-dots {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

body.light .terminal-body {
  color: rgba(0, 0, 0, 0.6);
}

body.light .terminal-line .cmd {
  color: rgba(0, 0, 0, 0.85);
}

body.light .terminal-cursor {
  background: var(--accent);
}

/* ============================================
   ROBOTIC ARM — inside terminal
   ============================================ */
.terminal-arm-wrap {
  padding: 8px 0;
  overflow: hidden;
  text-align: center;
}

.robot-arm {
  width: 100%;
  max-width: 600px;
  height: auto;
  display: block;
  margin: 4px auto;
  overflow: visible;
}

.robot-arm .arm-grid-rect {
  fill: rgba(255, 255, 255, 0.01);
  stroke: none;
}

.robot-arm .arm-grid {
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 0.5;
  stroke-dasharray: 3 6;
}

.robot-arm .arm-stroke {
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: filter 0.5s ease;
}

.robot-arm .arm-link-wide {
  stroke-width: 1.8;
}

.robot-arm .arm-dot {
  fill: var(--accent);
  stroke: none;
}

.robot-arm .arm-label {
  fill: var(--accent);
  font-family: 'Space Grotesk', monospace;
  font-size: 8px;
  opacity: 0.6;
}

.robot-arm .arm-anno {
  stroke: var(--accent);
  stroke-width: 0.6;
  stroke-dasharray: 2 3;
  opacity: 0.3;
}

.robot-arm .arm-glow-trace {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  fill: none;
  opacity: 0;
}

/* Draw animation */
.robot-arm.animate .arm-stroke {
  animation: armDraw 0.6s ease forwards;
}

.robot-arm.animate .arm-glow-trace {
  animation: armGlow 2.5s ease-in-out forwards;
}

@keyframes armDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes armGlow {
  0%   { opacity: 0; }
  8%   { opacity: 0.5; }
  70%  { opacity: 0.2; stroke-dashoffset: 0; }
  100% { opacity: 0; stroke-dashoffset: 0; }
}

/* Light theme */
body.light .robot-arm .arm-grid-rect {
  fill: rgba(0, 0, 0, 0.01);
}

body.light .robot-arm .arm-grid {
  stroke: rgba(0, 0, 0, 0.05);
}

body.light .robot-arm .arm-label {
  fill: var(--accent);
}

.robot-arm.arm-hover .arm-stroke {
  filter: drop-shadow(0 0 3px var(--accent));
  transition: filter 0.3s ease;
}

/* Workspace range indicators */
.robot-arm .arm-workspace-min,
.robot-arm .arm-workspace-max {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.5;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.robot-arm.tracking .arm-workspace-min,
.robot-arm.tracking .arm-workspace-max {
  opacity: 0.15;
}

/* Target crosshair */
.robot-arm .arm-target-line {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.robot-arm .arm-target-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0.8;
}

.robot-arm.tracking .arm-target {
  display: block !important;
  filter: drop-shadow(0 0 4px var(--accent));
}

/* End effector marker */
.robot-arm .arm-end-marker {
  fill: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent));
  animation: endMarkerPulse 1s ease-in-out infinite;
}

@keyframes endMarkerPulse {
  0%, 100% { r: 3; opacity: 0.8; }
  50% { r: 4; opacity: 1; }
}

/* Terminal output for arm parameters */
.terminal-line.arm-status {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.terminal-line.arm-params {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.terminal-line.arm-workspace {
  font-size: 0.7rem;
  opacity: 0.6;
  margin-bottom: 4px;
}

/* Tracking state glow - pulse animation */
@keyframes trackingPulse {
  0%, 100% {
    filter: drop-shadow(0 0 4px var(--accent));
    opacity: 0.8;
  }
  50% {
    filter: drop-shadow(0 0 12px var(--accent)) drop-shadow(0 0 20px var(--accent));
    opacity: 1;
  }
}

@keyframes dotPulse {
  0%, 100% {
    filter: drop-shadow(0 0 6px var(--accent));
    r: 3;
  }
  50% {
    filter: drop-shadow(0 0 15px var(--accent)) drop-shadow(0 0 25px var(--accent));
    r: 4;
  }
}

.robot-arm.tracking .arm-stroke {
  animation: trackingPulse 1.2s ease-in-out infinite;
}

.robot-arm.tracking .arm-dot {
  animation: dotPulse 0.8s ease-in-out infinite;
}

/* End effector extra glow when tracking */
.robot-arm.tracking .arm-glow-trace {
  filter: drop-shadow(0 0 10px var(--accent)) drop-shadow(0 0 20px var(--accent));
  stroke-linecap: round;
  stroke-dasharray: none;
  stroke-dashoffset: 0;
  animation: none;
}

/* Idle state - handled by JS setGlowIntensity */

/* Hide terminal input permanently */
.terminal-input-line {
  display: none !important;
}

/* Workspace indicator dot */
.robot-arm .workspace-indicator {
  transition: fill 0.3s ease, r 0.3s ease;
}

.btn-primary {
  display: inline-block;
  padding: 16px 48px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  text-decoration: none;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 100px;
  background: linear-gradient(90deg, #ffffff, var(--accent), var(--accent-mid), #ffffff);
  background-size: 200% 200%;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
  animation: gradientShift 3s ease infinite;
}

.btn-primary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: transparent;
  box-shadow:
    0 0 40px var(--accent-glow),
    0 0 80px rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
}

.btn-primary:hover::before {
  opacity: 0.15;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
  position: relative;
  padding: 120px 0;
  border-top: 1px solid rgba(255,255,255,0.03);
  overflow: hidden;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  box-sizing: border-box;
}

.section-header {
  margin-bottom: 80px;
}

.section-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 5px;
  text-transform: uppercase;
  margin-bottom: 20px;
  opacity: 0.8;
}

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1px;
}

.section-title .line-reveal {
  overflow: hidden;
}

.section-title .line-reveal span {
  display: inline-block;
}

/* ============================================
   PROJECT CARDS — GLASSMORPHISM
   ============================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
}

.project-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-width: 0;
  perspective: 1000px;
}

.card-glass {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(40px) saturate(1.5);
  -webkit-backdrop-filter: blur(40px) saturate(1.5);
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  flex: 1;
  display: flex;
  flex-direction: column;
  transform-style: preserve-3d;
  will-change: transform;
}

.card-glass > a {
  display: block;
  flex: 1;
  text-decoration: none;
  color: inherit;
}

.card-actions {
  padding: 16px 32px 24px;
  margin-top: auto;
  position: relative;
  z-index: 3;
}

.card-glass:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.25),
    0 0 40px rgba(223, 166, 221, 0.15),
    0 0 80px rgba(223, 166, 221, 0.06);
}

.card-image {
  position: relative;
  height: 180px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.card-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.1));
}

.card-image-placeholder span {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 2px;
}

.card-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.6) 100%);
  z-index: 1;
  transition: opacity 0.4s ease;
}

/* Spotlight glare — follows cursor, fades in on hover */
.card-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    500px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(255, 255, 255, 0.07),
    transparent 50%
  );
  transition: opacity 0.4s ease;
}

.card-glass:hover::before {
  opacity: 1;
}

.card-glass:hover .card-image::after {
  opacity: 0.5;
}

.card-image img {
  width: 110%;
  height: 110%;
  object-fit: cover;
  margin: -5%;
  filter: saturate(0.65);
  transition: filter 0.6s ease;
}

.card-glass:hover .card-image img {
  filter: saturate(1);
}

.card-content {
  padding: 28px 32px;
  position: relative;
  z-index: 3;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.card-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-tags span {
  padding: 4px 12px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.btn-card-action {
  display: inline-block;
  padding: 8px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(223, 166, 221, 0.1);
  border: 1px solid rgba(223, 166, 221, 0.18);
  border-radius: 8px;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
}

.btn-card-action:hover {
  background: rgba(223, 166, 221, 0.2);
  border-color: rgba(223, 166, 221, 0.35);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}

/* ============================================
   ABOUT SECTION
   ============================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.about-text {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 48px;
  padding-top: 48px;
  border-top: 1px solid var(--glass-border);
}

.stat-number {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -1px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 3px;
}

/* ============================================
   CONTACT SECTION
   ============================================ */
.contact-section {
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.contact-content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.contact-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -2px;
  margin: 24px 0 40px;
}

.contact-title .line-reveal {
  overflow: hidden;
}

.contact-title .line-reveal span {
  display: inline-block;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.contact-item:hover {
  color: var(--text);
}

.contact-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.contact-icon svg {
  width: 20px;
  height: 20px;
}

.contact-item:hover .contact-icon {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.contact-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  font-weight: 400;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 4px;
}

.contact-item:hover .contact-text {
  border-color: var(--accent);
}

/* ============================================
   CREDITS
   ============================================ */
.credits-section {
  min-height: auto;
  padding: 80px 0;
}

.credits-content {
  text-align: center;
}

.credits-list {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}

.credits-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.credits-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: transform var(--transition);
}

.credits-link:hover {
  transform: translateY(-4px);
}

.credits-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.credits-link:hover .credits-avatar {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
}

.credits-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 1px;
  transition: color var(--transition);
}

.credits-link:hover .credits-name {
  color: var(--text);
}

.credits-desc {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  padding: 32px 0;
  border-top: 1px solid var(--glass-border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  letter-spacing: 1px;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--text);
}

/* ============================================
   LOGO VIDEO
   ============================================ */
.logo-video-wrapper {
  margin-bottom: 48px;
  margin-top: 20px;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 2;
  perspective: 1000px;
}

/* Card breathing float */
body.intro-done .logo-video-wrapper {
  animation: wrapperBreathe 5s ease-in-out infinite;
}

@keyframes wrapperBreathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.logo-video-glass {
  position: relative;
  width: calc(100vw * 2 / 3);
  height: auto;
  aspect-ratio: 16/9;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  border: 1px solid transparent;
  backdrop-filter: none;
  box-shadow: none;
  will-change: transform, border-radius;
  transition: box-shadow 1s ease, border-color 1s ease, background 1s ease, backdrop-filter 1s ease;
}

.logo-video-glass.video-ended {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-color: rgba(223, 166, 221, 0.3);
  box-shadow:
    0 0 60px rgba(223, 166, 221, 0.15),
    0 0 120px rgba(223, 166, 221, 0.06),
    0 0 80px rgba(223, 166, 221, 0.1);
}

body.light .logo-video-glass.video-ended {
  border-color: rgba(102, 187, 106, 0.3);
  box-shadow:
    0 0 60px rgba(102, 187, 106, 0.18),
    0 0 120px rgba(102, 187, 106, 0.06),
    0 0 80px rgba(102, 187, 106, 0.12);
}

.logo-video {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: radial-gradient(circle at center, transparent 50%, rgba(10, 10, 10, 0.4));
  pointer-events: none;
  opacity: 0;
}

/* ============================================
   EFFECT 1: SPOTLIGHT GLARE — cursor-following glow
   ============================================ */
.logo-video-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(223, 166, 221, 0.12),
    rgba(223, 166, 221, 0.04) 30%,
    transparent 55%
  );
  border-radius: inherit;
  transition: opacity 0.8s ease;
}

.logo-video-glass.video-ended::before {
  opacity: 1;
}

body.light .logo-video-glass::before {
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(102, 187, 106, 0.15),
    rgba(102, 187, 106, 0.05) 30%,
    transparent 55%
  );
}

/* ============================================
   EFFECT 2: AURORA BORDER — flowing gradient edge
   ============================================ */
@property --aurora-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.aurora-border {
  position: absolute;
  inset: -2px;
  z-index: 1;
  border-radius: inherit;
  background: conic-gradient(
    from var(--aurora-angle),
    transparent 0%,
    rgba(223, 166, 221, 0.6) 10%,
    rgba(188, 209, 241, 0.5) 20%,
    transparent 30%,
    transparent 50%,
    rgba(223, 166, 221, 0.4) 60%,
    rgba(188, 209, 241, 0.6) 70%,
    transparent 80%
  );
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}

.logo-video-glass.video-ended .aurora-border {
  opacity: 1;
  animation: auroraRotate 8s linear infinite;
}

@keyframes auroraRotate {
  to { --aurora-angle: 360deg; }
}

/* Mask: show only the border ring, hide the interior */
.aurora-border::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background: var(--bg);
}

body.light .aurora-border {
  background: conic-gradient(
    from var(--aurora-angle),
    transparent 0%,
    rgba(102, 187, 106, 0.5) 10%,
    rgba(200, 230, 201, 0.4) 20%,
    transparent 30%,
    transparent 50%,
    rgba(102, 187, 106, 0.35) 60%,
    rgba(200, 230, 201, 0.5) 70%,
    transparent 80%
  );
}

body.light .aurora-border::after {
  background: #ffffff;
}

/* ============================================
   AMBIENT BLUR BLOBS
   ============================================ */
/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.scroll-indicator.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 1px;
}

.scroll-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: scrollDotPulse 2s ease-in-out infinite;
}

@keyframes scrollDotPulse {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(36px); opacity: 1; }
}

/* Scroll indicator light theme */
body.light .scroll-line {
  background: rgba(0, 0, 0, 0.15);
}

.blur-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(150px);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 1.5s ease;
}

.blur-blob.visible {
  opacity: 0.2;
}

.blob-1 {
  background: var(--accent);
  animation: blobFloat 12s ease-in-out infinite;
}

.blob-2 {
  background: var(--accent-mid);
  animation: blobFloat 15s ease-in-out infinite reverse;
}

.blob-3 {
  background: var(--accent-mid);
  opacity: 0.08;
  animation: blobPulse 10s ease-in-out infinite;
}

/* ============================================
   ANIMATIONS
   ============================================ */
.line-reveal {
  overflow: hidden;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

@keyframes blobPulse {
  0%, 100% { transform: scale(1); opacity: 0.08; }
  50% { transform: scale(1.2); opacity: 0.12; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
}

@media (max-width: 768px) {
  .project-card,
  .nav-link,
  .btn-primary {
    cursor: pointer;
  }

  .nav {
    padding: 12px 24px;
  }

  .nav-inner {
    gap: 24px;
  }

  .nav-links {
    gap: 16px;
  }

  .nav-logo {
    font-size: 1rem;
  }

  .nav-link {
    font-size: 0.75rem;
    letter-spacing: 1px;
  }

  .container {
    padding: 0 24px;
  }

  .section {
    padding: 100px 0;
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .stat-number {
    font-size: 2rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 16px;
    padding: 0 24px;
  }
}

@media (max-width: 480px) {
  .nav {
    padding: 12px 20px;
    top: 10px;
    max-width: calc(100vw - 20px);
    border-radius: 14px;
  }

  .nav-inner {
    gap: 16px;
  }

  .nav-links {
    gap: 14px;
  }

  .nav-logo {
    font-size: 0.9rem;
    letter-spacing: 1px;
  }

  .nav-link {
    font-size: 0.72rem;
    letter-spacing: 0.5px;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .contact-title {
    font-size: 2rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
/* Dark mode (default): show sun → user sees "switch to light" */
.nav-logo .icon-sun { display: block; }
.nav-logo .icon-moon { display: none; }

/* Light mode: show moon → user sees "switch to dark" */
body.light .nav-logo .icon-sun { display: none; }
body.light .nav-logo .icon-moon { display: block; }

/* Responsive: keep nav-logo icon sizing in check */
@media (max-width: 768px) {
  .nav-logo svg { width: 14px; height: 14px; }
}

/* ============================================
   LIGHT THEME — CSS Variable Overrides
   ============================================ */
body.light {
  --bg: #ffffff;
  --bg-secondary: #fafafa;
  --text: #1a1a1a;
  --text-secondary: rgba(0, 0, 0, 0.6);
  --text-tertiary: rgba(0, 0, 0, 0.35);
  --accent: #66BB6A;
  --accent-glow: rgba(102, 187, 106, 0.22);
  --accent-mid: #C8E6C9;
  --glass-bg: rgba(0, 0, 0, 0.03);
  --glass-border: rgba(0, 0, 0, 0.07);
  --glass-hover: rgba(0, 0, 0, 0.05);
}

/* ============================================
   LIGHT THEME — Hardcoded Color Overrides
   ============================================ */

/* --- Hero --- */
body.light .hero { background: #ffffff; }

/* Light theme title bloom */
body.light .hero-title::before {
  background: radial-gradient(ellipse at center, rgba(102, 187, 106, 0.3), transparent 70%);
}

/* Blob parallax wrappers */
.blob-parallax {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  transition: transform 1.8s ease-out;
}

.blob-wrap-1 { top: 10%; left: 15%; width: 500px; height: 500px; }
.blob-wrap-2 { bottom: 15%; right: 10%; width: 400px; height: 400px; }
.blob-wrap-3 { top: 50%; left: 50%; width: 600px; height: 600px; }

.blob-parallax .blur-blob {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.5s ease;
}

/* --- Body & video playback --- */
body.light { background: #fff; }

/* --- Loader — white in light mode to avoid dark flash --- */
body.light .loader { background: #fff; }
body.light .loader-logo { color: #1a1a1a; }
body.light .loader-text { color: rgba(0, 0, 0, 0.3); }
body.light .loader-bar-track { background: rgba(0, 0, 0, 0.1); }

body.light .hero-title .title-line:first-child [data-char],
body.light .hero-title .title-line:last-child [data-char]:nth-child(-n+4) {
  color: #1a1a1a;
}
body.light .hero-title .title-line:last-child [data-char]:nth-child(n+5) {
  background: linear-gradient(90deg, var(--accent), var(--accent-mid));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light .btn-primary {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}
body.light .btn-primary:hover { background: rgba(0, 0, 0, 0.06); }
body.light .btn-primary::before {
  background: linear-gradient(90deg, #1a1a1a, var(--accent), var(--accent-mid), #1a1a1a);
  background-size: 200% 200%;
}

/* --- Nav glass --- */
body.light .nav {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.07);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* --- Sections --- */
body.light .section { border-top-color: rgba(0, 0, 0, 0.06); }

/* --- Project cards --- */
body.light .card-glass {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
}
body.light .card-glass:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.1),
    0 0 40px rgba(102, 187, 106, 0.25),
    0 0 80px rgba(102, 187, 106, 0.1);
}

/* Spotlight glare — lighter in light theme */
body.light .card-glass::before {
  background: radial-gradient(
    500px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(102, 187, 106, 0.12),
    transparent 50%
  );
}
body.light .card-image { background: rgba(0, 0, 0, 0.02); }
body.light .card-tags span {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.04);
}
body.light .btn-card-action {
  color: var(--accent);
  background: rgba(102, 187, 106, 0.08);
  border-color: rgba(102, 187, 106, 0.2);
}
body.light .btn-card-action:hover { background: var(--accent-mid); border-color: var(--accent); }

/* --- Contact icons --- */
body.light .contact-icon {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.08);
}
body.light .contact-item:hover .contact-icon {
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.15);
}
body.light .contact-text { border-bottom-color: rgba(0, 0, 0, 0.08); }

/* --- Credits --- */
body.light .credits-avatar { border-color: rgba(0, 0, 0, 0.1); }

/* --- Light theme uses separate video asset (logo_light.mp4) --- */
body.light.video-playing { background: #fff; }
body.light .video-overlay {
  background: radial-gradient(circle at center, transparent 40%, rgba(102, 187, 106, 0.15));
}

/* ============================================
   THEME TRANSITION (View Transitions API)
   ============================================ */
::view-transition-old(root) {
  animation: theme-fade-out 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}
::view-transition-new(root) {
  animation: theme-fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes theme-fade-out {
  to { opacity: 0; }
}
@keyframes theme-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Fallback flash overlay for browsers without View Transitions API */
.theme-flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.theme-flash-overlay.active {
  opacity: 1;
}

/* ============================================
   ORIENTATION LOCK — gyro-stabilized horizon mode
   #horizon-wrapper gets counter-rotated via JS
   ============================================ */
#horizon-wrapper {
  transform-origin: 50vw 50vh;  /* viewport-relative — no JS tracking needed */
  will-change: transform;       /* promote to own compositor layer → 120Hz on ProMotion */
}
