/* ============================================
   CSS TABLE OF CONTENTS
   ============================================
   1.  Reset & CSS Custom Properties
   2.  Base & Typography
   3.  Layout
   4.  Navigation
   5.  Contact Bar
   6.  Sections & Content Items
   7.  Home Section
   8.  Gallery
   9.  Photo Carousel
   10. Lightbox / Image Viewer
   11. Theme Toggle & Dark Mode
   12. Loading Screen
   13. Scroll Indicator
   14. Cursor Follower
   15. Responsive - Tablet (max-width: 1024px)
   16. Responsive - Mobile (max-width: 768px)
   17. Responsive - Small Mobile (max-width: 480px)
   18. Responsive - Touch Devices
   ============================================ */


/* ============================================
   1. RESET & CSS CUSTOM PROPERTIES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-light: #ffead3;
  --text-dark: #121212;
  --text-muted: #8b7355;
  --text-dark-80: #3f3c36;
  --text-dark-90: #282520;
  --item-secondary: #7f6b50;
  --text-muted-70: #b09a7e;
  --spacing: clamp(16px, 3vw, 40px);
  --line-color: #c9b99a;
}

@font-face {
  font-family: 'InterVariable';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('/fonts/InterVariable.woff2') format('woff2');
}

@font-face {
  font-family: 'InterVariable';
  font-style: italic;
  font-weight: 300 600;
  font-display: swap;
  src: url('/fonts/InterVariable-Italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/GeistMono-Regular.ttf') format('truetype');
}

@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/GeistMono-Medium.ttf') format('truetype');
}

@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/GeistMono-SemiBold.ttf') format('truetype');
}


/* ============================================
   2. BASE & TYPOGRAPHY
   ============================================ */
::selection {
  background-color: var(--text-dark);
  color: var(--bg-light);
}

::-moz-selection {
  background-color: var(--text-dark);
  color: var(--bg-light);
}

html {
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  scroll-behavior: smooth;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
  background-color: var(--bg-light);
  background-image: none;
  color-scheme: light;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
  background-color: var(--bg-light);
  background-image: none;
}

body.lightbox-open {
  position: fixed;
  width: 100%;
  overflow: hidden;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: transparent;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background-color: var(--text-muted);
  border-radius: 999px;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-dark);
}

body {
  font-family: 'InterVariable';
  color: var(--text-dark);
  line-height: 1.6;
}

a {
  color: var(--text-dark);
  text-decoration: underline;
}

a:hover {
  text-decoration: underline;
}

a,
button,
[role="button"],
.gallery-item {
  -webkit-tap-highlight-color: transparent;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible),
.gallery-item:focus:not(:focus-visible) {
  outline: none;
}


/* ============================================
   3. LAYOUT
   ============================================ */
.main-wrapper {
  min-height: 100vh;
  min-height: 100dvh;
  touch-action: pan-y;
  transform: translateY(100vh);
  transform: translateY(100dvh);
  transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}

.main-wrapper.visible {
  transform: none;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  padding: var(--spacing);
  gap: var(--spacing);
  touch-action: pan-y;
}

.sidebar {
  grid-column: 1 / 2;
  position: fixed;
  top: var(--spacing);
  left: var(--spacing);
  width: calc((100vw - (var(--spacing) * 5)) / 4);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: grid-column 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

body.is-resizing .sidebar {
  transition: none;
}

.content {
  grid-column: 2 / 5;
  overflow: visible;
  touch-action: pan-y;
  transition: grid-column 0.3s ease-in-out;
}


/* ============================================
   4. NAVIGATION
   ============================================ */
.nav-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-item {
  font-family: inherit;
  font-size: 13.2px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
  background: none;
  border: none;
  text-align: left;
  padding: 0;
  width: fit-content;
  white-space: nowrap;
}

.sidebar,
.mobile-top-bar,
.hamburger {
  font-family: 'Geist Mono';
}

.nav-item:hover {
  color: var(--text-dark);
}

.nav-item.active {
  color: var(--text-dark);
}

.mobile-top-bar {
  display: none;
}

.hamburger {
  display: none;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text-dark);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.open .hamburger-line:first-child {
  transform: translateY(4px) rotate(45deg);
}

.hamburger.open .hamburger-line:last-child {
  transform: translateY(-4px) rotate(-45deg);
}


/* ============================================
   5. CONTACT BAR
   ============================================ */
.contact-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: calc((100vw - (var(--spacing) * 5)) / 4 + (var(--spacing) * 2));
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  padding: 24px var(--spacing) var(--spacing);
  background-color: var(--bg-light);
  z-index: 100;
  font-family: 'Geist Mono';
}

