/* ==========================================================
   Bytewave — foglio di stile
   Palette presa dal logo: onda blu su bianco, scritta nera.
   ========================================================== */

:root {
  --paper: #F4F8FD;   /* fondo pagina, bianco freddo */
  --white: #FFFFFF;
  --ink: #07163A;     /* testo, blu notte */
  --ink-soft: #46557A;
  --wave: #1D5FE0;    /* blu del logo */
  --crest: #48A6FF;   /* cresta dell'onda */
  --deep: #0B2F86;    /* blu profondo per le fasce scure */
  --foam: #E3EEFF;
  --line: #D5E1F2;
  --ok: #16A36A;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Scala tipografica */
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.4rem, 1.15rem + 1vw, 1.75rem);
  --step-3: clamp(1.9rem, 1.3rem + 2.4vw, 3rem);
  --step-4: clamp(2.5rem, 1.2rem + 4.6vw, 4.6rem);

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1200px;
  --radius-s: 8px;
  --radius-l: 14px;
  --shadow: 0 1px 2px rgba(7, 22, 58, .06), 0 12px 32px -8px rgba(7, 22, 58, .18);

  color-scheme: light;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

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

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  line-height: 1.1;
  font-variation-settings: "wdth" 108;
  letter-spacing: -0.012em;
}
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }

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

:focus-visible {
  outline: 3px solid var(--crest);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: var(--white);
  padding: 10px 16px;
  border-radius: var(--radius-s);
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* Icone a linea */
.ico {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico-lg { width: 28px; height: 28px; stroke-width: 1.6; }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 1.5px solid var(--wave);
  border-radius: var(--radius-s);
  background: var(--wave);
  color: var(--white);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--deep); border-color: var(--deep); }
.btn-ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--white); border-color: var(--ink); }
.btn-small { min-height: 40px; padding: 0 16px; font-size: var(--step--1); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  min-height: 72px;
}
.brand img { width: 160px; }
.site-header nav { margin-left: auto; }
.nav-links { display: flex; gap: 30px; }
.nav-links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 0;
}
.nav-links a:hover { color: var(--ink); }

@media (max-width: 860px) {
  .site-header nav { display: none; }
  .header-inner { justify-content: space-between; }
  .brand img { width: 132px; }
}

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(60rem 30rem at 85% 0%, rgba(72, 166, 255, .16), transparent 70%),
    var(--white);
  padding-block: clamp(40px, 7vw, 96px) clamp(56px, 8vw, 112px);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: center;
}
.hero-kicker {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--wave);
}
.hero-title {
  margin-top: 22px;
  font-size: var(--step-4);
  font-weight: 750;
  font-variation-settings: "wdth" 112;
  line-height: 1.02;
  letter-spacing: -0.02em;
  max-width: 12ch;
  text-wrap: balance;
}
.hero-lede {
  margin-top: 24px;
  max-width: 34rem;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-soft);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 32px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.hero-points li { display: flex; align-items: center; gap: 8px; }
.hero-points .ico { color: var(--wave); width: 18px; height: 18px; stroke-width: 2.2; }

.hero-visual { position: relative; padding: 24px 0 40px 24px; }
.hero-photo {
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
}

/* Schede interfaccia sovrapposte alla foto */
.ui-card {
  position: absolute;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  font-size: var(--step--1);
  line-height: 1.35;
}
.ui-title { font-weight: 650; color: var(--ink); }
.ui-sub { color: var(--ink-soft); font-size: 0.8125rem; }
.ui-row { display: flex; gap: 12px; align-items: center; }
.ico-badge {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 9px;
  background: var(--foam);
  color: var(--wave);
  stroke-width: 1.9;
}
.ico-ok { background: #DDF5EA; color: var(--ok); }

.ui-track { left: 0; bottom: 0; width: min(300px, 78%); }
.ui-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 14px;
  font-size: 0.6875rem;
  color: var(--ink-soft);
}
.ui-steps li { padding-top: 8px; border-top: 3px solid var(--line); }
.ui-steps .done { border-top-color: var(--wave); }
.ui-steps .now { border-top-color: var(--crest); color: var(--ink); font-weight: 650; }

.ui-deploy {
  top: 0;
  right: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-visual { max-width: 620px; }
}
@media (max-width: 640px) {
  .hero-visual { padding: 20px 0 56px 0; }
  .ui-deploy { right: 8px; padding: 12px 14px; }
  .ui-track { left: 8px; }
}

