/* ===== LUCENT AUTOMOBILI ===== */
:root {
  --ice: #a8e6ff;
  --ice-dim: #6fb3cf;      /* schiarito per contrasto WCAG su fondo scuro */
  --silver: #c9d2dc;
  --bg: #04060a;
  --panel-bg: rgba(8, 12, 18, 0.92);
  --line: rgba(168, 230, 255, 0.18);
  --glacier: #b9c6d3;
  --solar: #ff6a1a;
  --midnight: #5b2d8f;
  --font-ui: 'Outfit', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Cormorant Garamond', Georgia, serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--silver);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; touch-action: manipulation; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

#canvas-container { position: fixed; inset: 0; z-index: 1; }
#canvas-container canvas { display: block; }

/* ===== Flash ===== */
#flash {
  position: fixed; inset: 0; z-index: 40;
  background: #eaf6ff; opacity: 0; pointer-events: none;
  transition: opacity 0.9s ease-out;
}
#flash.on { opacity: 1; transition: opacity 0.05s; }

/* ===== Enter screen ===== */
#enter-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #0a1017 0%, #04060a 70%);
  transition: opacity 1.2s ease;
}
#enter-screen.hidden { opacity: 0; pointer-events: none; }
.enter-inner { text-align: center; }
.wordmark {
  font-size: clamp(2.4rem, 7vw, 5rem);
  font-weight: 200; letter-spacing: 0.42em;
  color: #e8f2fa; text-indent: 0.42em;
}
.wordmark span {
  display: block; font-size: 0.28em; font-weight: 300;
  letter-spacing: 0.85em; text-indent: 0.85em;
  color: var(--ice-dim); margin-top: 0.6em;
}
#enter-btn {
  margin-top: 3.2rem; padding: 0.95rem 3.6rem;
  background: transparent; color: #e8f2fa;
  border: 1px solid rgba(168, 230, 255, 0.45);
  font-size: 0.85rem; letter-spacing: 0.5em; text-indent: 0.5em;
  transition: all 0.35s ease;
}
#enter-btn:hover {
  background: rgba(168, 230, 255, 0.08);
  border-color: var(--ice);
  box-shadow: 0 0 32px rgba(168, 230, 255, 0.25);
}
.enter-hint {
  margin-top: 1.4rem; font-size: 0.72rem;
  letter-spacing: 0.22em; color: rgba(201, 210, 220, 0.62);
}

/* ===== Slogan ===== */
#slogan {
  position: fixed; inset: 0; z-index: 37; /* above the intro video (35) */
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 0 8vw;
  opacity: 0; pointer-events: none;
  transition: opacity 2s ease;
}
#slogan.visible { opacity: 1; }
#slogan {
  background: radial-gradient(ellipse at center, rgba(2, 4, 7, 0.72) 0%, rgba(2, 4, 7, 0.45) 60%, rgba(2, 4, 7, 0.25) 100%);
}
.slogan-it {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.6vw, 2.7rem);
  font-weight: 400; font-style: italic;
  color: #eef6fc; letter-spacing: 0.05em; line-height: 1.5;
  text-shadow: 0 0 40px rgba(168, 230, 255, 0.35);
}
.slogan-en {
  margin-top: 1.6rem; font-size: clamp(0.7rem, 1.3vw, 0.95rem);
  font-weight: 300; letter-spacing: 0.32em;
  color: var(--ice-dim); text-transform: uppercase;
}

/* ===== Skip ===== */
#skip-btn {
  position: fixed; bottom: 2rem; right: 2.2rem; z-index: 45;
  background: transparent; border: none;
  color: rgba(201, 210, 220, 0.45);
  font-size: 0.72rem; letter-spacing: 0.28em;
  padding: 0.6rem 0.4rem; display: none;
  transition: color 0.3s;
}
#skip-btn:hover { color: var(--ice); }
#skip-btn.visible { display: block; }

