/* ==========================================================================
   Trais — sistema visivo
   Palette derivata da src/theme/colors.ts dell'app, così sito e app
   condividono la stessa identità. Il fondo scuro è l'inchiostro dei testi
   dell'app (#0E1B2A) usato come superficie.
   ========================================================================== */

:root {
  --ink:        #0E1B2A;
  --ink-soft:   #16283A;
  --ink-line:   #24384C;
  --teal:       #619BA7;
  --teal-bright:#8CC5D1;
  --teal-deep:  #4E8793;
  --paper:      #F4F7F9;
  --white:      #FFFFFF;
  --muted:      #6E7C8C;
  --muted-dark: #8FA3B5;
  --border:     #E6ECF2;
  --amber:      #E8B54D;

  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --body:    'Public Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --wrap: 1120px;
  --radius: 20px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
}

p { margin: 0; }

a { color: var(--teal-deep); }

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

:focus-visible {
  outline: 3px solid var(--teal-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- eyebrow: etichetta di sezione ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: 18px;
}
.on-ink .eyebrow { color: var(--teal-bright); }

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--body);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  padding: 15px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
}
.btn:hover { transform: translateY(-2px); }

/* testo scuro sul teal: 5,58:1, mentre il bianco si ferma a 3,13:1 */
.btn-primary { background: var(--teal); color: var(--ink); }
.btn-primary:hover { background: var(--teal-bright); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--teal); }

.on-ink .btn-ghost { color: var(--white); border-color: var(--ink-line); }
.on-ink .btn-ghost:hover { border-color: var(--teal-bright); }

/* badge App Store */
.btn-store {
  background: var(--white);
  color: var(--ink);
  padding: 13px 24px 13px 20px;
}
.btn-store:hover { background: var(--paper); }
.btn-store svg { width: 26px; height: 26px; flex: none; }
.btn-store .store-lines { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.btn-store .store-small { font-size: 11px; font-weight: 500; color: var(--muted); }
.btn-store .store-big { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }

/* ---------- navigazione ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(14, 27, 42, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ink-line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--white);
  font-family: var(--display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--teal);
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
}
/* icona reale dell'app (stessa immagine di App Store / home screen) */
.brand-mark img { width: 100%; height: 100%; border-radius: inherit; }

.nav-links { display: flex; align-items: center; gap: 30px; }
/* :not(.btn) evita che questa regola vinca sul colore del pulsante per specificità */
.nav-links a:not(.btn) {
  color: var(--muted-dark);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: color .18s ease;
}
.nav-links a:not(.btn):hover { color: var(--white); }
.nav-cta { padding: 10px 20px; font-size: 15px; }

@media (max-width: 800px) {
  .nav-links a:not(.nav-cta) { display: none; }
}

/* ==========================================================================
   HERO — l'elemento firma: l'onda audio che si risolve in testo
   ========================================================================== */
.hero {
  background: var(--ink);
  color: var(--white);
  padding: 68px 0 84px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  /* alone teal diffuso dietro l'onda */
  content: '';
  position: absolute;
  left: 50%;
  top: 58%;
  width: 900px; height: 460px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(97,155,167,.20), transparent 68%);
  pointer-events: none;
}
.hero .wrap { position: relative; z-index: 1; }

.hero-head { max-width: 760px; }

.hero h1 {
  font-size: clamp(44px, 7.2vw, 82px);
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 22px;
}
.hero h1 .accent { color: var(--teal-bright); }

.hero-sub {
  font-size: clamp(17px, 2.2vw, 20px);
  color: var(--muted-dark);
  max-width: 560px;
  margin-bottom: 34px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

.hero-note {
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted-dark);
}

/* --- il modulo firma --- */
.converter {
  margin-top: 44px;
  background: var(--ink-soft);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 28px 28px 26px;
  max-width: 880px;
}

.converter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted-dark);
  text-transform: uppercase;
}
.rec-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--amber);
  flex: none;
}
.converter-time { margin-left: auto; color: var(--muted-dark); text-transform: none; letter-spacing: 0.04em; }

/* onda */
.wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 76px;
  margin-bottom: 24px;
}
.wave span {
  flex: 1;
  min-width: 2px;
  background: var(--teal);
  border-radius: 2px;
  height: 12%;
  transform-origin: center;
}

/* riga di output */
.output {
  border-top: 1px solid var(--ink-line);
  padding-top: 22px;
  min-height: 92px;
}
.output-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-bright);
  margin-bottom: 12px;
}
.typed {
  font-family: var(--mono);
  font-size: clamp(14px, 1.9vw, 17px);
  line-height: 1.62;
  color: var(--white);
}
.caret {
  display: inline-block;
  width: 9px;
  height: 1.05em;
  background: var(--teal-bright);
  vertical-align: text-bottom;
  margin-left: 2px;
}

