/* ==========================================================================
   OnTheRoad — landing getontheroad.app
   "Mezzanotte sul Tavolo del Cartografo": hero ossidiana cinematografico,
   corpo pergamena, ambra ≤15% (rarità), Figtree monofont self-hosted.
   Token allineati a .impeccable/design.json. Nessun font CDN (privacy).
   ========================================================================== */

/* ---- Figtree self-hosted (no Google Fonts) ---- */
@font-face { font-family: 'Figtree'; src: url('fonts/Figtree_400Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('fonts/Figtree_500Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('fonts/Figtree_600SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('fonts/Figtree_700Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('fonts/Figtree_800ExtraBold.ttf') format('truetype'); font-weight: 800; font-style: normal; font-display: swap; }

/* ---- Token ---- */
:root {
  /* corpo (light) */
  --bg: #F9F6F1;
  --surface: #FFFFFF;
  --surface-subtle: #F0EBE2;
  --ink: #1A1712;
  --muted: #6B6258;
  --border: #DDD7CB;
  --teal: #1B7A6C;

  /* accento — invariato fra i temi */
  --ambra: #E8860A;
  --on-ambra: #000000;

  /* banner permanente — invariato fra i temi */
  --banner-bg: #2A2A28;
  --banner-fg: #ECE5DA;

  /* hero / footer ossidiana — FISSO, non segue lo scheme (art direction) */
  --ink-bg: #131109;
  --footer-bg: #1A1712;
  --hero-ink: #ECE5DA;
  --hero-muted: #A89E8C;

  /* scena cartografica (decorativa, su ossidiana) */
  --map-contour: #5B5444;
  --map-tick: rgba(236, 229, 218, 0.20);
  --map-tick-strong: rgba(236, 229, 218, 0.52);
  --map-route: #4CBDB0;
  --map-comet: #9AE8E0;
  --map-phone-screen: #1A1611;
  --map-phone-frame: #8A8173;
  --map-ui-muted: #A89E8C;
  --map-ui-ink: #ECE5DA;

  /* forma / movimento */
  --maxw: 72rem;
  --radius: 16px;
  --pill: 999px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --fab-glow: 0 6px 20px rgba(232, 134, 10, 0.40);
  --card-ambient: 0 4px 12px rgba(0, 0, 0, 0.06);
  --font: 'Figtree', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --z-sticky: 50;
  --z-skip: 100;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131109;
    --surface: #1C1A14;
    --surface-subtle: #25221A;
    --ink: #ECE5DA;
    --muted: #968A7C;
    --border: #2D2A22;
    --teal: #4CBDB0;
    --card-ambient: 0 4px 14px rgba(0, 0, 0, 0.40);
  }
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--ambra); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 50%; top: -100px; transform: translateX(-50%);
  z-index: var(--z-skip); background: var(--ambra); color: var(--on-ambra);
  padding: 10px 18px; border-radius: var(--pill); font-weight: 600;
  transition: top .15s var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ---- Eyebrow (firma del sistema) ---- */
.eyebrow {
  font-size: 0.625rem; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 0.9rem;
}
.eyebrow--onDark { color: var(--hero-muted); }

/* ==========================================================================
   Masthead — assoluto sopra l'hero ossidiana (testo chiaro, sempre)
   ========================================================================== */
.masthead {
  position: absolute; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; max-width: var(--maxw); margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 1.6rem) clamp(1.25rem, 4vw, 2.5rem);
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--hero-ink); }
.brand-mark { color: var(--hero-ink); border-radius: 8px; flex: none; }
.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.mast-nav { display: flex; gap: 1.6rem; align-items: center; }
.mast-nav a { color: var(--hero-muted); font-size: 0.95rem; font-weight: 500; transition: color .15s var(--ease-out); }
.mast-nav a:hover { color: var(--hero-ink); }

/* ==========================================================================
   Hero (ossidiana, sempre dark)
   ========================================================================== */
