/* ==========================================================================
   MAGESH VENKATESAN - CINEMATIC PORTFOLIO STYLES
   Design System:
     - Pure Black Background: #000000
     - Primary Text:          #F5EFE7
     - Muted Text:            #A39B91
     - Electric Blue Accent:  #38A9FF
     - Dark Glass Cards:      rgba(8, 14, 22, 0.76) + backdrop blur
     - Paper Resume Card:     #F5EFE7 background with #111418 text
     - Fonts:                 Anton (Headings), Inter (Body)
   ========================================================================== */

:root {
  --color-bg: #000000;
  --color-text: #F5EFE7;
  --color-muted: #A39B91;
  --color-accent: #38A9FF;
  --color-accent-glow: rgba(56, 169, 255, 0.35);
  --color-glass-bg: rgba(8, 14, 22, 0.76);
  --color-glass-border: rgba(56, 169, 255, 0.16);
  --color-paper-bg: #F5EFE7;
  --color-paper-text: #121417;
  --color-paper-muted: #56534E;
  
  --font-heading: 'Anton', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --header-height: 64px;
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  scroll-behavior: auto; /* Scroll driven manually by JS playhead */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body.is-loading {
  overflow: hidden;
}

/* ==========================================================================
   1. CINEMATIC LOADER
   ========================================================================== */
.loader-overlay {
  position: fixed;
  inset: 0;
  background-color: #000000;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s;
  pointer-events: auto;
}

.loader-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.loader-brand {
  margin-bottom: 28px;
}

.loader-name {
  display: block;
  font-family: var(--font-heading);
  font-size: 2.2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text);
}

.loader-role {
  display: block;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 6px;
  letter-spacing: 0.02em;
}

.loader-bar-wrap {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  margin-bottom: 14px;
}

.loader-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--color-accent);
  box-shadow: 0 0 10px var(--color-accent);
  transition: width 0.15s ease-out;
}

.loader-progress-bar.is-indeterminate {
  width: 40%;
  animation: indeterminate-slide 1.4s infinite ease-in-out;
}

@keyframes indeterminate-slide {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(120%); }
  100% { transform: translateX(260%); }
}

.loader-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--color-muted);
}

.loader-percent {
  font-variant-numeric: tabular-nums;
  color: var(--color-accent);
  font-weight: 600;
}

/* ==========================================================================
   2. TOP NAVIGATION & PROGRESS BAR
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 100;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.35) 75%, transparent 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform var(--transition-smooth);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.brand-link {
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text);
  display: flex;
  gap: 6px;
  align-items: center;
}

.brand-last {
  color: var(--color-accent);
}

.site-nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 8px;
}

.nav-link {
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 9999px;
  transition: color 0.2s, background-color 0.2s;
}

.nav-link:hover {
  color: var(--color-text);
  background-color: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
  color: #FFFFFF;
  background-color: rgba(56, 169, 255, 0.15);
  border: 1px solid rgba(56, 169, 255, 0.3);
}

.nav-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.scroll-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
}

.scroll-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--color-accent);
  box-shadow: 0 0 8px var(--color-accent);
}

/* ==========================================================================
   3. FIXED VIDEO STAGE & FEATHERING MASKS
   ========================================================================== */
.stage-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000000;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-wrapper {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  
  /* Feather all four video edges into pure black #000000 */
  mask-image: radial-gradient(ellipse 92% 88% at 50% 50%, #000000 68%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 92% 88% at 50% 50%, #000000 68%, transparent 100%);
}

.film-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000000;
}

.poster-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000000;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.poster-fallback.is-active {
  opacity: 1;
}

/* Extra perimeter vignette for absolute pure black border integration */
.stage-vignette {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 2;
  pointer-events: none;
  box-shadow: inset 0 0 100px 30px #000000;
}

/* Contact Rounded SVG Frame */
.contact-svg-frame {
  position: absolute;
  width: 480px;
  height: 640px;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease-out;
  filter: drop-shadow(0 0 16px rgba(56, 169, 255, 0.6));
}

.contact-svg-frame.is-visible {
  opacity: 1;
}

.contact-svg-frame rect {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 3;
  stroke-dasharray: 3800;
  stroke-dashoffset: 3800;
  transition: stroke-dashoffset 0.1s linear;
}

/* ==========================================================================
   4. SCROLL TRACK (Drives page height)
   ========================================================================== */
.scroll-track {
  width: 100%;
  position: relative;
  z-index: 0;
  visibility: hidden;
}