/* ===== Topbar ===== */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.5rem 2.6rem;
  opacity: 0; transform: translateY(-12px); pointer-events: none;
  transition: opacity 1.4s ease 0.3s, transform 1.4s ease 0.3s;
  background: linear-gradient(to bottom, rgba(4, 6, 10, 0.85), transparent);
}
body.showroom-active #topbar { opacity: 1; transform: none; pointer-events: auto; }
#topbar .brand {
  font-weight: 200; letter-spacing: 0.35em;
  font-size: 1.05rem; color: #e8f2fa;
}
#topbar .brand span {
  color: var(--ice-dim); font-size: 0.72em; letter-spacing: 0.4em;
  text-shadow: 0 0 14px rgba(140, 220, 255, 0.6), 0 0 34px rgba(140, 220, 255, 0.3);
}
#topbar nav { display: flex; gap: 0.4rem; }
.nav-link {
  background: transparent; border: none;
  color: rgba(201, 210, 220, 0.72);
  font-size: 0.72rem; letter-spacing: 0.24em; text-transform: uppercase;
  padding: 0.8rem 1rem; min-height: 44px; border-bottom: 1px solid transparent;
  transition: all 0.3s;
}
.nav-link:hover { color: #e8f2fa; }
.nav-link.active { color: var(--ice); border-bottom-color: var(--ice); }

/* ===== Lang toggle ===== */
#lang-toggle {
  background: transparent;
  border: 1px solid rgba(168, 230, 255, 0.3);
  color: var(--ice-dim);
  font-size: 0.68rem; letter-spacing: 0.18em; text-indent: 0.18em;
  padding: 0.45rem 0.8rem; margin-left: 0.8rem;
  transition: all 0.3s;
}
#lang-toggle:hover { color: var(--ice); border-color: var(--ice); }

/* ===== Intro video ===== */
#intro-video {
  position: fixed; inset: 0; z-index: 35;
  width: 100%; height: 100%; object-fit: cover;
  background: #000; display: none;
}
#intro-video.playing { display: block; }

/* ===== Car caption ===== */
#car-caption {
  position: fixed; left: 2.6rem; bottom: 3.4rem; z-index: 15;
  opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity 1.6s ease 0.8s, transform 1.6s ease 0.8s;
}
body.showroom-active #car-caption { opacity: 1; transform: none; }
.caption-model {
  font-size: clamp(1.3rem, 2.7vw, 2.05rem); font-weight: 200;
  letter-spacing: 0.3em; color: #eef6fc;
}
.caption-edition {
  margin-top: 0.5rem; font-size: 0.72rem;
  letter-spacing: 0.34em; color: var(--ice-dim);
}
.caption-color {
  margin-top: 0.55rem; font-size: 0.78rem;
  letter-spacing: 0.3em; color: #e8f2fa;
}
.caption-tease {
  margin-top: 1rem; font-size: 0.8rem; font-style: italic;
  letter-spacing: 0.12em; color: rgba(201, 210, 220, 0.55);
}

/* ===== 3D view bar ===== */
#view-bar {
  position: fixed; bottom: 2.2rem; left: 50%; transform: translateX(-50%) translateY(14px);
  z-index: 15;
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: rgba(8, 12, 18, 0.6);
  border: 1px solid rgba(168, 230, 255, 0.14);
  backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none;
  transition: opacity 1.4s ease 1.2s, transform 1.4s ease 1.2s;
}
body.showroom-active #view-bar { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
#view-bar button {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: transparent; border: 1px solid transparent;
  color: rgba(201, 210, 220, 0.75);
  transition: all 0.25s;
}
#view-bar button:hover { color: var(--ice); border-color: rgba(168, 230, 255, 0.3); }
#view-bar button:active { background: rgba(168, 230, 255, 0.1); }
.view-hint {
  font-size: 0.62rem; letter-spacing: 0.14em;
  color: rgba(201, 210, 220, 0.55);
  padding: 0 0.7rem 0 0.4rem;
}
@media (max-width: 760px) {
  /* to the right, clear of the captions */
  #view-bar {
    left: auto; right: 0.9rem; bottom: 1rem;
    transform: translateY(14px);
    flex-direction: column; padding: 0.35rem;
  }
  body.showroom-active #view-bar { transform: none; }
  .view-hint { display: none; }
}