.hero {
  position: relative;
  background: var(--ink-bg);
  color: var(--hero-ink);
  padding: clamp(7rem, 14vh, 10rem) clamp(1.25rem, 4vw, 2.5rem) clamp(3rem, 8vh, 5rem);
  overflow: hidden;
}
.hero-grid {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center;
}
.hero-copy { max-width: 34rem; }
.hero-title {
  font-weight: 800;
  font-size: clamp(2rem, 6.4vw, 4.4rem);
  line-height: 1.03; letter-spacing: -0.025em;
  color: var(--hero-ink); text-wrap: balance;
  margin: 0 0 1.25rem; overflow-wrap: break-word;
}
.hero-lede {
  font-size: 1.125rem; line-height: 1.6; color: var(--hero-muted);
  max-width: 46ch; text-wrap: pretty; margin: 0 0 2rem;
}

/* CTA */
.cta-row { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--font); font-weight: 600; font-size: 1rem;
  padding: 0.9rem 1.5rem; border-radius: var(--pill); border: 1.5px solid transparent;
  cursor: pointer; transition: transform .15s var(--ease-out), box-shadow .2s var(--ease-out), opacity .15s var(--ease-out), background-color .15s var(--ease-out);
}
.btn-primary { background: var(--ambra); color: var(--on-ambra); box-shadow: var(--fab-glow); }
.btn-primary:hover { box-shadow: 0 8px 26px rgba(232, 134, 10, 0.50); opacity: .96; }
.btn-primary:active { transform: scale(0.95); opacity: .9; }
.btn-primary--sm { padding: 0.6rem 1.15rem; font-size: 0.95rem; box-shadow: 0 4px 14px rgba(232,134,10,0.38); }
.btn-sub {
  font-weight: 500; font-size: 0.72rem; letter-spacing: 0.02em;
  padding-left: 0.6rem; margin-left: 0.1rem; border-left: 1px solid rgba(0,0,0,0.22);
}
.btn-ghost { background: transparent; color: var(--hero-ink); border-color: rgba(236,229,218,0.28); }
.btn-ghost:hover { border-color: var(--hero-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-subtle); }
.btn-secondary:active { transform: scale(0.96); }

.trust-ticks { margin: 1.6rem 0 0; font-size: 0.85rem; color: var(--hero-muted); letter-spacing: 0.01em; }

/* Scena mappa */
.hero-scene { width: 100%; }
.map-scene { width: 100%; height: auto; max-height: 78vh; }
.coord { font-size: 11px; font-weight: 500; letter-spacing: 0.1em; }
.pin-label { font-size: 10px; font-weight: 500; letter-spacing: 0.13em; }
.ui-eyebrow { font-size: 9px; font-weight: 500; letter-spacing: 0.14em; }
.ui-title { font-size: 13px; font-weight: 600; }

/* transizione ossidiana → pergamena */
.hero-fade { height: 80px; background: linear-gradient(to bottom, var(--ink-bg), var(--bg)); }

/* ==========================================================================
   Strip privacy (banner permanente antracite)
   ========================================================================== */
.privacy-strip {
  background: var(--banner-bg); color: var(--banner-fg);
  padding: 1rem clamp(1.25rem, 4vw, 2.5rem);
}
.privacy-strip p {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 0.65rem;
  font-weight: 600; font-size: 0.98rem; text-align: center; color: var(--banner-fg);
}
.privacy-strip svg { color: var(--map-route); flex: none; }
.privacy-strip strong { color: #fff; }

/* ==========================================================================
   Blocchi corpo (pergamena)
   ========================================================================== */
.block {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3rem, 8vh, 5.5rem) clamp(1.25rem, 4vw, 2.5rem);
}
.block--alt { background: var(--surface-subtle); max-width: none; }
.block--alt > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.section-title {
  font-weight: 700; font-size: clamp(1.5rem, 3.6vw, 2.15rem);
  line-height: 1.15; letter-spacing: -0.015em; color: var(--teal);
  text-wrap: balance; max-width: 22ch; margin: 0 0 2rem;
}
.block-note { margin-top: 1.75rem; color: var(--muted); max-width: 52ch; text-wrap: pretty; }

