/* ============================================================
   Studio Legale R&B — Rosales & Bartolini
   Direzione: "Atlante degli investimenti" (cartografico, navy-dominante)
   ============================================================ */

:root {
  /* Palette */
  --ink:        #0f1b2d;   /* navy profondo (footer, testo su chiaro) */
  --navy:       #14233b;   /* navy sezioni scure */
  --navy-2:     #1c3151;   /* superfici card su scuro */
  --navy-line:  rgba(174, 196, 224, 0.16); /* linee griglia su scuro */
  --paper:      #f4f7fb;   /* carta-mappa fredda (sezioni chiare) */
  --paper-2:    #fcfdfe;   /* bianco-carta tintato (non #fff puro) */
  --paper-alt:  #eaeff6;   /* sezione alternata */
  --gold:       #c8a45c;   /* oro/bronzo (accento di pregio) */
  --gold-soft:  #d8bd84;
  --gold-ink:   #8a6a1c;   /* bronzo scuro: accento-testo su sfondo chiaro */
  --jade:       #4ea587;   /* verde giada (crescita / Perù) */
  --jade-soft:  #6cbfa3;

  /* Testo */
  --on-light:        #122236;
  --on-light-muted:  #4f6178;
  --on-dark:         #eaf1f9;
  --on-dark-muted:   #a9bcd4;

  /* Bordi */
  --border-light: #d8e0ec;
  --border-dark:  rgba(174, 196, 224, 0.18);

  /* Tipografia */
  --font-display: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;
  --font-body:    "Hanken Grotesk", system-ui, -apple-system, sans-serif;

  /* Layout */
  --wrap: 1140px;
  --pad: 22px;
  --radius: 16px;
  --radius-sm: 11px;
  --header-h: 68px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--on-light);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

h1, h2, h3 { font-family: var(--font-display); font-weight: 800; line-height: 1.08; letter-spacing: -0.018em; }