.profile-photo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--text-muted);
  overflow: hidden;
  flex-shrink: 0;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: nowrap;
  white-space: nowrap;
  margin-left: 0;
}

.contact-bar a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.contact-bar a:hover {
  color: var(--text-dark);
  text-decoration: none;
}

.contact-bar .dot {
  color: var(--text-muted);
  font-size: 11px;
}

.contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.contact-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 13px);
  z-index: 20;
  display: block;
  padding: 7px 10px;
  background-color: var(--bg-light);
  border: 1px solid var(--line-color);
  color: var(--text-dark);
  font-family: 'Geist Mono';
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  transform: translate(-50%, 4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
  white-space: nowrap;
}

.contact-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% - 7px);
  width: 14px;
  height: 14px;
  background-color: var(--bg-light);
  border-right: 1px solid var(--line-color);
  border-bottom: 1px solid var(--line-color);
  transform: translateX(-50%) rotate(45deg);
  transition: border-color 0.16s ease;
}

.contact-icon:hover .contact-tooltip,
.contact-icon:focus-visible .contact-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
  border-color: var(--text-muted);
}

.contact-icon:hover .contact-tooltip::after,
.contact-icon:focus-visible .contact-tooltip::after {
  border-color: var(--text-muted);
}

.contact-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-icon svg.filled-icon {
  fill: currentColor;
  stroke: none;
}

.mobile-menu-contact {
  display: none;
}

/* ============================================
   6. SECTIONS & CONTENT ITEMS
   ============================================ */
section {
  position: relative;
  display: none;
  flex-direction: column;
  min-height: calc(100vh - (var(--spacing) * 2));
  min-height: calc(100dvh - (var(--spacing) * 2));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
  will-change: opacity;
  overflow: visible;
  padding-bottom: var(--spacing);
  touch-action: pan-y;
}

section.active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.section-description {
  font-family: 'InterVariable';
  font-size: clamp(24px, 4vw, 35px);
  line-height: 1.3;
  color: var(--text-dark);
  margin-bottom: clamp(20px, 3vw, 32px);
}

.section-description strong {
  font-weight: 600;
}

.section-description:not(.home-intro) {
  display: none;
}

.items {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.item {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(12px, 2vw, 24px);
  align-items: start;
  padding-top: 8px;
}

.item-meta {
  font-family: 'Geist Mono';
  font-size: 13.2px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding-top: 8px;
  border-top: 1px solid var(--line-color);
}

.item-meta:empty {
  border-top: none;
}

.item:has(.item-meta:not(:empty)) + .item:has(.item-meta:not(:empty)) {
  margin-top: 0;
}

.items > .item:has(.item-meta:not(:empty)):not(:first-child) {
  margin-top: 24px;
}

#experience .item:has(.item-meta:empty) + .item:has(.item-meta:not(:empty)) {
  margin-top: 0;
}

.item-content {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line-color);
}

.item-content > * {
  flex-basis: 100%;
}

.item-tags {
  font-size: 24px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted-70);
}

.item-title {
  font-size: 18.72px;
  font-weight: 400;
  line-height: 1.25;
}

.item-subtitle {
  font-size: 16.72px;
  line-height: 1.35;
  color: var(--item-secondary);
}

.item-content a {
  color: inherit;
  text-decoration: none;
}

.item-content a:hover {
  text-decoration: underline;
}

.item-content a[target="_blank"]::after {
  content: "↗";
  display: inline-block;
  margin-left: 0.2em;
  font-size: 0.7em;
  line-height: 1;
  vertical-align: 0.12em;
}

.date-text {
  font-family: 'Geist Mono';
}

.source-name,
#experience .item-subtitle,
.experience-location {
  font-family: 'Geist Mono';
}

.item-description {
  font-size: 16.72px;
  line-height: 1.35;
  color: var(--item-secondary);
  margin-top: 2px;
}

.item-description ul {
  margin: 4px 0 0 0;
  padding-left: 16px;
  list-style-type: disc;
}

.item-description ul li {
  margin-bottom: 4px;
}

.item-description ul li a {
  color: inherit;
}

.item-tools {
  font-family: 'Geist Mono';
  font-size: 13.2px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 4px;
}

