/* ========== SELF-HOSTED FONTS ========== */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(assets/fonts/ibm-plex-mono-400-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(assets/fonts/ibm-plex-mono-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(assets/fonts/ibm-plex-mono-500-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(assets/fonts/ibm-plex-mono-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(assets/fonts/ibm-plex-mono-600-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(assets/fonts/ibm-plex-mono-600-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Default cursor hidden when JS is active */
html {
  scrollbar-gutter: stable;
}

html, body {
  cursor: auto;
}

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

/* Normal: OS cursor hidden, only DOM cursor visible */
html.custom-cursor-enabled,
html.custom-cursor-enabled *,
body.custom-cursor-enabled,
body.custom-cursor-enabled * {
  cursor: none !important;
}

/* During transitions: OS cursor = custom SVG, DOM cursor hidden */
html.custom-cursor-enabled.is-transitioning,
html.custom-cursor-enabled.is-transitioning *,
body.custom-cursor-enabled.is-transitioning,
body.custom-cursor-enabled.is-transitioning * {
  cursor: var(--cursor-svg) !important;
}

::view-transition,
::view-transition-group(*),
::view-transition-image-pair(*),
::view-transition-old(*),
::view-transition-new(*) {
  cursor: var(--cursor-svg) !important;
}

:root {
  /* ========== COLOR SYSTEM ========== */
  --bg: #ffffff;
  --text: #111111;
  --text-secondary: #666666; /* WCAG AA compliant: 5.7:1 contrast on white */
  --card-bg: #f0f0f0; 
  --cursor-color: #000000;
  --cursor-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 28 28'%3E%3Cpolygon fill='%23FFFFFF' points='8.2,20.9 8.2,4.9 19.8,16.5 13,16.5 12.6,16.6'/%3E%3Cpolygon fill='%23FFFFFF' points='17.3,21.6 13.7,23.1 9,12 12.7,10.5'/%3E%3Crect x='12.5' y='13.6' transform='matrix(0.9221 -0.3871 0.3871 0.9221 -5.7605 6.5909)' fill='%23000000' width='2' height='8'/%3E%3Cpolygon fill='%23000000' points='9.2,7.3 9.2,18.5 12.2,15.6 12.6,15.5 17.4,15.5'/%3E%3C/svg%3E") 8 4, none;
  
  /* ========== TYPOGRAPHY SCALE ========== */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 24px;
  --text-xl: 36px;
  --text-2xl: 48px;
  
  /* Line Heights */
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.4;
  --leading-relaxed: 1.5;
  
  /* Letter Spacing */
  --tracking-tight: -0.02em;
  --tracking-normal: 0.005em; /* Slight positive for mono readability */
  --tracking-wide: 0.02em;
  
  /* ========== SPACING SCALE (8px base) ========== */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 40px;
  --space-10: 64px;
  
  /* ========== ANIMATION SYSTEM ========== */
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  
  --duration-instant: 100ms;
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 800ms;
  
  /* ========== LAYOUT ========== */
  --grid-gap: var(--space-4);
  --grid-cols: 2; 
  --font-size: var(--text-base);
  --sidebar-width: 300px;
  --sidebar-padding: 24px;
}

[data-theme="dark"] {
  --bg: #000000;
  --text: #ffffff;
  --text-secondary: #a0a0a0; /* WCAG AA compliant: 4.5:1 contrast on black */
  --card-bg: #111111; 
  --cursor-color: #ffffff;
  --cursor-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 28 28'%3E%3Cpolygon fill='%23FFFFFF' points='8.2,20.9 8.2,4.9 19.8,16.5 13,16.5 12.6,16.6'/%3E%3Cpolygon fill='%23FFFFFF' points='17.3,21.6 13.7,23.1 9,12 12.7,10.5'/%3E%3Crect x='12.5' y='13.6' transform='matrix(0.9221 -0.3871 0.3871 0.9221 -5.7605 6.5909)' fill='%23FFFFFF' width='2' height='8'/%3E%3Cpolygon fill='%23FFFFFF' points='9.2,7.3 9.2,18.5 12.2,15.6 12.6,15.5 17.4,15.5'/%3E%3C/svg%3E") 8 4, none;
}

body {
  margin: 0;
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--font-size); 
  letter-spacing: var(--tracking-normal);
  background-color: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-sizing: border-box;
  transition: background-color var(--duration-normal) var(--ease-out), 
              color var(--duration-normal) var(--ease-out);
}

button, a, p, h1, h2, div, span {
  font-size: var(--font-size); 
}

/* ========== FOCUS STATES ========== */
a:focus-visible,
button:focus-visible,
.control-btn:focus-visible,
.theme-btn:focus-visible,
.info-link:focus-visible,
.about-link:focus-visible,
.career-item:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Remove default outline */
a:focus,
button:focus {
  outline: none;
}

/* ========== SAFARI OPTIMIZATIONS ========== */
html.safari .control-btn .btn-svg {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: auto;
}

html.safari body.grid-large .gallery-stage {
  scroll-behavior: auto;
}

/* ========== REDUCED MOTION ========== */
/* @media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .hello-text {
    animation: none !important;
  }
} */

/* --- LAYOUT --- */
.layout-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
  padding-left: var(--sidebar-width); /* Reserve space for fixed left sidebar */
}

/* --- SIDEBAR --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: var(--sidebar-padding);
  padding-bottom: var(--sidebar-padding);
  box-sizing: border-box;
  height: 100vh;
  height: 100dvh;
  z-index: 100;
  background-color: var(--bg);
}

/* Ensure right sidebar matches */
.sidebar-right {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: var(--sidebar-padding);
  padding-bottom: var(--sidebar-padding);
  box-sizing: border-box;
  position: relative;
  height: 100vh;
  height: 100dvh;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Stable font size for sidebar to prevent jumps in focus mode */
.sidebar button, 
.sidebar a, 
.sidebar p, 
.sidebar h1, 
.sidebar h2, 
.sidebar div, 
.sidebar span {
  font-size: 14px !important;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.monogram-container {
  margin-bottom: var(--space-1);
}

.monogram {
  width: 37px;
  height: auto;
  color: var(--text);
}

.role-minimal {
  color: var(--text);
  font-size: 14px;
  line-height: var(--leading-relaxed);
  font-weight: 500;
}

.sidebar .name {
  margin: 0;
  font-weight: 500;
  font-size: 14px;
  line-height: var(--leading-normal);
}

.sidebar .role {
  margin: 0;
  color: var(--text);
  font-weight: 400;
  line-height: var(--leading-relaxed);
  font-size: 14px;
  max-width: 240px;
}

.info-link {
  color: var(--text-secondary);
  text-decoration: none !important;
  cursor: pointer;
  font-size: 14px;
  margin-top: var(--space-2);
  border-bottom: none !important;
  width: fit-content;
  padding-bottom: 2px;
  transition: color var(--duration-fast) var(--ease-out);
}

.info-link:hover {
  color: var(--text);
}

.sidebar-controls {
  display: flex;
  gap: var(--space-5);
  align-items: center;
  margin-bottom: 0; 
}

.controls {
  display: flex;
  align-items: center;
  gap: 24px; /* Increased gap */
  background-color: transparent;
}

/* Monumental Buttons */
.control-btn {
  background: none !important; 
  border: none;
  font-family: inherit;
  cursor: none; 
  color: var(--text); 
  padding: 0;
  width: 86px; 
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

/* Apply animations to inner SVG to maintain hit area */
.control-btn .btn-svg {
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  transform-origin: center;
}

/* Smooth Morph Transitions for Inner Shapes */
.control-btn .btn-shape-fill,
.control-btn .btn-shape-stroke,
.control-btn .btn-icon {
  transition: fill-opacity 0.3s ease;
}

/* ... existing inner SVG styles ... */

/* Hover: keep static */
.control-btn:hover:not(:disabled) .btn-svg {
  transform: none;
}

/* Mechanical Press Effect — keyframe animation, immune to reflow interruptions */
@keyframes btnPress {
  0% { transform: scale(1); }
  15% { transform: scale(0.88); }
  60% { transform: scale(0.88); }
  100% { transform: scale(1); }
}

.control-btn.simulate-active:not(:disabled) .btn-svg {
  animation: btnPress 0.45s cubic-bezier(0.2, 0, 0.2, 1) both;
}

/* Close State (Zoom-in becomes Close) */
.control-btn.is-close-btn .btn-svg {
  transform: rotate(45deg);
}

.control-btn.is-close-btn:hover:not(:disabled) .btn-svg {
  transform: rotate(45deg);
}

@keyframes btnPressClose {
  0% { transform: rotate(45deg) scale(1); }
  15% { transform: rotate(45deg) scale(0.88); }
  60% { transform: rotate(45deg) scale(0.88); }
  100% { transform: rotate(45deg) scale(1); }
}

.control-btn.is-close-btn.simulate-active:not(:disabled) .btn-svg {
  animation: btnPressClose 0.45s cubic-bezier(0.2, 0, 0.2, 1) both;
}

/* Hidden State for Zoom-out (Smooth Fade) */
.control-btn.btn-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Monogram and Name Hover */
.monogram-container, 
.role-minimal {
  transition: opacity 0.2s ease;
}

/* Hover effects removed per user request */
.monogram-container:hover, 
.role-minimal:hover {
  opacity: 1;
}

/* Disabled/Maxed State (Gray Outline, Hollow Icon) */
.control-btn:disabled {
  opacity: 1;
  pointer-events: none; /* Prevent further clicks */
}

/* Permanently pressed look for disabled state */
.control-btn:disabled .btn-svg {
  transform: scale(0.92);
  filter: none;
}

.control-btn:disabled .btn-shape-fill {
  fill-opacity: 0; /* Transparent fill */
}

.control-btn:disabled .btn-shape-stroke {
  stroke: #C2C2C2 !important; 
  stroke-width: 2px !important;
}

/* Hollow Icon for Disabled State (fill-opacity allows smooth return transition) */
.control-btn:disabled .btn-icon {
  fill: white !important;
  fill-opacity: 0 !important;
  stroke: #C2C2C2 !important; 
  stroke-width: 2px !important;
}

/* Return animation: fill with black, no scale — distinct from press */
.control-btn.btn-returning .btn-svg {
  transform: scale(1) !important;
  transition: none !important;
}

.control-btn.btn-returning .btn-shape-fill,
.control-btn.btn-returning .btn-icon {
  transition: fill-opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.control-btn.btn-returning .btn-shape-stroke {
  transition: stroke 0.85s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* Theme Toggle Button */
.theme-btn {
  background: none;
  border: none;
  font-family: inherit;
  cursor: none; 
  color: var(--text-secondary);
  padding: 0;
  font-size: 14px;
}

.theme-text {
  transition: color var(--duration-fast) var(--ease-out);
}

.theme-text.active {
  color: var(--text);
  font-weight: 500;
}

/* --- SIDEBAR RIGHT --- */
.sidebar-right {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: var(--sidebar-padding);
  box-sizing: border-box;
  position: relative;
  height: 100vh;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.project-details-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.project-details-container.visible {
  opacity: 1;
}

/* Reusing styles for content inside the right sidebar */
.desc-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.desc-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.desc-title {
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase; 
  margin-bottom: var(--space-1);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-wide);
}

.desc-text {
  font-size: 14px;
  line-height: var(--leading-relaxed);
  color: var(--text);
  max-width: 100%;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.result-list .result-item {
  display: block;
}

.desc-footer {
  margin-top: auto;
  font-size: 14px;
  color: var(--text-secondary);
}

/* --- INFORMATION STAGE --- */
.information-stage {
  flex-grow: 1;
  width: auto; 
  min-width: 0; 
  padding: 0 var(--sidebar-padding);
  box-sizing: border-box;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center; 
  align-items: center; /* Center horizontally */
  /* min-height: 100vh; REMOVED to match focus mode behavior */
  height: 100vh;
  padding-top: var(--space-5);
  padding-bottom: var(--space-5);
  
  /* Scroll handling matching grid-large */
  overflow-y: scroll;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.information-stage::-webkit-scrollbar {
  display: none;
}

/* Constrain item info to match visual container */
.information-stage .item-info {
  width: 100%;
  max-width: calc(80vh * 16 / 9);
  box-sizing: border-box;
}

.information-stage.hidden {
  display: none !important;
}

.info-visual-container {
  width: 100%;
  max-width: calc(80vh * 16 / 9); /* Limit width based on max-height aspect ratio to prevent overflow/cropping */
  aspect-ratio: 16/9;
  background-color: var(--card-bg);
  position: relative; 
  overflow: hidden;
  display: block; 
  max-height: 80vh;
}

/* Info Slides */
.info-slides {
  width: 100%;
  height: 100%;
  position: relative;
}

.info-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
  pointer-events: none;
}

.info-slide.active {
  opacity: 1;
  pointer-events: auto;
}

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

video.info-img {
  object-position: bottom;
}

/* Info Details for Sidebar Right (injected) */
.info-details-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  margin-top: 0;
}

.info-group-title {
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase; 
  margin-bottom: var(--space-2);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-wide);
  color: var(--text);
}

.info-group-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-group-content li {
  font-size: 14px;
  color: var(--text-secondary);
}

.info-group-content a {
  text-decoration: none;
  color: var(--text-secondary);
  transition: color var(--duration-fast);
  font-size: inherit;
}

.info-group-content a:hover {
  color: var(--text);
}

/* --- GALLERY GRID --- */
.gallery-stage {
  flex-grow: 1;
  width: auto; 
  min-width: 0; 
  padding: var(--sidebar-padding);
  box-sizing: border-box;
  margin-bottom: var(--sidebar-padding);
  scroll-snap-type: none;
  overflow-y: visible;
  height: auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  gap: var(--grid-gap);
  width: 100%;
}

.grid-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.project-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.project-details {
    display: none;
}

/* Visual Container (Slider) */
.item-visual {
  position: relative;
  width: 100%;
  background-color: var(--card-bg); 
  overflow: hidden;
  transition: background-color var(--duration-normal) var(--ease-out); 
  aspect-ratio: 16 / 9;
}

/* Ensure About Me and Description slides have a fixed aspect ratio matching video/standard landscape */
.about-item .item-visual,
.grid-item .item-visual {
    aspect-ratio: 16 / 9 !important;
    display: block; 
}

/* In large grid, visual takes more space */
/* Currently using default 16/9 aspect ratio */

.item-content {
  position: absolute; /* Changed from relative to absolute to stack correctly in block container */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%; 
  display: none; 
  /* z-index: 1; Removed to allow children to pop out if needed */
}

.about-item .item-content {
  width: 100%;
  height: 100%;
}

.item-content.active {
  display: block;
}

.item-content img,
.item-content video {
  width: 100%;
  height: 100%; /* Force fill container height */
  object-fit: cover; /* Crop to fill without distortion */
  display: block;
}

/* --- About Me Slide Styling --- */
.about-slide {
  width: 100%;
  height: 100%;
  padding: var(--space-4);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--text);
  background-color: var(--card-bg);
  transition: font-size var(--duration-normal) var(--ease-out), 
              padding var(--duration-normal) var(--ease-out);
}

/* Small Grid State (Four Columns) */
body.grid-small {
    --font-size: 13px;
}

body.grid-small .about-slide,
body.grid-small .description-slide,
body.grid-small .awards-slide,
body.grid-small .awards-list-slide,
body.grid-small .career-slide {
    padding: 12px;
}

body.grid-small .hello-text,
body.grid-small .career-title,
body.grid-small .desc-title {
    font-size: 1.1em;
}

body.grid-small .career-item,
body.grid-small .about-link,
body.grid-small .footer-link {
    font-size: 0.95em;
}

body.grid-small .awards-list {
    font-size: 0.8em;
    gap: 2px 6px;
}

/* Dense Grid State (Five Columns) */
body.grid-dense {
    --font-size: 11px;
}

body.grid-dense .about-slide,
body.grid-dense .description-slide,
body.grid-dense .awards-slide,
body.grid-dense .awards-list-slide,
body.grid-dense .career-slide {
    padding: 8px;
}

body.grid-dense .about-slide {
    font-size: 11px; 
}

body.grid-dense .about-slide .about-link,
body.grid-dense .about-slide .hello-text,
body.grid-dense .about-slide .bio-text,
body.grid-dense .career-title,
body.grid-dense .career-subtitle,
body.grid-dense .career-item {
    font-size: 11px; 
}

body.grid-dense .about-header,
body.grid-dense .career-header {
    margin-bottom: 4px;
    gap: 2px;
}

body.grid-dense .bio-text,
body.grid-dense .career-subtitle {
    line-height: 1.2;
}

body.grid-dense .description-slide {
    font-size: 0.85em; /* 11px * 0.85 ~ 9.3px */
}

body.grid-dense .award-item {
    font-size: 0.8em; /* 11px * 0.8 ~ 8.8px */
}

/* Medium Grid State (Two Columns) - Intermediate Style */
body.grid-medium {
    --font-size: 16px; /* Reduced from 18px, closer to base 15px */
}

body.grid-medium .about-slide,
body.grid-medium .description-slide,
body.grid-medium .awards-slide,
body.grid-medium .awards-list-slide,
body.grid-medium .career-slide {
    padding: 24px; /* Reduced from 32px */
}

/* Typography scaling for Medium Grid */
body.grid-medium .hello-text,
body.grid-medium .career-title,
body.grid-medium .desc-title,
body.grid-medium .about-header .hello-text {
    font-size: 1.6em !important; /* Reduced from 2em */
    letter-spacing: -0.02em;
    margin-bottom: 8px; /* Reduced from 16px - tighter gap */
    line-height: 1.1;
}

body.grid-medium .bio-text,
body.grid-medium .career-subtitle,
body.grid-medium .desc-text {
    font-size: 1em !important;
    line-height: 1.4;
    letter-spacing: -0.01em;
    max-width: 95%; 
    opacity: 0.95;
}

body.grid-medium .career-item,
body.grid-medium .about-link,
body.grid-medium .footer-link {
    font-size: 1.1em !important;
}

body.grid-medium .about-links {
    margin-top: 32px;
}

body.grid-medium .career-list {
    gap: 8px;
}

body.grid-medium .awards-list {
    gap: 8px 16px;
    font-size: 1em;
}

body.grid-medium .description-content {
    gap: 16px; /* Reduced gap between sections */
}

/* body.grid-medium .desc-footer is handled with grid-large shared rule */

/* Large Grid State (Single Column) - Monumental Style */
body.grid-large {
    --font-size: 24px; /* Base size increase */
}

/* Scroll Snap removed for Large Grid */
body.grid-large .gallery-stage {
    /* height: 100vh; removed */
    /* overflow-y: scroll; removed */
    /* scroll-snap-type: y mandatory; removed */
    padding: 40px; 
    margin: 0;
}

body.grid-large .gallery-grid {
  gap: var(--sidebar-padding);
  padding-top: 0; 
}

body.grid-large .grid-item {
  min-height: 100vh;
  scroll-snap-align: start;
  justify-content: center; 
  padding: var(--space-5) 0;
  box-sizing: border-box;
  gap: var(--space-5);
}

body.grid-large .gallery-stage {
  padding: 0 var(--sidebar-padding);
  height: 100vh; 
  overflow-y: scroll; 
  scroll-snap-type: y mandatory; 
  scroll-behavior: smooth;
  margin-bottom: 0;
  
  /* Hide scrollbar */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

body.grid-large .gallery-stage::-webkit-scrollbar {
    display: none;
}

/* Ensure visual takes maximum available space */
body.grid-large .item-visual {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9; /* Maintain ratio but allow full width */
    max-height: 80vh; /* Prevent it from being taller than screen */
}

body.grid-large .about-slide,
body.grid-large .description-slide,
body.grid-large .awards-slide,
body.grid-large .awards-list-slide,
body.grid-large .career-slide {
    padding: 64px; /* Much larger padding */
}

/* Typography scaling for Large Grid */
body.grid-large .hello-text,
body.grid-large .career-title,
body.grid-large .about-header .hello-text {
    font-size: 3em !important; /* Huge titles */
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    line-height: 1;
}

body.grid-large .desc-title {
    font-size: 14px !important;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

body.grid-large .bio-text,
body.grid-large .career-subtitle,
body.grid-large .desc-text {
    font-size: 1.4em !important; /* Large body text */
    line-height: 1.3;
    max-width: 80%; /* Limit width for readability */
    opacity: 0.9;
}

body.grid-large .career-item,
body.grid-large .about-link,
body.grid-large .footer-link {
    font-size: 1.2em !important;
}

body.grid-large .about-links {
    margin-top: 64px;
}

body.grid-large .career-list {
    gap: 16px;
    margin-top: auto;
}

body.grid-large .awards-list {
    gap: 16px 32px;
    font-size: 1.2em;
}

body.grid-large .description-content {
    display: flex;
    flex-direction: column;
    gap: 40px; /* 5x8 grid */
    justify-content: flex-start;
    flex-grow: 1;
}

body.grid-large .desc-section {
    display: flex;
    flex-direction: column;
    gap: 16px; /* 2x8 grid */
}

body.grid-large .desc-text {
    font-size: 14px !important; 
    line-height: 1.5;
    max-width: 100%; 
    opacity: 1;
}

body.grid-large .desc-footer,
body.grid-medium .desc-footer {
    font-size: 14px !important; /* Same size as body text */
    opacity: 1; /* Keep opacity for hierarchy, but size matches */
    margin-top: auto;
}

.about-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

/* .about-links and other removed classes can stay if not conflicting, but cleaned up somewhat */

/* --- Project Description Slide Styling --- */
.description-slide {
  width: 100%;
  height: 100%;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--text);
  background-color: var(--card-bg);
  font-size: 0.9em;
}

.description-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    line-height: 1.4;
}

/* .career-slide uses base structure from .about-slide */

.career-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.career-title {
    font-weight: 600;
}

.career-subtitle {
    max-width: 90%;
    line-height: 1.4;
}

.career-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    z-index: 102; /* Above nav-area */
    position: relative;
    width: 100%;
}

.career-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between; 
  text-decoration: none;
  color: var(--text-secondary);
  transition: opacity var(--duration-fast) var(--ease-out), 
              color var(--duration-fast) var(--ease-out);
  width: 100%;
  opacity: 0.8;
  padding: var(--space-1) 0;
}

.career-item:hover {
  opacity: 1;
  color: var(--text);
}

.career-dots {
    flex-grow: 1;
    border-bottom: 1px dotted currentColor; /* Thinner dots look cleaner in mono */
    margin: 0 12px;
    height: 1px; 
    position: relative;
    top: -4px; 
    opacity: 0.3; /* Subtle dots */
}

.career-item:hover .career-dots {
    /* border-color automatically follows color via currentColor */
    opacity: 1;
}

.career-date {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}


/* --- Awards Slide Styling --- */
.awards-slide {
  width: 100%;
  height: 100%;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background-color: var(--card-bg);
}

.awards-images {
    display: flex;
    flex-grow: 1;
    gap: 8px; /* Space between photos */
    margin-top: 8px;
    height: 100%;
    overflow: hidden;
    min-height: 0; /* Important for flex child scrolling/sizing */
}

.award-img {
    flex: 1; /* Share space equally */
    width: 100%; /* Fallback */
    min-width: 0; /* Allow shrinking below content size */
    height: 100%;
    object-fit: cover; /* Fill the area */
    object-position: center top; /* Focus on faces/top usually */
    display: block;
}



/* --- Awards List Slide Styling --- */
.awards-list-slide {
  width: 100%;
  height: 100%;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background-color: var(--card-bg);
}

.awards-list {
    display: grid;
    grid-template-columns: max-content 1fr max-content 1fr max-content;
    align-content: end;
    align-items: center;
    gap: 4px 8px; /* row-gap 4px, column-gap 8px for spacing */
    flex-grow: 1;
    margin-top: auto;
    width: 100%;
    font-size: 0.9em; 
}

.award-item {
    display: contents; /* Flattens the div so children participate in the grid */
    color: var(--text-secondary); /* Inherited by children */
}

/* Ensure children inherit color properly if needed, usually automatic */
.award-name, .award-place, .award-date {
    white-space: nowrap;
    color: var(--text-secondary);
}

.award-date {
    font-variant-numeric: tabular-nums;
}

.award-dots {
    width: 100%;
    border-bottom: 2px dotted var(--text-secondary);
    height: 1px;
    position: relative;
    top: -4px;
    opacity: 0.5;
    margin: 0; /* Spacing handled by grid gap */
}



/* Navigation Overlay */
.nav-area {
  position: absolute;
  top: 0;
  bottom: 0;
  height: 100% !important; /* Force height */
  z-index: 100 !important; /* Force above everything */
  cursor: none; 
  pointer-events: auto !important; /* Force interaction */
  display: block;
}
.nav-area.left { 
    left: 0; 
    width: 30%; 
}
.nav-area.center { 
    left: 30%; 
    width: 40%; 
}
.nav-area.right { 
    left: 70%; /* Explicit left positioning to avoid ambiguity */
    width: 30%; 
    right: auto; /* Reset right */
}

/* Info Row */
.item-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  color: var(--text);
}

.project-title {
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1; 
  min-width: 0;
}

.project-counter {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-left: 8px;
}

/* --- FOOTER --- */
.site-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 24px 32px;
  box-sizing: border-box;
  margin-top: auto;
}

.footer-link {
  text-decoration: none;
  color: var(--text-secondary);
  margin-right: var(--space-4);
  transition: color var(--duration-fast) var(--ease-out);
}

.footer-link:last-child {
  margin-right: 0;
}

.footer-link:hover {
  color: var(--text);
}

.footer-left, .footer-right {
  display: flex;
  gap: 16px;
}

/* --- CUSTOM CURSOR --- */
#custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 32px; 
  height: 32px;
  pointer-events: none !important; 
  z-index: 9999;
  will-change: transform;
  opacity: 0; 
}

#custom-cursor * {
    pointer-events: none !important;
}

body.custom-cursor-enabled #custom-cursor {
  opacity: 1;
}