/* ---------- Titoli di sezione ---------- */
.section-head { max-width: 46rem; }
.section-title {
  font-size: var(--step-3);
  max-width: 20ch;
  text-wrap: balance;
}
.section-intro {
  margin-top: 18px;
  max-width: 40rem;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---------- Servizi ---------- */
.services { padding-block: clamp(72px, 10vw, 128px); }
.services-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

/* Onda del logo: i tre fili sono i tre servizi. Unico momento animato. */
.services-wave svg { width: 100%; }
.nodes circle { fill: var(--paper); stroke: var(--wave); stroke-width: 6; }
.node-labels text {
  font-family: var(--font);
  font-size: 34px;
  font-weight: 650;
  fill: var(--ink);
}

/* L'onda si disegna quando entra nello schermo (classe aggiunta da script.js).
   Senza JavaScript resta semplicemente disegnata. */
.js .trace { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .is-drawn .trace { animation: draw 1.6s cubic-bezier(.6, .05, .25, 1) forwards; }
.js .is-drawn .t2 { animation-delay: .18s; }
.js .is-drawn .t3 { animation-delay: .36s; }
.packet { stroke-dasharray: 0.01 9.99; opacity: 0; }
.is-drawn .packet { animation: fade-in .6s ease 1.8s forwards, flow 3.2s linear 1.8s infinite; }
.is-drawn .p2 { animation-duration: .6s, 4.1s; }
.is-drawn .p3 { animation-duration: .6s, 3.6s; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes flow { to { stroke-dashoffset: -10; } }
@keyframes fade-in { to { opacity: .85; } }

@media (prefers-reduced-motion: reduce) {
  .js .trace { animation: none; stroke-dashoffset: 0; }
  .packet { display: none; }
}

@media (max-width: 860px) {
  .services-head { grid-template-columns: minmax(0, 1fr); }
  .services-wave { max-width: 560px; }
}
@media (max-width: 480px) {
  .node-labels text { font-size: 44px; }
}
.service {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
  margin-top: clamp(56px, 8vw, 104px);
}
.service-flip .service-media { order: 2; }

.service-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
}
.service-name {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: var(--step-2);
  color: var(--wave);
}
/* Il nodo del logo davanti al nome del servizio */
.service-name::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 4px solid var(--wave);
  background: var(--white);
}
.service-claim {
  margin-top: 12px;
  font-size: var(--step-3);
  font-weight: 700;
  font-variation-settings: "wdth" 108;
  letter-spacing: -0.012em;
  line-height: 1.12;
  max-width: 18ch;
  text-wrap: balance;
}
.check-list { margin-top: 28px; display: grid; gap: 12px; }
.check-list li { display: flex; gap: 12px; align-items: flex-start; }
.check-list .ico {
  margin-top: 2px;
  padding: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--foam);
  color: var(--wave);
  stroke-width: 2.6;
}
.service-example {
  margin-top: 28px;
  padding: 16px 18px;
  border-left: 3px solid var(--wave);
  background: var(--white);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  color: var(--ink-soft);
}
.service-example strong { color: var(--ink); font-weight: 650; }

@media (max-width: 860px) {
  .service { grid-template-columns: minmax(0, 1fr); }
  .service-flip .service-media { order: 0; }
  .service-claim { max-width: none; }
}

/* ---------- Tecnologie ---------- */
.tech {
  background: var(--white);
  border-block: 1px solid var(--line);
  padding-block: clamp(72px, 10vw, 128px);
}
.tech-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: clamp(40px, 6vw, 64px);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.tech-grid li {
  padding: 32px 28px 36px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.tech-grid .ico { color: var(--wave); }
.tech-grid h3 { margin-top: 20px; font-size: var(--step-1); }
.tech-grid p { margin-top: 8px; color: var(--ink-soft); font-size: 0.96875rem; }

@media (max-width: 900px) { .tech-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .tech-grid { grid-template-columns: minmax(0, 1fr); }
  .tech-grid li { padding: 26px 20px 28px; }
}

/* ---------- Flusso integrato ---------- */
.flow {
  position: relative;
  color: var(--white);
  padding-block: clamp(80px, 11vw, 144px);
  background:
    linear-gradient(100deg, rgba(7, 22, 58, .96) 0%, rgba(11, 47, 134, .9) 55%, rgba(11, 47, 134, .78) 100%),
    url("assets/img/porto.jpg") center / cover no-repeat;
}
.flow .section-intro { color: var(--foam); }
.flow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(48px, 7vw, 80px);
}
.flow-steps li {
  position: relative;
  padding: 36px 28px 0 0;
  border-top: 3px solid var(--crest);
}
.flow-steps li::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 0;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--deep);
  border: 4px solid var(--crest);
}
.flow-steps h3 { font-size: var(--step-1); margin-bottom: 8px; }
.flow-steps p { color: var(--foam); max-width: 26ch; }

