@font-face {
  font-family: "Inter";
  src: url("./assets/fonts/Inter-Light.woff2") format("woff2");
  font-weight: 300 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-inter: "Inter";
  --bg-primary: #000000;
  --bg-secondary: #070707;
  --text-primary: #ffffff;
  --text-secondary: #555555;
  --dot-bg: #ffffff;
  --cursor-color: #EBFF00;
}

html.light-mode,
body.light-mode {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --text-primary: #000000;
  --text-secondary: #888888;
  --dot-bg: #000000;
  --cursor-color: #000000;
}

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

html {
  background-color: var(--bg-secondary);
  transition: background-color 0.6s ease;
}

body {
  font-family: var(--font-inter), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: transparent;
  color: var(--text-primary);
  transition: color 0.6s ease;
  overflow-x: hidden;
  overscroll-behavior: none;
  min-height: 100vh;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

.portfolio-main {
  width: 100%;
  height: 100dvh;
  background-color: var(--bg-secondary);
  position: relative;
  overflow: hidden;
  touch-action: none;
  transition: background-color 0.6s ease;
}

.portfolio-main.phase-2 {
  touch-action: auto;
}

/* Main Foreground Stage (Carousel + Hero Header) */
.stage-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  z-index: 5;
  transform-origin: center center;
  pointer-events: auto;
  background-color: var(--bg-secondary);
  will-change: transform, filter, opacity;
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1),
              filter 1.2s cubic-bezier(0.22, 1, 0.36, 1),
              background-color 0.6s ease;
}

.stage-wrapper.is-expanded {
  transform: scale(0.93);
  opacity: 0.3;
  filter: blur(10px);
  pointer-events: none;
}