/* ---------- striscia dati ---------- */
.facts {
  background: var(--teal);
  color: var(--ink);
}
.facts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
}
.fact {
  padding: 30px 8px 32px;
  text-align: center;
  position: relative;
}
.fact + .fact::before {
  content: '';
  position: absolute;
  left: 0; top: 26%;
  height: 48%;
  width: 1px;
  background: rgba(14,27,42,.22);
}
.fact-value {
  font-family: var(--display);
  font-size: clamp(23px, 2.9vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  display: block;
  margin-bottom: 4px;
  text-wrap: balance;
}
.fact-label { font-size: 13.5px; color: rgba(14,27,42,.78); }

@media (max-width: 720px) {
  .facts-grid { grid-template-columns: repeat(2, 1fr); }
  .fact:nth-child(3)::before { display: none; }
  .fact:nth-child(3), .fact:nth-child(4) { border-top: 1px solid rgba(14,27,42,.22); }
}

/* ---------- sezioni generiche ---------- */
.band { padding: 96px 0; }
.band-paper { background: var(--paper); }
.band-white { background: var(--white); }
.band-ink { background: var(--ink); color: var(--white); }

.band-head { max-width: 660px; margin-bottom: 56px; }
.band-head h2 {
  font-size: clamp(30px, 4.4vw, 46px);
  font-weight: 700;
  margin-bottom: 16px;
}
.band-head p { color: var(--muted); font-size: 18px; }
.band-ink .band-head p { color: var(--muted-dark); }

/* ---------- come funziona: passi con schermate reali ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 34px;
}
.step-num {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--teal-deep);
  margin-bottom: 14px;
}
.step h3 { font-size: 21px; margin-bottom: 9px; }
.step p { color: var(--muted); font-size: 15.5px; }

.phone {
  position: relative;
  border-radius: 30px;
  background: var(--ink);
  padding: 7px;
  box-shadow: 0 26px 54px -22px rgba(14,27,42,.44);
  margin: 0 auto 28px;
  max-width: 236px;
  transition: transform .5s cubic-bezier(.22,.8,.3,1);
}
.phone img { border-radius: 23px; width: 100%; }
.step:hover .phone { transform: translateY(-9px); }

@media (max-width: 860px) {
  .steps { grid-template-columns: 1fr; gap: 52px; max-width: 380px; margin: 0 auto; }
}

/* ---------- funzioni ---------- */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 28px 32px;
  transition: border-color .22s ease, transform .22s ease;
}
.feature:hover { border-color: var(--teal); transform: translateY(-3px); }
.feature-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: rgba(97,155,167,.12);
  display: grid; place-items: center;
  margin-bottom: 18px;
}
.feature-icon svg { width: 21px; height: 21px; stroke: var(--teal-deep); }
.feature h3 { font-size: 18px; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 15px; }

@media (max-width: 900px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .features { grid-template-columns: 1fr; } }

/* ---------- piani ---------- */
.plans {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 820px;
}
.plan {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 32px 36px;
  display: flex;
  flex-direction: column;
}
.plan-featured {
  border-color: var(--teal);
  box-shadow: 0 20px 46px -26px rgba(97,155,167,.62);
  position: relative;
}
.plan-tag {
  position: absolute;
  top: -12px; left: 32px;
  background: var(--teal);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 13px;
  border-radius: 999px;
}
.plan-name { font-size: 20px; margin-bottom: 4px; }
.plan-for { color: var(--muted); font-size: 14.5px; margin-bottom: 22px; }
.plan-price {
  font-family: var(--display);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.plan-per { font-size: 15px; color: var(--muted); font-family: var(--body); font-weight: 500; }
.plan-alt { font-size: 14px; color: var(--muted); margin-top: 8px; }
.plan-trial {
  display: inline-block;
  margin-top: 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--teal-deep);
  background: rgba(97,155,167,.12);
  padding: 6px 12px;
  border-radius: 999px;
}
.plan ul { list-style: none; padding: 0; margin: 26px 0 28px; }
.plan li {
  position: relative;
  padding: 8px 0 8px 28px;
  font-size: 15.5px;
  border-bottom: 1px solid var(--border);
}
.plan li:last-child { border-bottom: 0; }
.plan li::before {
  content: '';
  position: absolute;
  left: 2px; top: 15px;
  width: 12px; height: 7px;
  border-left: 2px solid var(--teal);
  border-bottom: 2px solid var(--teal);
  transform: rotate(-45deg);
}
.plan .btn { margin-top: auto; justify-content: center; }
.plan-note { font-size: 13px; color: var(--muted); margin-top: 14px; text-align: center; }