@media (max-width: 860px) {
  .flow-steps { grid-template-columns: minmax(0, 1fr); margin-left: 10px; }
  .flow-steps li { border-top: 0; border-left: 3px solid var(--crest); padding: 0 0 32px 30px; }
  .flow-steps li:last-child { padding-bottom: 0; }
  .flow-steps li::before { top: 0; left: -12px; }
  .flow-steps p { max-width: none; }
}

/* ---------- Metodo ---------- */
.method { padding-block: clamp(72px, 10vw, 128px); }
.method-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: center;
}
.method-media img {
  width: 100%;
  aspect-ratio: 6 / 7;
  object-fit: cover;
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
}
.method-steps {
  counter-reset: step;
  display: grid;
  gap: 28px;
  margin-top: 40px;
}
.method-steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 4px 20px;
  align-content: start;
}
.method-steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--wave);
  color: var(--white);
  font-weight: 700;
}
.method-steps h3 { font-size: var(--step-1); padding-top: 9px; }
.method-steps p { color: var(--ink-soft); max-width: 46ch; }

@media (max-width: 860px) {
  .method-grid { grid-template-columns: minmax(0, 1fr); }
  .method-media img { aspect-ratio: 16 / 10; }
}

/* ---------- Contatti ---------- */
.contact {
  background: var(--white);
  border-top: 1px solid var(--line);
  padding-block: clamp(72px, 10vw, 128px);
}
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: start;
}
.contact-copy > p {
  margin-top: 18px;
  max-width: 36ch;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-soft);
}
.contact-info { display: grid; gap: 20px; margin: 40px 0 0; }
.contact-info dt { font-size: var(--step--1); font-weight: 650; color: var(--wave); }
.contact-info dd { margin: 2px 0 0; }
.contact-info a { text-underline-offset: 3px; }

.contact-form {
  display: grid;
  gap: 20px;
  padding: clamp(24px, 4vw, 40px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: 0.9375rem; padding: 0; }
.optional { font-weight: 400; color: var(--ink-soft); }

.field input[type="text"],
.field input[type="email"],
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #B4C5DE;
  border-radius: var(--radius-s);
  background: var(--white);
  color: var(--ink);
  font: inherit;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus-visible, .field textarea:focus-visible {
  outline: 3px solid rgba(72, 166, 255, .45);
  outline-offset: 0;
  border-color: var(--wave);
}
.field [aria-invalid="true"] { border-color: #B3261E; }

.choices { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid #B4C5DE;
  border-radius: 999px;
  background: var(--white);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.choice input:checked + span { background: var(--wave); border-color: var(--wave); color: var(--white); }
.choice input:focus-visible + span { outline: 3px solid var(--crest); outline-offset: 2px; }

.privacy-note { font-size: var(--step--1); color: var(--ink-soft); }
.contact-form .btn { justify-self: start; }
.form-status { min-height: 1.5em; font-weight: 600; font-size: 0.9375rem; }
.form-status:empty { display: none; }
.form-status.is-error { color: #B3261E; }
.form-status.is-ok { color: #13703A; }

@media (max-width: 860px) {
  .contact-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .field-row { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: #C3D3EE;
  padding-block: 64px 36px;
  font-size: 0.9375rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr) minmax(0, 1fr);
  gap: 40px 56px;
}
.footer-logo { width: 168px; }
.footer-brand p { margin-top: 18px; max-width: 30ch; }
.footer-heading { color: var(--white); font-weight: 650; margin-bottom: 12px; }
.footer-nav ul { display: grid; gap: 8px; }
.footer-nav a, .legal a { text-decoration: none; }
.footer-nav a:hover, .legal a:hover { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }
.legal { display: grid; gap: 2px; align-content: start; }
.legal .footer-heading { margin-bottom: 10px; }
.copyright {
  grid-column: 1 / -1;
  padding-top: 24px;
  border-top: 1px solid rgba(221, 235, 255, 0.16);
  font-size: var(--step--1);
}

@media (max-width: 860px) {
  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
}