/* Legenda (privacy) — voci di legenda cartografica, piano unico */
.legend { display: grid; gap: 0; }
.legend-row {
  display: flex; gap: 1.1rem; align-items: flex-start;
  padding: 1.25rem 0; border-bottom: 1px solid var(--border);
}
.legend-row:first-child { border-top: 1px solid var(--border); }
.legend-glyph {
  flex: none; width: 48px; height: 48px; display: grid; place-items: center;
  color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.legend-glyph svg { color: var(--teal); }
.legend-text h3 { font-weight: 600; font-size: 1.0625rem; margin: 0 0 0.25rem; color: var(--ink); }
.legend-text p { color: var(--muted); max-width: 52ch; text-wrap: pretty; }

/* Checklist */
.checklist { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 0.6rem 2rem; max-width: 56rem; }
.checklist li { position: relative; padding-left: 2rem; color: var(--ink); }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 0.5em;
  width: 13px; height: 7px; border-left: 2.5px solid var(--teal); border-bottom: 2.5px solid var(--teal);
  transform: rotate(-45deg) translateY(-2px);
}
.checklist em { color: var(--muted); font-style: italic; }

/* Come funziona — 3 step con pin tipizzati */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.5rem; counter-reset: step; }
.step { position: relative; padding-left: 3.5rem; }
.step-pin {
  position: absolute; left: 0; top: 0; width: 2.5rem; height: 2.5rem;
  display: grid; place-items: center; border-radius: var(--pill);
  border: 2px solid var(--teal); color: var(--teal);
  font-weight: 700; font-size: 1rem;
}
.step h3 { font-weight: 600; font-size: 1.0625rem; margin: 0.35rem 0 0.3rem; color: var(--ink); }
.step p { color: var(--muted); text-wrap: pretty; }

/* Prezzi — riquadri piatti, Ko-fi secondary (niente fill ambra) */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.25rem; }
.plan {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.75rem; box-shadow: var(--card-ambient);
}
.plan-name { font-weight: 600; font-size: 1.0625rem; margin: 0 0 0.3rem; color: var(--ink); }
.plan-price { font-weight: 800; font-size: 1.9rem; color: var(--ink); margin: 0 0 1rem; letter-spacing: -0.02em; }
.plan-price--soft { font-size: 1.15rem; font-weight: 600; color: var(--teal); }
.plan-list { display: grid; gap: 0.4rem; margin: 0 0 1.25rem; }
.plan-list li { position: relative; padding-left: 1.4rem; color: var(--muted); }
.plan-list li::before { content: "·"; position: absolute; left: 0.4rem; color: var(--teal); font-weight: 700; }

/* FAQ */
.faq { max-width: 48rem; }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  list-style: none; cursor: pointer; padding: 1.05rem 2rem 1.05rem 0; position: relative;
  font-weight: 600; font-size: 1.0625rem; color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 0.3rem; top: 1.35rem;
  width: 9px; height: 9px; border-right: 2px solid var(--teal); border-bottom: 2px solid var(--teal);
  transform: rotate(45deg); transition: transform .2s var(--ease-out);
}
.faq details[open] summary::after { transform: rotate(-135deg); }
.faq-body { padding: 0 0 1.2rem; color: var(--muted); }
.faq-body ol { list-style: decimal; padding-left: 1.3rem; display: grid; gap: 0.35rem; }
.faq-body p { color: var(--muted); }
.checksum { margin-top: 0.8rem; font-size: 0.9rem; word-break: break-all; }
code {
  font-family: 'Cascadia Code', Consolas, monospace; font-size: 0.86em;
  background: var(--surface-subtle); padding: 0.12em 0.4em; border-radius: 5px;
}

/* ==========================================================================
   Footer (inchiostro)
   ========================================================================== */
