/* =================================================================
   WOLFCODING — sito istituzionale
   Brand-driven, dark, tecnico. No framework, no build step.
   ================================================================= */

:root {
  --bg-1: #050918;
  --bg-2: #0b1330;
  --bg-3: #142055;
  --brand: #4FB8E8;
  --brand-2: #2E8FC4;
  --brand-soft: rgba(79, 184, 232, 0.12);
  --green: #2EE6A0;
  --green-soft: rgba(46, 230, 160, 0.18);
  --text: #ffffff;
  --text-dim: #a8b3cf;
  --text-meta: #6b7799;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --shadow-1: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 24px 60px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 0 1px rgba(79, 184, 232, 0.18), 0 30px 80px rgba(0, 0, 0, 0.5);

  --maxw: 1200px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-1);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a { color: var(--brand); text-decoration: none; transition: color 150ms; }
a:hover { color: #82d3f5; }
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 3px;
}

button { font-family: inherit; cursor: pointer; }
button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

/* ---------- SKIP LINK ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand);
  color: var(--bg-1);
  padding: 0.7rem 1.2rem;
  font-weight: 700;
  z-index: 1000;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* =================================================================
   HEADER / NAV
   ================================================================= */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(5, 9, 24, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background 200ms;
}

.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 1rem;
}
.brand-logo img { width: 34px; height: 34px; object-fit: contain; }
.brand-logo span { color: var(--text); }
.brand-logo .accent { color: var(--brand); }

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.4rem;
  align-items: center;
}
.nav-links a {
  display: inline-block;
  padding: 0.55rem 0.9rem;
  font-size: 0.92rem;
  color: var(--text-dim);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: color 150ms, background 150ms;
}
.nav-links a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav-links .cta {
  margin-left: 0.5rem;
  background: var(--brand);
  color: var(--bg-1);
  padding: 0.6rem 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.nav-links .cta:hover { background: #6ec6ee; color: var(--bg-1); }

.nav-links .nav-deck {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.5rem 0.85rem;
}
.nav-links .nav-deck:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: transparent;
}
.nav-links .nav-deck svg { opacity: 0.7; transition: opacity 150ms, transform 150ms; }
.nav-links .nav-deck:hover svg { opacity: 1; transform: translate(1px, -1px); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
}
.nav-toggle svg { width: 22px; height: 22px; }

/* =================================================================
   HERO
   ================================================================= */
.hero {
  position: relative;
  padding: 8rem 1.5rem 5rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 70% 30%, rgba(79, 184, 232, 0.18), transparent 70%),
    radial-gradient(ellipse 60% 50% at 20% 90%, rgba(20, 32, 85, 0.7), transparent 70%),
    linear-gradient(140deg, var(--bg-1) 0%, var(--bg-2) 60%, #0d1638 100%);
}

.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 4rem;
  align-items: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 600;
  background: var(--brand-soft);
}
.hero-eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero h1 {
  margin-top: 1.5rem;
  font-size: clamp(2.4rem, 5.5vw, 4.6rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.hero h1 .accent {
  background: linear-gradient(135deg, var(--brand) 0%, #82d3f5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin-top: 1.5rem;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  color: var(--text-dim);
  max-width: 60ch;
  line-height: 1.6;
}

.hero-cta {
  margin-top: 2.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.95rem 1.6rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  transition: transform 150ms, background 150ms, border-color 150ms;
}
.btn-primary {
  background: var(--brand);
  color: var(--bg-1);
}
.btn-primary:hover { background: #6ec6ee; color: var(--bg-1); transform: translateY(-1px); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }

.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-logo-wrap {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 184, 232, 0.2) 0%, transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.hero-logo-wrap::before,
.hero-logo-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(79, 184, 232, 0.25);
  animation: ring 6s ease-in-out infinite;
}
.hero-logo-wrap::after {
  inset: -30px;
  animation-delay: 1s;
  border-color: rgba(79, 184, 232, 0.12);
}
@keyframes ring {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.05); opacity: 1; }
}
.hero-logo-wrap img {
  width: 220px;
  height: 220px;
  object-fit: contain;
  filter: drop-shadow(0 0 30px rgba(79, 184, 232, 0.5));
}

/* =================================================================
   GENERIC SECTION
   ================================================================= */
section {
  padding: 6rem 1.5rem;
  position: relative;
}
section.alt { background: var(--bg-2); }

.section-inner {
  max-width: var(--maxw);
  margin: 0 auto;
}

.section-header {
  margin-bottom: 3rem;
  max-width: 800px;
}
.section-header .eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 1rem;
}
.section-header h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}
.section-header h2 .accent { color: var(--brand); }
.section-header p {
  color: var(--text-dim);
  font-size: clamp(1rem, 1.2vw, 1.1rem);
  line-height: 1.6;
  max-width: 65ch;
}