.cursor-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px; 
  height: 32px;
}

.cursor-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scaleX(1) rotate(0deg);
  transition: transform 0.2s cubic-bezier(0.2, 0, 0.2, 1);
}

.cursor-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: var(--cursor-color);
}

/* Cursor States */
.cursor-icon.point-left {
  transform: scaleX(1) rotate(-69deg);
}

.cursor-icon.point-right {
  transform: scaleX(-1) rotate(-69deg);
}

/* --- VIEW TRANSITIONS --- */
::view-transition-group(root) {
  animation-duration: 0s;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* Spotlight animation: only focused card morphs, others fade */
::view-transition-group(spotlight-target) {
  animation-duration: 350ms;
  animation-timing-function: var(--ease-out);
  z-index: 100;
}

::view-transition-old(spotlight-target) {
  display: none;
}

::view-transition-new(spotlight-target) {
  height: 100%;
  width: 100%;
  object-fit: cover;
  animation: none;
  mix-blend-mode: normal;
}

/* Text Morphing for Focus Mode */
::view-transition-group(title-target),
::view-transition-group(counter-target) {
  animation-duration: 350ms;
  animation-timing-function: var(--ease-out);
  z-index: 101; /* Slightly above image */
  mix-blend-mode: normal;
}

::view-transition-old(title-target),
::view-transition-new(title-target),
::view-transition-old(counter-target),
::view-transition-new(counter-target) {
  height: 100%;
  width: 100%;
}

/* Non-focused items: instant hide */
::view-transition-group(spotlight-hide) {
  animation-duration: var(--duration-instant);
  animation-timing-function: linear;
}

::view-transition-old(spotlight-hide) {
  animation: spotlight-fade-out var(--duration-instant) linear forwards;
}

::view-transition-new(spotlight-hide) {
  animation: spotlight-fade-in var(--duration-normal) var(--ease-out) forwards;
  animation-delay: var(--duration-slow);
}

@keyframes spotlight-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes spotlight-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========== SPOTLIGHT MODE CLASSES ========== */
/* Applied during focus transition */
.grid-item.spotlight-target {
  z-index: 100;
  /* box-shadow removed to avoid white margins during transition */
}

/* Ensure view transition groups for projects are on top of root */
::view-transition-group(root) {
    z-index: 0;
}

/* Entering focus mode - hide non-target items immediately */
body.entering-focus .grid-item:not(.spotlight-target) {
  opacity: 0;
  pointer-events: none;
}

/* Exiting focus mode - fade all back in */
body.exiting-focus:not(.is-transitioning) .grid-item {
  animation: spotlight-fade-in var(--duration-normal) var(--ease-out) forwards;
}

/* Drum Text Animations */
.drum-roll-out-up {
  animation: drumRollOutUp var(--duration-slow) var(--ease-in-out) forwards;
  transform-origin: bottom center;
}

.drum-roll-in-up {
  animation: drumRollInUp var(--duration-slow) var(--ease-in-out) forwards;
  transform-origin: top center;
}

.drum-roll-out-down {
  animation: drumRollOutDown var(--duration-slow) var(--ease-in-out) forwards;
  transform-origin: top center;
}

.drum-roll-in-down {
  animation: drumRollInDown var(--duration-slow) var(--ease-in-out) forwards;
  transform-origin: bottom center;
}

@keyframes drumRollOutUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

@keyframes drumRollInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes drumRollOutDown {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(30px);
    }
}

