/*
  Lo Ristudio. Sistema grafico
  - Un solo accento: il blu del logo. Base neutra fredda, chiaro e scuro.
  - Titoli: Bricolage Grotesque. Testo: Inter Tight. Tutto ospitato sul sito.
  - Raggi: superfici 24px, campi 12px, pulsanti e pillole a pillola intera.
  - Icone: Phosphor (assets/phosphor).
*/
:root {
  --bg: #f4f4f1;
  --surface: #fbfbf9;
  --surface-2: #e9e9e4;
  --ink: #121317;
  --ink-2: #3e3f46;
  --muted: #64656c;
  --line: rgba(18, 19, 23, 0.1);
  --line-2: rgba(18, 19, 23, 0.2);
  --accent: #3d5afe;
  --accent-ink: #ffffff;
  --accent-text: #2b44d8;
  --accent-soft: rgba(61, 90, 254, 0.1);
  --nav-bg: rgba(244, 244, 241, 0.82);
  --logos-filter: brightness(0);
  --shadow: 0 24px 60px -30px rgba(25, 28, 45, 0.35);
  --display: "Bricolage Grotesque", "Inter Tight", system-ui, sans-serif;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --r: 24px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e0f12;
  --surface: #16171b;
  --surface-2: #1f2026;
  --ink: #efede7;
  --ink-2: #bdbab2;
  --muted: #8e8b84;
  --line: rgba(239, 237, 231, 0.1);
  --line-2: rgba(239, 237, 231, 0.2);
  --accent-text: #8d9dff;
  --accent-soft: rgba(61, 90, 254, 0.18);
  --nav-bg: rgba(14, 15, 18, 0.8);
  --logos-filter: brightness(0) invert(1);
  --shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f12;
    --surface: #16171b;
    --surface-2: #1f2026;
    --ink: #efede7;
    --ink-2: #bdbab2;
    --muted: #8e8b84;
    --line: rgba(239, 237, 231, 0.1);
    --line-2: rgba(239, 237, 231, 0.2);
    --accent-text: #8d9dff;
    --accent-soft: rgba(61, 90, 254, 0.18);
    --nav-bg: rgba(14, 15, 18, 0.8);
    --logos-filter: brightness(0) invert(1);
    --shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

/* Logo: versione chiara su fondo scuro e viceversa */
.logo-img--on-dark { display: none; }
:root[data-theme="dark"] .logo-img--on-dark { display: block; }
:root[data-theme="dark"] .logo-img--on-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-img--on-dark { display: block; }
  :root:not([data-theme="light"]) .logo-img--on-light { display: none; }
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }
.num { font-variant-numeric: tabular-nums; }
.ph { line-height: 1; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; border-radius: 8px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container { padding: 0 32px; } }
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ===== Pulsanti ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 10px 22px; border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 16px; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.3s var(--ease);
}
.btn .ph { font-size: 18px; transition: transform 0.3s var(--ease); }
.btn:hover { box-shadow: 0 12px 30px -12px rgba(61, 90, 254, 0.7); }
.btn:hover .ph-arrow-right, .btn:hover .ph-arrow-up-right { transform: translateX(3px); }
.btn:active { transform: scale(0.97); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn--sm { min-height: 40px; padding: 8px 16px; font-size: 15px; }
.btn--lg { min-height: 54px; padding: 14px 26px; font-size: 17px; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.6; pointer-events: none; }
.iconbtn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink);
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.iconbtn:hover { background: var(--surface-2); }
.iconbtn:active { transform: scale(0.94); }
.iconbtn .ph { font-size: 18px; }

