/* ==========================================================
   Dotmax — foglio di stile principale
   Colori e misure sono token su :root: cambiali qui.
   ========================================================== */
:root {
  /* colori del logo: blu #044c96, grigi #a1aaac e #717c7d */
  --brand: #044c96;
  --gray-light: #a1aaac;
  --gray-dark: #717c7d;
  --navy-900: #0a1730;
  --navy-800: #10213f;
  --navy-700: #183058;
  --accent: #4f9ce6;        /* blu del logo schiarito, per sfondi scuri */
  --accent-dark: #044c96;   /* blu del logo, per testo su sfondo chiaro */
  --accent-2: #ff8a3d;      /* arancio per SOS / call to action */
  --text: #1c2433;
  --muted: #5b6678;
  --bg: #ffffff;
  --bg-soft: #f3f6fb;
  --border: #e2e8f2;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(11, 20, 38, .08);
  --max: 1180px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; color: var(--navy-900); }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); font-weight: 800; letter-spacing: -.01em; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.section { padding: 90px 0; }
.section--soft { background: var(--bg-soft); }
.section--dark { background: var(--navy-900); color: #c9d3e6; }
.section--dark h2, .section--dark h3 { color: #fff; }
.eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent-dark); margin-bottom: .8em;
}
.section--dark .eyebrow { color: var(--accent); }
.section-head { max-width: 680px; margin-bottom: 50px; }
.section-head p { color: var(--muted); font-size: 1.08rem; }
.section--dark .section-head p { color: #9fb0cc; }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .85em 1.5em; border-radius: 999px; font-weight: 700; font-size: .98rem;
  border: 2px solid transparent; cursor: pointer; transition: .2s ease;
  text-decoration: none !important; font-family: inherit;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: #0a5fb8; color: #fff; }
.hero .btn--primary, .page-hero .btn--primary { background: var(--accent); color: var(--navy-900); }
.hero .btn--primary:hover, .page-hero .btn--primary:hover { background: #fff; }
.btn--ghost { border-color: rgba(255,255,255,.35); color: #fff; background: transparent; }
.btn--ghost:hover { border-color: #fff; background: rgba(255,255,255,.08); }
.btn--sos { background: var(--accent-2); color: #fff; }
.btn--sos:hover { background: #ff7420; }
.btn--dark { background: var(--navy-900); color: #fff; }
.btn--dark:hover { background: var(--navy-700); }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header .container { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo { display: inline-flex; align-items: center; }
.logo img { height: 40px; width: auto; }
.footer .logo img { height: 44px; }

.nav { display: flex; align-items: center; gap: 6px; }
.nav a { color: var(--text); font-weight: 600; font-size: .95rem; padding: 8px 14px; border-radius: 8px; }
.nav a:hover, .nav a.active { color: var(--accent-dark); background: var(--bg-soft); text-decoration: none; }
.nav .btn { margin-left: 8px; padding: .6em 1.2em; }
.nav .btn:hover { background: #ff7420; color: #fff; }

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 26px; height: 3px; background: var(--navy-900); margin: 5px 0; border-radius: 2px; transition: .25s; }

/* ---------- Menu a tendina ---------- */
.has-sub { position: relative; }
.has-sub > a::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-3px) rotate(45deg); }
.sub {
  position: absolute; top: 100%; left: 0; min-width: 290px; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: 8px; display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transform: translateY(8px); transition: .2s;
}
.has-sub:hover .sub, .has-sub:focus-within .sub { opacity: 1; visibility: visible; transform: none; }
.sub a { font-weight: 500; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: radial-gradient(1100px 500px at 85% -10%, rgba(4,76,150,.28), transparent 60%),
              linear-gradient(160deg, var(--navy-900), var(--navy-700));
  color: #c9d3e6; padding: 110px 0 120px;
}
.hero h1 { color: #fff; max-width: 780px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 1.2rem; max-width: 620px; color: #b7c4dc; margin-bottom: 2em; }
.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero__grid {
  position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 70% 30%, #000 0%, transparent 70%);
}
.hero__content { position: relative; }
.hero__badges { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 56px; }
.badge { display: flex; align-items: center; gap: 10px; color: #dbe4f3; font-weight: 600; font-size: .95rem; }
.badge svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }

/* ---------- Card servizi ---------- */
.grid { display: grid; gap: 24px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px; transition: .25s ease; position: relative; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.card__icon {
  width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(4,76,150,.15), rgba(4,76,150,.05));
  color: var(--accent-dark); margin-bottom: 20px;
}
.card__icon svg { width: 28px; height: 28px; }
.card p { color: var(--muted); }
.card ul { margin: 0 0 1.2em; padding: 0; list-style: none; }
.card li { position: relative; padding-left: 22px; margin-bottom: 6px; font-size: .94rem; color: var(--text); }
.card li::before { content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.card__link { margin-top: auto; font-weight: 700; font-size: .92rem; }
.card details summary { cursor: pointer; font-weight: 700; color: var(--accent-dark); list-style: none; margin-top: auto; }
.card details summary::-webkit-details-marker { display: none; }
.card details summary::after { content: " +"; }
.card details[open] summary::after { content: " –"; }
.card details ul { margin-top: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: .75rem; font-weight: 600; background: var(--bg-soft); color: var(--muted); padding: 3px 10px; border-radius: 999px; }

/* ---------- Chi siamo ---------- */
.about { display: grid; grid-template-columns: 1.1fr 1fr; gap: 60px; align-items: center; }
.about__visual {
  position: relative; border-radius: 20px; padding: 40px;
  background: linear-gradient(150deg, var(--navy-800), var(--navy-700)); color: #fff;
  box-shadow: var(--shadow);
}
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.stat strong { display: block; font-size: 2.6rem; font-weight: 800; color: var(--accent); line-height: 1; }
.stat span { color: #b7c4dc; font-size: .92rem; }
.checklist { list-style: none; padding: 0; margin: 1.5em 0 2em; }
.checklist li { display: flex; gap: 12px; margin-bottom: 12px; }
.checklist svg { width: 22px; height: 22px; color: var(--accent-dark); flex-shrink: 0; margin-top: 2px; }

/* ---------- Metodo ---------- */
.steps { counter-reset: step; }
.step { position: relative; padding: 28px; border-radius: var(--radius); background: var(--navy-800); border: 1px solid rgba(255,255,255,.06); }
.step::before {
  counter-increment: step; content: "0" counter(step);
  font-size: 2.2rem; font-weight: 800; color: var(--accent); display: block; margin-bottom: 10px; line-height: 1;
}
.step p { color: #9fb0cc; margin: 0; font-size: .95rem; }

/* ---------- Partner ---------- */
.partners { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.partner {
  padding: 12px 22px; border-radius: 10px; border: 1px solid var(--border); background: #fff;
  font-weight: 700; color: var(--muted); font-size: .95rem; transition: .2s;
}
.partner:hover { color: var(--navy-900); border-color: var(--accent); }

/* ---------- Banner SOS ---------- */
.sos-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 30px; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--accent-2), #ff5f6d); color: #fff;
  border-radius: 20px; padding: 44px 50px;
}
.sos-banner h2 { color: #fff; margin-bottom: .3em; }
.sos-banner p { margin: 0; opacity: .92; max-width: 560px; }
.sos-banner .btn { background: #fff; color: #e2551c; }
.sos-banner .btn:hover { background: var(--navy-900); color: #fff; }

/* ---------- Contatti ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.3fr; gap: 50px; }
.contact__info { display: flex; flex-direction: column; gap: 22px; }
.info-item { display: flex; gap: 16px; align-items: flex-start; }
.info-item .card__icon { margin: 0; width: 48px; height: 48px; flex-shrink: 0; }
.info-item strong { display: block; color: var(--navy-900); }
.info-item span, .info-item a { color: var(--muted); }

.form { background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 36px; box-shadow: var(--shadow); }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--navy-900); }
.field input, .field textarea, .field select {
  font: inherit; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); transition: .2s;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(4,76,150,.15); }
.field textarea { min-height: 130px; resize: vertical; }
.field--check { flex-direction: row; gap: 10px; align-items: flex-start; font-size: .88rem; color: var(--muted); }
.field--check input { margin-top: 4px; }
.form__note { font-size: .85rem; color: var(--muted); margin: 12px 0 0; }
.form__status { margin-top: 14px; font-weight: 600; }
.form__status.ok { color: #118a4e; }
.form__status.err { color: #c62828; }

/* ---------- Pagine interne ---------- */
.page-hero {
  background: radial-gradient(900px 400px at 90% -20%, rgba(79,156,230,.25), transparent 60%),
              linear-gradient(160deg, var(--navy-900), var(--navy-700));
  color: #b7c4dc; padding: 70px 0 70px;
}
.page-hero h1 { color: #fff; max-width: 820px; }
.page-hero p { max-width: 680px; font-size: 1.12rem; margin-bottom: 1.6em; }
.breadcrumb { font-size: .85rem; margin-bottom: 18px; color: #8d9cb8; }
.breadcrumb a { color: #b7c4dc; }
.breadcrumb span { margin: 0 6px; }
.detail { display: grid; grid-template-columns: 1fr 340px; gap: 60px; align-items: start; }
.detail h2 { font-size: 1.7rem; }
.detail .lead-text { font-size: 1.12rem; color: var(--muted); }
.feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0 40px; padding: 0; list-style: none; }
.feature-list li { background: var(--bg-soft); border-radius: 12px; padding: 18px 20px; display: flex; gap: 12px; }
.feature-list svg { width: 22px; height: 22px; color: var(--accent-dark); flex-shrink: 0; margin-top: 2px; }
.feature-list small { display: block; color: var(--muted); font-size: .85rem; }
.aside { position: sticky; top: 100px; display: flex; flex-direction: column; gap: 20px; }
.aside-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.aside-box--dark { background: var(--navy-900); color: #b7c4dc; border: 0; }
.aside-box--dark h3 { color: #fff; }
.aside-box ul { list-style: none; padding: 0; margin: 0; }
.aside-box li a { display: block; padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: .94rem; }
.aside-box li:last-child a { border-bottom: 0; }
.aside-box li a:hover, .aside-box li a.current { color: var(--accent-dark); text-decoration: none; }
.cta-band { background: var(--bg-soft); border-radius: 20px; padding: 44px; display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.cta-band h2 { margin: 0 0 .2em; font-size: 1.6rem; }
.cta-band p { margin: 0; color: var(--muted); }
.tool { display: flex; gap: 20px; align-items: flex-start; }
.tool .card__icon { margin: 0; flex-shrink: 0; }
.tool h3 { margin-bottom: .3em; }
.tool p { margin-bottom: .8em; }
.tool .btn { padding: .6em 1.2em; font-size: .9rem; }
.notice {
  border-left: 4px solid var(--accent); background: var(--bg-soft);
  padding: 18px 22px; border-radius: 0 10px 10px 0; color: var(--muted);
}
.steps-list { counter-reset: s; list-style: none; padding: 0; }
.steps-list li { counter-increment: s; position: relative; padding-left: 50px; margin-bottom: 18px; }
.steps-list li::before {
  content: counter(s); position: absolute; left: 0; top: -2px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--navy-900); font-weight: 800; display: grid; place-items: center;
}

/* ---------- Testo legale ---------- */
.prose { max-width: 780px; }
.prose h2 { font-size: 1.4rem; margin-top: 1.8em; }

/* ---------- Footer ---------- */
.footer { background: var(--navy-900); color: #8d9cb8; padding: 70px 0 30px; font-size: .94rem; }
.footer .logo { color: #fff; }
.footer h4 { color: #fff; font-size: 1rem; margin: 0 0 1em; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 8px; }
.footer a { color: #b7c4dc; }
.footer a:hover { color: #fff; }
.footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 50px; }
.footer__bottom { border-top: 1px solid rgba(255,255,255,.08); padding-top: 24px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .85rem; }

/* ---------- Animazioni ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

.to-top {
  position: fixed; right: 20px; bottom: 20px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--navy-900); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center;
  opacity: 0; pointer-events: none; transition: .3s; box-shadow: var(--shadow); z-index: 40;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top svg { width: 20px; height: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .about, .contact, .detail { grid-template-columns: 1fr; gap: 40px; }
  .aside { position: static; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed; top: 72px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: #fff; padding: 16px 20px 24px; border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow); transform: translateY(-120%); transition: transform .3s ease; gap: 2px;
  }
  .nav.open { transform: none; }
  .nav a { padding: 12px 14px; }
  .nav .btn { margin: 10px 0 0; justify-content: center; }
  .nav { max-height: calc(100vh - 72px); overflow-y: auto; }
  .sub { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 0 14px; min-width: 0; }
  .has-sub > a::after { display: none; }
  .nav-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}
@media (max-width: 640px) {
  .section { padding: 64px 0; }
  .hero { padding: 80px 0 90px; }
  .grid--3, .grid--2, .grid--4, .form__row, .footer__grid, .feature-list { grid-template-columns: 1fr; }
  .cta-band { padding: 30px 24px; }
  .sos-banner { padding: 32px 26px; }
  .form { padding: 24px; }
  .tool { flex-direction: column; }
}

/* ---------- Foto ---------- */
/* Hero con foto di sfondo: <img class="hero__bg"> sotto un velo scuro */
.hero--photo, .page-hero--photo { position: relative; overflow: hidden; }
.hero__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.hero--photo::before, .page-hero--photo::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(100deg, rgba(10,23,48,.95) 0%, rgba(10,23,48,.85) 50%, rgba(10,23,48,.6) 100%);
}
.hero--photo .hero__grid { z-index: 1; }
.hero--photo > .container, .page-hero--photo > .container { position: relative; z-index: 2; }
.page-hero--photo { padding: 90px 0; }
.card--media { padding-top: 0; overflow: hidden; }
.card__img {
  width: calc(100% + 60px); max-width: none; margin: 0 -30px 0; height: 180px; object-fit: cover;
  transition: transform .5s ease;
}
.card--media:hover .card__img { transform: scale(1.04); }
.card--media .card__icon { margin-top: -27px; position: relative; background: #fff; box-shadow: var(--shadow); }
.about__media { position: relative; }
.about__media > img { border-radius: 20px; height: auto; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; box-shadow: var(--shadow); }
.about__media .about__visual { margin: -110px 28px 0; position: relative; padding: 30px; }
.footer__legal { line-height: 1.7; }
@media (max-width: 640px) {
  .about__media .about__visual { margin: -60px 12px 0; padding: 24px; }
  .stat strong { font-size: 2rem; }
}

/* ---------- Loghi dei marchi ----------
   Larghezza/altezza di ogni logo sono calcolate dal generatore (area costante),
   così loghi larghi e loghi quadrati hanno lo stesso peso visivo. */
.logos { display: grid; grid-template-columns: repeat(7, 1fr); gap: 14px; }
/* home: righe centrate anche quando l'ultima è incompleta */
.logos:not(.logos--compact) { display: flex; flex-wrap: wrap; justify-content: center; }
.logos:not(.logos--compact) .logo-tile { flex: 0 0 calc((100% - 7 * 14px) / 8); min-width: 0; padding: 10px; height: 88px; }
.logo-tile {
  height: 104px; display: grid; place-items: center; padding: 14px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; transition: .25s ease;
}
.logo-tile img { max-width: 100%; height: auto; filter: grayscale(1); opacity: .85; transition: .25s ease; }
.logo-tile:hover { border-color: transparent; box-shadow: var(--shadow); }
.logo-tile:hover img { filter: none; opacity: 1; }
.logos--compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.logos--compact .logo-tile { height: 88px; }
.logos--compact .logo-tile img { transform: scale(.85); }
@media (hover: none) { .logo-tile img { filter: none; opacity: 1; } }
@media (max-width: 1000px) { .logos:not(.logos--compact) .logo-tile { flex-basis: calc((100% - 3 * 14px) / 4); } }
@media (max-width: 640px) {
  .logos { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .logos:not(.logos--compact) .logo-tile { flex-basis: calc((100% - 10px) / 2); }
  .logo-tile { height: 84px; padding: 12px; }
}

/* ---------- Testi lunghi (privacy) ---------- */
.prose h3 { font-size: 1.05rem; margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin-bottom: .4em; }
.prose h2[id] { scroll-margin-top: 90px; }
.tool__alt { margin: 10px 0 0; font-size: .88rem; }
.tool__logo { width: 56px; height: 56px; flex-shrink: 0; border-radius: 12px; }