/* Carousel */
.carousel-section {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.carousel-section.phase-2 {
  opacity: 1;
  pointer-events: auto;
}

.carousel-container {
  width: 100%;
  height: 100dvh;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  padding-top: 20px;
}

@media (max-width: 767px) {
  .carousel-container {
    padding-top: 8px;
  }
}

.carousel-track {
  display: flex;
  align-items: flex-start;
  will-change: transform;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.carousel-track.no-transition {
  transition: none !important;
}

.carousel-slide {
  flex-shrink: 0;
  flex-grow: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: flex-basis 0.8s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.carousel-slide-drop {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  will-change: transform, opacity;
}

.carousel-slide-media-box {
  width: 100%;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  cursor: auto;
}

.carousel-slide-media-box.is-clickable {
  cursor: pointer;
}

.carousel-slide-media-box img,
.carousel-slide-media-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Active Slide Link */
.slide-project-link {
  position: absolute;
  bottom: 20px;
  left: 20px;
  color: #ffffff;
  font-size: 20px;
  text-decoration: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 30;
  display: flex;
  flex-direction: row;
  font-weight: 300;
  align-items: center;
}

.slide-project-link.is-active {
  pointer-events: auto;
  opacity: 1;
}

.slide-project-link-text {
  height: 28px;
  display: flex;
  align-items: center;
}

.slide-project-link-arrow {
  display: flex;
  align-items: center;
  height: 28px;
  margin-left: 8px;
  font-weight: 300;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.slide-project-link.is-hovered .slide-project-link-arrow,
.carousel-slide-media-box.is-hovered .slide-project-link.is-active .slide-project-link-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Static Active Title Overlay */
.carousel-active-overlay {
  position: absolute;
  top: 0;
  left: 0;
  height: 250px;
  padding-top: 32px;
  padding-left: 34px;
  z-index: 9999;
  transform: translateZ(100px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease-out 1.8s;
}

.carousel-active-overlay.phase-2 {
  opacity: 1;
}

@media (max-width: 767px) {
  .carousel-active-overlay {
    padding-top: 16px;
    padding-left: 18px;
  }
}

.carousel-active-overlay-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.carousel-active-dot {
  width: 10px;
  height: 10px;
  background-color: #ffffff;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.carousel-active-title {
  color: #ffffff;
  font-size: 18px;
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.5px;
  white-space: normal;
}

/* Hero Header */
.hero-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  z-index: 10;
}

.hero-header.phase-2 {
  justify-content: flex-end;
}

.hero-title-motion {
  pointer-events: auto;
  width: 100%;
  will-change: transform;
}

.hero-title-padding {
  width: 100%;
  padding: 20px;
}

.responsive-title-scale {
  transform: scale(1);
  transform-origin: top left;
}

@media (min-width: 1024px) {
  .responsive-title-scale {
    transform: scale(2);
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .responsive-title-scale.phase-2 {
    transform: scale(1);
  }
}

.hero-h1 {
  font-size: clamp(24px, 3vw, 44px);
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 0;
  letter-spacing: -1px;
  line-height: 1.1;
  white-space: pre-wrap;
  transition: color 0.6s ease;
  -webkit-font-smoothing: antialiased;
}

.hero-h2 {
  font-size: clamp(24px, 3vw, 44px);
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: -1px;
  line-height: 1.1;
  margin: 0;
  white-space: pre-wrap;
  transition: color 0.6s ease;
  -webkit-font-smoothing: antialiased;
}

.hero-char {
  display: inline-block;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-char.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Presentation Slide-Up Container */
.presentation-slide-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  background-color: var(--bg-primary);
  z-index: 100;
  transform: translateY(100dvh);
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.6s ease;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: block;
  will-change: transform;
}

.presentation-slide-container.is-expanded {
  transform: translateY(0dvh);
}

.presentation-slide-content {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 20px 20px 80px 20px;
  box-sizing: border-box;
  gap: 64px;
  color: var(--text-primary);
  transition: color 0.6s ease;
}

.presentation-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-shrink: 0;
  width: calc(100% - 120px);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.presentation-left-text {
  font-size: 24px;
  line-height: 1.2;
}

@media (max-width: 500px) {
  .presentation-left-text {
    max-width: 280px;
  }
}

.presentation-image-wrapper {
  flex: none;
  width: 100%;
  max-width: 275px;
  height: auto;
  aspect-ratio: 1 / 1;
}

.presentation-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}

.presentation-credentials {
  font-size: 12px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
}

@keyframes live-blink {
  0% { opacity: 1; }
  50% { opacity: 0.15; }
  100% { opacity: 1; }
}

.blinking-dot {
  animation: live-blink 1.5s ease-in-out infinite;
  font-size: 12px;
}

.presentation-right {
  display: flex;
  flex-direction: column;
  gap: 48px;
  flex-shrink: 0;
  padding-bottom: 64px;
  width: calc(100% - 120px);
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: 20px;
  line-height: 1.4;
}

.footer-heading {
  color: #555555;
  font-size: 20px;
  font-weight: 300;
  font-family: inherit;
  margin-bottom: 16px;
}

.footer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (min-width: 1024px) {
  .presentation-slide-content {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    padding-bottom: 20px;
  }
  .presentation-left {
    grid-column: span 3;
    padding-right: 0;
    width: 100%;
  }
  .presentation-right {
    grid-column: 6 / 13;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding-bottom: 0;
    padding-right: 0;
    width: 100%;
  }
}

/* Footer Link Arrow Animation */
.footer-link {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-right: 24px;
}

.footer-link-text {
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.footer-link::before {
  content: "→";
  font-family: var(--font-inter), sans-serif !important;
  font-weight: 300;
  position: absolute;
  left: 0;
  top: 50%;
  opacity: 0;
  transform: translateY(-50%) scale(0);
  transform-origin: left center;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.footer-link:hover .footer-link-text {
  transform: translateX(24px);
}

.footer-link:hover::before {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* Loading Progress Overlay */
.loading-overlay {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay.is-visible {
  opacity: 1;
}

.loading-indicator {
  position: relative;
  width: 100%;
  height: 40px;
}

.loading-number-wrapper {
  position: absolute;
  left: 0%;
  transform: translateX(0%);
  display: flex;
  align-items: baseline;
  bottom: 0;
}

.loading-number {
  font-size: 20px;
  color: var(--text-primary);
  font-weight: 300;
  line-height: 0.8;
  transition: color 0.6s ease;
}

/* Theme Toggle Button */
.theme-toggle-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.theme-toggle-container.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--dot-bg);
  cursor: pointer;
  border: none;
  padding: 0;
  transition: background-color 0.6s ease;
}

/* Custom Cursors */
.global-custom-cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  background-color: var(--cursor-color);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.2s ease, background-color 0.6s ease;
  will-change: transform;
}

.carousel-custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  color: var(--dot-bg);
  border-radius: 50%;
  opacity: 0;
  transform: translate3d(-100px, -100px, 0) translate(-50%, -50%) scale(0.5);
  transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  will-change: transform, opacity;
}

@media (hover: none) and (pointer: coarse) {
  .global-custom-cursor,
  .carousel-custom-cursor {
    display: none !important;
  }
}

@media (hover: hover) and (pointer: fine) {
  .hide-system-cursor,
  .hide-system-cursor * {
    cursor: none !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