.item-stats {
  font-family: 'Geist Mono';
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted-70);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.stat-badge {
  font-family: 'Geist Mono';
  background: var(--bg-light);
  color: var(--text-dark);
  border: 1px solid var(--text-dark);
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.stat-badge svg {
  width: 10px;
  height: 10px;
}

.role-badge {
  background: var(--bg-light);
  color: var(--text-dark);
  border: 1px solid var(--text-dark);
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 12px;
  letter-spacing: 0.1em;
}

#talks .item-meta,
#talks .item-subtitle,
#talks .item-tags,
#talks .role-badge {
  font-family: 'Geist Mono';
}



/* ============================================
   7. HOME SECTION
   ============================================ */
.home-intro {
  --home-name-size: clamp(32px, 4.8vw, 52px);
  --home-role-size: clamp(17px, 1.85vw, 23px);
  font-size: var(--home-name-size);
  line-height: 1.08;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
  max-width: min(760px, 100%);
}

.home-intro a {
  color: inherit;
  text-decoration: none;
}

.home-intro a:hover {
  text-decoration: underline;
}

.home-intro a[target="_blank"]::after {
  content: "↗";
  display: inline-block;
  margin-left: 0.2em;
  font-size: 0.7em;
  line-height: 1;
  vertical-align: 0.12em;
}

.home-name {
  color: var(--text-dark);
  font-size: calc(var(--home-role-size) + 4px);
  line-height: 1.35;
}

.home-roles {
  color: var(--item-secondary);
  font-size: var(--home-role-size);
  line-height: 1.35;
}

.home-work-link {
  display: none;
  align-self: flex-start;
  margin-top: -2px;
  border: 1px solid var(--text-dark);
  border-radius: 22px;
  background: transparent;
  color: var(--text-dark);
  font-family: 'InterVariable';
  font-size: 14px;
  line-height: 1.1;
  cursor: pointer;
  padding: 8px 12px;
}

.home-work-link span {
  display: inline-block;
  margin-left: 1.2em;
  font-size: 0.9em;
  transition: transform 0.16s ease;
}

.home-work-link:hover span {
  transform: translateX(3px);
}

/* ============================================
   8. GALLERY
   ============================================ */
#gallery {
  position: relative;
  overflow-x: hidden;
}

#gallery .bento-grid {
  width: 100%;
}

.bento-grid {
  display: flex;
  gap: 6px;
  width: 100%;
}

.gallery-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.gallery-item {
  overflow: hidden;
  border-radius: 0;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .gallery-item img {
    will-change: transform;
  }

  .gallery-item:hover img {
    transform: scale(1.02);
  }
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 1;
  transition: opacity 0.2s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item.is-loading {
  background-color: var(--line-color);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.gallery-item.is-loading img {
  opacity: 0;
}

.gallery-skeleton {
  background-color: var(--line-color);
  border-radius: 0;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.3; }
}


/* ============================================
   9. PHOTO CAROUSEL
   ============================================ */
.photo-carousel-wrapper {
  position: fixed;
  left: 0;
  right: 0;
  height: 200px;
  overflow: hidden;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
  will-change: opacity;
}

.photo-carousel-wrapper.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease-in-out, visibility 0s;
}

.photo-carousel-wrapper.hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0s, visibility 0s;
}

.photo-carousel {
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-x;
  user-select: none;
}

.photo-carousel::-webkit-scrollbar {
  display: none;
}

.photo-carousel-track {
  display: flex;
  width: max-content;
  height: 100%;
}

.photo-carousel img {
  height: 100%;
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
  margin-right: 8px;
}

.photo-carousel img.carousel-img-loaded {
  opacity: 1;
}

.carousel-skeleton {
  height: 100%;
  width: 140px;
  flex-shrink: 0;
  margin-right: 8px;
  background-color: var(--line-color);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.photo-carousel.loading, .photo-carousel .error {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  height: 100%;
}


/* ============================================
   10. LIGHTBOX / IMAGE VIEWER
   ============================================ */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  --lightbox-control-gap: 68px;
  --lightbox-counter-size: clamp(13px, 1.1vw, 18px);
  padding:
    calc(var(--spacing) + var(--lightbox-control-gap) + 38px)
    var(--spacing)
    calc(var(--spacing) + var(--lightbox-control-gap) + var(--lightbox-counter-size));
  background-color: rgba(0, 0, 0, 0.985);
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lightbox-story-bar {
  position: absolute;
  top: var(--spacing);
  left: var(--spacing);
  right: var(--spacing);
  z-index: 3;
  height: 2px;
  overflow: hidden;
  background-color: rgba(255, 234, 211, 0.18);
}

.lightbox-story-progress {
  width: 100%;
  height: 100%;
  background-color: #ffead3;
  transform: scaleX(0);
  transform-origin: left center;
}

.lightbox.active .lightbox-story-progress.is-running {
  animation: story-progress 5s linear forwards;
}

@keyframes story-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.lightbox-tap-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 25%;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-tap-zone:focus {
  outline: none;
}

.lightbox-hint-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  align-items: center;
  justify-items: center;
  gap: 12px;
  padding: calc(var(--spacing) * 2);
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.84), rgba(0, 0, 0, 0.66) 34%, transparent 72%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.76), rgba(0, 0, 0, 0.34) 28%, rgba(0, 0, 0, 0.34) 72%, rgba(0, 0, 0, 0.76));
  opacity: 0;
  pointer-events: none;
}

