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

/* BASE */
html {
  scroll-behavior: auto;
  overscroll-behavior: none;
  color-scheme: dark;
}

body {
  background: #000;
  color: #f2f2f2;
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
  line-height: 1.6;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ================================
   FIXED TOP BAR
================================ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: clamp(60px, 10vh, 90px);
  padding: 0 clamp(16px, 4vw, 40px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
}

/* Logo - animated size via JS */
.logo {
  height: auto;
  flex-shrink: 0;
  transform-origin: left center;
}

/* Language selector */
.lang {
  flex-shrink: 0;
  position: relative;
  z-index: 10001; /* above symbol */
}

/* Hamburger toggle - hidden on desktop */
.lang-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 4px;
}

.lang-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #00b3ff;
  transition: transform 0.3s, opacity 0.3s;
}

.lang-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.lang-toggle.open span:nth-child(2) {
  opacity: 0;
}

.lang-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

.lang-menu {
  display: flex;
  gap: clamp(10px, 2vw, 20px);
  list-style: none;
  padding: 0;
  margin: 0;
}

.lang-menu a {
  color: #00b3ff;
  font-family: 'Inter', sans-serif;
  font-size: clamp(10px, 1.4vw, 14px);
  font-weight: 400;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lang-menu a.active {
  color: #ff2fb3;
  font-weight: 500;
}

/* ================================
   SYMBOL - starts big, goes to topbar, then descends to compass
================================ */
.symbol {
  position: fixed;
  height: auto;
  z-index: 10000;
  transition: filter 0.4s ease, opacity 0.4s ease;
  pointer-events: none; /* clicks pass through to elements below */
  filter: brightness(1.1) saturate(1.2); /* more vivid colors */
}

/* Symbol dimmed when behind topbar */
.symbol.under-topbar {
  filter: brightness(0.5) saturate(0.8);
  opacity: 0.6;
}

/* Symbol bright when in compass */
.symbol.in-compass {
  filter: brightness(1.3) saturate(1.4);
  opacity: 1;
  z-index: 1001;
}

/* ================================
   HERO SECTION - centered, full viewport
================================ */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0 clamp(20px, 5vw, 80px);
  position: relative;
}

.hero-content {
  max-width: 100%;
}

/* Row 1: Claim + Symbol inline */
.claim-row {
  display: flex;
  align-items: center;
  gap: clamp(20px, 4vw, 50px);
}

/* Claim - Big Shoulders Stencil 500 100px */
.claim {
  font-family: 'Big Shoulders Stencil', sans-serif;
  font-size: clamp(52px, 10vw, 102px);
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: #f2f2f2;
  white-space: nowrap;
}

/* Placeholder for symbol position in claim row - 2x symbol topbar size */
.symbol-placeholder {
  width: clamp(270px, 35vw, 400px);
  height: clamp(180px, 23vw, 280px);
  flex-shrink: 0;
}

/* Row 2: Subline - Syncopate 23px - più vicino al claim */
.subline {
  font-family: 'Syncopate', sans-serif;
  font-size: clamp(14px, 2.3vw, 23px);
  font-weight: 400;
  color: #888;
  letter-spacing: 0.05em;
  margin-top: clamp(4px, 1vw, 10px);
  text-transform: lowercase;
}

/* Freccia inline con subline - pulse bagliore */
.arrow-down {
  margin-left: 8px;
  display: inline-block;
  animation: arrow-glow 2.5s ease-in-out infinite;
}

@keyframes arrow-glow {
  0% {
    opacity: 0.2;
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0.2;
  }
}

/* ================================
   NARRATIVE / MANIFESTO - starts immediately
================================ */
.narrative {
  min-height: 150vh;
  padding: 0 clamp(20px, 5vw, 80px) 20px;
  position: relative;
}

.narrative-content {
  max-width: 900px;
  padding-top: 0;
  margin: 0 auto; /* center content */
}

/* Base reveal line */
.reveal-line {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  margin-bottom: clamp(24px, 4vh, 50px);
}

.reveal-line.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-line.dimmed {
  opacity: 0.2;
  transform: translateY(0);
}

/* Big Shoulders Stencil - 400 57px */
.line-big {
  font-family: 'Big Shoulders Stencil', sans-serif;
  font-size: clamp(34px, 5.5vw, 57px);
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: #f2f2f2;
}