/* ===== Configurator panel (McLaren-style right rail) ===== */
.panel.cfg {
  width: min(400px, 100vw);
  background: rgba(6, 9, 14, 0.78);
}
.cfg-sub {
  font-size: 0.64rem; letter-spacing: 0.26em;
  color: var(--ice-dim); margin: -0.6rem 0 1.8rem;
}
.cfg-steps {
  display: flex; gap: 0.3rem; margin-bottom: 1.8rem;
  border-bottom: 1px solid rgba(168, 230, 255, 0.12);
}
.cfg-step {
  flex: 1; background: transparent; border: none;
  border-bottom: 2px solid transparent;
  color: rgba(201, 210, 220, 0.55);
  font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 0.7rem 0.2rem;
  display: flex; align-items: center; justify-content: center; gap: 0.35rem;
  transition: all 0.3s;
}
.cfg-step.active { color: var(--ice); border-bottom-color: var(--ice); }
.cfg-step.locked { color: rgba(201, 210, 220, 0.3); cursor: not-allowed; }
.cfg-step .lock { font-size: 0.6rem; filter: grayscale(1); opacity: 0.7; }
.cfg-locked-note {
  display: none; text-align: center;
  font-size: 0.68rem; letter-spacing: 0.3em;
  color: var(--ice-dim);
  border: 1px dashed rgba(168, 230, 255, 0.25);
  padding: 0.8rem; margin-top: 1.2rem;
}
.cfg-locked-note.show { display: block; animation: notePulse 0.5s ease; }
@keyframes notePulse { 0% { opacity: 0; transform: translateY(4px); } 100% { opacity: 1; transform: none; } }

.swatches { display: flex; flex-direction: column; gap: 0.5rem; }
.swatch {
  display: flex; align-items: center; gap: 0.9rem;
  background: rgba(12, 18, 26, 0.6); border: 1px solid rgba(168, 230, 255, 0.08);
  padding: 0.75rem 1rem; text-align: left;
  transition: all 0.3s;
}
.swatch:hover { border-color: var(--line); }
.swatch.active { border-color: rgba(168, 230, 255, 0.5); background: rgba(16, 24, 34, 0.85); }
.swatch .dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff3, transparent 45%), var(--c);
  box-shadow: 0 0 12px 0 var(--c); flex-shrink: 0;
}
.swatch-name { font-size: 0.8rem; letter-spacing: 0.14em; color: #e8f2fa; display: block; }
.swatch-sub { font-size: 0.62rem; letter-spacing: 0.08em; color: rgba(201,210,220,0.45); display: block; margin-top: 2px; }
.config-note {
  margin-top: 1.6rem; font-size: 0.7rem; font-style: italic; line-height: 1.7;
  letter-spacing: 0.06em; color: rgba(201, 210, 220, 0.6);
}

/* ===== Race form ===== */
#race-form { border-top: 1px solid rgba(168, 230, 255, 0.12); padding-top: 1.6rem; }
.form-title { font-size: 0.66rem; letter-spacing: 0.34em; color: var(--ice-dim); margin-bottom: 1.2rem; }
#race-form label { display: block; margin-bottom: 0.9rem; }
#race-form label > span {
  display: block; font-size: 0.62rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: rgba(201, 210, 220, 0.5); margin-bottom: 0.35rem;
}
#race-form input, #race-form select {
  width: 100%; padding: 0.7rem 0.85rem; min-height: 44px; font-size: 16px;
  background: rgba(12, 18, 26, 0.7);
  border: 1px solid rgba(168, 230, 255, 0.15);
  color: #e8f2fa; font-family: inherit; font-size: 0.85rem;
  outline: none; transition: border-color 0.3s;
}
#race-form input:focus, #race-form select:focus { border-color: rgba(168, 230, 255, 0.5); }
#race-form select option { background: #0a0e14; }
#race-form .cta { width: 100%; margin-top: 0.4rem; background: transparent; }
.form-msg { margin-top: 1rem; font-size: 0.78rem; line-height: 1.6; color: var(--ice); display: none; }
.form-msg.show { display: block; }
.form-msg a { color: var(--ice); }

/* ===== Panels ===== */
#panel-backdrop {
  position: fixed; inset: 0; z-index: 24;
  background: rgba(2, 4, 7, 0.55); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity 0.5s;
}
#panel-backdrop.visible { opacity: 1; pointer-events: auto; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 25;
  width: min(560px, 100vw);
  background: var(--panel-bg); backdrop-filter: blur(14px);
  border-left: 1px solid var(--line);
  padding: 5.5rem 3rem 3rem;
  transform: translateX(102%);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
}
.panel.open { transform: none; }
.panel h2 {
  font-weight: 200; font-size: 2rem;
  letter-spacing: 0.22em; color: #eef6fc; margin-bottom: 1.4rem;
}
.panel-lead { font-size: 0.92rem; font-weight: 300; line-height: 1.75; color: rgba(201,210,220,0.8); margin-bottom: 2.2rem; }
.panel-close {
  position: absolute; top: 1.6rem; right: 1.8rem;
  background: transparent; border: none;
  color: rgba(201,210,220,0.5); font-size: 1.7rem; line-height: 1;
  transition: color 0.3s;
}
.panel-close:hover { color: var(--ice); }

