/* ── BiblioDeDM ──────────────────────────────────────────────────────────
   Page-specific rules only. Layout, typography, buttons, modal, chips and
   accordion all come from materializeCustom.css (site components) — this
   file only covers the bibliography list, the A-Z grid, the saved panel
   and the print rendering, using the site CSS variables. */

/* Result bar */
.biblio-result-bar { display: flex; align-items: center; justify-content: space-between; max-width: var(--max-text-width); margin-bottom: 0.5rem; }
.biblio-result-bar .biblio-result-count { font-size: 1rem !important; }

/* Letter dividers */
.biblio-letter-divider { font-size: 1.125rem; font-weight: 500; color: var(--mid-gray); margin: 1.25rem 0 0.25rem; padding-bottom: 0.2rem; border-bottom: 3px solid var(--yellow); max-width: var(--max-text-width); }

/* Entry rows */
#biblio-list { list-style: none; padding: 0; margin: 0; max-width: var(--max-text-width); }
#biblio-list > li { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid #eee; }
#biblio-list > li:hover { background: #fafafa; }
.biblio-citation { flex: 1; line-height: 1.65rem; font-size: 1rem; font-weight: 300; overflow-wrap: break-word; word-break: break-word; min-width: 0; }

/* Row actions: space reserved, revealed on hover/focus so text doesn't reflow */
.biblio-actions { display: flex; flex-direction: column; gap: 0.2rem; opacity: 0; transition: opacity .15s ease; }
#biblio-list > li:hover .biblio-actions,
#biblio-list > li:focus-within .biblio-actions,
.biblio-actions:has(.biblio-save-btn.saved) { opacity: 1; }
.biblio-actions .btn-flat { font-size: 0.7rem; line-height: 1.8rem; height: 1.8rem; padding: 0 0.6rem; white-space: nowrap; }
.biblio-save-btn.saved { background: var(--yellow); color: var(--dark-gray); }

/* Sticky filters: keep the aside visible while scrolling the corpus.
   The Materialize row is floated, so this row becomes flex (col widths still
   apply); the aside sticks and scrolls internally when taller than the viewport. */
@media (min-width: 601px) {
  .biblio-row { display: flex; flex-wrap: wrap; }
  /* Materialize's .row .col.s12 carries margin-left:auto (inert on floats, but
     in flex it shifts the main column right while the page is still streaming
     and the aside hasn't arrived yet — then everything jumps left). Pin them
     with matching specificity (this file loads after materializeCustom.css). */
  .row.biblio-row > .col.s12 { margin-left: 0; margin-right: 0; }
  .biblio-row > aside { position: sticky; top: 1rem; align-self: flex-start; max-height: calc(100vh - 2rem); overflow-y: auto; }
}

/* Aside tool blocks (titles come from div.pub_toc > p site styling) */
.biblio-tool { margin-bottom: 2rem; max-width: var(--max-cover-width); }
.biblio-tool select.browser-default,
.biblio-tool input[type="text"] { margin-bottom: 0.4rem; font-size: 0.85rem; }

/* Site-accent action button (same accent as a.pub_download) */
.biblio-btn { background: var(--yellow); color: var(--dark-gray); }
.biblio-btn:hover, .biblio-btn:focus { background: var(--yellow); filter: brightness(0.95); }