/* ==========================================================================
   5. CONTENT PANELS & SECTIONS
   ========================================================================== */
.content-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

.section-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  padding: calc(var(--header-height) + 16px) 40px 24px 40px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease-out, transform 0.45s ease-out, visibility 0.45s;
  pointer-events: none;
}

.section-panel.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.section-inner {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Reusable Glass Panel */
.glass-card {
  background: var(--color-glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-glass-border);
  border-radius: 20px;
  padding: 30px 36px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  max-height: calc(100vh - var(--header-height) - 48px);
  max-height: calc(100dvh - var(--header-height) - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 169, 255, 0.35) transparent;
  box-sizing: border-box;
}

.glass-card::-webkit-scrollbar,
.paper-card::-webkit-scrollbar {
  width: 6px;
}

.glass-card::-webkit-scrollbar-track,
.paper-card::-webkit-scrollbar-track {
  background: transparent;
}

.glass-card::-webkit-scrollbar-thumb {
  background: rgba(56, 169, 255, 0.35);
  border-radius: 3px;
}

.paper-card::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.section-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-text);
  line-height: 1.1;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 0.95rem;
  color: var(--color-muted);
  margin-bottom: 28px;
}

/* --- SECTION 0: HOME --- */
.section-home {
  align-items: center;
  justify-content: flex-start;
}

.home-inner {
  max-width: 620px;
  margin-left: 5vw;
}

.intro-greeting {
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--color-muted);
  margin-bottom: -4px;
  letter-spacing: 0.02em;
}

.hero-name {
  font-family: var(--font-heading);
  font-size: clamp(3.8rem, 8vw, 6.8rem);
  line-height: 0.92;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
}

.hero-name-line1 {
  display: block;
  color: var(--color-text);
}

.hero-name-line2 {
  display: block;
  color: var(--color-accent);
  text-shadow: 0 0 35px var(--color-accent-glow);
}

.hero-role {
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 18px;
}

.hero-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--color-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--color-accent);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.status-sep {
  opacity: 0.5;
}

/* Scroll Hint */
.scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--color-muted);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: opacity 0.4s ease-out;
  pointer-events: none;
}

.scroll-hint.is-faded {
  opacity: 0;
  visibility: hidden;
}

.scroll-hint-chevron {
  animation: bounce-chevron 2s infinite;
}

@keyframes bounce-chevron {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(6px); }
  60% { transform: translateY(3px); }
}

/* --- SECTION 1: ABOUT --- */
.section-about {
  justify-content: flex-start;
}

.about-inner {
  max-width: 620px;
  margin-left: 5vw;
  max-height: calc(100vh - var(--header-height) - 48px);
  max-height: calc(100dvh - var(--header-height) - 48px);
  overflow-y: auto;
  box-sizing: border-box;
}

.about-headline {
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 2.3vw, 2.1rem);
  line-height: 1.18;
  color: var(--color-text);
  margin-bottom: 14px;
}

.about-copy {
  font-size: 0.90rem;
  line-height: 1.55;
  color: #D6CEC5;
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-number-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  color: var(--color-accent);
  line-height: 1;
}

.stat-unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--color-muted);
  line-height: 1.35;
}

/* --- SECTION 2: WORK --- */
.section-work {
  justify-content: flex-start;
}

.work-inner {
  max-width: 760px;
  margin-left: 4vw;
}

.project-cards-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  perspective: 1000px;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 169, 255, 0.35) transparent;
}

.project-cards-stage::-webkit-scrollbar {
  width: 4px;
}

.project-cards-stage::-webkit-scrollbar-track {
  background: transparent;
}

.project-cards-stage::-webkit-scrollbar-thumb {
  background: rgba(56, 169, 255, 0.35);
  border-radius: 4px;
}

.project-card {
  background: var(--color-glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--color-glass-border);
  border-radius: 16px;
  padding: 24px 28px;
  cursor: pointer;
  transition: transform 0.4s var(--transition-smooth), border-color 0.3s, box-shadow 0.3s, opacity 0.4s;
  will-change: transform, opacity;
  transform-origin: left center;
}

.project-card:hover {
  border-color: rgba(56, 169, 255, 0.4);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 169, 255, 0.15);
  transform: translateX(8px) scale(1.01) !important;
}

