/* ============================================
   403 Super Vega Custom Font
   ============================================ */
@font-face {
  font-family: '403 Super Vega';
  src: url('../fonts/403-super-vega-regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
  /* Colors */
  --color-bg: #000000;
  --color-text: #FFFFFF;
  --color-placeholder: #d9d9d9;
  
  /* Typography - Desktop */
  --font-title: '403 Super Vega', sans-serif;
  --font-body: 'Nanum Myeongjo', serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-arrow: 'Alegreya', serif;
  
  --title-size: 136px;
  --title-line-height: 130px;
  --title-letter-spacing: -4px;
  
  --body-size: 20px;
  --body-line-height: 26px;
  
  --label-size: 14px;
  --label-line-height: 14px;
  
  --arrow-size: 18px;
  --arrow-line-height: 21.6px;
  
  --index-size: 27px;
  --index-line-height: 35.4px;
  
  /* Spacing */
  --page-padding: 30px;
  --corner-size: 25px;
  
  /* Carousel */
  --carousel-gap: 44px;
  --carousel-top: 96px;
  --carousel-left: 580px;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Corner Accents
   ============================================ */
.corner-accent {
  position: fixed;
  width: var(--corner-size);
  height: var(--corner-size);
  background-color: var(--color-text);
  z-index: 100;
  pointer-events: none;
}

.corner-accent.top-left {
  top: 0;
  left: 0;
}

.corner-accent.top-right {
  top: 0;
  right: 0;
}

.corner-accent.bottom-left {
  bottom: 0;
  left: 0;
}

.corner-accent.bottom-right {
  bottom: 0;
  right: 0;
}

/* ============================================
   Back Button
   ============================================ */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--color-text);
  border-radius: 30px;
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--label-size);
  font-weight: 500;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  width: fit-content;
  flex-shrink: 0;
  white-space: nowrap;
  margin-bottom: 20px;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
}

.back-arrow {
  font-family: var(--font-arrow);
  font-size: 16px;
  font-style: italic;
  flex-shrink: 0;
}

/* ============================================
   Gallery Page Layout
   ============================================ */
.gallery-page {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ============================================
   Left Content Section
   ============================================ */
.gallery-content {
  position: absolute;
  top: 35px;
  left: var(--page-padding);
  width: 520px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 35px - var(--page-padding));
  z-index: 1;
}

.gallery-title {
  font-family: var(--font-title);
  font-size: var(--title-size);
  font-weight: normal;
  line-height: var(--title-line-height);
  letter-spacing: var(--title-letter-spacing);
  white-space: nowrap;
  margin-bottom: auto;
}

/* Instructions & Learn More */
.gallery-info {
  margin-top: auto;
}

.instruction-text {
  font-family: var(--font-body);
  font-size: var(--body-size);
  font-weight: 700;
  line-height: var(--body-line-height);
  margin-bottom: 26px;
}

.learn-more {
  font-family: var(--font-body);
  font-size: var(--body-size);
  font-weight: 700;
  line-height: var(--body-line-height);
  margin-bottom: 22px;
}

/* Navigation Buttons */
.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow: visible;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 30px;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
  width: fit-content;
  flex-shrink: 0;
  overflow: visible;
}

.btn:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.btn-text {
  font-family: var(--font-mono);
  font-size: var(--label-size);
  font-weight: 500;
  line-height: var(--label-line-height);
  text-transform: uppercase;
}

.btn-arrow {
  font-family: var(--font-arrow);
  font-size: var(--arrow-size);
  font-style: italic;
  line-height: 1;
  flex-shrink: 0;
}

.btn-primary {
  background-color: var(--color-text);
  color: var(--color-bg);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.btn-secondary.active {
  background-color: rgba(255, 255, 255, 0.1);
}

/* CTA Styles */
.cta-text {
  font-family: var(--font-body);
  font-size: var(--body-size);
  font-weight: 700;
  line-height: var(--body-line-height);
  margin-bottom: 22px;
}

.cta-primary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: nowrap;
}

.cta-primary-row .cta-text {
  margin-bottom: 0;
  display: inline;
  white-space: nowrap;
}

.cta-arrow {
  font-family: var(--font-body);
  font-size: var(--body-size);
  font-weight: 700;
  color: var(--color-text);
  line-height: var(--body-line-height);
}

/* ============================================
   Carousel Section
   ============================================ */
.carousel-wrapper {
  position: absolute;
  top: var(--carousel-top);
  left: var(--carousel-left);
  right: 0;
  /* Responsive height: fills from top offset to bottom with padding */
  height: calc(100vh - var(--carousel-top) - var(--page-padding));
  height: calc(100dvh - var(--carousel-top) - var(--page-padding));
  overflow: visible;
  z-index: 5;
}

.carousel-track {
  display: flex;
  gap: var(--carousel-gap);
  height: 100%;
  padding-right: 100px;
  cursor: grab;
  user-select: none;
  will-change: transform;
  transition: transform 0.05s ease-out;
  touch-action: pan-y pinch-zoom; /* Allow vertical scroll, handle horizontal ourselves */
}

.carousel-track:active {
  cursor: grabbing;
}

/* Carousel Item */
.carousel-item {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  height: 100%;
}

/* Index number aligned at start (top) */
.carousel-item:nth-child(odd) {
  align-items: flex-start;
}

/* Index number aligned at end (bottom) for even items */
.carousel-item:nth-child(even) {
  align-items: flex-end;
}