.dept-list { list-style: none; }
.dept-list li {
  display: flex; gap: 1.3rem; padding: 1.05rem 0;
  border-bottom: 1px solid rgba(168, 230, 255, 0.08);
}
.dept-num { font-size: 0.75rem; color: var(--ice-dim); letter-spacing: 0.1em; padding-top: 0.2rem; }
.dept-list strong { font-weight: 400; font-size: 0.9rem; letter-spacing: 0.14em; color: #e8f2fa; }
.dept-list p { font-size: 0.78rem; line-height: 1.6; color: rgba(201,210,220,0.55); margin-top: 0.3rem; }
.coming-soon {
  margin-top: 2.4rem; text-align: center;
  font-size: 0.72rem; letter-spacing: 0.5em; color: var(--ice-dim);
  border: 1px dashed rgba(168, 230, 255, 0.25); padding: 1rem;
}

.event-prize {
  border: 1px solid rgba(168, 230, 255, 0.3);
  padding: 1.5rem 1.7rem; margin-bottom: 2rem;
  background: linear-gradient(135deg, rgba(168, 230, 255, 0.06), transparent);
}
.prize-label { font-size: 0.62rem; letter-spacing: 0.4em; color: var(--ice); margin-bottom: 0.7rem; }
.event-prize p { font-size: 0.95rem; font-weight: 300; line-height: 1.7; }
.event-facts { list-style: none; margin-bottom: 2.4rem; }
.event-facts li {
  display: flex; justify-content: space-between; gap: 1.5rem;
  padding: 0.85rem 0; border-bottom: 1px solid rgba(168, 230, 255, 0.08);
  font-size: 0.82rem;
}
.event-facts strong { font-weight: 400; letter-spacing: 0.18em; color: #e8f2fa; text-transform: uppercase; font-size: 0.7rem; }
.event-facts span { color: rgba(201,210,220,0.6); text-align: right; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: rgba(168, 230, 255, 0.12); margin-bottom: 2.2rem; }
.stat { background: rgba(8, 12, 18, 0.95); padding: 1.4rem 1.2rem; }
.stat-num { font-size: 1.9rem; font-weight: 200; color: var(--ice); letter-spacing: 0.05em; }
.stat-label { font-size: 0.68rem; line-height: 1.55; color: rgba(201,210,220,0.55); margin-top: 0.45rem; letter-spacing: 0.06em; }
.invest-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; margin-bottom: 2.4rem; }
.invest-columns strong { font-size: 0.68rem; letter-spacing: 0.26em; color: #e8f2fa; }
.invest-columns p { font-size: 0.72rem; line-height: 1.6; color: rgba(201,210,220,0.55); margin-top: 0.5rem; }
.invest-contact { margin-top: 1.8rem; font-size: 0.76rem; line-height: 1.8; color: rgba(201,210,220,0.6); }

.cta {
  display: block; text-align: center; text-decoration: none;
  padding: 1rem 1.4rem; margin-top: 0.6rem;
  border: 1px solid rgba(168, 230, 255, 0.45); color: #e8f2fa;
  font-size: 0.74rem; letter-spacing: 0.4em; text-indent: 0.4em;
  transition: all 0.35s;
}
.cta:hover { background: rgba(168, 230, 255, 0.1); box-shadow: 0 0 28px rgba(168, 230, 255, 0.18); }

/* ===== Footer ===== */
#site-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between;
  padding: 0.8rem 2.6rem;
  font-size: 0.6rem; letter-spacing: 0.2em; color: rgba(201,210,220,0.3);
  opacity: 0; transition: opacity 1.5s ease 1.5s;
  pointer-events: none;
}
body.showroom-active #site-footer { opacity: 1; }

/* ===== Mobile ===== */
@media (max-width: 760px) {
  #topbar { padding: 1rem 1.2rem; flex-direction: column; gap: 0.7rem; }
  #topbar nav { flex-wrap: wrap; justify-content: center; }
  .nav-link { padding: 0.4rem 0.55rem; font-size: 0.64rem; }
  #lang-toggle { margin-left: 0.3rem; padding: 0.35rem 0.6rem; }
  #car-caption { left: 1.2rem; bottom: 2.4rem; }
  .panel { padding: 4.5rem 1.6rem 2.5rem; }
  #site-footer { display: none; }
}
