/* ==========================================================================
   style-home-separato.css — Letture.eu (Home)
   --------------------------------------------------------------------------
   VERSIONE CENTRALIZZATA — PRODUZIONE

   Obiettivi:
   - Responsive solido (320–480px inclusi) senza scroll orizzontale
   - Accessibilità: focus visibile, skip-link, immagini fluid
   - Compatibilità cross-browser moderna
   ========================================================================== */


/* --------------------------------------------------------------------------
   1) VARIABILI E RESET MINIMO + BASE TIPOGRAFICA
   -------------------------------------------------------------------------- */

:root {
  --font-base: system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans",
               sans-serif;
}

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

html {
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 1rem;
  line-height: 1.6;
  color: #1a1a1a;
  background-color: #fff;
  letter-spacing: 0;
  word-spacing: 0.02rem;
  text-rendering: optimizeLegibility;
  hyphens: auto;
}

/* Link: per discoverability, sottolineatura di base.
   Le CTA (bottoni) gestiscono il proprio aspetto più sotto. */
a {
  color: #003366;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:hover,
a:focus {
  color: #005fcc;
}

/* Focus accessibile: funziona anche dove :focus-visible non è supportato */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #000;
  outline-offset: 3px;
}

/* Miglioramento preferenziale: evita outline su click mouse (dove supportato) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #000;
  outline-offset: 3px;
}


/* --------------------------------------------------------------------------
   2) IMMAGINI FLUIDE + DIDASCALIE
   -------------------------------------------------------------------------- */

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

figure {
  margin: 0 auto 1rem;
}

figcaption {
  font-size: 0.95rem;
  color: #444;
  text-align: center;
  line-height: 1.4;
}

/* Se si desidera una didascalia più piccola SOLO qui */
#caption-biblio {
  font-size: 0.9rem;
}


/* --------------------------------------------------------------------------
   3) CONTENITORI “PROPORZIONATI”
   Nota: max-width unico e centratura coerente
   -------------------------------------------------------------------------- */

.contenitore-proporzionato,
.footer-proporzionato {
  width: 100%;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}


/* --------------------------------------------------------------------------
   4) SKIP LINK (visibile solo al focus)
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border: 1px solid #000;
  z-index: 9999;
}

.skip-link:focus,
.skip-link:focus-visible {
  left: 0.75rem;
  top: 0.75rem;
}


/* --------------------------------------------------------------------------
   5) HOME — TOPBAR (logo)
   -------------------------------------------------------------------------- */

.home-topbar {
  text-align: center;
}

.home-topbar-inner {
  display: inline-block;
}

.home-topbar-logo {
  height: 80px;
  width: auto;
}


main#contenuto-principale {
  padding-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   6) HOME — CTA “Entra in Biblioteca” / “Entra in Emeroteca”
   -------------------------------------------------------------------------- */

.home-cta-wrap {
  text-align: center;
  margin-top: 0.2rem;
}

.home-cta-wrap + .home-cta-wrap {
  margin-top: 1.25rem;
}

.home-cta-link {
  display: inline-block;
  padding: 0.2rem 0.6rem;

  background-color: #000;
  color: #fff;
  text-decoration: none; /* CTA: aspetto “pulsante” */
  font-weight: 700;

  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.2;
}

.home-cta-link:hover,
.home-cta-link:focus {
  color: #fff;
  text-decoration: underline;
}

.home-cta-link:visited {
  color: #fff;
}


/* --------------------------------------------------------------------------
   7) HOME — BLOCCO TITOLI
   -------------------------------------------------------------------------- */

.home-titleblock {
  text-align: center;
}

.home-titleblock h1 {
  margin-bottom: 0.08rem;
  line-height: 1.05;
}

.home-titleblock h2 {
  margin-top: 0;
  line-height: 1.05;
}


/* --------------------------------------------------------------------------
   8) HOME — FOOTER
   -------------------------------------------------------------------------- */

.home-footer {
  text-align: center;
}

.home-footer-copy {
  font-size: 0.9rem;
  margin: 0;
}


/* --------------------------------------------------------------------------
   9) ROBUSTEZZA — prevenzione overflow per stringhe lunghe (URL/parole)
   -------------------------------------------------------------------------- */

main,
header,
footer {
  overflow-wrap: anywhere;
  word-break: normal; /* comportamento standard; overflow-wrap gestisce le stringhe lunghe */
}


/* --------------------------------------------------------------------------
   10) RESPONSIVE
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  /* Mantiene leggibilità e aria attorno ai blocchi */
  .contenitore-proporzionato,
  .footer-proporzionato {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .home-titleblock h1 {
    font-size: 1.8rem;
    line-height: 1.08;
    margin: 0.6rem 0 0.08rem;
  }

  .home-titleblock h2 {
    font-size: 1.3rem;
    line-height: 1.08;
    margin: 0;
  }
}

@media (max-width: 480px) {
  /* Smartphone piccoli: mantenere coerenza senza “schiacciare” troppo */
  .home-titleblock h1 { font-size: 1.6rem; }
  .home-titleblock h2 { font-size: 1.2rem; }
}

@media (max-width: 320px) {
  /* Extra-small device */
  .contenitore-proporzionato,
  .footer-proporzionato {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}
