/*
Theme Name: Acquapendente onlus
Theme URI: https://www.acquapendenteonlus.it/
Author: Fabrizio Mazzuoli
Author URI: https://fabriziomazzuoli.it/
Description: Tema su misura per l'Associazione di Protezione Civile Acquapendente onlus. Accesso rapido all'emergenza, aree di emergenza e contributi gestibili dal pannello.
Version: 1.1.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: acquapendente
*/

/* ---------- Font (file locali in assets/fonts, vedi README) ---------- */
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("assets/fonts/AtkinsonHyperlegibleNext-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("assets/fonts/AtkinsonHyperlegibleNext-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("assets/fonts/Archivo-ExtraBold.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }

/* ---------- Token ---------- */
:root {
	--ink: #0F2A4A;
	--ink-deep: #0B1F38;
	--text: #2E405A;
	--muted: #4A5A6E;
	--bg: #F7F6F2;
	--surface: #FFFFFF;
	--line: #E2DED4;
	--line-strong: #C9C3B4;
	--yellow: #FFC72C;
	--yellow-text: #5C4300;
	--urgent: #B93C0A;
	--urgent-text: #9A3208;
	--urgent-soft: #FBE6DC;
	--blue: #1D4E89;
	--on-dark: #D5DEEA;
	--radius: 14px;
	--font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-head: "Archivo", "Arial Black", system-ui, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 18px; line-height: 1.55; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); }
a:hover { color: var(--urgent-text); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
p { margin: 0; }
[hidden] { display: none !important; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; width: auto; height: auto; clip: auto; padding: 12px 18px; background: var(--yellow); color: var(--ink-deep); font-weight: 700; border-radius: 8px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding-top: 80px; padding-bottom: 80px; }
.section--tight { padding-top: 40px; padding-bottom: 40px; }
.section--white { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.split { display: flex; flex-wrap: wrap; gap: 48px; }
.split > * { flex: 1 1 360px; min-width: 0; }
.split > .split__wide { flex: 2 1 520px; }
.h-display { font-family: var(--font-head); font-weight: 800; font-size: clamp(36px, 5.2vw, 56px); line-height: 1.05; letter-spacing: -0.01em; }
.h-section { font-family: var(--font-head); font-weight: 800; font-size: clamp(28px, 3.4vw, 40px); }
.h-card { font-family: var(--font-head); font-weight: 800; font-size: 22px; }
.eyebrow { font-size: 15px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--urgent-text); }
.lead { font-size: 20px; color: var(--text); max-width: 34em; }
.text { color: var(--text); }
.small { font-size: 16px; }
.muted { color: var(--muted); }
.entry-content > * + * { margin-top: 1em; }
.entry-content { color: var(--text); max-width: 46em; }

/* ---------- Pulsanti ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 12px 24px; border-radius: 8px; font: inherit; font-weight: 700; text-decoration: none; border: 2px solid transparent; cursor: pointer; line-height: 1.2; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: var(--ink-deep); color: #fff; }
.btn--deep { background: var(--ink-deep); color: #fff; }
.btn--deep:hover { background: #000; color: #fff; }
.btn--outline { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn--urgent { background: var(--urgent); color: #fff; min-height: 44px; padding: 10px 20px; }
.btn--urgent:hover { background: var(--urgent-text); color: #fff; }
.btn--sm { min-height: 44px; padding: 10px 16px; font-size: 16px; }
.btn svg { flex: none; }

/* ---------- Barra emergenza ---------- */
.topbar { background: var(--ink-deep); color: #fff; font-size: 16px; }
.topbar .wrap { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: center; justify-content: space-between; padding-top: 10px; padding-bottom: 10px; }
.topbar__nums { display: flex; flex-wrap: wrap; gap: 6px 24px; align-items: center; }
.topbar__label { font-weight: 700; color: var(--yellow); }
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { color: var(--yellow); }
.topbar__cta { color: var(--yellow) !important; font-weight: 700; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: relative; }
.site-header .wrap { display: flex; gap: 16px 32px; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; }
.brand { display: flex; gap: 14px; align-items: center; text-decoration: none; }
.brand img { width: 52px; height: 52px; object-fit: contain; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-family: var(--font-head); font-weight: 800; font-size: 22px; color: var(--ink); }
.brand__tag { font-size: 14px; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 26px; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 26px; }
.nav a { text-decoration: none; font-weight: 700; font-size: 17px; }
.nav .current-menu-item > a, .nav .current_page_item > a, .nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 8px; text-decoration-color: var(--yellow); }
.nav-toggle { display: none; width: 48px; height: 48px; border: 0; background: transparent; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); }
.header-actions { display: flex; gap: 8px; align-items: center; }

@media (max-width: 960px) {
	.nav-toggle { display: inline-flex; }
	.nav { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 12px 24px rgba(11, 31, 56, 0.08); display: none; flex-direction: column; align-items: stretch; padding: 8px 24px 20px; }
	.nav.is-open { display: flex; }
	.nav ul { flex-direction: column; gap: 0; }
	.nav ul a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
	.nav .btn--urgent { display: none; }
	.brand__name { font-size: 19px; }
	.brand img { width: 44px; height: 44px; }
}
.header-actions { display: none; }
@media (max-width: 960px) { .header-actions { display: flex; } }
.footer-bottom ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 20px; }
/* Header su schermi stretti: il nome va a capo invece di finire sotto il pulsante. */
@media (max-width: 960px) {
	.site-header .wrap { gap: 12px; }
	.brand { flex: 1 1 auto; min-width: 0; gap: 10px; }
	.brand__text { min-width: 0; }
	.brand__name { font-size: clamp(16px, 4.4vw, 19px); overflow-wrap: anywhere; }
	.header-actions { flex: none; gap: 4px; }
	.header-emergenza { gap: 6px; }
}
@media (max-width: 480px) {
	.brand__tag { display: none; }
	.brand img { width: 40px; height: 40px; }
	/* Solo icona: l'etichetta resta per i lettori di schermo. */
	.header-emergenza { width: 44px; padding: 0; justify-content: center; }
	.header-emergenza__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- Hero ---------- */
.hero { padding: 72px 0 56px; }
.hero .wrap { display: flex; flex-wrap: wrap; gap: 48px; align-items: center; }
.hero__text { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.hero__img { flex: 1 1 420px; min-width: 0; }
.hero__img img { width: 100%; aspect-ratio: 5 / 4; object-fit: cover; border-radius: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Schede ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid--wide { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: var(--ink); }
a.card:hover { border-color: var(--ink); color: var(--ink); }
.card--dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.card--dark .text { color: var(--on-dark); }
a.card--dark:hover { background: var(--ink-deep); color: #fff; }
.card .text { font-size: 16px; }
.quick { min-height: 170px; }

.feature { display: flex; flex-direction: column; gap: 8px; }
.feature h3 { font-size: 19px; }
.feature p { font-size: 16px; color: var(--text); }
.feature-row { border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; gap: 20px; align-items: flex-start; }
.feature-row__icon { flex: none; width: 56px; height: 56px; border-radius: 12px; background: var(--urgent-soft); display: flex; align-items: center; justify-content: center; }
.feature-row h3 { font-size: 21px; margin-bottom: 6px; }
.feature-row p { font-size: 17px; color: var(--text); }

.band { background: var(--yellow); border-radius: 20px; padding: clamp(28px, 5vw, 56px); display: flex; flex-wrap: wrap; gap: 40px; align-items: center; color: var(--ink-deep); }
.band > * { flex: 1 1 340px; min-width: 0; }
.band .text { color: #1B2A3E; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; }
.checklist svg { flex: none; margin-top: 3px; }

.outline-box { border: 2px solid var(--ink); border-radius: 20px; padding: clamp(24px, 4vw, 40px); display: flex; flex-wrap: wrap; gap: 24px 48px; align-items: center; justify-content: space-between; }
.outline-box > div:first-child { flex: 1 1 420px; min-width: 0; }
.cf-box { background: var(--surface); border-radius: 12px; padding: 18px 26px; display: flex; flex-direction: column; gap: 4px; }
.cf-box__label { font-size: 14px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.cf-box__value { font-family: var(--font-head); font-weight: 800; font-size: 32px; letter-spacing: 0.04em; }

.pills { display: flex; flex-wrap: wrap; gap: 12px; }
.pill { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 10px 20px; font-weight: 700; }

.label { font-size: 14px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* ---------- Emergenza ---------- */
.emerg-hero { background: var(--ink-deep); color: #fff; }
.emerg-hero .wrap { padding-top: 56px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 28px; }
.emerg-hero h1 { color: #fff; }
.emerg-hero .lead { color: var(--on-dark); }
.numbers { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.num { background: var(--surface); color: var(--ink-deep); border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 2px; min-height: 112px; text-decoration: none; }
.num:hover { color: var(--ink-deep); box-shadow: 0 0 0 3px var(--yellow); }
.num--primary { background: var(--yellow); }
.num__label { font-size: 15px; font-weight: 700; }
.num__value { font-family: var(--font-head); font-weight: 800; font-size: clamp(26px, 3vw, 32px); line-height: 1.35; }
.num__value--big { font-size: 44px; line-height: 1.1; }
.anchors { display: flex; flex-wrap: wrap; gap: 10px; }
.anchors a { color: #fff; border: 1px solid #4C6385; border-radius: 999px; padding: 10px 18px; min-height: 44px; display: inline-flex; align-items: center; font-weight: 700; text-decoration: none; }
.anchors a:hover { border-color: #fff; color: #fff; }
.anchors a.is-key { background: var(--yellow); color: var(--ink-deep); border-color: var(--yellow); }

.advice { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; padding: 64px 0 24px; }
.advice__box { background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--ink); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 18px; scroll-margin-top: 24px; }
.advice__box--fire { border-top-color: var(--urgent); }
.advice__box--water { border-top-color: var(--blue); }
.advice__box h3 { font-size: 18px; margin-bottom: 6px; }
.advice__box ul { margin: 0; padding-left: 20px; font-size: 17px; color: var(--text); }
.advice__box li + li { margin-top: 4px; }
.advice__title { display: flex; gap: 12px; align-items: center; font-family: var(--font-head); font-weight: 800; font-size: 28px; }
.advice__title svg { flex: none; }
.advice__content { color: var(--text); font-size: 17px; }
.advice__content > * { margin: 0; }
.advice__content > * + * { margin-top: 14px; }
.advice__content h3 { font-size: 18px; color: var(--ink); margin-top: 22px; }
.advice__content h3 + ul, .advice__content h3 + ol { margin-top: 6px; }
.advice__content ol { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: step; color: var(--ink); font-size: 18px; }
.advice__content ol li { position: relative; padding-left: 46px; min-height: 32px; counter-increment: step; }
.advice__content ol li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.advice__box[style*="#9A3208"] .advice__content ol li::before { background: var(--urgent); }
.advice__content strong { color: var(--ink); }
.lead p + p, .text p + p, .entry-content p + p { margin-top: 0.8em; }
.steps-num { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: step; }
.steps-num li { display: flex; gap: 14px; counter-increment: step; }
.steps-num li::before { content: counter(step); flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--urgent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }

.filters { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 8px 18px; border-radius: 999px; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; background: var(--surface); color: var(--ink); border: 2px solid var(--line-strong); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.area-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.area { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.area[hidden] { display: none; }
.area__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.area__name { font-weight: 700; font-size: 18px; line-height: 1.3; }
.area__note { font-size: 15px; color: var(--muted); }
.area .btn { margin-top: auto; align-self: flex-start; }
.badge { font-size: 13px; font-weight: 700; border-radius: 6px; padding: 3px 9px; }
.badge--attesa { background: #FFE7A3; color: var(--yellow-text); }
.badge--accoglienza { background: #DCE7F5; color: #123A66; }
.area__loc { font-size: 13px; font-weight: 700; color: var(--muted); }
.map { height: 460px; border-radius: 16px; border: 1px solid var(--line); background: #E6E2D7; z-index: 0; }
.map--small { height: 380px; }

/* ---------- Trasparenza ---------- */
.year-head { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-end; justify-content: space-between; }
.total { display: flex; flex-direction: column; align-items: flex-end; }
.total__value { font-family: var(--font-head); font-weight: 800; font-size: 40px; line-height: 1.1; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 17px; }
.table th { text-align: left; background: #EFECE4; padding: 14px 20px; font-size: 15px; }
.table td { padding: 14px 20px; border-top: 1px solid var(--line); vertical-align: top; }
.table .num-col { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.table .date-col { white-space: nowrap; color: var(--text); }
.year-panel + .year-panel { margin-top: 48px; }
.js .year-panel[hidden] { display: none; }

/* ---------- Moduli ---------- */
.form { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.field label { font-weight: 700; font-size: 16px; }
.field .opt { font-weight: 400; color: var(--muted); }
.field input, .field textarea, .field select { font: inherit; color: var(--ink); padding: 12px 14px; border: 2px solid var(--line-strong); border-radius: 8px; min-height: 48px; background: var(--surface); width: 100%; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--yellow); }
.field textarea { resize: vertical; }
.consent { grid-column: 1 / -1; display: flex; gap: 12px; align-items: flex-start; font-size: 16px; color: var(--text); }
.consent input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--ink); }
.form .btn { grid-column: 1 / -1; justify-self: start; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.notice { border-radius: 12px; padding: 16px 20px; font-weight: 700; }
.notice--ok { background: #DDF0E2; color: #134E26; }
.notice--err { background: var(--urgent-soft); color: #5A1E05; }
.alert { display: flex; gap: 14px; align-items: flex-start; background: var(--urgent-soft); color: #5A1E05; border-radius: 12px; padding: 16px 20px; max-width: 46em; }
.alert a { color: #5A1E05; font-weight: 700; }
.alert svg { flex: none; margin-top: 2px; }
.contact-list { display: flex; flex-direction: column; gap: 28px; }
.contact-list > div { display: flex; flex-direction: column; gap: 6px; }
.contact-list strong.big { font-family: var(--font-head); font-weight: 800; font-size: 24px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink-deep); color: var(--on-dark); font-size: 16px; }
.site-footer a { color: var(--on-dark); }
.site-footer a:hover { color: var(--yellow); }
.footer-grid { display: grid; gap: 36px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding: 64px 0 32px; }
.footer-grid > div { display: flex; flex-direction: column; gap: 10px; }
.footer-grid .title { font-weight: 700; color: #fff; }
.footer-grid .brand__name { color: #fff; font-size: 20px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-bottom { border-top: 1px solid #23395A; padding: 20px 0 32px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font-size: 14px; }
.footer-bottom nav { display: flex; gap: 20px; flex-wrap: wrap; }
.five-img { max-width: 220px; border-radius: 8px; }

@media (max-width: 600px) {
	body { font-size: 17px; }
	.section { padding-top: 56px; padding-bottom: 56px; }
	.hero { padding: 40px 0 40px; }
	.wrap { padding: 0 16px; }
	.advice__box, .card, .feature-row { padding: 22px; }
	.total { align-items: flex-start; }
	.map { height: 360px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print { .topbar, .site-header, .site-footer, .filters, .map, .form { display: none !important; } }