a { color: inherit; }

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

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}
/* Su fondi scuri l'anello scuro non si vedrebbe: passa all'oro (≥3:1 su navy) */
.hero :focus-visible,
.section-dark :focus-visible,
.promise :focus-visible,
.site-footer :focus-visible,
.mobile-menu :focus-visible { outline-color: var(--gold); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-inline: var(--pad); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--ink); color: var(--on-dark); padding: 12px 18px; border-radius: 0 0 10px 0;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ---------- Map label (eyebrow cartografico) ---------- */
.map-label {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em;
  color: var(--on-light-muted);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.map-label::before {
  content: ""; width: 13px; height: 13px; flex: none;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px transparent, 0 0 0 0 transparent;
  background:
    linear-gradient(var(--gold), var(--gold)) center/3px 3px no-repeat;
}
.map-label-light { color: var(--on-dark-muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 13px 26px;
  font-family: var(--font-body); font-size: 1rem; font-weight: 600;
  border-radius: 999px; border: 1.5px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.btn-primary {
  background: var(--gold); color: var(--ink);
  box-shadow: 0 12px 28px -12px rgba(200, 164, 92, 0.7);
}
.btn-primary:hover { background: var(--gold-soft); transform: translateY(-2px); }
.btn-ghost {
  background: transparent; color: var(--on-light); border-color: var(--border-light);
}
.btn-ghost:hover { border-color: var(--ink); transform: translateY(-1px); }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(244, 247, 251, 0.86);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; }

.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.brand-mark {
  position: relative;
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 9px;
  background: var(--ink); color: var(--on-dark);
  font-family: var(--font-display); font-weight: 800; font-size: 0.92rem;
  letter-spacing: 0.02em;
}
/* cornice interna sottile: dà al monogramma un'aria da stemma */
.brand-mark::before {
  content: ""; position: absolute; inset: 3px;
  border: 1px solid var(--gold); border-radius: 6px;
  opacity: 0.55; pointer-events: none;
}
.brand-mark .amp { color: var(--gold); font-weight: 700; }
.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.02rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.7rem; color: var(--on-light-muted); font-weight: 500; letter-spacing: 0.01em; }

.nav-desktop { display: none; }
.nav-cta { display: none; }

/* Hamburger */
.hamburger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; background: transparent; border: 1px solid var(--border-light);
  border-radius: 12px; cursor: pointer;
}
.hamburger-box { position: relative; width: 22px; height: 14px; }
.hamburger-line {
  position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px;
  background: var(--ink); transition: transform 0.28s var(--ease), opacity 0.2s var(--ease), top 0.28s var(--ease);
}
.hamburger-line:nth-child(1) { top: 0; }
.hamburger-line:nth-child(2) { top: 6px; }
.hamburger-line:nth-child(3) { top: 12px; }
body.menu-open .hamburger-line:nth-child(1) { top: 6px; transform: rotate(45deg); }
body.menu-open .hamburger-line:nth-child(2) { opacity: 0; }
body.menu-open .hamburger-line:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* Mobile overlay menu (full-screen: nessun problema di translate math) */
.mobile-menu {
  position: fixed; inset: 0; z-index: 95;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 90px 28px 48px;
  background: var(--ink);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.3s var(--ease), transform 0.35s var(--ease), visibility 0s linear 0.3s;
}
body.menu-open .mobile-menu {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0);
  transition: opacity 0.3s var(--ease), transform 0.35s var(--ease), visibility 0s;
}
.mobile-link {
  font-family: var(--font-display); font-weight: 700; font-size: 1.7rem;
  color: var(--on-dark); text-decoration: none; padding: 12px 4px;
  border-bottom: 1px solid var(--border-dark);
  display: flex; align-items: center; min-height: 56px;
}
.mobile-link:last-child { border-bottom: none; }
.mobile-cta { color: var(--gold); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative; isolation: isolate;
  background: var(--ink);
  color: var(--on-dark);
  padding: 64px 0 76px;
  overflow: hidden;
}
.hero::before {
  /* griglia carta nautica */
  content: ""; position: absolute; inset: 0; z-index: -2;
  background-image:
    linear-gradient(var(--navy-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--navy-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(120% 120% at 70% 30%, #000 35%, transparent 88%);
  -webkit-mask-image: radial-gradient(120% 120% at 70% 30%, #000 35%, transparent 88%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(90% 70% at 78% 18%, rgba(78, 165, 135, 0.10), transparent 60%),
    linear-gradient(180deg, rgba(15,27,45,0.10) 0%, rgba(15,27,45,0.78) 78%, var(--ink) 100%);
}
.hero-chart { position: absolute; inset: 0; z-index: -1; opacity: 0.9; }
.chart-svg { width: 100%; height: 100%; }

.chart-svg .arc {
  fill: none; stroke: var(--gold); stroke-width: 1.4; opacity: 0.7;
  stroke-dasharray: 5 9; stroke-linecap: round;
}
.chart-svg .arc-2 { stroke: var(--jade); }
.chart-svg .node-ring { fill: none; stroke: var(--gold); stroke-width: 1.6; opacity: 0.85; }
.chart-svg .node-dot { fill: var(--gold); }
.chart-svg .node line { stroke: var(--gold); stroke-width: 1; opacity: 0.5; }
.chart-svg .node-new .node-ring,
.chart-svg .node-new .node-dot { stroke: var(--jade); fill: var(--jade); }
.chart-svg .node-new line { stroke: var(--jade); }
.chart-svg .node-name {
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  fill: var(--on-dark); text-anchor: middle;
}
.chart-svg .node-coord {
  font-family: var(--font-body); font-weight: 500; font-size: 11px;
  fill: var(--on-dark-muted); text-anchor: middle; letter-spacing: 0.02em;
}

.hero-inner { position: relative; max-width: 760px; }
.hero-title {
  font-size: clamp(1.7rem, 7vw, 4rem);
  font-weight: 900; letter-spacing: -0.025em;
  margin-bottom: 22px;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.hero-lead {
  font-size: clamp(1.04rem, 2.4vw, 1.22rem);
  color: var(--on-dark-muted); max-width: 600px; margin-bottom: 32px;
}
.hero-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.hero-note { font-size: 0.86rem; color: var(--on-dark-muted); }

/* ============================================================
   SECTIONS (generico)
   ============================================================ */
.section { padding: 72px 0; }
.section-alt { background: var(--paper-alt); }
.section-head { max-width: 680px; margin-bottom: 44px; }
.section-title { font-size: clamp(1.7rem, 4.4vw, 2.7rem); margin-bottom: 18px; text-wrap: balance; }
.section-intro { font-size: 1.06rem; color: var(--on-light-muted); }
.lead { font-size: 1.12rem; color: var(--on-light); margin-bottom: 16px; }
.muted { color: var(--on-light-muted); }

/* ---------- Lo studio ---------- */
.studio-grid { display: grid; gap: 40px; }
.stats { display: grid; grid-template-columns: 1fr; gap: 14px; }
.stat {
  background: var(--paper-2); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 22px 24px;
  display: flex; align-items: baseline; gap: 16px;
}
.stat-num {
  font-family: var(--font-display); font-weight: 900; font-size: 2.6rem; line-height: 1;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.stat-plus { color: var(--gold-ink); }
.stat-cap { color: var(--on-light-muted); font-size: 0.98rem; }

/* ---------- Servizi ---------- */
.service-core {
  display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start;
  background: var(--ink); color: var(--on-dark);
  border-radius: var(--radius); padding: 30px 26px; margin-bottom: 22px;
  position: relative; overflow: hidden;
}
.service-core::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--navy-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--navy-line) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(80% 120% at 90% 0%, #000, transparent 70%);
  -webkit-mask-image: radial-gradient(80% 120% at 90% 0%, #000, transparent 70%);
  pointer-events: none;
}
.service-core-mark { color: var(--gold); width: 48px; position: relative; }
.service-core-body { position: relative; }
.service-core-title { font-size: 1.34rem; margin-bottom: 10px; }
.service-core-body p { color: var(--on-dark-muted); max-width: 60ch; }

.services-grid { list-style: none; display: grid; grid-template-columns: 1fr; gap: 14px; }
.service-card {
  background: var(--paper-2); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 22px 22px;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.service-card:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 16px 30px -22px rgba(15,27,45,0.5); }
.service-title { font-size: 1.12rem; font-weight: 700; margin-bottom: 7px; }
.service-card p { color: var(--on-light-muted); font-size: 0.98rem; }

/* ---------- Phases (percorso) ---------- */
.phases { list-style: none; display: grid; grid-template-columns: 1fr; gap: 0; }
.phase { position: relative; padding: 0 0 30px 34px; }
.phase:last-child { padding-bottom: 0; }
.phase::before {
  /* linea verticale di collegamento */
  content: ""; position: absolute; left: 6px; top: 6px; bottom: -6px; width: 2px;
  background: linear-gradient(var(--gold), var(--border-light));
}
.phase:last-child::before { display: none; }
.phase-mark {
  position: absolute; left: 0; top: 3px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--gold);
}
.phase-title { font-size: 1.18rem; margin-bottom: 6px; }
.phase p { color: var(--on-light-muted); }

/* ============================================================
   SEZIONE SCURA — I PAESI
   ============================================================ */
.section-dark { position: relative; background: var(--navy); color: var(--on-dark); padding: 76px 0; overflow: hidden; isolation: isolate; }
.dark-grid {
  position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--navy-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--navy-line) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(110% 90% at 15% 10%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(110% 90% at 15% 10%, #000 30%, transparent 80%);
}
.section-title-light { color: var(--on-dark); }
.section-intro-light { color: var(--on-dark-muted); }

.countries { list-style: none; display: grid; grid-template-columns: 1fr; gap: 16px; }
.country {
  background: var(--navy-2); border: 1px solid var(--border-dark);
  border-radius: var(--radius); padding: 24px 24px;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.country:hover { transform: translateY(-3px); border-color: rgba(200,164,92,0.5); }
.country-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.country-name { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; }
.country-coord {
  font-size: 0.78rem; color: var(--on-dark-muted); font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em; white-space: nowrap;
}
.country-place { color: var(--gold-soft); font-weight: 600; font-size: 0.92rem; margin-bottom: 12px; }
.country-desc { color: var(--on-dark-muted); }
.country-featured { border-color: rgba(78,165,135,0.55); background: linear-gradient(180deg, rgba(78,165,135,0.10), var(--navy-2)); }
.tag-new {
  display: inline-block; background: var(--jade); color: var(--ink);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 4px 11px; border-radius: 999px; text-transform: uppercase;
}
.countries-note {
  margin-top: 26px; color: var(--on-dark-muted); font-size: 1.02rem;
  border-left: none; max-width: 62ch;
}

/* ---------- Perché noi ---------- */
.reasons { list-style: none; display: grid; grid-template-columns: 1fr; gap: 26px; }
.reason { position: relative; padding-left: 32px; }
.reason-mark {
  position: absolute; left: 0; top: 6px; width: 16px; height: 16px;
  border: 2px solid var(--gold); border-radius: 50%;
}
.reason-mark::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px;
  transform: translate(-50%,-50%); background: var(--gold); border-radius: 50%;
}
.reason-title { font-size: 1.16rem; margin-bottom: 6px; }
.reason p { color: var(--on-light-muted); }

/* ============================================================
   PROMESSA
   ============================================================ */
.promise { background: var(--ink); color: var(--on-dark); padding: 76px 0; position: relative; overflow: hidden; isolation: isolate; }
.promise::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(80% 120% at 50% 0%, rgba(200,164,92,0.14), transparent 60%);
}
.promise-wrap { max-width: 760px; }
.promise-text {
  font-family: var(--font-display); font-weight: 700; line-height: 1.28;
  font-size: clamp(1.32rem, 3.6vw, 2.08rem); letter-spacing: -0.015em;
  margin-bottom: 22px; text-wrap: balance;
}
.promise-sign { color: var(--gold-soft); font-weight: 600; font-size: 1.04rem; }

/* ---------- Contatti ---------- */
.contatti-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 18px; }
.contatto {
  background: var(--paper-2); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 20px 22px;
  display: flex; flex-direction: column; gap: 5px;
}
.contatto-label { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; color: var(--on-light-muted); text-transform: uppercase; }
.contatto-value { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; color: var(--ink); word-break: break-word; }
.contatti-hint { color: var(--on-light-muted); font-size: 0.94rem; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { background: var(--ink); color: var(--on-dark); padding: 48px 0 36px; }
.footer-inner { display: grid; grid-template-columns: 1fr; gap: 28px; }
.footer-brand { display: inline-flex; align-items: center; gap: 11px; }
.footer-brand .brand-mark { background: var(--navy-2); }
.footer-brand .brand-name { color: var(--on-dark); }
.footer-brand .brand-sub { color: var(--on-dark-muted); }
.footer-info { display: flex; flex-direction: column; gap: 4px; }
.footer-line { color: var(--on-dark-muted); font-size: 0.95rem; }
.footer-meta { display: flex; flex-direction: column; gap: 6px; padding-top: 22px; border-top: 1px solid var(--border-dark); }
.footer-copy { color: var(--on-dark-muted); font-size: 0.88rem; }
.footer-credit { font-size: 0.82rem; color: var(--on-dark-muted); }
.footer-credit a { color: var(--gold-soft); text-decoration: underline; text-underline-offset: 2px; }
.footer-credit a:hover { color: var(--gold); }

/* ============================================================
   ANIMAZIONI (gated dietro .anim-ready: contenuto sempre visibile senza JS)
   ============================================================ */
.anim-ready .reveal { opacity: 0; transform: translateY(16px); }
.anim-ready .reveal {
  animation: reveal 0.7s var(--ease) forwards;
  animation-delay: calc(var(--d, 0) * 0.12s + 0.1s);
}
.anim-ready .reveal-up { opacity: 0; transform: translateY(22px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.anim-ready .reveal-up.is-visible { opacity: 1; transform: none; }

@keyframes reveal { to { opacity: 1; transform: none; } }

.anim-ready .chart-svg .arc {
  animation: dashflow 7s linear infinite;
}
.anim-ready .chart-svg .node-ring { transform-box: fill-box; transform-origin: center; animation: pulse 3.4s var(--ease) infinite; }
.anim-ready .chart-svg .node:nth-child(3) .node-ring { animation-delay: 1.1s; }
.anim-ready .chart-svg .node:nth-child(4) .node-ring { animation-delay: 2.2s; }

@keyframes dashflow { to { stroke-dashoffset: -140; } }
@keyframes pulse { 0%, 100% { opacity: 0.85; } 50% { opacity: 0.4; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 600px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat { flex-direction: column; gap: 8px; }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .contatti-grid { grid-template-columns: repeat(3, 1fr); }
  .countries { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  :root { --pad: 36px; --header-h: 76px; }

  .hamburger { display: none; }
  .nav-desktop { display: flex; align-items: center; gap: 30px; }
  .nav-desktop a {
    text-decoration: none; color: var(--on-light); font-weight: 600; font-size: 0.98rem;
    position: relative; padding: 6px 0;
  }
  .nav-desktop a::after {
    content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 2px;
    background: var(--gold); transition: width 0.25s var(--ease);
  }
  .nav-desktop a:hover::after { width: 100%; }
  .nav-cta { display: inline-flex; min-height: 44px; padding: 9px 20px; }

  .hero { padding: 96px 0 110px; }
  .section, .section-dark, .promise { padding: 100px 0; }

  .studio-grid { grid-template-columns: 1.15fr 0.85fr; gap: 56px; align-items: center; }

  .phases { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .phase { padding: 38px 18px 0 0; }
  .phase::before { left: 0; top: 6px; right: -8px; bottom: auto; width: auto; height: 2px; background: linear-gradient(90deg, var(--gold), var(--border-light)); }
  .phase:last-child::before { display: none; }
  .phase-mark { left: 0; top: 0; }

  .reasons { grid-template-columns: repeat(2, 1fr); gap: 36px 48px; }
  .service-core { padding: 38px 36px; }
}

@media (min-width: 1024px) {
  .services-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-title { font-size: clamp(3rem, 5vw, 4.2rem); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .reveal, .reveal-up { opacity: 1 !important; transform: none !important; }
}
