:root {
  --colore-primario: #e66432;     /* Arancione principale */
  --colore-secondario: #fff4ee;   /* Beige chiaro di sfondo */
  --colore-hover: #cc4e1e;        /* Arancione più scuro per hover */
}

/* ---------- STRUTTURA BASE ---------- */
body {
  font-family: "Helvetica", sans-serif;
  background: var(--colore-secondario);
  color: #222;
  margin: 0;
  line-height: 1.6;
}

/* ---------- HEADER ---------- */
header {
  background: var(--colore-primario);
  color: white;
  text-align: center;
  padding: 1.5em 0;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1em;
  flex-wrap: wrap; /* così su mobile va a capo */
}

.logo-header {
  height: 70px;
  width: auto;
}

.titolo-header h1 {
  margin: 0;
  font-size: 1.8em;
}

.titolo-header p {
  margin: 0.3em 0 0;
  font-size: 1em;
}

/* Responsive: su schermi piccoli il logo va sopra */
@media (max-width: 700px) {
  .header-container {
    flex-direction: column;
    gap: 0.5em;
  }
  .logo-header {
    height: 60px;
  }
}

/* ---------- NAV (MENU) ---------- */
nav {
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
  z-index: 20;
}

.menu-toggle {
  display: none;
  font-size: 1.8em;
  padding: 0.4em 1em;
  cursor: pointer;
  color: var(--colore-primario);
}

.menu-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.5em 0;
}

.menu-links a {
  color: var(--colore-primario);
  text-decoration: none;
  margin: 0.4em 1em;
  font-weight: bold;
  line-height: 1;
  display: inline-block; /* ← mantiene l’allineamento uniforme */
  transition: background 0.2s, color 0.2s;
  border-radius: 6px;
  padding: 0.3em 0.8em; /* uguale anche alla versione active */
}

/* Hover generico */
.menu-links a:hover {
  color: var(--colore-hover);
}

/* Link attivo (pagina corrente) */
.menu-links a.active {
  background-color: var(--colore-primario);
  color: white !important;
  border-radius: 6px;
  padding: 0.3em 0.8em; /* uguale a quello normale */
  line-height: 1;
  position: relative;
  top: 0; /* forza l’allineamento perfetto */
}

.menu-links a.active:hover {
  background-color: var(--colore-hover);
}

/* ---------- TOOLBAR (ZOOM TESTO) ---------- */
.toolbar {
  text-align: right;
  padding: 0.5em 1em;
  background: white;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5em;
}

.toolbar button {
  background: var(--colore-primario);
  color: white;
  border: none;
  padding: 0.4em 0.8em;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1em;
  margin-left: 0.4em;
  transition: background 0.2s, color 0.2s;
}

.toolbar button:hover {
  background: var(--colore-hover);
}

/* ---------- TOOLBAR in DARK MODE ---------- */
body.dark-mode .toolbar {
  background: #2c2c2c;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  border-bottom: 1px solid #444;
}

body.dark-mode .toolbar button {
  background: #444;
  color: #ffa47c;
}

body.dark-mode .toolbar button:hover {
  background: #666;
  color: white;
}

/* ---------- CONTENUTO (BOX GENERICI) ---------- */
.contenuto {
  max-width: 900px;
  margin: 2em auto;
  background: white;
  color: #222;
  padding: 2em;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  font-size: 18px;
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease, font-size 0.2s ease;
}

