/* Portale dei distretti (PORT-001): stessi colori e stessa testata istituzionale di Servizi Sociali App. */
:root {
  --ssa-blue: #0066cc;
  --ssa-blue-dark: #004b99;
  --ssa-navy: #082f57;
  --ssa-ink: #17324d;
  --ssa-muted: #5d7388;
  --ssa-line: #dce7f1;
  --ssa-surface: #f4f8fc;
  --ssa-soft: #ecf5fe;
  --ssa-soft-3: #e6f2ff;
  --ssa-blue-rgb: 0, 102, 204;
  --ssa-ok: #1d7a3e;
  --ssa-ok-soft: #e7f5ec;
  --ssa-radius: 16px;
  --ssa-shadow: 0 10px 30px rgba(8, 47, 87, .08);
}

* { box-sizing: border-box; }
html { scroll-padding-top: 130px; }
body {
  margin: 0;
  color: var(--ssa-ink);
  background: #fff;
  font: 16px/1.55 "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}
img { max-width: 100%; }
a { color: var(--ssa-blue-dark); }
h1, h2, h3, h4 { margin: 0; color: var(--ssa-navy); letter-spacing: -.015em; line-height: 1.2; }
:focus-visible { outline: 3px solid #ffb703; outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; }
.skip-link { position: fixed; z-index: 100; top: -5rem; left: 1rem; padding: .75rem 1rem; border-radius: 10px; color: #fff; background: #111; }
.skip-link:focus { top: 1rem; }

/* Testata: topbar blu, navbar bianca, fascia italiana da 5 px */
.site-header { position: sticky; z-index: 20; top: 0; background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--ssa-line); box-shadow: 0 4px 22px rgba(16, 42, 67, .055); }
.institutional-bar { color: #fff; background: var(--ssa-blue-dark); }
.institutional-inner { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .74rem; font-weight: 650; }
.institutional-links { display: flex; gap: 1rem; }
.institutional-links a { color: #fff; text-decoration: none; }
.institutional-links a:hover { text-decoration: underline; }
.header-inner { min-height: 78px; display: flex; align-items: center; gap: 1rem; }
.brand img { display: block; width: 168px; height: auto; }
nav { margin-left: auto; display: flex; gap: .2rem; }
nav a { padding: .6rem .75rem; border-radius: 9px; color: #3f5b73; font-size: .88rem; font-weight: 700; text-decoration: none; }
nav a:hover, nav a:focus-visible { color: var(--ssa-blue-dark); background: var(--ssa-soft-3); }
.italian-band { display: grid; grid-template-columns: repeat(3, 1fr); height: 5px; }
.italian-band span:nth-child(1) { background: #009246; }
.italian-band span:nth-child(2) { background: #fff; }
.italian-band span:nth-child(3) { background: #ce2b37; }

/* Pulsanti */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .65rem 1.15rem; border: 1px solid transparent; border-radius: 10px; font: inherit; font-weight: 750; font-size: .95rem; text-decoration: none; cursor: pointer; }
.btn-primary { color: #fff; background: var(--ssa-blue); }
.btn-primary:hover { background: var(--ssa-blue-dark); }
.btn-secondary { color: var(--ssa-blue-dark); background: #fff; border-color: #b8cde2; }
.btn-secondary:hover { background: var(--ssa-soft); }
.btn-link { padding: .4rem 0; border: 0; color: var(--ssa-blue-dark); background: none; font: inherit; font-size: .9rem; font-weight: 650; text-decoration: underline; cursor: pointer; }
.btn-link-light { color: #fff; }

.eyebrow { margin: 0 0 .4rem; color: var(--ssa-blue); font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.note { color: var(--ssa-muted); font-size: .92rem; }

/* Rotta ricordata */
.return-panel { background: var(--ssa-soft); border-bottom: 1px solid var(--ssa-line); }
.return-inner { display: flex; align-items: center; gap: 1.25rem; padding: 1.1rem 0; }
.return-crest { width: 52px; height: 58px; object-fit: contain; flex: none; }
.return-copy { flex: 1; }
.return-copy h2 { font-size: 1.15rem; }
.return-copy p { margin: .2rem 0 0; }
.return-countdown { color: var(--ssa-muted); font-size: .9rem; }
.return-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; justify-content: flex-end; }
.return-actions .btn-link { width: 100%; text-align: right; }

/* Apertura con ricerca del Comune */
.hero { color: #fff; background: radial-gradient(circle at 85% 10%, rgba(255, 255, 255, .12), transparent 40%), linear-gradient(125deg, var(--ssa-navy), var(--ssa-blue-dark) 55%, var(--ssa-blue)); }
.hero-inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: center; padding: 3.5rem 0; }
.hero .eyebrow { color: #bfe0ff; }
.hero h1 { color: #fff; font-size: clamp(1.9rem, 4vw, 2.75rem); }
.lead { margin: 1rem 0 0; color: #e3f0fc; font-size: 1.1rem; max-width: 34rem; }
.finder { padding: 1.5rem; border-radius: var(--ssa-radius); color: var(--ssa-ink); background: #fff; box-shadow: 0 20px 45px rgba(0, 20, 50, .25); }
.finder label { display: block; margin-bottom: .55rem; color: var(--ssa-navy); font-weight: 800; font-size: 1.05rem; }
.finder-row { display: flex; gap: .6rem; }
.finder input { flex: 1; min-width: 0; min-height: 48px; padding: .6rem .9rem; border: 1px solid #b8cde2; border-radius: 10px; font: inherit; font-size: 1rem; color: var(--ssa-ink); }
.finder input:focus { border-color: var(--ssa-blue); outline: 3px solid rgba(var(--ssa-blue-rgb), .2); }
.finder-result { min-height: 1.5em; margin: .7rem 0 0; color: var(--ssa-ink); font-weight: 650; }

/* Sezioni */
.section { padding: 3.5rem 0; }
.section-soft { background: var(--ssa-surface); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-head h2 { font-size: 1.7rem; }
.section-head p { margin: 0; color: var(--ssa-muted); font-weight: 650; }
.region + .region { margin-top: 2rem; }
.region-title { margin-bottom: 1rem; font-size: 1.05rem; color: var(--ssa-muted); text-transform: uppercase; letter-spacing: .06em; }
.empty { padding: 1.25rem; border-radius: 12px; background: var(--ssa-surface); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.card { display: flex; flex-direction: column; gap: .85rem; padding: 1.25rem; border: 1px solid var(--ssa-line); border-radius: var(--ssa-radius); background: #fff; }
.card-active { border-color: #bcd6f0; box-shadow: var(--ssa-shadow); }
.card-head { display: flex; align-items: center; gap: .85rem; }
.card-crest { width: 56px; height: 62px; object-fit: contain; flex: none; }
.card-monogram { display: grid; place-items: center; width: 56px; height: 56px; flex: none; border-radius: 14px; color: var(--ssa-muted); background: var(--ssa-surface); border: 1px solid var(--ssa-line); font-weight: 800; }
.card-title h4 { font-size: 1.08rem; }
.badge { display: inline-block; margin-top: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 750; }
.badge-on { color: var(--ssa-ok); background: var(--ssa-ok-soft); }
.badge-off { color: #5d6b78; background: #eef1f4; }
.card-comuni { flex: 1; margin: 0; color: var(--ssa-muted); font-size: .9rem; }
.card .btn { width: 100%; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding: 1.25rem 1.25rem 1.25rem 4rem; border-radius: var(--ssa-radius); background: #fff; border: 1px solid var(--ssa-line); counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 1.2rem; top: 1.2rem; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; color: #fff; background: var(--ssa-blue); font-weight: 800; }
.steps strong, .features strong { display: block; color: var(--ssa-navy); }
.steps span, .features span { color: var(--ssa-muted); font-size: .92rem; }

.enti { display: grid; grid-template-columns: 1fr 1.3fr; gap: 2.5rem; align-items: start; }
.enti h2 { font-size: 1.7rem; }
.enti-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.features { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin: 0; padding: 0; list-style: none; }
.features li { padding: 1rem 1.1rem; border-radius: 12px; background: var(--ssa-surface); border-left: 4px solid var(--ssa-blue); }

/* Piè di pagina */
.site-footer { color: #dbe8f5; background: var(--ssa-navy); }
.footer-inner { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 2rem; padding: 2.5rem 0 1.5rem; font-size: .92rem; }
.footer-inner img { display: block; padding: .5rem; border-radius: 10px; background: #fff; }
.footer-inner h2 { margin-bottom: .5rem; color: #fff; font-size: 1rem; }
.footer-inner a { color: #fff; }
.footer-bottom { padding: 1rem 0 1.5rem; border-top: 1px solid rgba(255, 255, 255, .15); font-size: .82rem; }
.footer-bottom a { color: #fff; }

/* Finestre */
.modal { width: min(560px, calc(100% - 2rem)); padding: 0; border: 0; border-radius: var(--ssa-radius); color: var(--ssa-ink); box-shadow: 0 30px 70px rgba(0, 20, 50, .35); }
.modal::backdrop { background: rgba(8, 47, 87, .55); }
.modal-body { padding: 1.5rem; }
.modal-head { display: flex; align-items: center; gap: 1rem; }
.modal-crest { width: 64px; height: 72px; object-fit: contain; }
.modal h2 { font-size: 1.4rem; }
.modal-comuni { color: var(--ssa-muted); }
.check { display: flex; gap: .65rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 12px; background: var(--ssa-soft); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: .15rem 0 0; flex: none; accent-color: var(--ssa-blue); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; }

@media (max-width: 900px) {
  .hero-inner, .enti { grid-template-columns: 1fr; gap: 1.75rem; }
  .hero-inner { padding: 2.5rem 0; }
  .steps { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  nav { display: none; }
  .institutional-links { display: none; }
  .header-inner { min-height: 64px; }
  .brand img { width: 136px; }
  .return-inner { flex-wrap: wrap; }
  .return-actions { justify-content: stretch; width: 100%; }
  .return-actions .btn { flex: 1 1 100%; }
  .return-actions .btn-link { text-align: left; }
  .finder-row { flex-direction: column; }
  .features { grid-template-columns: 1fr; }
  .section { padding: 2.5rem 0; }
  .section-head { flex-direction: column; gap: .25rem; }
  .modal-actions .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
