/* ═══════════════════════════════════════════════════════════════
   LEX AETERNA — Studio Legale
   Palette: blu notte · oro · bianco
   ═══════════════════════════════════════════════════════════════ */

:root {
  --navy-950: #060b1a;
  --navy-900: #0a1128;
  --navy-800: #101a38;
  --navy-700: #1a2650;
  --gold: #c9a227;
  --gold-light: #e3c565;
  --gold-dim: rgba(201, 162, 39, .35);
  --white: #f5f2ea;
  --grey: #9aa3b8;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --header-h: 76px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--navy-900);
  color: var(--white);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--gold); color: var(--navy-900); }

/* ── Tipografia ─────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: .01em;
}

h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
h2 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
h3 { font-size: 1.45rem; }
h4 { font-size: 1.2rem; }

h1 em, h2 em {
  font-style: italic;
  font-weight: 500;
  color: var(--gold-light);
}

p { color: var(--grey); max-width: 62ch; }
p strong, p a { color: var(--white); }
p a { text-decoration: underline; text-decoration-color: var(--gold-dim); }
p a:hover { color: var(--gold-light); }

.eyebrow {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1rem;
}

.lead, .page-lead { font-size: 1.08rem; }

/* ── Header fisso ───────────────────────────────────────────── */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.2rem, 4vw, 3rem);
  background: linear-gradient(to bottom, rgba(6, 11, 26, .92), rgba(6, 11, 26, .72));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(201, 162, 39, .14);
  transition: background .4s var(--ease);
}

.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  color: var(--gold);
}

.brand-logo { height: 48px; width: auto; flex: none; display: block; }

.main-nav { display: flex; align-items: center; gap: clamp(1rem, 2.6vw, 2.2rem); }

.main-nav a {
  position: relative;
  font-size: .82rem;
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--grey);
  padding: .4rem 0;
  transition: color .3s var(--ease);
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .35s var(--ease);
}

.main-nav a:hover, .main-nav a.active { color: var(--white); }
.main-nav a:hover::after, .main-nav a.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

.main-nav a.nav-cta {
  color: var(--navy-900);
  background: linear-gradient(120deg, var(--gold), var(--gold-light));
  padding: .55rem 1.3rem;
  border-radius: 2px;
  font-weight: 500;
}
.main-nav a.nav-cta::after { display: none; }
.main-nav a.nav-cta:hover { color: var(--navy-950); filter: brightness(1.08); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: .5rem;
}
.nav-toggle span {
  width: 24px; height: 2px;
  background: var(--gold);
  transition: .3s var(--ease);
}

/* ── Contenitore principale ─────────────────────────────────── */
#app { min-height: 100vh; }

.boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  color: var(--grey);
}

.boot-spinner {
  width: 42px; height: 42px;
  border: 2px solid var(--gold-dim);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ── Canvas Three.js ────────────────────────────────────────── */
.scene-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

/* ── HOME · Hero ────────────────────────────────────────────── */
.hero {
  position: relative;
  height: 100vh;
  min-height: 620px;
  overflow: hidden;
}

.hero .scene-canvas { position: absolute; inset: 0; }

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--header-h) + 2rem) clamp(1.4rem, 7vw, 7rem) 4rem;
  background: linear-gradient(100deg,
      rgba(6, 11, 26, .88) 0%,
      rgba(6, 11, 26, .55) 42%,
      rgba(6, 11, 26, 0) 70%);
  pointer-events: none;
}

.hero-overlay > * { pointer-events: auto; }

.hero-overlay .lead { margin: 1.4rem 0 2.2rem; color: #c4ccdd; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; }

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: .9rem 1.9rem;
  border-radius: 2px;
  cursor: pointer;
  transition: transform .3s var(--ease), filter .3s var(--ease), background .3s var(--ease), color .3s var(--ease);
}

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

.btn-gold {
  background: linear-gradient(120deg, var(--gold), var(--gold-light));
  color: var(--navy-950);
  border: 0;
}
.btn-gold:hover { filter: brightness(1.1); }

.btn-ghost {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(245, 242, 234, .35);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-light); }

.scroll-hint {
  position: absolute;
  left: 50%; bottom: 2rem;
  transform: translateX(-50%);
  width: 26px; height: 44px;
  border: 1px solid rgba(245, 242, 234, .3);
  border-radius: 14px;
  z-index: 2;
}
.scroll-hint span {
  position: absolute;
  left: 50%; top: 8px;
  width: 3px; height: 9px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--gold);
  animation: drop 1.8s var(--ease) infinite;
}
@keyframes drop {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(16px); opacity: 0; }
  100% { opacity: 0; }
}