/* Modalità scura */
body.dark-mode .contenuto {
  background: #2a2a2a;
  color: #f2f2f2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* ---------- VARIANTE TRASPARENTE (solo home) ---------- */
.trasparente {
  background: #fff;
  box-shadow: none;
  padding: 1em;
}

/* ---------- BLOCCHI PRE-FORMATTATI ---------- */
.pre-block {
  /* userai <pre class="pre-block"> per incollare i testi CEI74 così come sono */
  white-space: pre-wrap;     /* preserva \n e righe vuote */
  font-family: inherit;      /* no monospace */
  line-height: 1.2;
  margin: 0 0 1.5em 0;
}

/* ---------- INNO ---------- */
.contenuto .pre-inno {
  margin-bottom: 2em; /* più respiro dopo l'inno */
}

/* ---------- ANTIFONE ---------- */
.antifona {
  font-style: italic;
  margin-top: 1.5em;
  margin-bottom: 1.7em;
}
.antifona .ant {
  color: #ff0000;
  font-weight: bold;
  font-style: normal;
  margin-right: 0.3em;
}

/* ---------- TITOLI LITURGICI (h2) ---------- */
.titolo-liturgico {
  margin-top: 2.4em;          /* più margine sopra */
  margin-bottom: 0.5em;
  color: var(--colore-primario);
  border-bottom: 2px solid var(--colore-secondario);
  padding-bottom: 0.2em;
  text-transform: none;       /* niente maiuscolo forzato */
  font-size: 1.3em;
  font-weight: bold;
}

/* ---------- TITOLI SALMI/CANTICI A DUE RIGHE ---------- */
.titolo-salmo {
  font-weight: bold;
  color: #ff0000;
  margin-top: 0.8em;
  margin-bottom: 0.5em;
  line-height: 1.4;
}
.sottotitolo-rosso {
  color: #ff0000;
  font-weight: normal;
}

/* ---------- NOTE E SOTTOTITOLI ---------- */
.nota-nera {
  color: #444;
  font-style: italic;
  margin-top: 0.6em;
  margin-bottom: 1.2em;
}

/* Modalità scura: il testo delle note diventa chiaro */
body.dark-mode .nota-nera {
  color: #f2f2f2;
}

.nota-rossa {
  color: #ff0000;
  font-style: italic;
  font-size: 0.9em;
  margin-bottom: 0.6em;
}
.contenuto h2 .sottotitolo {
  display: block;
  font-size: 0.9rem;
  font-weight: normal;
  font-style: italic;
  color: #444;
  margin-top: 0.25em;
  margin-bottom: 0.2em;
}

/* ---------- RIFERIMENTI SCRITTURISTICI ---------- */
.riferimento {
  color: #ff0000;
  font-weight: 500;
  font-size: 0.85em;          /* più piccolo del corpo */
  margin: 0.3em 0 0.8em 0;
  display: block;
  text-align: left;
}

/* ---------- TITOLI CON RIFERIMENTO A DESTRA ---------- */
.titolo-sezione {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 2px solid var(--colore-secondario);
  margin-bottom: 0.4em;
  padding-bottom: 0.2em;
}

.titolo-sezione h2 {
  margin: 0;
  font-size: 1.3em;
}

.riferimento-destra {
  color: var(--colore-primario);
  font-style: italic;
  font-size: 0.95em;
  white-space: nowrap;
}


/* ---------- COLORI/SEGNI LITURGICI ---------- */
.rosso { color: #ff0000; font-weight: bold; }

/* ---------- FOOTER ---------- */
footer {
  text-align: center;
  padding: 3em 0 2em 0;
  color: #666;
  font-size: 0.9em;
}
.footer-box {
  display: inline-block;
  background: white;
  border: 1px solid var(--colore-secondario);
  border-radius: 10px;
  padding: 0.8em 1.6em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* ---------- SCELTA ORE (unico box bianco) ---------- */
.scelta-ore {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 2em auto;
  padding: 2em 0;
  width: 95%;
  max-width: 600px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.scelta-ore a {
  display: block;
  width: 80%;
  max-width: 300px;
  background: white;
  color: var(--colore-primario);
  text-decoration: none;
  padding: 1em 1.5em;
  margin: 0.4em 0.6em;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  font-weight: bold;
  text-align: center;
  transition: transform 0.2s, background 0.3s;
}

.scelta-ore a:hover {
  background: var(--colore-secondario);
  transform: scale(1.03);
}

/* ---------- RESPONSIVE (MOBILE) ---------- */
@media (max-width: 700px) {
  .menu-toggle { display: block; }
  .menu-links {
    display: none;
    flex-direction: column;
    text-align: center;
    background: white;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
  }
  .menu-links.open { display: flex; }
  .menu-links a { margin: 0.8em 0; }

  .contenuto {
    margin: 1em;
    padding: 1em 1.2em;
  }
}

/* Riduce lo spazio tra le strofe nei salmi e nei cantici */
.pre-block {
  margin-top: 0.6em;
  margin-bottom: 0.6em;
  line-height: 1.5;
}

.pre-block p {
  margin-top: 0.3em;
  margin-bottom: 0.3em;
}

#spazio.grande,
.spazio-grande {
  height: 1.8em; /* spazio verticale visibile tra blocchi */
  display: block;
  content: "";
}

/* ---------- NAVIGAZIONE TRA LE ORE ---------- */
.navigazione-ore {
  display: flex;
  justify-content: center;
  gap: 1em;
  flex-wrap: wrap;
  margin-top: 4em;
  text-align: center;
}

.btn-ora {
  background: var(--colore-primario);
  color: white;
  text-decoration: none;
  padding: 0.8em 1.6em;
  border-radius: 8px;
  font-weight: bold;
  transition: background 0.2s, transform 0.2s;
  display: inline-block;
}

.btn-ora:hover {
  background: var(--colore-hover);
  transform: scale(1.03);
}

/* Mobile: bottoni uno sopra l'altro */
@media (max-width: 600px) {
  .navigazione-ore {
    flex-direction: column;
    align-items: center;
  }

  .btn-ora {
    width: 80%;
    margin-bottom: 0.6em;
  }
}

/* ---------- POPUP "AGGIUNGI ALLA HOME" ---------- */
.popup-add-home {
  display: none; /* inizialmente nascosto */
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 2px solid var(--colore-primario);
  color: #222;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  z-index: 1000;
  padding: 1em 1.5em;
  width: calc(100% - 40px);
  max-width: 400px;
  animation: slideUp 0.5s ease;
}

.popup-content {
  text-align: center;
  font-size: 0.95em;
  line-height: 1.4;
}

.popup-add-home button {
  background: var(--colore-primario);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5em 1.2em;
  margin-top: 0.8em;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}

.popup-add-home button:hover {
  background: var(--colore-hover);
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 30px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Solo su mobile */
@media (min-width: 700px) {
  .popup-add-home {
    display: none !important;
  }
}

/* ---------- MODALITÀ SCURA ---------- */
body.dark-mode {
  background: #1e1e1e;
  color: #ddd;
}

body.dark-mode header {
  background: #292929;
  color: #fff;
}

body.dark-mode nav {
  background: #2e2e2e;
}

body.dark-mode .menu-links a {
  color: #ffa47c;
}

body.dark-mode .menu-links a.active {
  background-color: #e66432;
  color: white !important;
}

body.dark-mode .contenuto {
  background: #2a2a2a;
  color: #ddd;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  padding-left: 1em;
  padding-right: 1em;
}

body.dark-mode .footer-box {
  background: #2a2a2a;
  border-color: #3c3c3c;
  color: #bbb;
}

/* ---------- BOTTONE TEMA ---------- */
.tema-btn {
  background: white;
  color: var(--colore-primario);
  border: 1px solid var(--colore-primario);
  border-radius: 6px;
  padding: 0.4em 0.6em;
  cursor: pointer;
  font-size: 1.1em;
  margin-left: 0.6em;
  transition: background 0.2s, color 0.2s;
}

.tema-btn:hover {
  background: var(--colore-primario);
  color: white;
}

body.dark-mode .tema-btn {
  background: #333;
  color: #ffa47c;
  border-color: #ffa47c;
}

/* Titolo all'inizio della pagina ("Lodi mattutine", "Vespri", ecc.) */
.intestazione-ora {
  text-align: center;
  margin-bottom: 1.5em;
}

.intestazione-ora h2 {
  font-size: 1.8em;
  color: var(--colore-primario);
  margin-bottom: 0.3em;
}

.intestazione-ora p {
  color: #444;
  font-style: italic;
  margin: 0;
}

/* ---------- COOKIE BANNER ---------- */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  background: #fff;
  color: #222;
  border-radius: 14px;
  box-shadow: 0 -3px 12px rgba(0,0,0,0.15);
  padding: 1.2em 1.5em 1.4em;
  text-align: center;
  font-size: 0.95em;
  line-height: 1.5;
  z-index: 1000;
  display: none;
  animation: slideUp 0.5s ease forwards;
}

/* Pulsante */
.cookie-banner button {
  background: var(--colore-primario);
  color: white;
  border: none;
  padding: 0.6em 1.6em;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
  margin-top: 0.8em;
}
.cookie-banner button:hover {
  background: var(--colore-hover);
}

/* Tema scuro */
body.dark-mode .cookie-banner {
  background: rgba(30, 30, 30, 0.96);
  color: #fff;
  border: 1px solid #444;
}

/* Animazione */
@keyframes slideUp {
  from { transform: translate(-50%, 40px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ---------- MOBILE VERSION ---------- */
@media (max-width: 700px) {
  .cookie-banner {
    bottom: 0;
    left: 0;
    transform: none;
    width: 100%;
    border-radius: 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.25);
    padding: 1em 1.2em 1.4em;
    font-size: 0.9em;
  }

  .cookie-banner p {
    margin-bottom: 0.8em;
  }

  .cookie-banner button {
    width: 100%;
    font-size: 1em;
    padding: 0.9em;
    border-radius: 10px;
  }
}

/* === APPEND: fix tema scuro + cookie banner, senza rimuovere regole esistenti === */

/* 1) Home: box "Scegli l’Ora" adattato al tema */
body.dark-mode .scelta-ore {
  background: #2a2a2a;
  color: #f2f2f2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
}
body.dark-mode .scelta-ore h2 {
  color: #ffb690; /* arancione più caldo in scuro */
}
body.dark-mode .scelta-ore a {
  background: #333;
  color: #ffb690;
  border: 1px solid #444;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
body.dark-mode .scelta-ore a:hover {
  background: var(--colore-primario);
  color: #fff;
}

/* 2) Note informative leggibili anche in scuro (ridondante ma sicuro) */
body.dark-mode .nota-nera { color: #ddd; }

/* 3) Cookie banner coerente con il tema */
body:not(.dark-mode) .cookie-banner {
  background: #ffffff;
  color: #222;
  border-top: 1px solid #eee;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.08);
}
body.dark-mode .cookie-banner {
  background: rgba(20,20,20,0.95);
  color: #fff;
}

/* ---------- MENU MOBILE IN MODALITÀ SCURA ---------- */
body.dark-mode .menu-links {
  background: #2e2e2e;              /* sfondo scuro */
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

body.dark-mode .menu-links a {
  color: #ffa47c;                   /* testo arancione chiaro */
  border-radius: 0;
}

body.dark-mode .menu-links a:hover {
  background: #3a3a3a;              /* leggermente più chiaro per hover */
  color: #fff;
}

body.dark-mode .menu-links a.active {
  background: #e66432;              /* evidenzia la pagina corrente */
  color: #fff;
}

.cookie-banner a { color: var(--colore-primario); text-decoration: underline; }

/* === FIX CENTRATURA COOKIE BANNER === */
.cookie-banner {
  position: fixed;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  bottom: 0;
  margin: 0 auto;
}

/* Su schermi piccoli, centratura perfetta e margine dal bordo */
@media (max-width: 700px) {
  .cookie-banner {
    width: 90%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 10px;
    border-radius: 10px;
  }
}

/* ---------- TESTO "OPPURE" (variante liturgica) ---------- */
.oppure {
  display: block;
  color: #ff0000;          /* rosso liturgico coerente */
  font-style: italic;
  font-size: 0.9em;        /* leggermente più piccolo del testo normale */
  margin: 0.8em 0 0.4em 0; /* un po’ di respiro sopra e sotto */
  text-align: left;        /* allineato al testo principale */
}

/* Modalità scura */
body.dark-mode .oppure {
  color: #ff0000;          /* rosso più caldo e leggibile su sfondo scuro */
}


/* ---------- SCHEDE (TABS) ---------- */
.tabs {
  display: block;
  width: 100%;
  margin: 2em 0;
  border-radius: 12px;
  overflow: visible;
  position: relative;
  box-sizing: border-box;
  max-width: 100% !important;
}

/* Barra delle schede */
.tab-header {
  display: flex;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  background: #fff;
  border-bottom: 2px solid var(--colore-primario);
  gap: 0.2em;
  padding: 0.2em 0;
}
.tab-header::-webkit-scrollbar {
  display: none;
}

/* Pulsanti delle schede */
.tab-button {
  flex: 0 0 auto;
  padding: 0.7em 1.4em;
  background: none;
  border: none;
  color: var(--colore-primario);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1em;
  white-space: nowrap;
  border-radius: 12px 12px 0 0;
}
.tab-button:hover {
  background: var(--colore-secondario);
}
.tab-button.active {
  background: var(--colore-primario);
  color: white;
}

/* Frecce laterali */
.tab-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.4em;
  height: 2.4em;
  background: var(--colore-primario);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.3s ease, background 0.3s ease, transform 0.2s ease;
  font-size: 1.2em;
  z-index: 15;
  box-shadow: none;
}

.tab-arrow.left  { left: -1.2em; }
.tab-arrow.right { right: -1.2em; }

.tab-arrow:hover {
  background: #c74d1a;
  transform: translateY(-50%) scale(1.1);
}

/* Mostra le frecce solo quando serve */
.tabs.scrollable .tab-arrow {
  opacity: 1;
}

/* Contenuto delle schede */
.tab-content {
  display: none;
  background: white;
  padding: 1.5em;
  border-radius: 0 0 12px 12px;
}
.tab-content.active {
  display: block;
}

/* Modalità scura */
body.dark-mode .tab-header {
  background: #2c2c2c;
  border-bottom: 2px solid #e66432;
}
body.dark-mode .tab-button {
  color: #ffa47c;
}
body.dark-mode .tab-button.active {
  background: #e66432;
  color: white;
}
body.dark-mode .tab-content {
  background: #2a2a2a;
  color: #eee;
}

/* Responsive */
@media (max-width: 700px) {
  .tab-button {
    font-size: 0.9em;
    padding: 0.6em 1.2em;
  }
  .tab-arrow {
    width: 2em;
    height: 2em;
    font-size: 1em;
    left: -1em;
    right: -1em;
  }
}


/* Modalità scura */
body.dark-mode .tab-header {
  background: #2c2c2c;
  border-bottom: 2px solid #e66432;
}
body.dark-mode .tab-button {
  color: #ffa47c;
}
body.dark-mode .tab-button.active {
  background: #e66432;
  color: white;
}
body.dark-mode .tab-content {
  background: #2a2a2a;
  color: #eee;
}

/* ---- SPAZI IN LINEA (per simulare indentazioni) ---- */
/* uso base: <span class="spazio"></span>  => 1 em di spazio */
.spazio { display:inline-block; width: 1em; }

/* moltiplicatori rapidi */
.spazio.x2 { width: 2em; }
.spazio.x3 { width: 3em; }
.spazio.x4 { width: 4em; }

/* versione parametrica: <span class="spazio" style="--n:2"></span> */
.spazio { width: calc(var(--n, 1) * 1em); }