/* =================================================================
   SERVICES
   ================================================================= */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.service-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: border-color 200ms, transform 200ms;
  position: relative;
  overflow: hidden;
}
.service-card:hover { border-color: var(--brand); transform: translateY(-3px); }
.service-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--green));
  opacity: 0.7;
}

.service-card .ico {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.2rem;
}

.service-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin-bottom: 0.6rem;
}

.service-card .lead {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.2rem;
}

.service-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.service-card ul li {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding-left: 1.2rem;
  position: relative;
}
.service-card ul li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--brand);
  font-weight: 700;
}

/* =================================================================
   APPROACH / PHASES
   ================================================================= */
.phases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  counter-reset: phase;
}
.phase {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.8rem;
  background: rgba(255, 255, 255, 0.02);
  counter-increment: phase;
  position: relative;
}
.phase::before {
  content: counter(phase, decimal-leading-zero);
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  font-size: 0.95rem;
  color: var(--brand);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}
.phase h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}
.phase p {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* =================================================================
   CERTIFICATIONS
   ================================================================= */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.cert {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.025);
  position: relative;
  overflow: hidden;
  transition: border-color 200ms;
}
.cert:hover { border-color: var(--brand); }
.cert::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--brand);
  opacity: 0.7;
}
.cert .iso {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-weight: 800;
  color: var(--brand);
  font-size: 1rem;
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.cert .desc {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* =================================================================
   SECTORS
   ================================================================= */
.sectors-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.sector {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 200ms, transform 200ms;
  position: relative;
}
.sector:hover { border-color: var(--brand); transform: translateY(-2px); }
.sector::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.4rem;
  width: 28px;
  height: 2px;
  background: var(--brand);
}
.sector h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0.4rem 0 0.5rem 0;
  line-height: 1.25;
}
.sector p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-dim);
}

/* =================================================================
   CONTACT
   ================================================================= */
.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 4rem;
}
.contact-info h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.contact-info p {
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.institutional {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
  margin-top: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}
.institutional .row { display: flex; flex-direction: column; gap: 0.2rem; }
.institutional .k {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--brand);
  font-weight: 600;
}
.institutional .v { font-size: 0.92rem; color: var(--text); }

.contact-form {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.field { margin-bottom: 1.2rem; }
.field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 150ms;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field textarea { resize: vertical; min-height: 130px; font-family: inherit; }

.consent {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  margin: 1.5rem 0;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}
.consent label {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
  cursor: pointer;
}
.consent label a { text-decoration: underline; }

.form-msg {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  display: none;
}
.form-msg.success {
  display: block;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green);
}
.form-msg.error {
  display: block;
  background: rgba(255, 100, 100, 0.1);
  color: #ff7676;
  border: 1px solid #ff7676;
}

/* honeypot */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* =================================================================
   FOOTER
   ================================================================= */
.site-footer {
  background: var(--bg-1);
  border-top: 1px solid var(--line);
  padding: 4rem 1.5rem 2rem;
  margin-top: 0;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}
.footer-col h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 1rem;
}
.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.footer-col ul a {
  color: var(--text-dim);
  font-size: 0.9rem;
}
.footer-col ul a:hover { color: var(--text); }

.footer-brand p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-top: 1rem;
  max-width: 35ch;
}
.footer-brand .brand-logo {
  margin-bottom: 0.5rem;
}

.footer-bottom {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-meta);
}
.footer-bottom .legal {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-bottom .legal a { color: var(--text-meta); }
.footer-bottom .legal a:hover { color: var(--brand); }

/* =================================================================
   COOKIE BANNER
   ================================================================= */
.cookie-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  max-width: 480px;
  background: rgba(11, 19, 48, 0.97);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  z-index: 200;
  box-shadow: var(--shadow-2);
  transform: translateY(100px);
  opacity: 0;
  transition: transform 350ms ease, opacity 350ms ease;
  pointer-events: none;
}
.cookie-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.cookie-banner h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}
.cookie-banner p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 1rem;
}
.cookie-banner p a { text-decoration: underline; }

.cookie-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  display: none;
}
.cookie-banner.expanded .cookie-options { display: flex; }

.cookie-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 0.85rem;
}
.cookie-option .info { display: flex; flex-direction: column; }
.cookie-option .name { font-weight: 600; color: var(--text); }
.cookie-option .desc { font-size: 0.78rem; color: var(--text-meta); }
.cookie-option .switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}
.cookie-option input[type="checkbox"] { display: none; }
.cookie-option .switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 200ms;
}
.cookie-option input:checked + .switch { background: var(--brand); }
.cookie-option input:checked + .switch::after { transform: translateX(18px); }
.cookie-option input:disabled + .switch {
  background: var(--brand);
  opacity: 0.5;
  cursor: not-allowed;
}