/* ── Sezioni generiche ──────────────────────────────────────── */
.content-narrow { max-width: 1060px; margin: 0 auto; padding-inline: clamp(1.2rem, 4vw, 2.5rem); }
.content-wide   { max-width: 1240px; margin: 0 auto; padding-inline: clamp(1.2rem, 4vw, 2.5rem); }
.section-pad    { padding-block: clamp(3.5rem, 8vh, 6rem); }

.section-title { margin-bottom: 2.2rem; }
.page-title { margin-bottom: 1.4rem; }
.page-lead { margin-bottom: 3rem; }

/* ── HOME · Stats & quote ───────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  text-align: center;
  margin-bottom: 4.5rem;
}

.stat-number, .stat-plus {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 5vw, 3.8rem);
  font-weight: 600;
  color: var(--gold-light);
}
.stat p { margin: .4rem auto 0; font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; }

.quote {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1.5;
  color: var(--white);
  border-left: 2px solid var(--gold);
  padding-left: 1.6rem;
  max-width: 46ch;
}
.quote cite {
  display: block;
  margin-top: 1.2rem;
  font-family: var(--sans);
  font-style: normal;
  font-size: .82rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--grey);
}

/* ── STUDIO · Split hero ────────────────────────────────────── */
.split-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  padding-top: var(--header-h);
}

.split-canvas-wrap {
  position: relative;
  min-height: 60vh;
  background: radial-gradient(ellipse at 50% 70%, var(--navy-800) 0%, var(--navy-950) 75%);
}

.split-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4.5rem);
  gap: 1.2rem;
  background: linear-gradient(160deg, var(--navy-900), var(--navy-950));
}

.principle {
  margin-top: 1.4rem;
  padding: 1.6rem 1.8rem;
  border: 1px solid var(--gold-dim);
  border-left: 3px solid var(--gold);
  background: rgba(201, 162, 39, .05);
}
.principle h3 { color: var(--gold-light); margin-bottom: .6rem; }
.principle p em { color: var(--white); }

/* ── STUDIO · Aree di pratica ───────────────────────────────── */
.practice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.4rem;
}

.practice-card {
  padding: 1.9rem 1.7rem;
  background: linear-gradient(160deg, var(--navy-800), rgba(16, 26, 56, .4));
  border: 1px solid rgba(201, 162, 39, .12);
  border-radius: 4px;
  transition: transform .35s var(--ease), border-color .35s var(--ease);
}
.practice-card:hover {
  transform: translateY(-6px);
  border-color: var(--gold-dim);
}
.practice-card h4 { color: var(--gold-light); margin-bottom: .7rem; }
.practice-card p { font-size: .92rem; }

/* ── SEDI · Globo ───────────────────────────────────────────── */
.sedi-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  min-height: 100vh;
  padding-top: var(--header-h);
}

.globe-wrap {
  position: relative;
  min-height: 70vh;
  background: radial-gradient(ellipse at center, #0d1530 0%, var(--navy-950) 80%);
}

.globe-hint {
  position: absolute;
  bottom: 1.4rem; left: 50%;
  transform: translateX(-50%);
  font-size: .75rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--grey);
  pointer-events: none;
  white-space: nowrap;
}

.sede-popup {
  position: absolute;
  z-index: 5;
  min-width: 230px;
  padding: 1.1rem 1.3rem;
  background: rgba(10, 17, 40, .94);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  transform: translate(-50%, calc(-100% - 18px));
  animation: pop .3s var(--ease);
}
@keyframes pop {
  from { opacity: 0; transform: translate(-50%, calc(-100% - 8px)); }
  to   { opacity: 1; transform: translate(-50%, calc(-100% - 18px)); }
}
.sede-popup h4 { color: var(--gold-light); margin-bottom: .4rem; }
.sede-popup p { font-size: .85rem; margin-bottom: .2rem; }
.sede-popup-close {
  position: absolute;
  top: .3rem; right: .5rem;
  background: none; border: 0;
  color: var(--grey);
  font-size: 1.2rem;
  cursor: pointer;
}
.sede-popup-close:hover { color: var(--white); }

.sedi-list {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.1rem;
  padding: clamp(2rem, 4vw, 3.5rem);
  background: linear-gradient(200deg, var(--navy-900), var(--navy-950));
}
.sedi-list h2 { margin-bottom: 1.2rem; }