/* Syncopate - 19px */
.line-syncopate {
  font-family: 'Syncopate', sans-serif;
  font-size: clamp(13px, 1.7vw, 19px);
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  line-height: 1.8;
  color: #888;
}

/* Offset line */
.line-offset {
  margin-left: clamp(80px, 15vw, 200px);
}

/* Staircase pattern - inline, items slide then lock */
.staircase {
  margin-bottom: clamp(24px, 4vh, 50px);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1.5vw, 20px);
  align-items: center;
}

.staircase .reveal-line {
  margin-bottom: 0;
  transition: opacity 0.5s ease, transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: inline-block;
  white-space: nowrap;
}

/* Final line emphasis */
.line-final {
  color: #f2f2f2;
}

/* ================================
   COMPASS PLACEHOLDER
================================ */
.compass {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px clamp(20px, 5vw, 80px);
}

.compass-placeholder {
  width: 100%;
  max-width: clamp(150px, 20vw, 300px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 50%;
  opacity: 0.1;
}

/* ================================
   FIX URGENTE - LOGO/SYMBOL/TIMING
================================ */
:root {
  --header-pad-y: 18px;
  --header-pad-x: 28px;

  /* LOGO: +25% (80→100, 114→142) */
  --logo-h-min: 100px;
  --logo-h-max: 142px;

  /* SYMBOL in TOPBAR: +50% (98→147, 135→200) */
  --mark-min: 147px;
  --mark-max: 200px;

  /* testo secondario bianco luminoso */
  --sub-white: #f2f2f2;
  --body-white: rgba(255,255,255,.78);
}

/* HEADER/TOPBAR - below symbol so symbol stays bright */
.topbar {
  z-index: 9998;
  /* overlay leggero per evitare che i testi "passino sopra" visivamente */
  background: linear-gradient(to bottom, rgba(0,0,0,.98) 0%, rgba(0,0,0,0.7) 50%, rgba(0,0,0,0) 100%);
}

/* Mobile: topbar solid background */
@media (max-width: 820px) {
  .topbar {
    background: rgba(0,0,0,0.95);
  }
}

/* Language menu always clickable */
.lang {
  position: relative;
  z-index: 10001;
}

/* LOGO: dimensione stabile (responsive solo per viewport, NON per scroll) */
.logo {
  height: clamp(var(--logo-h-min), 4vw, var(--logo-h-max)) !important;
  width: auto !important;
  max-width: none !important;
  transform: none !important;
  flex-shrink: 0 !important;
}

/* SYMBOL: dimensione controllata da JS (2x in hero → 1x in topbar) */
.symbol {
  height: auto;
  opacity: 1 !important;
  z-index: 10000 !important; /* ABOVE topbar so it's never dimmed by topbar gradient */
  background: transparent !important;
}

/* "and power requires responsibility." — 25px, bianco luminoso */
.subline,
.hero-subtitle {
  font-size: 25px !important;
  color: #f2f2f2 !important;
  opacity: 1 !important;
}

/* Testi manifesto: opacità controllata da JS basata su distanza dal centro */
.reveal-line {
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.5s ease, font-size 0.5s ease;
}

/* Ultima riga: si sposta al centro (solo posizione, no font/size change) */
.line-final-closing {
  position: relative;
  transition: opacity 0.4s ease, transform 0.6s ease;
}

/* Mobile/iPad fine-tuning */
@media (max-width: 820px) {
  .topbar {
    padding: 16px 18px;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9998 !important; /* Below symbol so symbol stays bright */
    background: rgba(0,0,0,0.98) !important;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  :root {
    --logo-h-min: 90px;
    --logo-h-max: 125px;
    --mark-min: 135px;
    --mark-max: 192px;
  }

  /* Symbol stays visible in topbar on mobile - ABOVE topbar */
  .symbol {
    z-index: 10000 !important;
    filter: brightness(1.2) saturate(1.3) !important;
  }

  /* Hamburger menu on mobile */
  .lang-toggle {
    display: flex;
  }

  .lang-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    flex-direction: column;
    padding: 12px 20px;
    gap: 12px;
    border-radius: 8px;
    margin-top: 8px;
  }

  .lang-menu.open {
    display: flex;
  }

  .lang-menu a {
    font-size: 14px;
  }

  .subline,
  .hero-subtitle {
    font-size: 18px !important;
  }

  /* Mobile: Hero layout - symbol above claim */
  .hero {
    align-items: center;
    text-align: center;
  }

  .hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .claim-row {
    flex-direction: column-reverse;
    align-items: center;
    gap: 20px;
  }

  .claim {
    white-space: normal;
    text-align: center;
  }

  .symbol-placeholder {
    width: clamp(150px, 40vw, 220px);
    height: clamp(100px, 26vw, 150px);
  }

  .subline {
    text-align: center;
  }

  /* Mobile: increase minimum font sizes */
  .claim {
    font-size: clamp(38px, 10vw, 102px);
  }

  .line-big {
    font-size: clamp(30px, 6vw, 57px);
  }

  .line-syncopate {
    font-size: clamp(14px, 2.5vw, 19px);
  }

  .line-penultimate {
    font-size: clamp(13px, 2.5vw, 19px) !important;
  }

  .line-final-closing {
    font-size: clamp(24px, 5vw, 45px) !important;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
  }
}

/* Prevent horizontal overflow */
html, body {
  overflow-x: hidden;
}

/* Penultima riga: +2px */
.line-penultimate {
  font-family: 'Syncopate', sans-serif;
  font-size: clamp(13px, 1.9vw, 19px) !important;
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  color: #f2f2f2;
}

/* Ultima riga: Big Shoulders Stencil, centrata nel viewport */
.line-final-closing {
  font-family: 'Big Shoulders Stencil', sans-serif;
  font-size: clamp(28px, 4vw, 45px) !important;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.03em;
  color: #f2f2f2;
  text-align: center;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-top: clamp(40px, 6vh, 80px);
}

/* ================================
   THE COMPASS - Interactive orientation device
================================ */
.compass {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(20px, 5vw, 80px);
  margin-top: -80vh; /* More overlap - compass appears sooner */
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

.compass-container {
  position: relative;
  width: clamp(320px, 50vw, 480px);
  height: clamp(320px, 50vw, 480px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ================================
   FIXED MARKERS - These stay in place
   The dots are anchors. The circle spins around them.
================================ */
.fixed-markers {
  position: absolute;
  width: 115%;
  height: 115%;
  pointer-events: none;
}

.fixed-marker {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #00b3ff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.4s ease;
  opacity: 0.7;
  box-shadow: 0 0 8px rgba(0, 179, 255, 0.5);
}

/* Position 8 markers around (every 45 degrees) - FIXED */
.fixed-marker[data-index="0"] { top: 50%; left: 100%; }
.fixed-marker[data-index="1"] { top: 14.6%; left: 85.4%; }
.fixed-marker[data-index="2"] { top: 0%; left: 50%; }
.fixed-marker[data-index="3"] { top: 14.6%; left: 14.6%; }
.fixed-marker[data-index="4"] { top: 50%; left: 0%; }
.fixed-marker[data-index="5"] { top: 85.4%; left: 14.6%; }
.fixed-marker[data-index="6"] { top: 100%; left: 50%; }
.fixed-marker[data-index="7"] { top: 85.4%; left: 85.4%; }

/* Active marker - when Ensō head aligns */
.fixed-marker.active {
  width: 16px;
  height: 16px;
  background: #ff2fb3;
  opacity: 1;
  box-shadow: 0 0 25px rgba(255, 47, 179, 0.8), 0 0 50px rgba(255, 47, 179, 0.4);
}

/* ================================
   THE ENSŌ - THIS rotates now
   Weight. Imperfection. Limit. Unresolved choice.
================================ */
.enso-wrapper {
  position: absolute;
  width: 116.88%;
  height: 116.88%;
  transform-origin: center center;
  will-change: transform;
  cursor: grab;
}

.enso-wrapper:active {
  cursor: grabbing;
}

.enso {
  width: 100%;
  height: 100%;
  opacity: 0.75;
  transition: opacity 0.5s ease, filter 0.5s ease;
  object-fit: contain;
  pointer-events: none;
}

/* Head indicator - marks where the brush stroke opens */
.enso-head {
  position: absolute;
  top: 50%;
  right: -5%;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.compass-container.engaged .enso-head {
  opacity: 0.6;
}

.compass-container.active .enso {
  opacity: 0.95;
}

/* Engaged state - subtle visual feedback */
.compass-container.engaged {
  cursor: grabbing;
}

.compass-container.engaged .enso {
  opacity: 1;
  filter: brightness(1.15);
}

/* Center: Symbol placeholder + principle text below */
.compass-center {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
  text-align: center;
}

/* Placeholder for where symbol will land */
.compass-symbol-placeholder {
  width: clamp(70px, 15vw, 100px);
  height: clamp(70px, 15vw, 100px);
  margin-bottom: 16px;
}

.compass-hint {
  font-family: 'Syncopate', sans-serif;
  font-size: clamp(10px, 1.4vw, 13px);
  color: #666;
  text-transform: lowercase;
  letter-spacing: 0.1em;
  margin-top: 12px;
  text-align: center;
  transition: opacity 0.4s ease;
}

.compass-subhint {
  font-family: 'Inter', sans-serif;
  font-size: clamp(9px, 1.1vw, 11px);
  color: #444;
  margin-top: 4px;
  text-align: center;
  transition: opacity 0.4s ease;
}

/* Hide hints when principle is showing */
.compass-center.has-principle .compass-hint,
.compass-center.has-principle .compass-subhint {
  opacity: 0;
}

/* Principle display - inside compass center, below symbol */
.compass-principle {
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  max-width: 220px;
  text-align: center;
}

.compass-principle.visible {
  opacity: 1;
}

.principle-title {
  font-family: 'Big Shoulders Stencil', sans-serif;
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 500;
  color: #f2f2f2;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  text-align: center;
}

.principle-text {
  font-family: 'Inter', sans-serif;
  font-size: clamp(12px, 1.8vw, 15px);
  font-weight: 300;
  color: #aaa;
  line-height: 1.5;
  text-align: center;
}

/* ================================
   COMPASS TUTORIAL OVERLAY
   Glass effect with instruction text
================================ */
.compass-tutorial {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.compass-tutorial.visible {
  opacity: 1;
}

.compass-tutorial.fade-out {
  opacity: 0;
}

.tutorial-glass {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(0, 0, 0, 0.4);
}

.tutorial-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
}

.tutorial-main {
  font-family: 'Syncopate', sans-serif;
  font-size: clamp(13px, 2.2vw, 18px);
  font-weight: 700;
  color: #ffffff;
  text-transform: lowercase;
  letter-spacing: 0.12em;
  line-height: 1.6;
  margin-bottom: 14px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.tutorial-sub {
  font-family: 'Inter', sans-serif;
  font-size: clamp(12px, 1.6vw, 15px);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.06em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* Drag area (invisible interaction layer) */
.compass-drag {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  cursor: grab;
  z-index: 10;
}

.compass-drag:active,
.compass-drag.dragging {
  cursor: grabbing;
}

/* Scroll snap for compass section */
html {
  scroll-snap-type: y proximity;
}

/* Mobile adjustments for compass */
@media (max-width: 820px) {
  .compass {
    min-height: 100vh;
    padding: 40px 20px 80px;
    padding-top: 0;
    margin-top: -60vh;
  }

  .compass-container {
    width: clamp(280px, 80vw, 340px);
    height: clamp(280px, 80vw, 340px);
  }

  .fixed-markers {
    width: 118%;
    height: 118%;
  }

  .compass-symbol-placeholder {
    width: clamp(50px, 15vw, 70px);
    height: clamp(50px, 15vw, 70px);
    margin-bottom: 10px;
  }

  .compass-principle {
    max-width: 180px;
  }

  .principle-title {
    font-size: 17px;
  }

  .principle-text {
    font-size: 13px;
  }

  .compass-hint {
    font-size: 10px;
    margin-top: 10px;
  }

  .compass-subhint {
    font-size: 9px;
  }

  /* Fixed markers - slightly smaller on mobile */
  .fixed-marker {
    width: 8px;
    height: 8px;
  }

  .fixed-marker.active {
    width: 14px;
    height: 14px;
  }

  /* Ensō wrapper on mobile */
  .enso-wrapper {
    width: 110%;
    height: 110%;
  }

  .enso {
    opacity: 0.7;
  }

  .compass-container.active .enso {
    opacity: 0.92;
  }

  .fixed-markers {
    width: 115%;
    height: 115%;
  }

  .enso-head {
    width: 10px;
    height: 10px;
  }

  /* Tutorial overlay on mobile */
  .tutorial-main {
    font-size: 11px;
    padding: 0 10px;
  }

  .tutorial-sub {
    font-size: 10px;
  }
}