.project-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.project-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.project-category {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.project-desc {
  font-size: 0.92rem;
  line-height: 1.5;
  color: #D6CEC5;
  margin-bottom: 14px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--color-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 10px;
  border-radius: 6px;
}

/* --- SECTION 3: SKILLS --- */
.section-skills {
  justify-content: center;
}

.skills-inner {
  max-width: 820px;
  text-align: center;
  max-height: 85vh;
  overflow-y: auto;
}

.skills-header {
  margin-bottom: 32px;
}

.skills-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 26, 40, 0.85);
  border: 1px solid rgba(56, 169, 255, 0.22);
  border-radius: 9999px;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-text);
  transition: transform 0.3s var(--transition-smooth), opacity 0.3s, filter 0.3s, border-color 0.2s;
  will-change: transform, opacity, filter;
}

.skill-chip:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 16px var(--color-accent-glow);
  transform: translateY(-2px) scale(1.03);
}

.skill-category-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--color-accent);
  background: rgba(56, 169, 255, 0.12);
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* 4-Pillar Distinct Accents */
.badge-microsoft-enterprise {
  color: #38A9FF;
  background: rgba(56, 169, 255, 0.14);
}

.badge-azure-observability {
  color: #00E5FF;
  background: rgba(0, 229, 255, 0.14);
}

.badge-modern-full-stack {
  color: #10B981;
  background: rgba(16, 185, 129, 0.14);
}

.badge-agentic-ai {
  color: #A78BFA;
  background: rgba(167, 139, 250, 0.16);
}

/* --- SECTION 4: RÉSUMÉ (Light paper card with dark text) --- */
.section-resume {
  justify-content: center;
}

.resume-inner {
  max-width: 680px;
  width: 100%;
}

.paper-card {
  background: var(--color-paper-bg);
  color: var(--color-paper-text);
  border-radius: 16px;
  padding: 26px 32px;
  box-shadow: 0 30px 70px -10px rgba(0, 0, 0, 0.8), 0 0 2px rgba(255, 255, 255, 0.4);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s;
  will-change: transform, opacity;
  max-height: calc(100vh - var(--header-height) - 48px);
  max-height: calc(100dvh - var(--header-height) - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
  box-sizing: border-box;
}

.paper-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 2px solid #E0D7CD;
  margin-bottom: 16px;
}

.paper-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #0066CC;
  margin-bottom: 4px;
}

.paper-name {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  color: var(--color-paper-text);
  letter-spacing: 0.02em;
  line-height: 1;
}

.paper-role {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-paper-muted);
  margin-top: 4px;
}

.paper-download-wrap {
  flex-shrink: 0;
}

.paper-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #111418;
  color: #FFFFFF;
  text-decoration: none;
  font-size: 0.80rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background-color 0.2s, transform 0.2s;
}

.paper-download-btn:hover {
  background: #0066CC;
  transform: translateY(-2px);
}

.paper-download-btn:focus-visible {
  outline: 2px solid #0066CC;
  outline-offset: 2px;
}

.paper-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.paper-section-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #111418;
  margin-bottom: 8px;
}

.paper-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paper-item {
  border-left: 3px solid #0066CC;
  padding-left: 12px;
}

.paper-item-title {
  font-size: 0.90rem;
  font-weight: 700;
  color: #111418;
}

.paper-item-sub {
  font-size: 0.76rem;
  font-weight: 600;
  color: #0066CC;
  margin-bottom: 2px;
}

.paper-item-desc {
  font-size: 0.80rem;
  line-height: 1.40;
  color: #4A4641;
}

/* --- SECTION 5: CONTACT --- */
.section-contact {
  justify-content: flex-end;
}

.contact-inner {
  max-width: 520px;
  margin-right: 6vw;
}

.contact-glass-card {
  padding: 40px;
}

.contact-headline {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  color: var(--color-text);
  line-height: 1.1;
  margin-bottom: 10px;
}

.contact-subhead {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--color-muted);
  margin-bottom: 28px;
}

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

.contact-link-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(16, 26, 40, 0.6);
  border: 1px solid rgba(56, 169, 255, 0.15);
  border-radius: 12px;
  padding: 14px 18px;
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.25s, background-color 0.25s, transform 0.25s;
}

.contact-link-item:hover {
  border-color: var(--color-accent);
  background: rgba(56, 169, 255, 0.1);
  transform: translateX(4px);
}

.contact-link-item:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.contact-link-icon {
  width: 22px;
  height: 22px;
  color: var(--color-accent);
  flex-shrink: 0;
}