.sede-card {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  text-align: left;
  padding: 1.3rem 1.5rem;
  background: rgba(16, 26, 56, .5);
  border: 1px solid rgba(201, 162, 39, .14);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--sans);
  color: inherit;
  transition: border-color .3s var(--ease), background .3s var(--ease), transform .3s var(--ease);
}
.sede-card:hover, .sede-card.active {
  border-color: var(--gold);
  background: rgba(201, 162, 39, .07);
  transform: translateX(6px);
}
.sede-city {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--white);
}
.sede-addr { font-size: .85rem; color: var(--grey); }
.sede-phone { font-size: .82rem; color: var(--gold-light); }
.sede-tag {
  margin-top: .5rem;
  align-self: flex-start;
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  padding: .2rem .6rem;
}

/* ── PROFESSIONISTI ─────────────────────────────────────────── */
.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.6rem;
}

.team-card {
  padding: 2.2rem 1.8rem;
  text-align: center;
  background: linear-gradient(170deg, var(--navy-800), rgba(16, 26, 56, .35));
  border: 1px solid rgba(201, 162, 39, .12);
  border-radius: 4px;
  transition: transform .35s var(--ease), border-color .35s var(--ease);
}
.team-card:hover { transform: translateY(-6px); border-color: var(--gold-dim); }

.team-avatar {
  width: 84px; height: 84px;
  margin: 0 auto 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--gold-light);
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--navy-700), var(--navy-950));
}

.team-card h3 { font-size: 1.25rem; margin-bottom: .3rem; }
.team-role {
  font-size: .72rem !important;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold) !important;
  margin-bottom: .8rem;
}
.team-spec { font-size: .88rem; margin: 0 auto .8rem; }
.team-sede {
  font-size: .75rem !important;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--grey) !important;
  margin: 0 auto;
}

/* ── CONTATTI ───────────────────────────────────────────────── */
.contact-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: 2.5rem;
}

.contact-form { display: flex; flex-direction: column; gap: 1.2rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--grey);
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  font-family: var(--sans);
  font-size: .95rem;
  color: var(--white);
  background: rgba(16, 26, 56, .55);
  border: 1px solid rgba(201, 162, 39, .18);
  border-radius: 2px;
  padding: .85rem 1rem;
  transition: border-color .3s var(--ease);
}
.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.contact-form textarea { resize: vertical; }
.contact-form .btn { align-self: flex-start; }

.form-note { font-size: .88rem; color: var(--gold-light); }

.contact-info h3 { color: var(--gold-light); margin: 1.6rem 0 .5rem; }
.contact-info h3:first-child { margin-top: 0; }

/* ── Blocchi extra contenuti ufficiali ──────────────────────── */
.home-areas { margin: 1.4rem 0 3rem; }

.quote { margin-top: 1rem; }

.team-cta {
  margin-top: 3rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.4rem;
}
.team-cta p { margin: 0; }

@media (max-width: 640px) {
  .team-cta { flex-direction: column; align-items: flex-start; }
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid rgba(201, 162, 39, .14);
  background: var(--navy-950);
  padding: 2.6rem clamp(1.2rem, 4vw, 3rem);
}

.footer-grid {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  align-items: start;
}
.footer-brand {
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--white);
  margin-bottom: .3rem;
}
.footer-brand em { color: var(--gold-light); font-style: italic; }
.footer-note { font-size: .82rem; margin: 0; }

/* ── Indicatore HTMX ────────────────────────────────────────── */
.htmx-indicator-bar {
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
  pointer-events: none;
}
.htmx-request .htmx-indicator-bar,
.htmx-indicator-bar.htmx-request { transform: scaleX(1); }

/* ── Animazioni reveal (attivate da GSAP) ───────────────────── */
.reveal { opacity: 0; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 980px) {
  .split-hero { grid-template-columns: 1fr; }
  .split-canvas-wrap { min-height: 62vh; order: -1; }
  .sedi-layout { grid-template-columns: 1fr; }
  .globe-wrap { min-height: 64vh; }
  .practice-grid, .team-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .contact-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .main-nav {
    position: fixed;
    top: var(--header-h);
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.4rem;
    width: min(78vw, 320px);
    padding: 2rem 1.8rem;
    background: rgba(6, 11, 26, .97);
    border-left: 1px solid var(--gold-dim);
    border-bottom: 1px solid var(--gold-dim);
    transform: translateX(105%);
    transition: transform .4s var(--ease);
  }
  .main-nav.open { transform: translateX(0); }
  .nav-toggle { display: flex; }
  .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .practice-grid, .team-grid, .form-row { grid-template-columns: 1fr; }
  .hero-overlay { background: linear-gradient(to top, rgba(6, 11, 26, .92) 20%, rgba(6, 11, 26, .25)); justify-content: flex-end; padding-bottom: 5rem; }
  .scroll-hint { display: none; }
}

/* ── Accessibilità: riduzione movimento ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .scroll-hint span, .boot-spinner { animation: none; }
  html { scroll-behavior: auto; }
}