.lightbox-hint-overlay.is-visible {
  animation: lightbox-hint 3s ease-out forwards;
}

.lightbox-hint-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #ffead3;
  font-family: 'InterVariable';
  font-size: clamp(11px, 1.8vw, 12px);
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
}

.lightbox-hint-symbol {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffead3;
}

.lightbox-hint-arrow {
  font-size: 30px;
  line-height: 1;
  font-weight: 300;
}

.lightbox-hint-arrow-left {
  animation: hint-arrow-left-bob 1.05s ease-in-out infinite;
}

.lightbox-hint-arrow-right {
  animation: hint-arrow-right-bob 1.05s ease-in-out infinite;
}

.lightbox-hint-click {
  position: relative;
}

.lightbox-hint-click::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}

.lightbox-hint-click::after {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 234, 211, 0.76);
  animation: hint-click-ring 1.25s ease-in-out infinite;
}

@keyframes hint-arrow-left-bob {
  0%, 100% { transform: translateX(5px); }
  50% { transform: translateX(-7px); }
}

@keyframes hint-arrow-right-bob {
  0%, 100% { transform: translateX(-5px); }
  50% { transform: translateX(7px); }
}

@keyframes hint-click-ring {
  0% { transform: scale(0.75); opacity: 0; }
  36% { opacity: 0.78; }
  100% { transform: scale(1.2); opacity: 0; }
}

.lightbox-tap-prev {
  left: 0;
}

.lightbox-pause-zone {
  left: 25%;
  width: 50%;
  cursor: default;
}

.lightbox-tap-next {
  right: 0;
}

@keyframes lightbox-hint {
  0% {
    opacity: 0;
  }
  16% {
    opacity: 1;
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.lightbox-content {
  position: relative;
  max-width: calc(100vw - (var(--spacing) * 2));
  max-height: calc(100vh - (var(--spacing) * 2) - (var(--lightbox-control-gap) * 2) - 38px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: calc(100vh - (var(--spacing) * 2) - (var(--lightbox-control-gap) * 2) - 38px);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  background: transparent;
  border: 1px solid rgba(255, 234, 211, 0.35);
  color: rgba(255, 234, 211, 0.68);
  font-size: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
  font-family: 'InterVariable';
}

.lightbox-close:hover {
  border-color: #ffead3;
  color: #ffead3;
}

.lightbox-close {
  top: calc(var(--spacing) + 14px);
  right: var(--spacing);
  z-index: 4;
  background: none;
  border: none;
  border-radius: 0;
  color: #ffead3;
  font-size: 30px;
  width: 38px;
  height: 38px;
}

.lightbox-close:hover {
  background: none;
  color: #ffead3;
}

.lightbox-counter {
  position: absolute;
  bottom: var(--spacing);
  left: 50%;
  transform: translateX(-50%);
  color: #ffead3;
  font-size: var(--lightbox-counter-size);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}


/* ============================================
   11. THEME TOGGLE & DARK MODE
   ============================================ */
.theme-toggle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background-color: var(--text-dark);
  cursor: pointer;
  transition: background-color 0.5s ease-in-out, opacity 0.5s ease-in-out;
  margin-top: 8px;
  flex-shrink: 0;
}

.dark-mode {
  --bg-light: #121212;
  --text-dark: #ffead3;
  --text-muted: #a89880;
  --text-dark-80: #d4c1ad;
  --text-dark-90: #e9d6c0;
  --item-secondary: #b8a58e;
  --text-muted-70: #7d7260;
  --line-color: #3d3d3d;
  color-scheme: dark;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.4s;
  animation-timing-function: ease-in-out;
}


/* ============================================
   12. LOADING SCREEN
   ============================================ */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-light);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
  opacity: 0;
}

