/* ============================================================
   ENVIRTUAL3D — SPATIAL SYSTEM
   main.css — Reset · Nav · Geometry system · Lang · Footer · Utilities
   ============================================================ */

/* ---- Reset ---------------------------------------------------------------- */

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

html {
  font-size: 16px;
  scroll-behavior: auto; /* Lenis handles smooth scroll */
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--graphite);
  background: var(--white);
  line-height: 1.65;
  overflow-x: hidden;
}

img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.15;
}

input, textarea, select {
  font-family: inherit;
  font-size: 1rem; /* prevent iOS zoom */
}

/* ---- Skip Link ----------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  font: 600 0.875rem/1 var(--font-body);
  color: var(--white);
  background: var(--steel);
  padding: var(--space-sm) var(--space-md);
  z-index: calc(var(--z-modal) + 1);
}

.skip-link:focus { top: var(--space-sm); }

/* ---- Scroll Progress Bar ------------------------------------------------- */

#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--steel);
  transform-origin: left;
  transform: scaleX(0);
  z-index: calc(var(--z-nav) + 1);
  pointer-events: none;
}

/* ---- Navigation ---------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 var(--container-pad);
  z-index: var(--z-nav);
  transition:
    background var(--duration-base) var(--ease-out-smooth),
    border-color var(--duration-base) var(--ease-out-smooth);
  border-bottom: 1px solid transparent;
}

.nav--solid {
  background: var(--white);
  border-bottom-color: var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  gap: var(--space-xl);
}

/* Logo */
.nav-logo {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--void-text);
  transition: color var(--duration-fast) ease;
  flex-shrink: 0;
}

.nav--solid .nav-logo { color: var(--graphite); }

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2.5rem);
  margin-left: auto;
}

.nav-link {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  color: rgba(232,230,226,0.75);
  position: relative;
  transition: color var(--duration-fast) ease;
}

.nav--solid .nav-link { color: var(--dim); }

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--duration-fast) var(--ease-out-smooth);
}

.nav-link:hover { color: var(--void-text); }
.nav--solid .nav-link:hover { color: var(--graphite); }
.nav-link:hover::after { transform: scaleX(1); transform-origin: left; }

/* Language switcher — drawer only (desktop replaced by lang-drop) */
.lang-switcher {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  padding-bottom: 3px;
  flex-shrink: 0;
}

.lang-btn {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: rgba(232,230,226,0.5);
  padding: 0.25rem 0.35rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color var(--duration-fast) ease;
}

.lang-sep {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.2);
  user-select: none;
  pointer-events: none;
  line-height: 1;
}

.lang-btn.is-active { color: var(--void-text); }
.lang-btn:hover:not(.is-active) { color: rgba(232,230,226,0.8); }

.nav--solid .lang-btn { color: var(--muted); }
.nav--solid .lang-btn.is-active { color: var(--graphite); }
.nav--solid .lang-btn:hover:not(.is-active) { color: var(--dim); }
.nav--solid .lang-sep { color: rgba(0,0,0,0.15); }

/* Sliding steel underline indicator */
.lang-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 1.5px;
  background: var(--steel);
  width: var(--lang-w, 1.5rem);
  transform: translateX(var(--lang-x, 0px));
  transition:
    transform 0.35s var(--ease-in-out-spatial),
    width 0.35s var(--ease-in-out-spatial);
  pointer-events: none;
}

/* ---- Lang Drop — compact desktop dropdown --------------------------------- */

.lang-drop {
  position: relative;
  flex-shrink: 0;
}

.lang-drop-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(232,230,226,0.6);
  cursor: pointer;
  min-height: 44px;
  padding: 0 var(--space-sm);
  transition: color var(--duration-fast) ease;
}

.nav--solid .lang-drop-btn { color: var(--muted); }
.lang-drop-btn:hover { color: var(--void-text); }
.nav--solid .lang-drop-btn:hover { color: var(--graphite); }

.lang-drop-chevron {
  flex-shrink: 0;
  transition: transform var(--duration-fast) var(--ease-out-smooth);
}