@media (max-width: 760px) { .plans { grid-template-columns: 1fr; } }

/* ---------- FAQ ---------- */
.faq { max-width: 780px; }
.faq details {
  border-bottom: 1px solid var(--border);
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 24px 44px 24px 0;
  font-family: var(--display);
  font-size: 18.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '';
  position: absolute;
  right: 6px; top: 32px;
  width: 11px; height: 11px;
  border-right: 2px solid var(--teal);
  border-bottom: 2px solid var(--teal);
  transform: rotate(45deg);
  transition: transform .22s ease;
}
.faq details[open] summary::after { transform: rotate(-135deg); top: 36px; }
.faq details p { padding-bottom: 26px; color: var(--muted); font-size: 16px; max-width: 660px; }

/* ---------- CTA finale ---------- */
.closing { text-align: center; padding: 104px 0; }
.closing h2 { font-size: clamp(32px, 5vw, 52px); margin-bottom: 18px; }
.closing p { color: var(--muted-dark); font-size: 18px; margin-bottom: 34px; }
.closing .hero-actions { justify-content: center; }

/* ---------- footer ---------- */
.footer {
  background: var(--ink);
  color: var(--muted-dark);
  border-top: 1px solid var(--ink-line);
  padding: 46px 0;
  font-size: 14.5px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 30px;
  align-items: center;
  justify-content: space-between;
}
.footer a { color: var(--muted-dark); text-decoration: none; }
.footer a:hover { color: var(--white); }
.footer-links { display: flex; flex-wrap: wrap; gap: 22px; }

/* ==========================================================================
   Pagine di testo (privacy, termini, supporto)
   ========================================================================== */
.doc-hero {
  background: var(--ink);
  color: var(--white);
  padding: 66px 0 58px;
}
.doc-hero h1 { font-size: clamp(32px, 5vw, 46px); margin-bottom: 12px; }
.doc-hero p { color: var(--muted-dark); font-size: 15.5px; }

.doc { padding: 68px 0 96px; }
.doc-body { max-width: 760px; }
.doc-body section { margin-bottom: 42px; }
.doc-body h2 {
  font-size: 22px;
  margin-bottom: 12px;
  padding-top: 4px;
}
.doc-body h2 .doc-num {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--teal-deep);
  margin-right: 10px;
}
.doc-body p { color: #3C4A5A; margin-bottom: 12px; }
.doc-body ol, .doc-body ul {
  color: #3C4A5A;
  margin: 0 0 14px;
  padding-left: 22px;
}
.doc-body li { margin-bottom: 8px; }
.doc-body li::marker { color: var(--teal-deep); font-weight: 600; }
.doc-body .callout {
  background: var(--paper, #F4F7F9);
  border-left: 3px solid var(--teal-deep);
  padding: 16px 20px;
  margin: 0 0 14px;
  border-radius: 0 6px 6px 0;
}
.doc-body .callout p:last-child { margin-bottom: 0; }

.doc-body .en {
  color: var(--muted);
  font-size: 15px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.contact-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 46px;
  max-width: 760px;
}
.contact-card h2 { font-size: 20px; margin-bottom: 8px; }
.contact-card p { color: var(--muted); margin-bottom: 18px; }
.contact-mail {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--teal-deep);
  text-decoration: none;
}
.contact-mail:hover { text-decoration: underline; }
.contact-meta { font-size: 14px; color: var(--muted); margin-top: 16px; }

/* ==========================================================================
   Animazioni
   ========================================================================== */

/* onda: ogni barra respira, il ritardo è impostato inline */
@keyframes bar {
  0%, 100% { height: 14%; }
  50%      { height: var(--peak, 60%); }
}
.wave.is-recording span { animation: bar 1.05s ease-in-out infinite; }

/* alla risoluzione le barre si appiattiscono in una riga */
.wave.is-resolved span {
  animation: none;
  height: 3px;
  opacity: .34;
  transition: height .5s cubic-bezier(.5,0,.2,1), opacity .5s ease;
}

@keyframes caretBlink { 0%, 45% { opacity: 1; } 50%, 100% { opacity: 0; } }
.caret { animation: caretBlink 1.05s steps(1) infinite; }
.caret.is-done { display: none; }

@keyframes recPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .38; transform: scale(.82); }
}
.rec-dot.is-live { animation: recPulse 1.15s ease-in-out infinite; }

/* rivelazione allo scorrimento */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .62s cubic-bezier(.22,.8,.3,1), transform .62s cubic-bezier(.22,.8,.3,1);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .wave span { height: 40%; }
}