/* Search criteria rows */
.biblio-adv-row { display: flex; gap: 0.3rem; align-items: center; margin-bottom: 0.3rem; }
.biblio-adv-row select.browser-default { flex: 0 0 40%; height: 2rem; padding: 0; }
.biblio-adv-row input { flex: 1; }
/* AND/OR junction between criteria */
.biblio-tool select.browser-default.biblio-junction { display: block; width: 5rem; height: 1.7rem; padding: 0; font-size: 0.7rem; letter-spacing: .07em; margin: 0.1rem 0 0.25rem; }
.biblio-remove-row-btn { background: none; border: none; color: var(--very-light-gray); cursor: pointer; padding: 0 0.2rem; flex-shrink: 0; }
.biblio-remove-row-btn:hover { color: #c44; }
/* Search / clear-filters actions */
.biblio-search-actions { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; margin-top: 0.4rem; }
.biblio-reset-btn { display: none; }

/* A-Z grid */
.biblio-az-grid { display: flex; flex-wrap: wrap; gap: 3px; }
.biblio-az-btn { font-size: 0.77rem; font-weight: 500; width: 1.7rem; height: 1.7rem; display: flex; align-items: center; justify-content: center; border: 1px solid #ddd; border-radius: 2px; cursor: pointer; background: #fff; color: var(--mid-gray); }
.biblio-az-btn:hover { border-color: var(--yellow); }
.biblio-az-btn.active { background: var(--yellow); color: var(--dark-gray); border-color: var(--yellow); }
.biblio-az-empty { color: #ddd; cursor: default; pointer-events: none; }

/* Saved panel */
.biblio-saved-empty { font-size: 0.77rem; color: var(--very-light-gray); font-style: italic; }
.biblio-saved-item { display: flex; align-items: flex-start; gap: 0.3rem; padding: 0.25rem 0; border-bottom: 1px solid #eee; }
.biblio-saved-cite { flex: 1; font-size: 0.77rem; font-weight: 300; line-height: 1.1rem; color: var(--mid-gray); }
.biblio-saved-remove { background: none; border: none; color: var(--very-light-gray); cursor: pointer; font-size: 1rem; flex-shrink: 0; line-height: 1; padding: 0; }
.biblio-saved-remove:hover { color: #c44; }
.biblio-saved-actions { display: flex; gap: 0.3rem; margin-top: 0.6rem; flex-wrap: wrap; }
.biblio-saved-badge { background-color: var(--yellow) !important; color: var(--dark-gray) !important; }
/* Export menu: site default for .dropdown-content links is gray (#9e9e9e) */
#biblio-export-dd li > a { color: var(--dark-gray); }

/* Modal detail rows (modal chrome itself is the Materialize .modal component) */
.biblio-modal-row { display: flex; gap: 0.75rem; padding: 0.3rem 0; border-bottom: 1px solid #eee; font-size: 0.85rem; }
.biblio-modal-label { font-size: 0.7rem; font-weight: 500; color: var(--light-gray); text-transform: uppercase; letter-spacing: .06em; min-width: 90px; padding-top: 2px; flex-shrink: 0; }
.biblio-modal-value { flex: 1; line-height: 1.4rem; }
.biblio-modal-citation { font-size: 0.85rem; line-height: 1.5rem; font-weight: 300; padding: 0.4rem 0.6rem; background: #fafafa; border-left: 3px solid var(--yellow); margin: 0 0 0.75rem; }
.biblio-modal-abstract-wrap,
.biblio-modal-description-wrap { margin-top: 0.75rem; font-size: 0.85rem; line-height: 1.5rem; font-weight: 300; }
.biblio-modal-abstract-wrap .biblio-modal-label,
.biblio-modal-description-wrap .biblio-modal-label { display: block; margin-bottom: 0.2rem; }
.biblio-modal-subjects { display: flex; flex-wrap: wrap; gap: 0.2rem; }
.biblio-modal-subjects .chip { margin: 0; }
.biblio-modal-zotero-wrap { margin-top: 0.75rem; }
.biblio-modal-zotero { word-break: break-all; }
.biblio-modal-save-btn.saved { background: var(--yellow); color: var(--dark-gray); }
/* The site styles .modal-close as a big white lightbox ✕; restore a normal footer button here */
/* position stays relative (not static): the waves-effect ripple is absolutely
   positioned and a static parent would let it escape to the modal's top-left corner */
#biblio-modal .modal-footer .modal-close { position: relative; top: auto; right: auto; font-size: inherit; font-weight: inherit; color: var(--dark-gray); }

/* Print: only the saved list */
#biblio-print-zone { display: none; }
@media print {
  body > *:not(#biblio-print-zone) { display: none !important; }
  #biblio-print-zone { display: block !important; padding: 20mm; }
  .biblio-print-title { font-size: 16pt; margin-bottom: 18pt; }
  .biblio-print-list { padding-left: 18pt; }
  .biblio-print-list li { margin-bottom: 7pt; font-size: 10pt; line-height: 1.5; }
}
