/* 3D walking world (3d.html) */

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  touch-action: none;
}

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.gradient-text {
  background: linear-gradient(90deg, #ffffff, #a3a3a3, #ffffff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #737373;
  margin-bottom: 0.75rem;
}

/* Navigation */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px clamp(16px, 4vw, 48px);
  pointer-events: none;
}

.top-nav > * {
  pointer-events: auto;
}

.nav-link {
  position: relative;
  color: #a3a3a3;
  padding: 4px 0;
  transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: #fff;
}

.nav-link.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: #fff;
}

.nav-link-muted {
  color: #525252;
  font-size: 0.85rem;
}

/* Section panels */
.panel {
  position: fixed;
  z-index: 20;
  top: 50%;
  right: clamp(16px, 5vw, 80px);
  width: min(520px, 42vw);
  opacity: 0;
  transform: translate(32px, -50%);
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.panel.is-active {
  opacity: 1;
  transform: translate(0, -50%);
  pointer-events: auto;
}

.panel-body {
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid #262626;
  padding: 32px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  touch-action: pan-y;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.6rem;
  font-weight: 500;
  border: 2px solid #fff;
  transition: all 0.3s ease;
}

.btn-outline:hover {
  background: #fff;
  color: #000;
}

.btn-solid {
  background: #fff;
  color: #000;
}

.btn-solid:hover {
  background: #e5e5e5;
  border-color: #e5e5e5;
}

.chip {
  padding: 0.35rem 0.8rem;
  border: 1px solid #404040;
  font-size: 0.85rem;
  color: #d4d4d4;
}

.card {
  border: 1px solid #262626;
  transition: border-color 0.3s ease;
}

.card:hover {
  border-color: #fff;
}

.contact-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  font-size: 0.95rem;
}

.contact-link span {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Contact form */
.field {
  display: block;
}

.field span {
  display: block;
  margin-bottom: 4px;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #737373;
}

.field input,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid #333;
  color: #fff;
  font: inherit;
  resize: vertical;
  transition: border-color 0.3s ease;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Journey progress rail */
#rail {
  position: fixed;
  z-index: 25;
  left: clamp(16px, 4vw, 48px);
  bottom: 32px;
  width: min(500px, 40vw);
  height: 40px;
}

.rail-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5px;
  height: 1px;
  background: #333;
}

.rail-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: #fff;
}

.rail-stop {
  position: absolute;
  bottom: 0;
  left: calc(var(--u) * 100%);
  width: 11px;
  height: 11px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #666;
  background: #000;
  transform: translateX(-50%);
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.rail-stop::before {
  content: '';
  position: absolute;
  inset: -14px;
}

.rail-stop.is-passed {
  background: #fff;
  border-color: #fff;
}

.rail-stop.is-active {
  transform: translateX(-50%) scale(1.4);
}

.rail-label {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #737373;
  white-space: nowrap;
  transition: color 0.3s ease, opacity 0.3s ease;
}

/* With this many stops the names would collide, so only the current one (or the hovered one) shows */
.rail-label {
  opacity: 0;
}

.rail-stop.is-active .rail-label,
.rail-stop:hover .rail-label,
.rail-stop:focus-visible .rail-label {
  color: #fff;
  opacity: 1;
}

/* Scroll hint */
#hint {
  position: fixed;
  z-index: 25;
  left: clamp(16px, 4vw, 48px);
  bottom: 104px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #a3a3a3;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  transition: opacity 0.6s ease;
}

#hint.is-hidden {
  opacity: 0;
}

.mouse {
  position: relative;
  width: 20px;
  height: 32px;
  border: 2px solid #fff;
  border-radius: 12px;
}

.mouse::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 6px;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #fff;
  animation: wheel 1.6s ease infinite;
}

@keyframes wheel {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(10px); }
}

/* Loader and fallback */
#loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.loader-track {
  width: min(260px, 60vw);
  height: 2px;
  background: #262626;
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.loader-percent {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: #737373;
  font-variant-numeric: tabular-nums;
}

.loader-enter {
  margin-top: 8px;
}

.loader-enter[hidden] {
  display: none;
}

#loader.is-done {
  opacity: 0;
  visibility: hidden;
}

.loader-text {
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #a3a3a3;
  animation: pulse 1.4s ease infinite;
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

#no-webgl {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: #000;
}

#no-webgl[hidden] {
  display: none;
}

/* Mobile: character on top, panel as a bottom sheet */
@media (max-width: 767px) {
  .panel {
    top: auto;
    bottom: 44px;
    left: 16px;
    right: 16px;
    width: auto;
    transform: translateY(32px);
  }

  .panel.is-active {
    transform: translateY(0);
  }

  .panel-body {
    padding: 20px;
    max-height: 48vh;
  }

  #rail {
    bottom: 16px;
    left: 24px;
    right: 24px;
    width: auto;
    height: 12px;
  }

  .rail-label {
    display: none;
  }

  #hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .panel.is-active {
    transition: opacity 0.3s ease;
  }

  .gradient-text,
  .mouse::after,
  .loader-text {
    animation: none;
  }
}