.cookie-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.cookie-actions button {
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  font-size: 0.85rem;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  flex: 1;
  min-width: 110px;
  transition: background 150ms, border-color 150ms;
}
.cookie-actions button:hover { background: rgba(255, 255, 255, 0.06); }
.cookie-actions .accept {
  background: var(--brand);
  color: var(--bg-1);
  border-color: var(--brand);
}
.cookie-actions .accept:hover { background: #6ec6ee; }
.cookie-actions .save { display: none; }
.cookie-banner.expanded .cookie-actions .save { display: block; }
.cookie-banner.expanded .cookie-actions .customize { display: none; }

/* =================================================================
   LEGAL PAGES
   ================================================================= */
.legal-page {
  padding: 8rem 1.5rem 4rem;
  min-height: 100vh;
  background: var(--bg-1);
}
.legal-inner {
  max-width: 820px;
  margin: 0 auto;
}
.legal-inner h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}
.legal-inner .last-update {
  color: var(--text-meta);
  font-size: 0.85rem;
  margin-bottom: 3rem;
}
.legal-inner h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
  color: var(--brand);
}
.legal-inner h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.legal-inner p,
.legal-inner li {
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}
.legal-inner ul, .legal-inner ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.legal-inner table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.85rem;
}
.legal-inner th, .legal-inner td {
  text-align: left;
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
}
.legal-inner th {
  color: var(--text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.03);
}

/* =================================================================
   RESPONSIVE — full breakpoint chain
   ≥1280  desktop large (default)
   ≥1024  desktop small / laptop
   ≥768   tablet landscape
   ≥640   tablet portrait
   ≥480   mobile large
   ≥360   mobile standard
   <360   mobile small
   ================================================================= */

/* prevenzione overflow su parole/url molto lunghe */
h1, h2, h3, p, li, td {
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

/* tabelle delle pagine legali scrollabili in orizzontale su mobile */
.legal-inner table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}
@media (min-width: 640px) {
  .legal-inner table { display: table; white-space: normal; }
}

/* ------------------- ≤ 1280px (laptop) ------------------- */
@media (max-width: 1280px) {
  :root { --maxw: 100%; }
  .nav-inner, .hero-inner, .section-inner, .footer-inner, .footer-bottom {
    max-width: 1140px;
  }
}

/* ------------------- ≤ 1024px (tablet landscape / laptop small) ------------------- */
@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; gap: 3rem; text-align: left; }
  .hero-visual { order: -1; }
  .hero-logo-wrap { width: 240px; height: 240px; }
  .hero-logo-wrap img { width: 170px; height: 170px; }

  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .phases { grid-template-columns: repeat(2, 1fr); }
  .certs-grid { grid-template-columns: repeat(3, 1fr); }
  .sectors-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

/* ------------------- ≤ 860px — passa a hamburger e single-col ------------------- */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(5, 9, 24, 0.98);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    border-bottom: 1px solid var(--line);
    align-items: stretch;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  }
  .nav-links.open a {
    padding: 0.95rem 1rem;
    border-radius: var(--radius-sm);
  }
  .nav-links.open .nav-deck {
    border: 1px solid var(--line);
    justify-content: center;
  }
  .nav-links.open .cta {
    margin: 0.4rem 0 0 0;
    text-align: center;
    justify-content: center;
  }
  .nav-toggle { display: inline-flex; }

  .certs-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------- ≤ 720px — phablet ------------------- */
@media (max-width: 720px) {
  html { scroll-padding-top: 70px; }

  section { padding: 4rem 1.2rem; }
  .hero { padding: 6rem 1.2rem 3rem; }

  /* respiro a fondo pagina su mobile */
  .site-footer { padding-bottom: max(2rem, 5vh); }

  /* tipografia hero più contenuta su mobile */
  .hero h1 { font-size: clamp(2rem, 7vw, 2.8rem); margin-top: 1.2rem; }
  .hero-sub { margin-top: 1.2rem; font-size: 1rem; }
  .hero-cta { margin-top: 2rem; }

  /* hero visual riequilibrato per tablet/phablet */
  .hero-inner { gap: 2.2rem; }
  .hero-logo-wrap { width: 200px; height: 200px; }
  .hero-logo-wrap img { width: 145px; height: 145px; }
  .hero-logo-wrap::after { inset: -20px; }

  /* section header più compatto */
  .section-header { margin-bottom: 2.2rem; }
  .section-header h2 { font-size: clamp(1.7rem, 5.5vw, 2.2rem); }

  .services-grid { grid-template-columns: 1fr; gap: 1.2rem; }
  .phases { grid-template-columns: 1fr; gap: 1rem; }
  .sectors-grid { grid-template-columns: 1fr; gap: 0.9rem; }
  .institutional { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 2.5rem; }

  .footer-brand p { max-width: none; }

  .cookie-banner {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    padding: 1.2rem;
    max-width: none;
  }
  .cookie-actions {
    flex-direction: column;
  }
  .cookie-actions button { min-width: 100%; }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
  .footer-bottom .legal { gap: 1rem; }

  /* hero CTAs full-width on small screens */
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { justify-content: center; width: 100%; padding: 0.9rem 1.2rem; }
}

