/* Parrocchia S. Caterina V. M. - Messina
   Foglio di stile unico: nessuna dipendenza esterna, nessun JavaScript. */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #2a2522;
  --muted: #6b625b;
  --accent: #8e1f2f;
  --accent-hover: #6f1623;
  --on-accent: #ffffff;
  --border: #e4dcd1;
  --header-bg: #241c1a;
  --header-text: #f4ede4;
  --shadow: 0 1px 3px rgb(0 0 0 / .08), 0 4px 12px rgb(0 0 0 / .05);
  --radius: 10px;
  --maxw: 1140px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1716;
    --surface: #262120;
    --text: #ece5dc;
    --muted: #b3a89c;
    --accent: #d4606f;
    --accent-hover: #e27f8c;
    --on-accent: #1b1716;
    --border: #3a3331;
    --header-bg: #120e0d;
    --shadow: 0 1px 3px rgb(0 0 0 / .4);
  }
}

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

html { scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.65 var(--sans);
}

main { flex: 1; }

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

a { color: var(--accent); text-underline-offset: .18em; }
a:hover { color: var(--accent-hover); }

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

h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.25; font-weight: 600; }
h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); margin: 0 0 .25rem; }
h2 { font-size: 1.55rem; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.2rem; margin: 1.75rem 0 .5rem; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 1rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--on-accent); padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- Intestazione e menu (solo CSS) ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg); color: var(--header-text);
  box-shadow: 0 2px 8px rgb(0 0 0 / .25);
}
.site-header .container {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  min-height: 3.75rem;
}
.brand {
  color: var(--header-text); text-decoration: none;
  font-family: var(--serif); font-size: 1.2rem; font-weight: 600; padding: .6rem 0;
}
.brand:hover { color: #fff; }

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-button {
  display: none; cursor: pointer; padding: .45rem .8rem;
  border: 1px solid rgb(255 255 255 / .3); border-radius: 6px;
  color: var(--header-text); font-size: .95rem; user-select: none;
}
.nav-toggle:focus-visible + .nav-button { outline: 3px solid #fff; outline-offset: 2px; }

.menu, .submenu { list-style: none; margin: 0; padding: 0; }
.menu { display: flex; align-items: center; gap: .15rem; }
.menu a, .menu summary {
  display: block; padding: .5rem .75rem; border-radius: 6px;
  color: var(--header-text); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.menu a:hover, .menu summary:hover, .menu [aria-current="page"] { background: rgb(255 255 255 / .1); color: #fff; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: " ▾"; font-size: .8em; opacity: .75; }
.menu details[open] > summary { background: rgb(255 255 255 / .1); }
.menu .has-current > summary { color: #fff; box-shadow: inset 0 -2px 0 var(--accent); }

.dropdown { position: relative; }
.submenu {
  position: absolute; left: 0; top: calc(100% + .35rem); min-width: 13rem;
  background: var(--header-bg); border-radius: 8px; padding: .4rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / .35);
}

@media (max-width: 900px) {
  .nav-button { display: inline-block; }
  .site-nav { flex-basis: 100%; display: none; padding-bottom: .75rem; }
  .nav-toggle:checked ~ .site-nav { display: block; }
  .menu { flex-direction: column; align-items: stretch; }
  .submenu { position: static; box-shadow: none; padding: 0 0 .25rem 1rem; min-width: 0; }
}

/* ---------- Intestazione di pagina ---------- */

.page-head { padding: 2.25rem 0 1.25rem; }
.page-head .lead { margin: 0; font-size: 1.2rem; color: var(--muted); }

.hero-figure { margin: 1.5rem auto 0; max-width: 820px; }
.hero-figure img { margin-inline: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-figure.small { max-width: 340px; }

/* ---------- Testi ---------- */

.prose { max-width: 75ch; margin-inline: auto; padding-bottom: 3rem; }
.prose p { text-align: justify; hyphens: auto; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: .45rem; }

.columns { columns: 16rem; column-gap: 2rem; padding-left: 1.25rem; }
.columns li { break-inside: avoid; }

blockquote.welcome {
  margin: 0; padding: 1.5rem 1.75rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  font-family: var(--serif); font-style: italic; font-size: 1.1rem;
}
blockquote.welcome p { margin: 0 0 .9rem; text-align: left; }
blockquote.welcome footer { font-style: normal; text-align: right; color: var(--muted); }

.notice {
  padding: 1.25rem 1.5rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); text-align: center;
}

/* ---------- Pulsanti ---------- */

.btn {
  display: inline-block; padding: .55rem 1.1rem; border-radius: 6px;
  background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600;
}
.btn:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn.outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn.outline:hover { background: var(--accent); color: var(--on-accent); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin: 1.25rem 0; }

/* ---------- Schede ---------- */

.grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }

.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card > a:first-child img, .card > img { width: 100%; }
.card-body { padding: 1rem 1.15rem 1.15rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.card h3 { margin: 0; font-size: 1.12rem; }
.card p { margin: 0; color: var(--muted); }
.card .btn { align-self: flex-start; margin-top: auto; }

.thumb-link { display: block; background: var(--border); }
.thumb-link img { transition: opacity .2s; }
.thumb-link:hover img { opacity: .9; }

/* Galleria fotografica */
.gallery { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); padding-bottom: 3rem; }
.gallery a { display: block; border-radius: 6px; overflow: hidden; background: var(--border); }
.gallery img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }

/* ---------- Tabelle ---------- */

.tables { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); margin-top: 1.5rem; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
caption { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; padding: .5rem 0; text-align: left; caption-side: top; }
caption small { display: block; font-family: var(--sans); font-weight: 400; font-size: .9rem; color: var(--muted); }
th, td { padding: .6rem .9rem; border-bottom: 1px solid var(--border); text-align: left; }
thead th { background: var(--accent); color: var(--on-accent); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
@media (max-width: 480px) { th, td { padding: .55rem .5rem; } }

/* ---------- PDF incorporati e media ---------- */

.pdf-frame { width: 100%; height: 80vh; min-height: 30rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.pdf-frame p { padding: 1rem; }
audio, video { width: 100%; border-radius: var(--radius); }

.archive-section { margin-bottom: 2.5rem; }
.archive-section ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------- Contatti ---------- */

.contact-list { list-style: none; padding: 0; }
.contact-list li { margin-bottom: .5rem; }
.contact-list strong { display: inline-block; min-width: 6.5rem; }

/* ---------- Piè di pagina ---------- */

.site-footer {
  margin-top: 3rem; padding: 2.25rem 0; text-align: center;
  background: var(--header-bg); color: var(--header-text); font-size: .95rem;
}
.site-footer a { color: var(--header-text); }
.site-footer p { margin: .25rem 0; }
.site-footer .small { opacity: .7; font-size: .85rem; margin-top: .9rem; }

.prose.full { max-width: none; }
.maintenance { text-align: center; padding-top: 4rem; }
.maintenance img { margin: 2rem auto; }

/* ---------- Orario Messe (PHP) ---------- */

.orari { max-width: 36rem; margin: 1.5rem auto 0; }
tr.oggi th, tr.oggi td { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); font-weight: 600; }
tr.oggi small { font-weight: 400; color: var(--muted); }
.altro-periodo { margin-top: 1.5rem; }
.altro-periodo > summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: .75rem; }

/* ---------- Messa del giorno (PHP) ---------- */

.liturgia-data { text-align: center !important; font-size: 1.15rem; color: var(--muted); }
.liturgia-data::first-letter { text-transform: uppercase; }
.liturgia-messa {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 0 1.25rem; margin-bottom: 1.25rem;
}
.liturgia-messa > summary {
  cursor: pointer; padding: 1rem 0; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--accent);
}
.liturgia-messa[open] > summary { border-bottom: 1px solid var(--border); }
.liturgia-colore { color: var(--muted); }
.liturgia-sezione { padding-bottom: .5rem; }
.liturgia-sezione h3 { color: var(--accent); }
.liturgia-sottotitolo { font-style: italic; }
.liturgia-versetto { font-weight: 600; color: var(--muted); }
.liturgia p { text-align: left; }
.rosso { color: var(--accent); }
.liturgia-fonte { font-size: .9rem; color: var(--muted); text-align: center !important; }

/* ---------- Messaggio scorrevole della home (al posto di <marquee>) ---------- */

.scorrimento { height: 14rem; overflow: hidden; position: relative; }
/* sfumature in alto e in basso: il testo entra ed esce dolcemente */
.scorrimento::before, .scorrimento::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2.5rem; z-index: 1; pointer-events: none;
}
.scorrimento::before { top: 0; background: linear-gradient(var(--surface), transparent); }
.scorrimento::after { bottom: 0; background: linear-gradient(transparent, var(--surface)); }
.scorrimento-testo { padding-top: 11rem; animation: scorri 32s linear infinite; }
.scorrimento:hover .scorrimento-testo,
.scorrimento:focus-within .scorrimento-testo { animation-play-state: paused; }
@keyframes scorri {
  from { transform: translateY(0); }
  to { transform: translateY(-100%); }
}
@media (prefers-reduced-motion: reduce) {
  .scorrimento { height: auto; }
  .scorrimento::before, .scorrimento::after { display: none; }
  .scorrimento-testo { padding-top: 0; animation: none; }
}