.loading-screen.ready {
  opacity: 1;
}

.loading-screen.hidden {
  transform: translateY(-100%);
  pointer-events: none;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: var(--text-dark);
  font-family: 'InterVariable';
}

.loading-percentage {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.1em;
}


/* ============================================
   13. SCROLL INDICATOR
   ============================================ */
.scroll-indicator-btn {
  position: fixed;
  right: calc(var(--spacing) + 8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 95;
  background: var(--bg-light);
  border: 1px solid var(--line-color);
  border-radius: 50%;
  width: 39px;
  height: 39px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  font: inherit;
}

.scroll-indicator-btn:hover {
  border-color: var(--text-muted);
}

.scroll-indicator-btn.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-indicator-down {
  bottom: 20px;
}

.scroll-indicator-up {
  top: 20px;
}

.scroll-indicator-btn svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  will-change: transform;
}

.scroll-indicator-down svg {
  animation: bounce-down 2s infinite;
}

.scroll-indicator-up svg {
  animation: bounce-up 2s infinite;
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .photo-carousel {
    scroll-behavior: auto;
  }

  .scroll-indicator-btn svg,
  .gallery-skeleton,
  .carousel-skeleton {
    animation: none !important;
  }
}


/* ============================================
   14. CURSOR FOLLOWER
   ============================================ */
.cursor-follower {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #ffead3;
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  transform: translate3d(0, 0, 0) translate(-50%, -50%);
  transition: width 0.3s ease-in-out, height 0.3s ease-in-out;
  will-change: transform, width, height;
  mix-blend-mode: difference;
}

.cursor-follower.hovering {
  width: 30px;
  height: 30px;
}

@media (hover: none) and (pointer: coarse) {
  .cursor-follower {
    display: none !important;
  }
}