/* ===== Navigazione ===== */
.nav-sentinel { position: absolute; top: 0; height: 24px; width: 1px; }
.nav { position: sticky; top: 0; z-index: 30; transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease); border-bottom: 1px solid transparent; }
.nav.is-scrolled { background: var(--nav-bg); border-bottom-color: var(--line); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.nav__inner { display: flex; align-items: center; gap: 24px; height: 72px; }
.nav__logo img { height: 32px; width: auto; }
.nav__links { display: none; gap: 4px; margin-left: auto; }
.nav__links a { padding: 8px 14px; border-radius: 999px; text-decoration: none; font-weight: 500; font-size: 15px; color: var(--ink-2); transition: color 0.2s var(--ease), background-color 0.2s var(--ease); }
.nav__links a:hover { color: var(--ink); background: var(--surface-2); }
.nav__links a.is-active { color: var(--ink); background: var(--surface-2); }
.nav__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav__cta { display: none; }
.nav__mobile { display: grid; gap: 4px; padding: 8px 16px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.nav__mobile[hidden] { display: none; }
.nav__mobile a:not(.btn) { padding: 14px 4px; font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -0.03em; text-decoration: none; border-bottom: 1px solid var(--line); }
.nav__mobile .btn { margin-top: 14px; }
.menu-open .nav { background: var(--bg); }
@media (min-width: 900px) {
  .nav__links { display: flex; }
  .nav__actions { margin-left: 8px; }
  .nav__cta { display: inline-flex; }
  .nav__toggle { display: none; }
}

/* ===== Hero ===== */
.hero { padding: clamp(48px, 9vh, 96px) 0 clamp(64px, 10vh, 112px); }
.hero__title { font-size: clamp(44px, 7.2vw, 104px); line-height: 1.02; letter-spacing: -0.045em; font-weight: 700; }
.hero__line { display: block; }
.hero__line > .reveal { display: inline-block; }
.mark {
  display: inline-block; padding: 0 0.16em 0.06em; margin-left: -0.08em; border-radius: 0.14em;
  color: var(--accent-ink);
  background: linear-gradient(var(--accent), var(--accent)) no-repeat left / 0% 100%;
  transition: background-size 0.9s var(--ease) 0.45s, color 0.3s var(--ease) 0.45s;
}
.mark { color: var(--ink); }
.is-in .mark, .is-in.mark, html:not(.js) .mark { background-size: 100% 100%; color: var(--accent-ink); }
.hero__row { display: grid; gap: 28px; margin-top: clamp(32px, 6vh, 56px); padding-top: 28px; border-top: 1px solid var(--line); }
.hero__lead { font-size: clamp(18px, 1.6vw, 21px); color: var(--ink-2); max-width: 46ch; line-height: 1.5; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; }
@media (min-width: 900px) {
  .hero__row { grid-template-columns: 1fr auto; align-items: end; }
}

/* ===== Sezioni ===== */
.section { padding: clamp(72px, 11vw, 136px) 0; }
.section--tight { padding: clamp(48px, 7vw, 88px) 0; }
.h2 { font-size: clamp(34px, 4.6vw, 60px); max-width: 18ch; }
.h2--sm { font-size: clamp(26px, 2.8vw, 36px); max-width: none; }
.accent { color: var(--accent-text); }
.lead { margin-top: 18px; font-size: 19px; color: var(--ink-2); max-width: 44ch; }

/* ===== Servizi: bento ===== */
.bento { display: grid; gap: 14px; margin-top: clamp(40px, 5vw, 64px); }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 16px;
  padding: clamp(24px, 3vw, 40px); border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.tile h3 { font-size: clamp(26px, 2.6vw, 36px); }
.tile > p { color: var(--ink-2); max-width: 52ch; }
.tile__icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); }
.tile__icon .ph { font-size: 26px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.pills li { padding: 7px 13px; border-radius: 999px; font-size: 14px; font-weight: 500; line-height: 1.3; background: var(--surface-2); color: var(--ink-2); }
.tile__link { margin-top: auto; padding-top: 12px; display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-weight: 600; text-decoration: none; color: var(--accent-text); }
.tile__link .ph { transition: transform 0.3s var(--ease); }
.tile__link:hover .ph { transform: translateX(4px); }

.tile--main { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.tile--main > p { color: rgba(255, 255, 255, 0.86); }
.tile--main .tile__icon { background: rgba(255, 255, 255, 0.16); color: #fff; }
.tile--main .pills li { background: rgba(255, 255, 255, 0.14); color: #fff; }
.tile--main .tile__link { color: #fff; }
.tile--main h3 { font-size: clamp(32px, 3.6vw, 52px); }
.tile--eventi { background: radial-gradient(120% 90% at 100% 0%, var(--accent-soft), transparent 60%), var(--surface); }
@media (min-width: 960px) {
  .bento { grid-template-columns: 1.25fr 1fr; grid-template-rows: auto auto; }
  .tile--main { grid-row: 1 / span 2; }
  .tile--main > p { font-size: 19px; }
  .tile--main .pills { margin-top: auto; padding-top: 24px; }
  .tile--main .pills li { font-size: 15px; padding: 9px 15px; }
  .tile--main .tile__link { margin-top: 8px; }
}

/* ===== Clienti ===== */
.logos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 32px; }
.logos a { display: grid; place-items: center; height: 120px; padding: 10px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease); }
.logos img { max-height: 96px; width: auto; filter: var(--logos-filter); opacity: 0.72; transition: opacity 0.3s var(--ease), transform 0.4s var(--ease); }
.logos a:hover { border-color: var(--line-2); }
.logos a:hover img { opacity: 1; transform: scale(1.04); }
@media (min-width: 768px) { .logos { grid-template-columns: repeat(4, minmax(0, 1fr)); } .logos a { height: 140px; } }

/* ===== Metodo ===== */
.method { display: grid; gap: 40px; }
.steps { position: relative; display: grid; gap: 0; counter-reset: s; }
.step { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 20px; padding: 0 0 40px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 27px; top: 60px; bottom: 4px; width: 2px; background: var(--line-2); border-radius: 2px; }
.step:last-child::before { display: none; }
.step__icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); color: var(--accent-text); }
.step__icon .ph { font-size: 24px; }
.step h3 { font-size: 26px; padding-top: 10px; }
.step p { margin-top: 8px; color: var(--ink-2); max-width: 46ch; }
@media (min-width: 960px) {
  .method { grid-template-columns: 5fr 7fr; gap: 64px; align-items: start; }
  .method__head { position: sticky; top: 120px; }
  .step { grid-template-columns: 64px 1fr; gap: 28px; padding-bottom: 56px; }
  .step__icon { width: 64px; height: 64px; }
  .step::before { left: 31px; top: 70px; }
}

/* ===== CTA ===== */
.cta { padding: 0 16px; }
.cta__link {
  display: block; max-width: 1240px; margin: 0 auto; border-radius: calc(var(--r) + 8px);
  background: var(--accent); color: var(--accent-ink); text-decoration: none; overflow: hidden;
  transition: transform 0.4s var(--ease);
}
.cta__inner { display: grid; gap: 10px; padding-top: clamp(56px, 8vw, 104px); padding-bottom: clamp(56px, 8vw, 104px); }
.cta__small { font-size: clamp(18px, 1.8vw, 22px); opacity: 0.85; }
.cta__big { display: inline-flex; align-items: center; gap: 0.25em; font-family: var(--display); font-weight: 700; font-size: clamp(42px, 11vw, 168px); line-height: 0.95; letter-spacing: -0.055em; }
.cta__arrow { font-size: 0.7em; color: var(--accent-ink); transition: transform 0.5s var(--ease); }
.cta__link:hover .cta__arrow { transform: translateX(0.18em); }
.cta__link:active { transform: scale(0.995); }
@media (min-width: 768px) { .cta { padding: 0 32px; } }

/* ===== Domande ===== */
.faq { max-width: 920px; }
.faq__list { margin-top: 40px; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 24px 0; cursor: pointer; list-style: none;
  font-family: var(--display); font-size: clamp(19px, 2vw, 24px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.25;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ph { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 999px; background: var(--surface-2); font-size: 18px; transition: transform 0.35s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease); }
.faq summary:hover .ph { background: var(--accent-soft); color: var(--accent-text); }
.faq details[open] summary .ph { transform: rotate(45deg); background: var(--accent); color: var(--accent-ink); }
.faq details p { padding: 0 56px 26px 0; color: var(--ink-2); max-width: 65ch; }
.faq details[open] p { animation: faqIn 0.45s var(--ease); }
@keyframes faqIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ===== Contatti ===== */
.contact { display: grid; gap: 48px; }
.contact__list { display: grid; gap: 20px; margin-top: 36px; }
.contact__list li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; }
.contact__list .ph { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); font-size: 20px; color: var(--accent-text); }
.contact__list span { display: block; font-size: 14px; color: var(--muted); }
.contact__list a { text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.contact__list a:hover { color: var(--accent-text); }
.form { display: grid; gap: 18px; padding: clamp(22px, 3vw, 36px); border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.form__row { display: grid; gap: 18px; }
@media (min-width: 640px) { .form__row { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field label { font-size: 15px; font-weight: 600; color: var(--ink); }
.field .opt { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg);
  font-size: 16px; color: var(--ink); transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 128px; line-height: 1.5; }
.field select { appearance: none; -webkit-appearance: none; padding-right: 42px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 54%, calc(100% - 15px) 54%; background-size: 5px 5px; background-repeat: no-repeat; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
.field__hint { font-size: 14px; color: var(--muted); }
.field__err { display: none; font-size: 14px; font-weight: 500; color: #d43f3f; }
:root[data-theme="dark"] .field__err { color: #ff8a8a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .field__err { color: #ff8a8a; } }
.field.is-invalid input, .field.is-invalid select, .field.is-invalid textarea { border-color: #d43f3f; }
.field.is-invalid .field__err { display: block; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; font-size: 15px; color: var(--ink-2); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.check a { color: var(--accent-text); text-underline-offset: 3px; }
.check.is-invalid span { color: #d43f3f; }
.form__status { min-height: 1.4em; font-size: 15px; font-weight: 500; }
.form__status.ok { color: #1f8a4c; }
.form__status.err { color: #d43f3f; }
@media (min-width: 960px) {
  .contact { grid-template-columns: 5fr 7fr; gap: 64px; align-items: start; }
  .contact__info { position: sticky; top: 120px; }
}

/* ===== Footer ===== */
.footer { margin-top: 24px; padding: 56px 0 48px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.footer__grid { display: grid; gap: 28px; }
.footer__brand img { height: 30px; width: auto; }
.footer__brand p { margin-top: 14px; color: var(--ink-2); }
.footer__legal { font-style: normal; line-height: 1.7; }
.footer__links { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.footer__links a { text-decoration: none; color: var(--ink-2); }
.footer__links a:hover { color: var(--accent-text); }
@media (min-width: 900px) { .footer__grid { grid-template-columns: 1fr auto auto; gap: 56px; align-items: start; } }

/* ===== Notifica "Sei qui da" ===== */
.toast {
  position: fixed; z-index: 40; right: 16px; bottom: 16px; left: 16px; max-width: 380px; margin-left: auto;
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start;
  padding: 16px 16px 18px; border-radius: 20px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(16px) scale(0.98); transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
}
.toast.is-open { opacity: 1; transform: none; }
.toast__icon { font-size: 22px; color: var(--accent); margin-top: 2px; }
.toast__title { font-weight: 600; }
.toast__clock { display: inline-flex; font-weight: 700; }
.toast__clock .d { display: inline-block; overflow: hidden; height: 1.3em; vertical-align: bottom; }
.toast__clock .d span { display: block; }
.toast__clock .d .in { animation: digit 0.35s var(--ease); }
@keyframes digit { from { transform: translateY(100%); } to { transform: none; } }
.toast__text { margin-top: 2px; font-size: 15px; opacity: 0.75; line-height: 1.45; }
.toast__link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 600; text-decoration: none; color: var(--bg); }
.toast__link .ph { color: var(--accent); }
.toast__close { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 999px; border: 0; background: transparent; color: inherit; opacity: 0.7; }
.toast__close:hover { opacity: 1; background: rgba(127, 127, 127, 0.2); }

/* ===== Comparsa allo scorrimento ===== */
/* Nascosti solo se lo script è partito davvero: senza JS la pagina resta leggibile */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.8s var(--ease) var(--d, 0s), transform 0.8s var(--ease) var(--d, 0s); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .mark { background-size: 100% 100%; color: var(--accent-ink); }
}
