/* ==========================================================================
   City Scroll Journey - Tokyo Miniature
   Vinyl-toy diorama aesthetic with GSAP ScrollTrigger
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* Tokyo-inspired palette with miniature toy feel */
  --color-bg: #1a1a2e;
  --color-surface: #16213e;
  --color-surface-light: #0f3460;
  --color-text: #e8e8e8;
  --color-text-muted: #a0a0a0;
  
  /* Scene accent colors */
  --accent-skyline: #FF6B9D;
  --accent-market: #FFD93D;
  --accent-shibuya: #6BCB77;
  --accent-temple: #9B59B6;
  --accent-waterfront: #3498DB;
  
  /* Typography */
  --font-display: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 8rem;
  
  /* Journey dimensions */
  --journey-height: 900vh;
  --scene-height: 180vh;
  
  /* Transitions */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.4s var(--ease-smooth), backdrop-filter 0.4s var(--ease-smooth);
}

.nav--transparent {
  background: transparent;
}

.nav--solid {
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav__links {
  display: flex;
  gap: var(--space-md);
  list-style: none;
}

.nav__link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav__link:hover,
.nav__link:focus {
  color: #fff;
}

/* --------------------------------------------------------------------------
   Journey Container
   -------------------------------------------------------------------------- */
.journey {
  position: relative;
  height: var(--journey-height);
}

.journey__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--color-bg);
}

/* --------------------------------------------------------------------------
   Scene Backgrounds (SVG Canvas)
   -------------------------------------------------------------------------- */
.scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s var(--ease-smooth);
}

.scene--active {
  opacity: 1;
}

.scene__canvas {
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Scene Overlays (Copy + CTA)
   -------------------------------------------------------------------------- */
.scene__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: var(--space-lg);
  pointer-events: none;
  z-index: 10;
}

.scene__content {
  max-width: 600px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--ease-smooth), transform 0.6s var(--ease-smooth);
}

.scene--active .scene__content {
  opacity: 1;
  transform: translateY(0);
}

.scene__eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: var(--space-xs);
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.scene__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: var(--space-sm);
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.scene__body {
  font-size: 1.125rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  max-width: 480px;
}

/* CTA in final scene */
.scene__cta {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  pointer-events: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s var(--ease-smooth);
  cursor: pointer;
  border: none;
}

.btn:hover,
.btn:focus {
  transform: translateY(-2px);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent-waterfront), #2980B9);
  color: #fff;
  box-shadow: 0 4px 20px rgba(52, 152, 219, 0.4);
}

.btn--primary:hover,
.btn--primary:focus {
  box-shadow: 0 8px 30px rgba(52, 152, 219, 0.5);
}

.btn--secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn--secondary:hover,
.btn--secondary:focus {
  background: rgba(255, 255, 255, 0.25);
}

/* --------------------------------------------------------------------------
   Scrim / Atmosphere
   -------------------------------------------------------------------------- */
.scene__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(26, 26, 46, 0.3) 0%,
    transparent 30%,
    transparent 70%,
    rgba(26, 26, 46, 0.5) 100%
  );
  pointer-events: none;
  z-index: 5;
}

/* --------------------------------------------------------------------------
   Ambient Particles
   -------------------------------------------------------------------------- */
.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  animation: float 8s infinite ease-in-out;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) translateX(0);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-100px) translateX(20px);
    opacity: 0.8;
  }
}

/* --------------------------------------------------------------------------
   Progress Indicator
   -------------------------------------------------------------------------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-skyline), var(--accent-waterfront));
  width: 0%;
  z-index: 2000;
  transition: width 0.1s linear;
}

/* --------------------------------------------------------------------------
   Supporting Sections
   -------------------------------------------------------------------------- */
.content-section {
  position: relative;
  padding: var(--space-xl) var(--space-md);
  background: var(--color-bg);
}

.content-section--alt {
  background: var(--color-surface);
}

.section__header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.section__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.section__subtitle {
  color: var(--color-text-muted);
  font-size: 1.0625rem;
}

/* --------------------------------------------------------------------------
   Card Grids
   -------------------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--color-surface-light);
  border-radius: 1rem;
  overflow: hidden;
  transition: transform 0.4s var(--ease-bounce), box-shadow 0.4s var(--ease-smooth);
  opacity: 0;
  transform: translateY(40px);
}

.card--visible {
  opacity: 1;
  transform: translateY(0);
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.card__visual {
  aspect-ratio: 16 / 10;
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card__visual svg {
  width: 100%;
  height: 100%;
}

.card__body {
  padding: var(--space-sm);
}

.card__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.card__desc {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  background: var(--color-bg);
  padding: var(--space-lg) var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  text-align: center;
}

.footer__logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.footer__nav {
  display: flex;
  gap: var(--space-md);
  list-style: none;
}

.footer__link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.footer__link:hover,
.footer__link:focus {
  color: #fff;
}

.footer__copy {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .journey {
    height: auto;
  }
  
  .journey__sticky {
    position: relative;
    height: auto;
  }
  
  .scene {
    position: relative;
    height: 100vh;
    opacity: 1;
    margin-bottom: 0;
  }
  
  .scene__content {
    opacity: 1;
    transform: none;
  }
  
  .particle {
    display: none;
  }
  
  .card {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Mobile / Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --journey-height: 500vh;
    --scene-height: 100vh;
  }
  
  .nav__links {
    display: none;
  }
  
  .scene__overlay {
    padding: var(--space-md);
    justify-content: flex-end;
  }
  
  .scene__content {
    max-width: 100%;
  }
  
  .scene__title {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
  }
  
  .scene__body {
    font-size: 1rem;
  }
  
  .scene__cta {
    flex-direction: column;
    width: 100%;
  }
  
  .btn {
    justify-content: center;
  }
  
  .card-grid {
    grid-template-columns: 1fr;
  }
  
  .content-section {
    padding: var(--space-lg) var(--space-sm);
  }
}

/* --------------------------------------------------------------------------
   High Contrast / Accessibility
   -------------------------------------------------------------------------- */
@media (prefers-contrast: high) {
  :root {
    --color-bg: #000;
    --color-surface: #111;
    --color-text: #fff;
  }
  
  .btn {
    border: 2px solid currentColor;
  }
}

/* --------------------------------------------------------------------------
   Focus States
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent-waterfront);
  outline-offset: 4px;
}

/* --------------------------------------------------------------------------
   Loading State
   -------------------------------------------------------------------------- */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s, visibility 0.5s;
}

.loading-screen--hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-waterfront);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