/* ============================================
   15. RESPONSIVE - TABLET (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr 2fr;
  }

  .sidebar {
    grid-column: 1 / 2;
    width: calc((100vw - (var(--spacing) * 3)) / 3);
  }

  .content {
    grid-column: 2 / 3;
  }

  .cursor-follower {
    display: none !important;
  }

  .item {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 0 0 12px;
  }

  .item-content {
    grid-column: 1;
    padding-top: 8px;
  }

  .item-meta {
    border-top: none;
    padding-top: 0;
  }

  .item-meta:empty {
    display: none;
  }

  #experience .item:has(.item-meta:empty) + .item:has(.item-meta:not(:empty)) {
    margin-top: 8px;
  }
}


/* ============================================
   16. RESPONSIVE - MOBILE (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
  html, body {
    overflow: auto;
    height: auto;
    overscroll-behavior: auto;
    touch-action: pan-y;
    scrollbar-width: thin;
  }

  html.home-active,
  body.home-active,
  html.menu-active,
  body.menu-active {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    overscroll-behavior: none;
    touch-action: none;
  }

  .mobile-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding:
      calc(var(--spacing) + env(safe-area-inset-top, 0px))
      calc(var(--spacing) + env(safe-area-inset-right, 0px))
      12px
      calc(var(--spacing) + env(safe-area-inset-left, 0px));
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10020;
    background-color: var(--bg-light);
    background-image: none;
    border: 0;
    box-shadow: none;
    outline: 0;
  }

  .mobile-top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .mobile-top-bar .profile-photo {
    display: block;
  }

  .mobile-profile-photo {
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0;
  }

  .mobile-top-bar .theme-toggle {
    margin-top: 0;
  }

  .scroll-indicator-btn.visible {
    opacity: 1;
    visibility: visible;
  }

  .scroll-indicator-up {
    top: calc(var(--spacing) + 44px);
  }

  .hamburger {
    display: flex;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: calc(var(--spacing) + env(safe-area-inset-top, 0px) + 44px + 64px);
  }

  body.home-active .layout {
    padding-top: calc(var(--spacing) + env(safe-area-inset-top, 0px) + 44px);
  }

  .nav-links .theme-toggle {
    display: none;
  }

  .sidebar {
    position: fixed;
    inset: 0;
    width: auto;
    z-index: 10010;
    background-color: var(--bg-light);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 24px;
    padding:
      calc(var(--spacing) + env(safe-area-inset-top, 0px) + 44px + 64px)
      calc(var(--spacing) + env(safe-area-inset-right, 0px))
      calc(72px + env(safe-area-inset-bottom, 0px))
      calc(var(--spacing) + env(safe-area-inset-left, 0px));
    transform: translateX(100%);
    visibility: hidden;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1), visibility 0.35s;
  }

  .sidebar.menu-open {
    transform: translateX(0);
    visibility: visible;
  }

  .nav-links {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    width: 100%;
    font-family: 'InterVariable';
  }

  .nav-links.menu-text-repaint {
    opacity: 0.999;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }

  .nav-item {
    font-size: 32px;
    letter-spacing: 0;
    line-height: 1.1;
    padding: 2px 0;
    text-align: left;
    text-transform: none;
  }

  .sidebar .nav-item[data-target="home"] {
    display: none;
  }

  .mobile-menu-contact {
    display: flex;
    position: fixed;
    left: var(--spacing);
    right: var(--spacing);
    bottom: calc(var(--spacing) + env(safe-area-inset-bottom, 0px));
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0;
    font-family: 'InterVariable';
  }

  .mobile-menu-contact a {
    color: var(--text-muted);
    text-decoration: none;
  }

  .mobile-menu-contact .contact-icon {
    width: 36px;
    height: 36px;
    padding: 8px;
  }

  .mobile-menu-contact a:hover {
    color: var(--text-dark);
    text-decoration: none;
  }

  .mobile-menu-contact {
    justify-content: center;
  }

  .contact-bar {
    display: none;
  }

  .content {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
  }

  .home-intro {
    --home-name-size: clamp(28px, 8vw, 42px);
    --home-role-size: clamp(16px, 4.4vw, 20px);
    margin-top: 0;
    line-height: 1.12 !important;
  }

  .home-work-link {
    display: inline-flex;
    align-items: center;
  }

  .section-description {
    font-size: clamp(24px, 6vw, 32px);
    margin-bottom: 20px;
  }

  #experience {
    min-height: auto;
    padding-bottom: 0;
  }

  .item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .item-content {
    grid-column: 1;
  }

  .item-meta {
    border-top: none;
  }

  .item-meta:empty {
    display: none;
  }

  #experience .item:has(.item-meta:empty) + .item:has(.item-meta:not(:empty)) {
    margin-top: 8px;
  }

  .lightbox {
    flex-direction: column;
    justify-content: center;
    gap: 0;
    padding:
      calc(var(--spacing) + var(--lightbox-control-gap) + 38px)
      var(--spacing)
      calc(var(--spacing) + var(--lightbox-control-gap) + var(--lightbox-counter-size) + 10px);
  }

  .lightbox-story-bar {
    top: var(--spacing);
    left: var(--spacing);
    right: var(--spacing);
  }

  .lightbox-close {
    position: absolute;
    top: calc(var(--spacing) + 14px);
    right: var(--spacing);
    width: 44px;
    height: 44px;
    font-size: 18px;
    border: none;
  }

  .lightbox-content {
    order: initial;
    max-width: calc(100vw - (var(--spacing) * 2));
    max-height: calc(100vh - (var(--spacing) * 2) - (var(--lightbox-control-gap) * 2) - 38px);
    max-height: calc(100dvh - (var(--spacing) * 2) - (var(--lightbox-control-gap) * 2) - 38px);
  }

  .lightbox-content img {
    max-height: calc(100vh - (var(--spacing) * 2) - (var(--lightbox-control-gap) * 2) - 38px);
    max-height: calc(100dvh - (var(--spacing) * 2) - (var(--lightbox-control-gap) * 2) - 38px);
  }

  .lightbox-counter {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    border: none;
  }

  .scroll-indicator-btn {
    right: calc(var(--spacing) + 8px);
  }

  .scroll-indicator-down {
    bottom: 30px;
  }

  .scroll-indicator-up {
    top: calc(var(--spacing) + 44px + 10px);
  }

  .contact-bar {
    width: auto;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0;
  }
}


/* ============================================
   17. RESPONSIVE - SMALL MOBILE (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
  #gallery {
    padding-left: 0;
    padding-right: 0;
  }

  .home-intro {
    --home-name-size: clamp(27px, 8.4vw, 38px);
    --home-role-size: clamp(15px, 4.6vw, 19px);
    margin-top: 0;
    line-height: 1.12 !important;
  }

  .profile-photo {
    display: none;
  }

  .contact-links {
    margin-left: 0;
  }
}


/* ============================================
   18. RESPONSIVE - TOUCH DEVICES
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  section {
    scrollbar-width: thin;
  }
}