@keyframes drumRollInDown {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-project-details {
  display: none;
}

/* Mobile and Tablet (Sidebar on top) */
@media (max-width: 1024px) {
  :root {
    --sidebar-padding: var(--space-5);
    --grid-cols: 2; 
  }
  
  /* Tap Highlight Removal */
  * {
    -webkit-tap-highlight-color: transparent;
  }
  
  .layout-wrapper {
    flex-direction: column;
    padding-left: 0; /* Reset desktop fixed sidebar offset */
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative; /* Natural scroll flow on mobile */
    z-index: 1; /* Standard z-index */
    background-color: var(--bg);
    padding-bottom: 24px; /* White space buffer */
    margin-bottom: 0;
    border-bottom: none;
  }
  
  /* Fix Button Alignment (Left Align with Text) */
  .sidebar-controls {
    margin-left: 0; /* No offset needed for new assets */
    margin-bottom: 0; /* Reset desktop negative margin */
    gap: 0;
  }
  
  /* Fix Focus Mode Gap & Scroll - Applied generally for mobile to fix double padding */
  .gallery-stage {
      padding-top: 0 !important;
      padding-left: var(--sidebar-padding);
      padding-right: var(--sidebar-padding);
      /* Disable fixed height/scroll for mobile natural scrolling */
      height: auto !important;
      overflow-y: visible !important;
      scroll-snap-type: none !important;
  }
  
  /* Reset Grid Item for Mobile Focus Flow */
  body.grid-large .grid-item {
      min-height: auto;
      justify-content: flex-start;
      padding-top: 24px; /* Visual gap from buttons */
      padding-bottom: 40px;
      /* In focus mode, we want 1 col */
      grid-column: span 2; 
  }
  
  /* Ensure Focus Mode is always 1 column width effectively */
  body.grid-large .gallery-grid {
      grid-template-columns: 1fr;
  }
  
  /* Mobile Project Details (Visible in Focus Mode) */
  body.grid-large .mobile-project-details,
  #mobile-about-details {
      display: flex;
      flex-direction: column;
      gap: 24px;
      margin-top: 32px;
      padding-top: 0;
  }

  /* Fix About Me Overlay for Mobile */
  #information-stage {
      height: auto !important;
      min-height: 100vh;
      overflow-y: visible !important;
      padding-bottom: 80px;
  }

  /* Fix Card Sizing in Grid (2 cols) */
  .grid-item .item-visual {
      flex: 0 0 auto; /* Prevent shrinking/growing */
      width: 100%;
      aspect-ratio: 16/9 !important;
  }

  /* Truncate text on mobile to one line */
  .project-title {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      flex: 1; 
      min-width: 0;
  }
  
  .project-counter {
      flex-shrink: 0;
      margin-left: 8px;
  }

  /* Fix About Me Padding on Mobile Focus Mode */
  body.grid-large .about-slide {
      padding: 24px !important;
  }
  
  .mobile-project-details .desc-title {
      font-weight: 600;
      font-size: 14px;
      text-transform: uppercase;
      margin-bottom: 4px;
      letter-spacing: var(--tracking-wide);
  }
  
  .mobile-project-details .desc-text {
      font-size: 14px;
      line-height: var(--leading-relaxed);
      color: var(--text);
  }
  
  .mobile-project-details .desc-footer {
      font-size: 14px;
      color: var(--text-secondary);
      margin-top: 8px;
  }
  
  .mobile-project-details .result-list {
      display: flex;
      flex-direction: column;
      gap: 4px;
  }

  .sidebar-right {
    display: none !important;
  }

  .sidebar-content {
    gap: var(--space-5);
  }

  .info-overlay {
    width: 100%;
  }
  
  html.custom-cursor-enabled,
  body.custom-cursor-enabled,
  body.custom-cursor-enabled * {
    cursor: auto !important;
  }
  
  #custom-cursor {
    display: none !important;
  }
}

/* Tablet breakpoint removed - merged into main media query */
