/* stile-pagine.css — Stile condiviso per le pagine secondarie (opendata, lettura-complementare, ecc.)
   Costruito da costruisci_assets.py → static/landing/pagine.{hash}.css */

/* ── Font self-hosted ── */
@font-face { font-family: 'Libre Bodoni'; font-style: normal; font-weight: 400; font-display: swap; src: url('/font/libre-bodoni-400.woff2') format('woff2'); }
@font-face { font-family: 'Libre Bodoni'; font-style: normal; font-weight: 600; font-display: swap; src: url('/font/libre-bodoni-700.woff2') format('woff2'); }
@font-face { font-family: 'Libre Bodoni'; font-style: normal; font-weight: 700; font-display: swap; src: url('/font/libre-bodoni-700.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400; font-display: swap; src: url('/font/eb-garamond-400.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400; font-display: swap; src: url('/font/eb-garamond-400i.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 600; font-display: swap; src: url('/font/eb-garamond-600.woff2') format('woff2'); }

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; }
body {
  font-family: 'EB Garamond', serif;
  font-size: 1.1rem;
  color: #3a2a14;
  background: #f5eed6;
  line-height: 1.7;
  min-height: 100vh;
}

/* ── Cornice medievale ── */
.cornice-pagina {
  max-width: 780px;
  margin: 2rem auto;
  padding: 0 1rem calc(48px + env(safe-area-inset-bottom, 0px));
  position: relative;
  z-index: 1;
}
.bordo-manoscritto {
  border: 2px solid #c8a96e;
  border-radius: 4px;
  padding: 2.5rem 3rem;
  position: relative;
  overflow: visible;
  background: linear-gradient(135deg, #f5eed6 0%, #f0e8cc 50%, #f5eed6 100%);
  box-shadow:
    0 0 0 6px #f5eed6,
    0 0 0 8px #d4c4a8,
    0 0 0 14px #f5eed6,
    0 0 0 15px #e8dcc0;
}

/* ── Angoli ornamentali ── */
.angolo-ornamento {
  position: absolute;
  width: 100px;
  height: 100px;
  overflow: visible;
  z-index: 2;
}
.angolo-ornamento.alto-sx { top: -6px; left: -6px; }
.angolo-ornamento.alto-dx { top: -6px; right: -6px; transform: scaleX(-1); }
.angolo-ornamento.basso-sx { bottom: -6px; left: -6px; transform: scaleY(-1); }
.angolo-ornamento.basso-dx { bottom: -6px; right: -6px; transform: scale(-1, -1); }

/* ── Tralci laterali ── */
.tralcio-wrap {
  position: absolute;
  pointer-events: none;
  opacity: 0.45;
  z-index: 1;
}
.tralcio-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
}
.tralcio-wrap.alto {
  top: -4px;
  left: 80px;
  right: 80px;
  height: 28px;
}
.tralcio-wrap.basso {
  bottom: -4px;
  left: 80px;
  right: 80px;
  height: 28px;
  transform: scaleY(-1);
}
.tralcio-wrap.sx {
  left: -8px;
  top: 80px;
  bottom: 80px;
  width: 28px;
}
.tralcio-wrap.dx {
  right: -8px;
  top: 80px;
  bottom: 80px;
  width: 28px;
  transform: scaleX(-1);
}

/* ── Intestazione ── */
.intestazione {
  text-align: center;
  padding: 1rem 0 2rem;
}
.intestazione h1 {
  font-family: 'Libre Bodoni', serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #3a2a14;
  margin-bottom: 0.3rem;
  letter-spacing: 0.04em;
}
.intestazione .sottotitolo {
  font-style: italic;
  color: #6b4c2a;
  font-size: 1rem;
}

/* ── Fregio divisore ── */
.fregio-divisore {
  display: block;
  margin: 1.5rem auto;
  height: 24px;
  width: 240px;
  opacity: 0.7;
}

/* ── Contenuto ── */
.contenuto {
  min-width: 0;
  overflow: hidden;
}
.contenuto h2 {
  font-family: 'Libre Bodoni', serif;
  font-size: 1.3rem;
  color: #6b4c2a;
  margin: 1.8rem 0 0.75rem;
}
.contenuto h3 {
  font-family: 'Libre Bodoni', serif;
  font-size: 1.1rem;
  color: #6b4c2a;
  margin: 1.2rem 0 0.5rem;
}
.contenuto p, .contenuto ul {
  margin-bottom: 0.75rem;
}
.contenuto ul {
  padding-left: 1.5rem;
}
.contenuto li {
  margin-bottom: 0.3rem;
}
.contenuto a {
  color: #6b4c2a;
  border-bottom: 1px solid #d4c4a8;
  text-decoration: none;
}

/* ── Codice ── */
code {
  font-family: monospace;
  font-size: 0.95em;
  background: #ece4c8;
  padding: 0.1em 0.4em;
  border-radius: 3px;
}
pre {
  background: #3a2a14;
  color: #f0e8cc;
  padding: 1rem 1.2rem;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0.5rem 0 1rem;
  max-width: 100%;
}
pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* ── Tabelle ── */
.tabella {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1rem;
  font-size: 0.95rem;
}
.tabella th, .tabella td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #d4c4a8;
}
.tabella code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.tabella th {
  font-family: 'Libre Bodoni', serif;
  color: #6b4c2a;
  font-weight: 600;
}

/* ── Badge licenza ── */
.badge-cc0 {
  display: block;
  text-align: center;
  background: #ece4c8;
  border: 1px solid #d4c4a8;
  border-radius: 4px;
  padding: 0.3rem 0.8rem;
  font-size: 0.9rem;
  margin: 0.5rem auto;
}

/* ── Citazione ── */
.citazione {
  border-left: 3px solid #c8a96e;
  padding: 0.8rem 1.2rem;
  margin: 1rem 0;
  font-style: italic;
  color: #6b4c2a;
  background: rgba(200, 169, 110, 0.06);
}
.citazione .fonte {
  display: block;
  font-style: normal;
  font-size: 0.85rem;
  margin-top: 0.4rem;
  color: #8b6b45;
}

/* ── Piede ── */
.piede {
  text-align: center;
  padding: 2rem 0 0;
  font-size: 0.85rem;
  color: #8b6b45;
}
.piede a {
  color: #6b4c2a;
  text-decoration: none;
  border-bottom: 1px solid #d4c4a8;
}
.collegamento-segnala {
  font-size: 0.8rem;
  color: #8b6b45;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
.collegamento-segnala:hover { color: #3a2a14; }

/* ── Barra inferiore fissa ── */
.barra-inferiore {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(245,238,214,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid #d4c4a8;
  box-shadow: 0 -2px 8px rgba(58,42,20,0.06);
}
.barra-inferiore a,
.barra-inferiore button {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  color: #8b6b45;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 4px;
  transition: color 250ms ease;
  text-decoration: none;
  font-family: 'EB Garamond', serif;
  font-size: 0.85rem;
}
.barra-inferiore a:hover,
.barra-inferiore a:focus-visible,
.barra-inferiore button:hover,
.barra-inferiore button:focus-visible {
  color: #3a2a14;
}
.barra-inferiore svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.barra-inferiore .barra-titolo {
  display: none;
  font-family: 'Libre Bodoni', serif;
  font-size: 0.85rem;
  color: #a08860;
  letter-spacing: 0.03em;
}
#btn-torna-su-pagina {
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}
#btn-torna-su-pagina.visibile {
  opacity: 1;
  pointer-events: auto;
}

/* ── Responsive ── */
@media (min-width: 601px) {
  .barra-inferiore .barra-titolo { display: block; }
  .barra-inferiore { padding: 0 1.5rem; }
}
/* Desktop: allinea barra alla cornice esterna */
@media (min-width: 812px) {
  .barra-inferiore {
    width: 778px;
    left: 50%; right: auto;
    transform: translateX(-50%);
    padding: 0 1rem;
    border-radius: 8px 8px 0 0;
  }
}
@media (max-width: 600px) {
  .cornice-pagina { margin: 0.5rem auto; padding: 0 0.5rem calc(48px + env(safe-area-inset-bottom, 0px)); }
  .bordo-manoscritto { padding: 1.5rem 1.25rem; box-shadow: none; border: 1.5px solid #c8a96e; }
  .angolo-ornamento { width: 60px; height: 60px; }
  .tralcio-wrap.alto, .tralcio-wrap.basso { left: 50px; right: 50px; }
  .tralcio-wrap.sx, .tralcio-wrap.dx { top: 50px; bottom: 50px; }
  .tralcio-wrap { opacity: 0.3; }
  .intestazione h1 { font-size: 1.8rem; }
  .fregio-divisore { width: 180px; }
  pre { font-size: 0.75rem; padding: 0.8rem; }
  .tabella { font-size: 0.85rem; }
}
@media (prefers-reduced-motion: reduce) {
  .barra-inferiore a, .barra-inferiore button { transition: none; }
  #btn-torna-su-pagina { transition: none; }
}