/* ------------------- ≤ 540px — mobile large ------------------- */
@media (max-width: 540px) {
  section { padding: 3.2rem 1rem; }
  .hero { padding: 5.5rem 1rem 2.5rem; }

  .nav-inner { padding: 0.7rem 1rem; gap: 1rem; }
  .brand-logo span { font-size: 0.92rem; }

  /* hero eyebrow: meno spaziatura per evitare overflow su narrow */
  .hero-eyebrow {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    padding: 0.35rem 0.75rem;
  }
  .hero h1 { font-size: clamp(1.85rem, 8vw, 2.4rem); }
  .hero-sub { font-size: 0.95rem; line-height: 1.55; }

  /* section header tighter */
  .section-header { margin-bottom: 1.8rem; }
  .section-header .eyebrow { font-size: 0.72rem; letter-spacing: 0.18em; margin-bottom: 0.7rem; }
  .section-header h2 { font-size: clamp(1.55rem, 7vw, 2rem); }
  .section-header p { font-size: 0.95rem; }

  /* certificazioni: 2 col su mobile large per non sembrare troppo spogli */
  .certs-grid { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
  .cert { padding: 1.1rem 0.8rem; }
  .cert .iso { font-size: 0.88rem; }
  .cert .desc { font-size: 0.72rem; }

  .institutional {
    padding: 1.2rem;
    gap: 0.8rem;
  }

  .service-card { padding: 1.5rem 1.3rem; }
  .phase { padding: 1.5rem 1.3rem; }
  .sector { padding: 1.3rem 1.2rem; }

  .contact-form { padding: 1.3rem; }
  .field input, .field textarea, .field select { padding: 0.75rem 0.9rem; font-size: 0.9rem; }
  .consent { padding: 0.85rem; }
  .consent label { font-size: 0.8rem; }

  .legal-page { padding: 6rem 1rem 3rem; }

  .footer-inner { gap: 2rem; }
  .footer-bottom { font-size: 0.75rem; }
  .footer-bottom .legal { flex-direction: column; gap: 0.5rem; }
}

/* ------------------- ≤ 380px — mobile small (iPhone SE etc.) ------------------- */
@media (max-width: 380px) {
  :root {
    --radius: 10px;
    --radius-lg: 14px;
  }
  .hero { padding: 5rem 0.85rem 2.2rem; }
  section { padding: 2.8rem 0.85rem; }

  .nav-inner { padding: 0.55rem 0.85rem; gap: 0.7rem; }
  .brand-logo img { width: 28px; height: 28px; }
  .brand-logo span { font-size: 0.82rem; letter-spacing: 0.04em; }
  .nav-toggle { width: 38px; height: 38px; }

  .hero-eyebrow {
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    padding: 0.3rem 0.65rem;
  }
  .hero h1 { font-size: clamp(1.65rem, 8.5vw, 2rem); }
  .hero-sub { font-size: 0.9rem; }

  .hero-logo-wrap { width: 170px; height: 170px; }
  .hero-logo-wrap img { width: 120px; height: 120px; }
  .hero-logo-wrap::after { inset: -15px; }

  /* singola colonna anche per certs su narrow */
  .certs-grid { grid-template-columns: 1fr; }

  .section-header h2 { font-size: clamp(1.4rem, 7.5vw, 1.75rem); }
  .section-header p { font-size: 0.9rem; }

  .service-card, .phase, .sector { padding: 1.3rem 1.1rem; }
  .service-card h3 { font-size: 1.1rem; }
  .service-card .lead { font-size: 0.9rem; margin-bottom: 1rem; }
  .service-card ul li { font-size: 0.82rem; }

  .institutional { padding: 1rem; gap: 0.7rem; }
  .institutional .v { font-size: 0.85rem; }

  .contact-form { padding: 1.1rem; }

  .cookie-banner { padding: 1rem; }
  .cookie-banner h3 { font-size: 1rem; }
  .cookie-banner p { font-size: 0.82rem; }
  .cookie-actions button { padding: 0.6rem 0.85rem; font-size: 0.82rem; }
}