/* ---------- Ingrandimento immagini (solo CSS: :target, nessuno script) ---------- */

.zoom { cursor: zoom-in; }
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgb(12 9 8 / .94); padding: 3.25rem 4rem 2.75rem;
  align-items: center; justify-content: center;
}
.lightbox:target { display: flex; animation: compari .2s ease-out both; }
@keyframes compari { from { opacity: 0; } }
.lightbox-sfondo { position: absolute; inset: 0; cursor: zoom-out; }
.lightbox img {
  position: relative; width: auto; height: auto;
  max-width: calc(100vw - 8rem); max-height: calc(100vh - 6rem); max-height: calc(100dvh - 6rem);
  object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgb(0 0 0 / .5);
}
.lightbox-foto {
  position: relative; display: flex; align-items: center; justify-content: center;
  cursor: zoom-in;
}
.lightbox .lightbox-foto:hover, .lightbox .lightbox-foto:focus-visible { background: none; }

/* Livello "dimensione originale": la foto a grandezza reale, si percorre scorrendo */
.originale {
  display: none; position: fixed; inset: 0; z-index: 101;
  background: #0c0908; overflow: auto; overscroll-behavior: contain;
}
.originale:target { display: block; }
.originale-foto { display: block; width: max-content; margin: auto; cursor: zoom-out; }
.originale img { max-width: none; width: auto; height: auto; }
.originale .lightbox-chiudi { position: fixed; color: #fff; text-shadow: 0 0 6px #000; }
.lightbox-chiudi, .lightbox-prec, .lightbox-succ {
  position: absolute; z-index: 1; color: #fff; text-decoration: none; line-height: 1;
}
.lightbox-chiudi { top: .4rem; right: 1rem; font-size: 2.6rem; padding: .25rem .5rem; }
.lightbox-prec, .lightbox-succ {
  top: 50%; transform: translateY(-50%); font-size: 3rem; padding: .9rem .75rem 1.1rem;
  background: rgb(255 255 255 / .1); border-radius: 10px;
}
.lightbox-prec { left: .6rem; }
.lightbox-succ { right: .6rem; }
.lightbox a:hover, .lightbox a:focus-visible { color: #fff; background-color: rgb(255 255 255 / .22); }
.lightbox-chiudi:hover { background: none; opacity: .8; color: #fff; }
.lightbox-pos {
  position: absolute; bottom: .8rem; left: 0; right: 0; text-align: center;
  color: rgb(255 255 255 / .75); font-size: .9rem; pointer-events: none;
}
@media (max-width: 600px) {
  .lightbox { padding: 3.25rem .5rem 2.75rem; }
  .lightbox img { max-width: calc(100vw - 1rem); }
  .lightbox-prec, .lightbox-succ { font-size: 2.2rem; padding: .7rem .55rem .9rem; background: rgb(0 0 0 / .45); }
}
@media (prefers-reduced-motion: reduce) { .lightbox:target { animation: none; } }
.lightbox-suggerimento {
  position: absolute; z-index: 1; left: 1rem; top: 1rem; right: 4rem;
  color: rgb(255 255 255 / .7); font-size: .85rem; pointer-events: none;
}

/* ---------- Eventi per anno ---------- */

.anni { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 1.75rem 0; }
.anni > span { color: var(--muted); }
.anni ul { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.anni a, .anni [aria-current] {
  display: inline-block; padding: .35rem .9rem; border-radius: 999px; text-decoration: none; font-weight: 600;
  border: 1.5px solid var(--accent);
}
.anni a:hover { background: var(--accent); color: var(--on-accent); }
.anni [aria-current] { background: var(--accent); color: var(--on-accent); }

/* ---------- Bacheca e Segreteria (pagine scritte dall'area di gestione) ---------- */

.elenco-notizie { list-style: none; padding: 0 !important; }
.elenco-notizie li { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.elenco-notizie time { display: block; font-weight: 600; color: var(--accent); margin-bottom: .25rem; }
.segreteria-voce { margin-bottom: 1.5rem; }
.card .quando { color: var(--accent); font-weight: 600; }

/* ---------- Area di gestione /adm/ ---------- */

.schede { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.5rem; }
.schede a { padding: .45rem 1rem; border: 1.5px solid var(--accent); border-radius: 999px; text-decoration: none; font-weight: 600; }
.schede a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.esito { padding: .9rem 1.2rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.esito-ok { border-left: 4px solid #2e7d32; }
.esito-errore { border-left: 4px solid #c62828; }
.esito ul { margin: .5rem 0 0; }
.modulo { max-width: 48rem; }
.modulo label { display: block; font-weight: 600; margin-bottom: .3rem; }
.modulo input[type="text"], .modulo input[type="date"], .modulo input[type="time"],
.modulo input[type="file"], .modulo textarea {
  width: 100%; font: inherit; color: inherit; padding: .55rem .7rem;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
}
.modulo textarea { resize: vertical; min-height: 6rem; }
.campi-data { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.nota { color: var(--muted); font-weight: 400; font-size: .9rem; }
.anteprima img { max-width: 12rem; max-height: 12rem; width: auto; border-radius: 6px; border: 1px solid var(--border); }
.elenco-gestione { list-style: none; padding: 0; }
.elenco-gestione li {
  display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between;
  padding: .8rem 0; border-bottom: 1px solid var(--border);
}
.elenco-gestione li > div:first-child { flex: 1 1 20rem; }
.con-miniatura { display: flex; gap: .8rem; align-items: center; }
.con-miniatura img { width: 4rem; height: 4rem; object-fit: cover; border-radius: 4px; flex: none; }
.azioni { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.azioni form { margin: 0; }
button.btn { font: inherit; border: 0; cursor: pointer; }
button.btn.outline { border: 1.5px solid var(--accent); }
.elenco-gestione .btn { padding: .3rem .75rem; font-size: .9rem; }
.btn.pericolo { background: #c62828; color: #fff; }
.btn.pericolo:hover { background: #8e1c1c; color: #fff; }
button[disabled] { opacity: .35; cursor: default; }