.contact-link-text {
  display: flex;
  flex-direction: column;
}

.contact-link-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
}

.contact-link-display {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-text);
}

/* ==========================================================================
   6. PROJECT MODAL (Expanded view for project slugs)
   ========================================================================== */
.project-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.project-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 2;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-modal.is-open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--color-text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.05);
}

.modal-close-btn:focus-visible {
  outline: 2px solid var(--color-accent);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--color-text);
  line-height: 1.1;
  margin-bottom: 6px;
}

.modal-category {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 18px;
}

.modal-desc {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #E2DBD2;
  margin-bottom: 18px;
}

.modal-detail {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-muted);
  margin-bottom: 24px;
}

/* ==========================================================================
   7. RESPONSIVE / MOBILE STYLES (<= 760px)
   ========================================================================== */
@media (max-width: 760px) {
  :root {
    --header-height: 54px;
  }

  .header-inner {
    padding: 0 16px;
  }

  .brand-link {
    font-size: 1.15rem;
  }

  .nav-list {
    gap: 4px;
  }

  .nav-link {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  /* Mobile: Zoomed out in distance by default so full stage, walking in skills, and waving "hi" in contact are 100% visible */
  .film-video,
  .poster-fallback {
    object-fit: contain;
    object-position: center 20%;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
  }

  /* Only during Resume pull-down & hold: Zoom in on head & chest directly above the card with no black gap */
  .video-wrapper.is-resume-zoomed .film-video,
  .video-wrapper.is-resume-zoomed .poster-fallback {
    transform: scale(2.05) translateY(24px);
    transform-origin: center 22%;
  }

  /* Content panels positioned at bottom with dark gradient overlay */
  .section-panel {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 16px 18px 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.96) 0%, rgba(0, 0, 0, 0.82) 48%, rgba(0, 0, 0, 0.15) 75%, rgba(0, 0, 0, 0) 100%);
  }

  .section-inner {
    max-width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .glass-card {
    padding: 24px 20px;
    border-radius: 16px;
    max-height: 60vh;
    overflow-y: auto;
  }

  .home-inner {
    margin-bottom: 24px;
  }

  .hero-name {
    font-size: 3.2rem;
    margin-bottom: 14px;
  }

  .hero-role {
    font-size: 0.95rem;
  }

  .about-inner {
    max-height: 62vh;
  }

  .about-headline {
    font-size: 1.5rem;
  }

  .about-copy {
    font-size: 0.88rem;
    margin-bottom: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding-top: 16px;
  }

  .stat-value {
    font-size: 1.8rem;
  }

  .work-inner {
    max-height: 64vh;
  }

  .project-cards-stage {
    gap: 10px;
  }

  .project-card {
    padding: 16px 18px;
  }

  .project-title {
    font-size: 1.15rem;
  }

  .project-desc {
    font-size: 0.85rem;
    margin-bottom: 10px;
  }

  .skills-inner {
    max-height: 60vh;
  }

  .skill-chip {
    padding: 8px 14px;
    font-size: 0.82rem;
  }

  .paper-card {
    padding: 20px 18px;
    max-height: 56vh;
    border-radius: 16px;
  }

  .paper-name {
    font-size: 1.7rem;
  }

  .contact-glass-card {
    padding: 24px 20px;
    max-height: 60vh;
  }

  .contact-headline {
    font-size: 1.8rem;
  }

  /* Contact SVG frame on mobile frames upper body */
  .contact-svg-frame {
    width: 280px;
    height: 380px;
    top: 12vh;
  }
}

/* ==========================================================================
   8. REDUCED MOTION MODE
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: smooth;
  }

  body {
    overflow-y: auto !important;
  }

  .scroll-track {
    display: none !important;
  }

  .stage-container {
    position: fixed;
    opacity: 0.35;
  }

  .film-video {
    display: none;
  }

  .poster-fallback {
    opacity: 1 !important;
  }

  .content-container {
    position: static;
    overflow: visible;
    pointer-events: auto;
    padding-top: var(--header-height);
  }

  .section-panel {
    position: relative;
    inset: auto;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    min-height: auto;
    padding: 80px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .home-inner,
  .about-inner,
  .work-inner,
  .skills-inner,
  .resume-inner,
  .contact-inner {
    margin: 0 auto !important;
  }

  .scroll-hint {
    display: none !important;
  }

  .contact-svg-frame {
    display: none !important;
  }

  .project-card,
  .skill-chip,
  .paper-card {
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
  }
}