.site-footer { background: var(--footer-bg); color: var(--hero-ink); }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(2.5rem, 6vh, 4rem) clamp(1.25rem, 4vw, 2.5rem);
  display: grid; gap: 1.25rem;
}
.brand--onDark { color: var(--hero-ink); }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.footer-links a { color: var(--hero-muted); font-weight: 600; font-size: 0.95rem; transition: color .15s var(--ease-out); }
.footer-links a:hover { color: var(--hero-ink); }
.footer-note { color: var(--hero-muted); font-size: 0.88rem; line-height: 1.7; }

/* ==========================================================================
   Sticky CTA
   ========================================================================== */
.sticky-cta {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%) translateY(160%);
  z-index: var(--z-sticky); visibility: hidden;
  display: flex; align-items: center; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--pill);
  padding: 0.55rem 0.6rem 0.55rem 1.25rem; box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  transition: transform .24s var(--ease-out), visibility .24s;
  max-width: calc(100% - 2rem);
}
.sticky-cta.show { transform: translateX(-50%) translateY(0); visibility: visible; }
.sticky-label { font-size: 0.85rem; font-weight: 500; color: var(--muted); white-space: nowrap; }

/* ==========================================================================
   Motion (enhancement; lo stato finale è il default)
   ========================================================================== */
@keyframes riseIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes contourIn { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes drawRoute { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes pinIn { from { opacity: 0; } to { opacity: 1; } }

/* default route teal: disegnata */
.route-teal { stroke-dasharray: 100; stroke-dashoffset: 0; }

/* hero intro */
.play-intro .hero-copy > *:not(.hero-title) { animation: riseIn 0.6s var(--ease-out) both; }
.play-intro .hero-copy > *:nth-child(1) { animation-delay: 0.05s; }
.play-intro .hero-copy > *:nth-child(2) { animation-delay: 0.14s; }
.play-intro .hero-copy > *:nth-child(3) { animation-delay: 0.23s; }
.play-intro .hero-copy > *:nth-child(4) { animation-delay: 0.32s; }
.play-intro .hero-copy > *:nth-child(5) { animation-delay: 0.40s; }

/* Scena cartografica: si anima quando ENTRA nello schermo (.scene-in via JS),
   non al load. Su mobile la scena è sotto il fold: così la rotta si disegna
   quando ci scrolli sopra, invece di farlo non visto al caricamento. */
.scene-in .contours { animation: contourIn 0.7s var(--ease-out) both; transform-origin: center; }
.scene-in .grid-ticks, .scene-in .grid-labels { animation: fadeIn 0.6s 0.2s var(--ease-out) both; }
.scene-in .route-amber { animation: fadeIn 0.5s 0.35s var(--ease-out) both; }
.scene-in .route-teal { animation: drawRoute 0.95s 0.55s var(--ease-out) both; }
.scene-in .phone { animation: fadeIn 0.7s 0.25s var(--ease-out) both; }
.scene-in .pins .pin { animation: pinIn 0.4s var(--ease-out) both; }
.scene-in .pins .pin:nth-child(2) { animation-delay: 1.05s; }
.scene-in .pins .pin:nth-child(3) { animation-delay: 1.15s; }
.scene-in .pins .pin:nth-child(4) { animation-delay: 1.3s; }
.scene-in .pins .pin--start { animation: pinIn 0.4s 1.35s var(--ease-out) both; }

/* reveal sezioni (solo transform; opacity sempre 1) */
.play-intro [data-reveal] > * { transform: translateY(16px); transition: transform 0.55s var(--ease-out); }
.play-intro [data-reveal] > *:nth-child(2) { transition-delay: 0.06s; }
.play-intro [data-reveal] > *:nth-child(3) { transition-delay: 0.12s; }
.play-intro [data-reveal] > *:nth-child(4) { transition-delay: 0.18s; }
.play-intro [data-reveal].in > * { transform: none; }

/* ==========================================================================
   Motion+ : signature potenziata + micro-interazioni (zero librerie esterne)
   ========================================================================== */

/* Parallax leggero della scena al puntatore (vars da JS, solo desktop) */
.hero-scene { transform: translate3d(var(--par-x, 0), var(--par-y, 0), 0); transition: transform 0.35s var(--ease-out); }

/* Titolo: reveal a wipe per riga (clip) */
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.hero-title .line-in { display: block; }
.play-intro .hero-title .line-in { transform: translateY(115%); animation: lineUp 0.8s var(--ease-out-expo) forwards; }
.play-intro .hero-title .line:nth-child(1) .line-in { animation-delay: 0.10s; }
.play-intro .hero-title .line:nth-child(2) .line-in { animation-delay: 0.22s; }
@keyframes lineUp { to { transform: translateY(0); } }

/* CTA: glint che attraversa al hover (transform, GPU) */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 35%, rgba(255,255,255,0.5) 50%, transparent 65%);
  transform: translateX(-120%);
}
.btn-primary:hover::after { animation: sheen 0.8s var(--ease-out); }
@keyframes sheen { to { transform: translateX(120%); } }