.item-index {
  font-family: var(--font-body);
  font-size: var(--index-size);
  font-weight: 700;
  line-height: var(--index-line-height);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Media container - responsive sizing */
.item-media {
  height: 100%;
  background-color: transparent;
  flex-shrink: 0;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-media img,
.item-media video {
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Placeholder styling when no media loaded */
.item-media.placeholder {
  background-color: var(--color-placeholder);
}

/* Video items - desktop */
.carousel-item.video-item .item-media {
  position: relative;
  min-width: 300px;
  min-height: 200px;
  overflow: hidden;
  border-radius: 2px;
}

.carousel-item.video-item .item-media video {
  border-radius: 2px;
}

/* Video shimmer - shows by default for unloaded videos */
.carousel-item.video-item .item-media:not(.video-loaded) {
  background: #1a1a1a;
}

.carousel-item.video-item .item-media:not(.video-loaded)::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 20%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.08) 80%,
    transparent 100%
  );
  animation: shimmerSlide 1.5s ease-in-out infinite;
  z-index: 1;
  pointer-events: none;
}

/* Hide video until loaded */
.carousel-item.video-item .item-media:not(.video-loaded) video {
  opacity: 0;
}

.carousel-item.video-item .item-media.video-loaded video {
  opacity: 1;
  transition: opacity 0.3s ease;
}

@keyframes shimmerSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================
   Scroll Indicators (optional subtle hint)
   ============================================ */
.scroll-hint {
  position: absolute;
  right: var(--page-padding);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.3);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  opacity: 1;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 5;
}

.scroll-hint.hidden {
  opacity: 0;
}


/* ============================================
   Responsive - Tablet (1024px and below)
   ============================================ */
@media screen and (max-width: 1024px) {
  :root {
    --title-size: 90px;
    --title-line-height: 86px;
    --title-letter-spacing: -3px;
  }
}

/* ============================================
   Mobile Responsive Styles
   ============================================ */
@media screen and (max-width: 768px) {
  :root {
    --title-size: 42px;
    --title-line-height: 40px;
    --title-letter-spacing: -1px;
    
    --body-size: 15px;
    --body-line-height: 24px;
    
    --label-size: 12px;
    --arrow-size: 14px;
    
    --index-size: 18px;
    --index-line-height: 24px;
    
    --page-padding: 20px;
    --corner-size: 15px;
    
    --carousel-gap: 24px;
  }
  
  /* Allow scrolling on mobile */
  html, body {
    height: auto;
    overflow: auto;
    overflow-x: hidden;
  }
  
  /* Stacked layout for mobile - natural document flow */
  .gallery-page {
    display: block;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    padding-bottom: 40px;
  }
  
  /* Title section fixed at top */
  .gallery-content {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 25px var(--page-padding) 30px;
    height: auto;
    display: block;
    background: linear-gradient(to bottom, 
      var(--color-bg) 0%, 
      var(--color-bg) 60%, 
      rgba(0, 0, 0, 0) 100%
    );
    z-index: 10;
  }
  
  .gallery-title {
    margin-bottom: 0;
  }
  
  /* Hide info section inside gallery-content on mobile */
  .gallery-content .gallery-info {
    display: none;
  }
  
  /* Carousel as vertical scroll - add padding top for fixed header */
  .carousel-wrapper {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    height: auto;
    margin-top: 0;
    padding-top: 110px; /* Space for fixed header */
    overflow: visible;
    padding-left: var(--page-padding);
    padding-right: var(--page-padding);
  }
  
  .carousel-track {
    display: flex;
    flex-direction: column;
    gap: var(--carousel-gap);
    height: auto;
    padding: 0;
    cursor: default;
    transform: none !important;
    will-change: auto;
    touch-action: auto;
  }
  
  .carousel-track:active {
    cursor: default;
  }
  
  /* Carousel items stack vertically */
  .carousel-item {
    display: flex;
    flex-direction: row;
    gap: 10px;
    height: auto;
    width: 100%;
    flex-shrink: 0;
    align-items: flex-start;
  }
  
  /* All items have index at top on mobile */
  .carousel-item:nth-child(odd),
  .carousel-item:nth-child(even) {
    align-items: flex-start;
  }
  
  .item-index {
    flex-shrink: 0;
    min-width: 28px;
  }
  
  /* Mobile: images take full available width */
  .carousel-item .item-media {
    height: auto;
    width: 100%;
    max-width: 100%;
    flex: 1;
    background-color: transparent;
  }
  
  .carousel-item .item-media img,
  .carousel-item .item-media video {
    height: auto;
    width: 100%;
    max-width: 100%;
    object-fit: contain;
  }
  
  .btn {
    padding: 6px 12px;
    width: fit-content;
    flex-shrink: 0;
    overflow: visible;
  }
  
  .btn-text {
    font-size: 12px;
    flex-shrink: 0;
  }
  
  .btn-arrow {
    font-size: 14px;
    flex-shrink: 0;
  }
  
  /* Hide scroll hint on mobile */
  .scroll-hint {
    display: none;
  }
  
  /* Back button mobile sizing */
  .back-button {
    padding: 6px 12px;
    font-size: 12px;
    margin-bottom: 10px;
  }
  
  .back-arrow {
    font-size: 14px;
  }
  
  /* Videos on mobile take full width */
  .carousel-item.video-item .item-media {
    width: 100%;
    height: auto;
  }
  
  .carousel-item.video-item .item-media video {
    width: 100%;
    height: auto;
  }
}

/* Extra small screens */
@media screen and (max-width: 480px) {
  :root {
    --title-size: 48px;
    --title-line-height: 44px;
    --title-letter-spacing: -1.5px;
    
    --body-size: 15px;
    --body-line-height: 24px;
  }
  
  .btn {
    padding: 5px 10px;
    width: fit-content;
    flex-shrink: 0;
    overflow: visible;
  }

  .btn-text {
    font-size: 11px;
    flex-shrink: 0;
  }
  
  .btn-arrow {
    font-size: 13px;
    flex-shrink: 0;
  }
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
  display: none !important;
}

