/* ═══════════════════════════════════════════════
   Biblioteca della Causa (#130, A3)
   Curial register — parchment, gold, ink. Same
   family as the standby card and login altarpiece.
   Locked artefacts dim into "non ancora
   disponibile"; unlocked ones fully render and
   expand inline on click.
   ═══════════════════════════════════════════════ */

.biblioteca-page {
  background: #2a1f12;
  color: rgba(225, 218, 200, 0.85);
  font-family: 'EB Garamond', Georgia, serif;
  min-height: 100vh;
}

.biblioteca-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

.biblioteca-hero {
  text-align: center;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(180, 140, 60, 0.25);
  margin-bottom: 3rem;
}

.biblioteca-stamp {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  color: rgba(220, 190, 130, 0.85);
}

.biblioteca-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #f0e4cc;
  margin: 0 0 0.75rem;
}

.biblioteca-subtitle {
  font-style: italic;
  /* 0.85 (was 0.6) to clear the project's ≥0.82-on-dark contrast
     convention. */
  color: rgba(225, 218, 200, 0.85);
  max-width: 540px;
  margin: 0 auto;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.biblioteca-empty-state {
  margin-top: 1.5rem;
  font-size: 1rem;
  font-style: italic;
  color: rgba(225, 218, 200, 0.78);
}

/* ── Grid ── */
.biblioteca-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.biblioteca-card {
  position: relative;
  background: linear-gradient(180deg, rgba(246, 239, 224, 0.08) 0%, rgba(246, 239, 224, 0.04) 100%);
  border: 1px solid rgba(180, 140, 60, 0.3);
  border-radius: 2px;
  padding: 1.75rem 1.5rem 1.5rem;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.biblioteca-card:not(.is-locked) {
  border-color: rgba(180, 140, 60, 0.55);
  background: linear-gradient(180deg, rgba(246, 239, 224, 0.12) 0%, rgba(246, 239, 224, 0.06) 100%);
}

.biblioteca-card.is-locked {
  opacity: 0.55;
}

.biblioteca-card-stamp {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d4a64c 0%, #6a4a14 90%);
  opacity: 0.6;
}

.biblioteca-card.is-locked .biblioteca-card-stamp {
  background: radial-gradient(circle at 35% 30%, rgba(180, 140, 60, 0.3) 0%, rgba(80, 60, 30, 0.5) 90%);
}

.biblioteca-card-title {
  font-family: 'Cinzel', serif;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #f0e4cc;
  margin: 0 0 0.5rem;
  padding-right: 2.5rem;
}

.biblioteca-card-meta {
  /* Bumped to the project's 1rem accessibility floor from 0.9375rem,
     and opacity raised from 0.78 to 0.85 to meet the ≥0.82-on-dark
     convention. Visible on every card, locked or unlocked, so it
     reads as the canonical availability line. */
  font-size: 1rem;
  font-style: italic;
  color: rgba(225, 218, 200, 0.85);
  margin: 0;
  line-height: 1.5;
}

/* Pending placeholder shown ONLY on cards that have unlocked but
   have no curated body yet (Bibliografia, Note dell'autrice,
   Cronologia). Hidden by default; revealed once the visitor earns
   the corresponding corona so the unlock doesn't read as silent. */
.biblioteca-card-pending {
  display: none;
  font-size: 1rem;
  font-style: italic;
  color: rgba(225, 218, 200, 0.82);
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(180, 140, 60, 0.2);
  line-height: 1.5;
}

.biblioteca-card:not(.is-locked) .biblioteca-card-pending {
  display: block;
}

.biblioteca-card-open {
  display: inline-block;
  /* Generous top margin so the button sits clearly below the
     meta line instead of crowding it (#269 follow-up). The
     0.25rem prior value made the button look glued to the
     "Disponibile con la corona..." line. */
  margin-top: 1.5rem;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(225, 218, 200, 0.85);
  /* no underline — some open controls are now anchors that navigate
     to a dedicated page (e.g. the Fotografie gallery, #300) rather
     than <button>s that toggle an inline body. */
  text-decoration: none;
  background: none;
  border: 1px solid rgba(180, 140, 60, 0.4);
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

/* The button is rendered in markup with the `hidden` attribute and the
   biblioteca.js IIFE removes it on unlock. The class-level `display:
   inline-block` above has the same specificity as the UA `[hidden] {
   display: none }` rule but loads later, so without this guard the
   button stayed visible on locked cards — visitors could click "Apri
   il glossario" on an artefact they hadn't earned (#269). Tying button
   visibility to the card's lock state removes the gap entirely. */
.biblioteca-card.is-locked .biblioteca-card-open {
  display: none;
}

.biblioteca-card-open:hover,
.biblioteca-card-open:focus-visible {
  background: rgba(180, 140, 60, 0.15);
  color: #f6efe0;
}

.biblioteca-card-open:focus-visible {
  outline: 2px solid rgba(220, 190, 130, 0.85);
  outline-offset: 2px;
}

.biblioteca-card-body {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(180, 140, 60, 0.25);
  font-size: 1rem;
  line-height: 1.65;
}

.biblioteca-card-intro {
  font-size: 1rem;
  font-style: italic;
  color: rgba(225, 218, 200, 0.85);
  margin: 0 0 1rem;
}

/* ── Glossario ── */
.biblioteca-glossary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 0;
}

.biblioteca-glossary dt {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(220, 190, 130, 0.9);
  margin-top: 0.25rem;
}

.biblioteca-glossary dd {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: rgba(225, 218, 200, 0.85);
}

.biblioteca-glossary em {
  color: rgba(220, 190, 130, 0.9);
}

/* Standalone glossary page (#300 follow-up) — the full lexicon moved
   out of the cramped card into biblioteca/glossario.html. Single
   column at a comfortable reading width, with a hairline rule above
   each term so the entries breathe instead of crowding. */
.biblioteca-glossary.glossario-page {
  max-width: 720px;
  margin: 0 auto;
  gap: 0;
}
.biblioteca-glossary.glossario-page dt {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(180, 140, 60, 0.18);
  font-size: 1.25rem;
}
.biblioteca-glossary.glossario-page dt:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.biblioteca-glossary.glossario-page dd {
  margin: 0.4rem 0 0;
  line-height: 1.6;
  font-size: 1.25rem;
}

.glossario-source {
  max-width: 720px;
  margin: 2.5rem auto 0;
  text-align: center;
}

/* ═══════════════════════════════════════════════
   Bibliografia Dicasteriale page (#300 follow-up)
   biblioteca/bibliografia.html
   ═══════════════════════════════════════════════ */
.biblio-section {
  max-width: 760px;
  margin: 0 auto 2.5rem;
}
.biblio-section-title {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(220, 190, 130, 0.95);
  margin: 0 0 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(180, 140, 60, 0.3);
}
.biblio-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.biblio-entry {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(180, 140, 60, 0.3);
}
.biblio-entry-title {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.375rem;
  font-weight: 600;
  font-style: italic;
  line-height: 1.35;
  color: #f0e4cc;
}
.biblio-entry-meta {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: rgba(220, 190, 130, 0.8);
}
.biblio-entry-note {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.55;
  color: rgba(225, 218, 200, 0.85);
}
.biblio-entry-note em {
  font-style: italic;
  color: rgba(232, 201, 122, 0.92);
}
.biblio-entry-link {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.125rem;
  color: rgba(220, 190, 130, 0.85);
  text-decoration: none;
  border-bottom: 1px solid rgba(180, 140, 60, 0.4);
  align-self: flex-start;
  margin-top: 0.15rem;
}
.biblio-entry-link:hover,
.biblio-entry-link:focus-visible {
  color: #f6efe0;
}
.biblio-entry-link:focus-visible {
  outline: 2px solid rgba(220, 190, 130, 0.85);
  outline-offset: 2px;
}

.biblio-note {
  max-width: 760px;
  margin: 2.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(180, 140, 60, 0.2);
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.6;
  color: rgba(225, 218, 200, 0.72);
  text-align: center;
}
.biblio-note a {
  color: rgba(220, 190, 130, 0.85);
  text-decoration: none;
  border-bottom: 1px solid rgba(180, 140, 60, 0.4);
}
.biblio-note a:hover,
.biblio-note a:focus-visible { color: #f6efe0; }

/* ═══════════════════════════════════════════════
   Cronologia page (#300 follow-up)
   biblioteca/cronologia.html
   A braided vertical timeline: two threads (the
   barber's art / the Causa dei Santi) running down
   a shared spine, each entry tagged by colour.
   ═══════════════════════════════════════════════ */
.crono-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 1.5rem 0 0;
}
.crono-legend-key {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: rgba(225, 218, 200, 0.8);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.crono-legend-key::before {
  content: '';
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex: 0 0 auto;
}
.crono-legend-key--barberia::before { background: rgba(176, 196, 222, 0.85); }
.crono-legend-key--dicastero::before { background: rgba(220, 190, 130, 0.95); }

.crono-timeline {
  list-style: none;
  max-width: 760px;
  margin: 2.5rem auto 0;
  padding: 0 0 0 1.75rem;
  position: relative;
}
/* The shared spine. */
.crono-timeline::before {
  content: '';
  position: absolute;
  top: 0.4rem;
  bottom: 0.4rem;
  left: 0.32rem;
  width: 2px;
  background: rgba(180, 140, 60, 0.3);
}
.crono-entry {
  position: relative;
  padding: 0 0 2.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.crono-entry:last-child { padding-bottom: 0; }
/* The marker dot on the spine. */
.crono-entry::before {
  content: '';
  position: absolute;
  left: -1.59rem;
  top: 0.45rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #2a1f12;
  border: 2px solid rgba(220, 190, 130, 0.95);
}
.crono-entry--barberia::before { border-color: rgba(176, 196, 222, 0.85); }

.crono-year {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(220, 190, 130, 0.95);
}
.crono-entry--barberia .crono-year { color: rgba(176, 196, 222, 0.92); }

.crono-thread {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(225, 218, 200, 0.6);
}
.crono-entry-title {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.3;
  color: #f0e4cc;
}
.crono-entry-note {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.55;
  color: rgba(225, 218, 200, 0.85);
}
.crono-entry-note em { font-style: italic; color: rgba(232, 201, 122, 0.92); }
.crono-entry .biblio-entry-link { margin-top: 0.25rem; }

/* ═══════════════════════════════════════════════
   Note dell'autrice page (Echo artefact)
   biblioteca/note.html — Beatriz Cabur's author note.
   ═══════════════════════════════════════════════ */
.note-essay {
  max-width: 40rem;
  margin: 0 auto;
}
.note-essay p {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.1875rem;
  line-height: 1.7;
  color: rgba(225, 218, 200, 0.88);
  margin: 0 0 1.4rem;
}
.note-essay p:last-child { margin-bottom: 0; }
.note-essay em { font-style: italic; color: rgba(232, 201, 122, 0.92); }
.note-essay a {
  color: rgba(220, 190, 130, 0.9);
  text-decoration: none;
  border-bottom: 1px solid rgba(180, 140, 60, 0.45);
}
.note-essay a:hover,
.note-essay a:focus-visible { color: #f6efe0; }
.note-essay a:focus-visible { outline: 2px solid rgba(220, 190, 130, 0.85); outline-offset: 2px; }

.note-lead {
  font-size: 1.375rem !important;
  font-style: italic;
  color: #f0e4cc !important;
  text-align: center;
  padding-bottom: 0.6rem;
}
.note-sign {
  margin-top: 2rem !important;
  text-align: right;
  font-family: 'Cinzel', serif;
  font-size: 0.9375rem !important;
  letter-spacing: 0.08em;
  color: rgba(220, 190, 130, 0.9) !important;
}

/* ── Photographs ── */
.biblioteca-photo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.biblioteca-photo {
  padding: 0.75rem 1rem;
  background: rgba(246, 239, 224, 0.04);
  border-left: 2px solid rgba(180, 140, 60, 0.4);
}

.biblioteca-photo a {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: rgba(220, 190, 130, 0.95);
  text-decoration: none;
}

.biblioteca-photo a:hover,
.biblioteca-photo a:focus-visible {
  color: #f6efe0;
  text-decoration: underline;
}

.biblioteca-photo-caption {
  font-size: 1rem;
  font-style: italic;
  color: rgba(225, 218, 200, 0.85);
  margin: 0.25rem 0 0;
}

.biblioteca-card-source {
  margin-top: 1rem;
  font-size: 1rem;
  font-style: italic;
  color: rgba(225, 218, 200, 0.82);
}

/* ── Legend ── */
.biblioteca-legend {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(180, 140, 60, 0.2);
  text-align: center;
  font-size: 1rem;
  font-style: italic;
  color: rgba(225, 218, 200, 0.85);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

@media (prefers-reduced-motion: reduce) {
  .biblioteca-card,
  .biblioteca-card-open {
    transition: none;
  }
}

/* ═══════════════════════════════════════════════
   Fotografie d'epoca — Roma 1946 gallery page
   (#300) — biblioteca/fotografie.html
   ═══════════════════════════════════════════════ */
.fotografie-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.75rem;
  margin: 0 auto;
  max-width: 1000px;
}

.fotografie-item {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: rgba(246, 239, 224, 0.04);
  border: 1px solid rgba(180, 140, 60, 0.22);
  border-radius: 3px;
  overflow: hidden;
}

/* The image sits inside a button that opens the lightbox. Reset the
   button chrome so only the photograph shows; add an affordance on
   hover/focus. */
.fotografie-trigger {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: #1a140c;
  cursor: zoom-in;
  overflow: hidden;
}
.fotografie-trigger:focus-visible {
  outline: 2px solid rgba(220, 190, 130, 0.9);
  outline-offset: -2px;
}

.fotografie-item img {
  display: block;
  width: 100%;
  height: auto;
  /* Sepia-warm filter ties the disparate archive sources into one
     visual register and matches the parchment palette. Subtle —
     the photographs stay legible. */
  filter: sepia(0.18) contrast(1.02);
  background: #1a140c;
  transition: transform 0.35s ease, filter 0.35s ease;
}
.fotografie-trigger:hover img,
.fotografie-trigger:focus-visible img {
  transform: scale(1.04);
  filter: sepia(0.05) contrast(1.04);
}

/* ── Lightbox ── */
.fotografie-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 3vh 2vw;
}
.fotografie-lightbox[hidden] { display: none; }
.fotografie-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 5, 0.92);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
}
.fotografie-lightbox-figure {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(1100px, 92vw);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: lightboxIn 0.22s ease-out;
}
@keyframes lightboxIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.fotografie-lightbox-img {
  display: block;
  max-width: 100%;
  /* Leave room for the caption + counter below. */
  max-height: 74vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid rgba(180, 140, 60, 0.3);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  background: #1a140c;
}
.fotografie-lightbox-caption {
  max-width: 720px;
  text-align: center;
  color: rgba(232, 201, 122, 0.92);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
/* Reuse the same caption sub-element classes from the grid. */
.fotografie-lightbox-caption .fotografie-caption-title {
  font-size: 1.0625rem;
}
.fotografie-lightbox-counter {
  position: absolute;
  z-index: 1;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cinzel', serif;
  font-size: 0.875rem;
  letter-spacing: 0.16em;
  color: rgba(232, 201, 122, 0.7);
}

/* Lightbox controls */
.fotografie-lightbox-close,
.fotografie-lightbox-nav {
  position: absolute;
  z-index: 2;
  background: rgba(20, 17, 12, 0.85);
  color: rgba(240, 228, 204, 0.92);
  border: 1px solid rgba(180, 140, 60, 0.45);
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.fotografie-lightbox-close {
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  font-size: 1.75rem;
}
.fotografie-lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 2.25rem;
}
.fotografie-lightbox-prev { left: 1.5vw; }
.fotografie-lightbox-next { right: 1.5vw; }
.fotografie-lightbox-close:hover,
.fotografie-lightbox-nav:hover,
.fotografie-lightbox-close:focus-visible,
.fotografie-lightbox-nav:focus-visible {
  background: #1d1812;
  border-color: rgba(232, 201, 122, 0.8);
  outline: none;
}
.fotografie-lightbox-close:focus-visible,
.fotografie-lightbox-nav:focus-visible {
  outline: 2px solid rgba(232, 201, 122, 0.9);
  outline-offset: 2px;
}

/* Lock background scroll while the lightbox is open. */
body.lightbox-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .fotografie-item img,
  .fotografie-trigger:hover img,
  .fotografie-trigger:focus-visible img { transition: none; transform: none; }
  .fotografie-lightbox-figure { animation: none; }
}

@media (max-width: 600px) {
  .fotografie-lightbox-nav { width: 44px; height: 44px; font-size: 1.75rem; }
  .fotografie-lightbox-img { max-height: 64vh; }
}

.fotografie-caption {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem 1.15rem;
}

.fotografie-caption-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #f0e4cc;
  line-height: 1.35;
}

.fotografie-caption-text {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1rem;
  font-style: italic;
  line-height: 1.5;
  color: rgba(225, 218, 200, 0.85);
}

.fotografie-credit {
  margin-top: 0.25rem;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.875rem;
  line-height: 1.5;
  color: rgba(225, 218, 200, 0.62);
}
.fotografie-credit a {
  color: rgba(220, 190, 130, 0.85);
  text-decoration: none;
  border-bottom: 1px solid rgba(180, 140, 60, 0.4);
}
.fotografie-credit a:hover,
.fotografie-credit a:focus-visible {
  color: #f6efe0;
}
.fotografie-credit a:focus-visible {
  outline: 2px solid rgba(220, 190, 130, 0.85);
  outline-offset: 2px;
}

.fotografie-sources {
  margin: 2.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(180, 140, 60, 0.2);
  max-width: 720px;
  text-align: center;
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(225, 218, 200, 0.7);
}