/* Rotta: cometa che la percorre una volta dopo il disegno */
.route-comet { opacity: 0; }
/* Cometa: invariante dash+gap = pathLength (100). Unico "flourish" dopo che i pin si posano. */
.scene-in .route-comet { stroke-dashoffset: 100; animation: comet 1.15s 1.55s var(--ease-out) forwards; }
@keyframes comet { 0% { opacity: 0; stroke-dashoffset: 100; } 14% { opacity: 1; } 86% { opacity: 1; } 100% { opacity: 0; stroke-dashoffset: 0; } }

/* Underline a scorrimento (nav + footer) */
.mast-nav a, .footer-links a { position: relative; }
.mast-nav a::after, .footer-links a::after {
  content: ""; position: absolute; left: 0; bottom: -3px; width: 100%; height: 1.5px;
  background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s var(--ease-out);
}
.mast-nav a:hover::after, .footer-links a:hover::after { transform: scaleX(1); }

/* Legenda: il glifo si solleva e si tinge al hover */
.legend-glyph { transition: transform 0.25s var(--ease-out), border-color 0.25s var(--ease-out); }
.legend-row:hover .legend-glyph { transform: translateY(-3px); border-color: var(--teal); }

/* Prezzi: lieve sollevamento al hover */
.plan { transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out); }
.plan:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,0.09); }

/* FAQ: corpo che entra con fade+slide all'apertura */
.faq details[open] .faq-body { animation: faqIn 0.3s var(--ease-out); }
@keyframes faqIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { max-width: 36rem; }
  .hero-scene { max-width: 26rem; margin: 0.5rem auto 0; }
  .map-scene { max-height: 60vh; }
}
@media (max-width: 600px) {
  .mast-nav { display: none; }
  .btn { width: 100%; justify-content: center; }
  .cta-row { flex-direction: column; align-items: stretch; }
  .sticky-cta { left: 1rem; right: 1rem; transform: translateY(160%); width: auto; max-width: none; }
  .sticky-cta.show { transform: translateY(0); }
  .sticky-label { display: none; }
  .sticky-cta .btn { width: 100%; }
}
@media (max-width: 460px) {
  .hero-scene .map-scene { content-visibility: auto; }
}

/* ==========================================================================
   Reduced motion — nessuna informazione vive solo nel movimento
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* Nessun movimento: parallax off, rotta già disegnata, niente cometa né sweep/slide. */
  .hero-scene { transform: none !important; transition: none !important; }
  .route-teal { stroke-dashoffset: 0 !important; }
  .route-comet { display: none !important; }
  .btn-primary:hover::after { animation: none !important; }
  .faq details[open] .faq-body { animation: none !important; }
  .sticky-cta { transition: none !important; }
  /* La pagina entra comunque con un fade gentile (solo opacità, vestibular-safe),
     invece di apparire del tutto statica. */
  .hero-copy > *, .hero-scene, .block > *, .privacy-strip > *, .site-footer {
    animation: rmFade 0.6s ease-out both;
  }
  @keyframes rmFade { from { opacity: 0; } to { opacity: 1; } }
}