.lang-drop.is-open .lang-drop-chevron { transform: rotate(180deg); }

.lang-drop-panel {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  background: var(--void-2);
  border: 1px solid var(--void-border);
  padding: var(--space-xs) 0;
  min-width: 52px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    opacity var(--duration-fast) var(--ease-out-smooth),
    transform var(--duration-fast) var(--ease-out-smooth);
  z-index: calc(var(--z-nav) + 1);
}

.nav--solid .lang-drop-panel {
  background: var(--white);
  border-color: var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.lang-drop.is-open .lang-drop-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.lang-drop-option {
  display: block;
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--void-muted);
  padding: var(--space-sm) var(--space-md);
  text-align: center;
  transition:
    color var(--duration-fast) ease,
    background var(--duration-fast) ease;
}

.lang-drop-option:hover { color: var(--void-text); background: var(--void-wire); }
.nav--solid .lang-drop-option { color: var(--muted); }
.nav--solid .lang-drop-option:hover { color: var(--graphite); background: var(--surface); }
.lang-drop-option[aria-selected="true"] { color: var(--steel); }

/* Nav CTA */
.nav-cta {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--white);
  background: var(--steel);
  padding: 0.625rem 1.5rem;
  border-radius: 0;
  transition: background var(--duration-fast) ease;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-block;
}

.nav-cta:hover { background: var(--steel-2); }

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  margin-left: auto;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.hamburger-bar {
  width: 22px;
  height: 1.5px;
  background: var(--void-text);
  transition:
    transform var(--duration-base) var(--ease-out-smooth),
    opacity var(--duration-fast) ease;
  pointer-events: none;
}

.nav--solid .hamburger-bar { background: var(--graphite); }

.nav-hamburger.is-active .hamburger-bar:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav-hamburger.is-active .hamburger-bar:nth-child(2) { opacity: 0; }
.nav-hamburger.is-active .hamburger-bar:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* Mobile nav drawer */
.nav-drawer {
  position: fixed;
  inset: 0;
  background: var(--void);
  z-index: calc(var(--z-nav) - 1);
  display: flex;
  flex-direction: column;
  padding: calc(var(--nav-h) + var(--space-3xl)) var(--container-pad) var(--space-3xl);
  transform: translateX(100%);
  transition: transform var(--duration-slow) var(--ease-out-smooth);
  overflow-y: auto;
}

.nav-drawer.is-open { transform: translateX(0); }

.drawer-link {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: var(--void-text);
  display: block;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--void-border);
  transition: color var(--duration-fast) ease;
}

.drawer-link:hover { color: var(--steel); }

.drawer-lang {
  margin-top: auto;
  padding-top: var(--space-2xl);
}

.drawer-lang .lang-btn { color: var(--void-muted); min-height: 48px; font-size: 0.875rem; }
.drawer-lang .lang-btn.is-active { color: var(--void-text); }
.drawer-lang .lang-indicator { background: var(--steel); }
.drawer-lang .lang-sep { color: var(--void-border); }

.drawer-cta {
  display: block;
  text-align: center;
  font: 600 1rem/1 var(--font-body);
  color: var(--white);
  background: var(--steel);
  padding: 1.125rem var(--space-xl);
  margin-top: var(--space-xl);
}

/* ---- Container ----------------------------------------------------------- */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

/* ---- Language system ----------------------------------------------------- */

[lang-content]                           { display: none; }
[lang-content].is-active                 { display: inline; }
[lang-content][data-block].is-active     { display: block; }

/* ---- Hero geometry overlay ----------------------------------------------- */

.hero-scan-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--steel);
  pointer-events: none;
  z-index: 4;
  opacity: 0;
}

.hero-geometry {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(var(--void-wire) 0, var(--void-wire) 1px, transparent 1px, transparent 120px),
    repeating-linear-gradient(90deg, var(--void-wire) 0, var(--void-wire) 1px, transparent 1px, transparent 120px);
  pointer-events: none;
}

