:root {
  --blue: #1b3f8b;
  --blue-deep: #10295e;
  --blue-soft: #e8eefb;
  --yellow: #ffd60a;
  --yellow-soft: #fff6c7;
  --ink: #14182b;
  --muted: #5a6178;
  --line: #e3e5ec;
  --paper: #fbfaf6;
  --white: #ffffff;
  --radius: 18px;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0 0 .5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.3rem, 5.5vw, 4rem); font-weight: 800; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: 20px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

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

.eyebrow {
  font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--blue); margin-bottom: .8em;
}
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55em;
  padding: .85em 1.4em; border-radius: 999px;
  background: var(--blue); color: #fff; text-decoration: none;
  font-weight: 600; font-size: 1rem; border: 2px solid var(--blue);
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--blue-deep); border-color: var(--blue-deep); transform: translateY(-1px); box-shadow: 0 8px 20px -10px rgba(16,41,94,.6); }
.btn svg { width: 20px; height: 20px; fill: currentColor; }
.btn-ghost { background: transparent; color: var(--blue); }
.btn-ghost:hover { background: var(--blue-soft); color: var(--blue-deep); }
.btn-small { padding: .5em 1.1em; font-size: .95rem; }
.btn-yellow { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.btn-yellow:hover { background: #ffe24d; border-color: #ffe24d; }
.btn-outline-light { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.btn-outline-light:hover { background: rgba(255,255,255,.1); border-color: #fff; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,250,246,.88);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-display); font-size: 1.2rem; color: var(--blue); }
.brand-text small { font-size: .78rem; color: var(--muted); }

.nav { display: flex; align-items: center; gap: 28px; }
.nav a:not(.btn) { text-decoration: none; font-weight: 500; color: var(--ink); position: relative; }
.nav a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px; background: var(--yellow);
  transition: right .2s ease;
}
.nav a:not(.btn):hover::after { right: 0; }

.nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--ink); margin: 5px 0; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 64px 0 96px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; align-items: center; position: relative; z-index: 1; }
.hl {
  background: linear-gradient(transparent 58%, var(--yellow) 58%, var(--yellow) 92%, transparent 92%);
  padding-inline: .06em;
}
.lead { font-size: 1.2rem; color: var(--muted); max-width: 34em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.cancel-lines {
  position: absolute; right: -40px; top: 40px; width: 55%; height: 220px; z-index: 0; opacity: .5;
  background: repeating-linear-gradient(to bottom, transparent 0 22px, var(--blue-soft) 22px 28px);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200' preserveAspectRatio='none'%3E%3Cpath d='M0 0 Q50 30 100 0 T200 0 T300 0 T400 0 V200 Q350 170 300 200 T200 200 T100 200 T0 200Z'/%3E%3C/svg%3E") center / 100% 100%;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200' preserveAspectRatio='none'%3E%3Cpath d='M0 0 Q50 30 100 0 T200 0 T300 0 T400 0 V200 Q350 170 300 200 T200 200 T100 200 T0 200Z'/%3E%3C/svg%3E") center / 100% 100%;
}

/* Ticket card */
.ticket {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  box-shadow: 0 1px 0 var(--line), 0 30px 60px -30px rgba(16,41,94,.35);
  border-top: 8px solid var(--yellow);
  transform: rotate(1.2deg);
}
.ticket-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.ticket-label { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: .9rem; padding: 5px 12px; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue);
}
.status i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status[data-state="open"] { background: #e3f6e9; color: #137a3a; }
.status[data-state="open"] i { animation: pulse 1.8s infinite; }
.status[data-state="closed"] { background: #fdeaea; color: #b42323; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(19,122,58,.5); } 70% { box-shadow: 0 0 0 8px rgba(19,122,58,0); } 100% { box-shadow: 0 0 0 0 rgba(19,122,58,0); } }

.ticket-today { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; margin: 0 0 4px; line-height: 1.25; }
.ticket-next { color: var(--muted); font-size: .95rem; min-height: 1.5em; margin: 0; }
.perforation {
  height: 2px; margin: 22px -28px;
  background-image: radial-gradient(circle, var(--line) 1.5px, transparent 1.6px);
  background-size: 10px 2px;
  position: relative;
}
.perforation::before, .perforation::after {
  content: ""; position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%;
  background: var(--paper); transform: translateY(-50%);
}
.perforation::before { left: -11px; }
.perforation::after { right: -11px; }
.ticket-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ticket-list li { display: flex; justify-content: space-between; gap: 16px; }
.ticket-list span { color: var(--muted); font-size: .9rem; }
.ticket-list a { font-weight: 600; text-decoration: none; color: var(--blue); word-break: break-all; text-align: right; }
.ticket-list a:hover { text-decoration: underline; }
.postmark {
  position: absolute; width: 92px; height: 92px; right: -26px; top: -40px;
  color: var(--blue); opacity: .85; transform: rotate(-14deg);
  background: transparent;
}

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section-alt { background: var(--yellow-soft); }
.section-dark { background: var(--blue-deep); color: #fff; }
.section-dark .eyebrow { color: var(--yellow); }
.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head p:last-child { color: var(--muted); font-size: 1.1rem; }

/* Services */
.services { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.service {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.service:hover { transform: translateY(-4px); border-color: transparent; box-shadow: 0 24px 40px -24px rgba(16,41,94,.35); }
.service p { color: var(--muted); margin: 0; }
.service strong { color: var(--ink); }
.ico {
  width: 52px; height: 52px; border-radius: 14px; margin-bottom: 18px;
  background: var(--yellow); display: grid; place-items: center;
}
.ico svg { width: 26px; height: 26px; fill: none; stroke: var(--blue-deep); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.note { margin-top: 28px; font-size: .92rem; color: var(--muted); }

/* Ritiro */
.ritiro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.ritiro-grid > div > p { font-size: 1.1rem; }
.partners { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.partners li {
  background: var(--white); border-radius: 14px; padding: 20px 22px;
  border-left: 6px solid var(--blue);
  display: grid; gap: 2px;
}
.partner-name { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; }
.partner-desc { color: var(--muted); font-size: .98rem; }
code { font-family: ui-monospace, Consolas, monospace; background: var(--blue-soft); color: var(--blue); padding: 1px 6px; border-radius: 5px; font-size: .9em; }

/* Steps */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; counter-reset: s; }
.steps li { position: relative; padding-top: 8px; }
.steps li:not(:last-child)::after {
  content: ""; position: absolute; top: 32px; left: 76px; right: -16px; height: 2px;
  background-image: linear-gradient(to right, var(--line) 50%, transparent 50%); background-size: 12px 2px;
}
.step-n {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--blue); color: var(--yellow); font-family: var(--font-display); font-weight: 800; font-size: 1.4rem;
  margin-bottom: 18px;
}
.steps p { color: var(--muted); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 56px; align-items: stretch; }
address { font-style: normal; font-size: 1.15rem; margin: 8px 0 28px; line-height: 1.55; }
.hours { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.hours-note { font-size: .9rem; color: rgba(255,255,255,.6); margin-bottom: 24px; }
.avviso {
  margin: 14px 0 0; padding: 10px 14px; border-radius: 10px;
  background: var(--yellow-soft); border-left: 4px solid var(--yellow);
  font-size: .92rem; font-weight: 600; color: var(--ink);
}
.avviso-dark { margin: 0 0 24px; background: rgba(255,214,10,.12); color: #fff; }
.hours th, .hours td { text-align: left; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.14); vertical-align: top; }
.hours th { font-weight: 500; color: rgba(255,255,255,.75); }
.hours td { text-align: right; font-weight: 600; }
.hours tr.today th, .hours tr.today td { color: var(--yellow); }
.hours tr.today th::after { content: " · oggi"; font-size: .8em; }
.contact-links { display: flex; flex-wrap: wrap; gap: 12px; }
.social { display: flex; gap: 10px; margin-top: 28px; }
.social a {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.1); transition: background .15s;
}
.social a:hover { background: var(--yellow); color: var(--ink); }
.social svg { width: 20px; height: 20px; fill: currentColor; }
.map { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 380px; background: #0c1f47; }
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; filter: saturate(.85); }
.map-link {
  position: absolute; left: 14px; bottom: 14px; background: var(--white); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .9rem;
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.4);
}

/* ---------- Footer ---------- */
.site-footer { background: #0a1c42; color: rgba(255,255,255,.6); font-size: .88rem; padding: 26px 0; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 24px; }
.footer-inner p { margin: 0; }
.footer-legal { flex: 1; }

/* Area riservata: volutamente discreta */
.staff-link {
  display: inline-flex; align-items: center; gap: 5px;
  color: rgba(255,255,255,.28); text-decoration: none; font-size: .75rem;
  transition: color .2s;
}
.staff-link svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.staff-link:hover, .staff-link:focus-visible { color: rgba(255,255,255,.75); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .status[data-state="open"] i { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid, .ritiro-grid, .contact-grid { grid-template-columns: 1fr; gap: 44px; }
  .ticket { transform: none; max-width: 480px; }
  .services { grid-template-columns: repeat(2, 1fr); }
  .cancel-lines { width: 90%; }
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: 72px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: 8px 20px 20px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a:not(.btn) { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav a:not(.btn)::after { display: none; }
  .nav .btn { margin-top: 14px; justify-content: center; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .hero { padding: 40px 0 72px; }
  .section { padding: 72px 0; }
  .services, .steps { grid-template-columns: 1fr; }
  .steps li::after { display: none; }
  .postmark { right: -6px; top: -46px; width: 80px; height: 80px; }
  .map { min-height: 300px; }
  .footer-legal { flex-basis: 100%; }
}