.hero-scan-id {
  position: absolute;
  top: calc(var(--nav-h) + var(--space-md));
  right: var(--container-pad);
  font-family: var(--font-data);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--void-muted);
  user-select: none;
}

/* ---- Sector corner markers ----------------------------------------------- */

.sector-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.sector-markers svg {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

/* ---- Buttons ------------------------------------------------------------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: 600 0.9375rem/1 var(--font-body);
  color: var(--white);
  background: var(--steel);
  padding: 0.9375rem 2rem;
  border-radius: 0;
  transition: background var(--duration-fast) ease;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  border: none;
}

.btn-primary:hover { background: var(--steel-2); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  font: 600 0.9375rem/1 var(--font-body);
  color: var(--void-text);
  background: transparent;
  border: 1px solid var(--steel-wire);
  padding: 0.9375rem 2rem;
  border-radius: 0;
  transition:
    border-color var(--duration-fast) ease,
    color var(--duration-fast) ease;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-ghost:hover {
  border-color: var(--steel);
  color: var(--steel-2);
}

/* ---- Section layout helpers ---------------------------------------------- */

section { position: relative; }

.section-header { margin-bottom: clamp(2rem, 5vw, 4rem); }

.section-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-h2);
  color: var(--graphite);
  line-height: 1.1;
}

.section-title--void { color: var(--void-text); }

.section-sub {
  font-family: var(--font-body);
  font-weight: 300;
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--space-sm);
}

.section-sub--void { color: var(--void-muted); }

/* ---- Footer -------------------------------------------------------------- */

.footer {
  background: var(--void);
  padding: var(--space-4xl) 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: var(--space-3xl);
  padding-bottom: var(--space-3xl);
  border-bottom: 1px solid var(--void-border);
}

.footer-logo {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--void-text);
  margin-bottom: var(--space-md);
}

.footer-tagline {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: var(--text-sm);
  color: var(--void-muted);
  line-height: 1.6;
  max-width: 22ch;
}

.footer-heading {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--void-muted);
  margin-bottom: var(--space-md);
}

.footer-links { display: flex; flex-direction: column; gap: var(--space-sm); }

.footer-link {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: var(--text-sm);
  color: rgba(232,230,226,0.5);
  transition: color var(--duration-fast) ease;
}

.footer-link:hover { color: var(--void-text); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  padding: var(--space-lg) 0;
  flex-wrap: wrap;
}

.footer-copy {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: var(--text-xs);
  color: var(--void-muted);
}

.footer-legal {
  display: flex;
  gap: var(--space-lg);
}

.footer-legal a {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: var(--text-xs);
  color: var(--void-muted);
  transition: color var(--duration-fast) ease;
}

.footer-legal a:hover { color: var(--void-text); }

.footer-lang {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  color: var(--void-muted);
}

/* ---- Utilities ----------------------------------------------------------- */

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

/* ---- Focus styles -------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 3px;
}

/* ---- Marquee keyframe ---------------------------------------------------- */

@keyframes ev3d-marquee {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

/* ---- Print --------------------------------------------------------------- */

@media print {
  .nav,
  #scroll-progress,
  .nav-drawer,
  #lightbox { display: none !important; }

  body { color: #000; background: #fff; }
}

/* ---- Prefers-reduced-motion ---------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 60ms;
    --duration-base: 120ms;
    --duration-slow: 180ms;
  }

  .hero-bg           { clip-path: none !important; }
  .hero-geometry     { opacity: 0 !important; pointer-events: none; }
  .hero-scan-line    { display: none !important; }

  .hero-logobar,
  .hero-headline,
  .hero-sub,
  .hero-ctas,
  .hero-meta         { transform: none !important; }

  .work-img          { clip-path: none !important; }
  .sector-img        { transform: none !important; }

  .marquee-track     { animation-duration: 60s !important; }
}

/* ---- Responsive: Mobile nav --------------------------------------------- */

@media (max-width: 767px) {
  .nav-links,
  .nav-cta,
  .lang-drop         { display: none; }
  .nav-hamburger     { display: flex; }
}
