/* Archdiocese of Los Angeles: Digital Library and Archives
   Stylesheet in the Vatican Library / Annuario Pontificio aesthetic.
   Cream parchment, EB Garamond serif body, Cinzel display, oxblood + gold. */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  /* Palette: parchment + oxblood + gold */
  --parchment:       #fdfbf5;     /* page background */
  --parchment-warm:  #f7f1e3;     /* card / surface */
  --parchment-deep:  #efe7d2;     /* hover / detail block */
  --rule:            #d8cdb0;     /* hairline */
  --text:            #1c1a14;     /* near-black with warm tint */
  --text-muted:      #5e554a;
  --text-subtle:     #8a7e68;
  --oxblood:         #6a1818;     /* the chancery red */
  --oxblood-deep:    #4a0e0e;
  --gold:            #a8841f;     /* the Vatican gold */
  --gold-deep:       #856719;
  --radius-sm:       3px;
  --radius:          5px;
  --shadow-card:     0 2px 12px rgba(60, 40, 20, 0.08);
  --shadow-deep:     0 24px 60px rgba(40, 20, 10, 0.35);
}

html, body {
  background: var(--parchment);
  color: var(--text);
  max-width: 100%;
  overflow-x: hidden;
}
body {
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
  font-feature-settings: 'liga' 1, 'kern' 1, 'onum' 1;
  -webkit-font-smoothing: antialiased;
}

#app, main, header, .hdr-inner { max-width: 100%; min-width: 0; }
img, svg, canvas, video { max-width: 100%; }

h1, h2, h3 {
  font-family: 'Cinzel', 'Trajan Pro', Georgia, serif;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--oxblood);
}

a {
  color: var(--oxblood);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { color: var(--oxblood-deep); text-decoration-color: var(--oxblood); }

/* ===== Gate (Vatican Library frontispiece) ===== */
#gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(168, 132, 31, 0.10) 0%, transparent 60%),
    linear-gradient(180deg, #2a1410 0%, #3d1818 40%, #1a0e0a 100%);
}

.gate-box {
  background: var(--parchment);
  padding: 3rem 3rem 2.25rem;
  border-radius: 2px;
  text-align: left;
  box-shadow: var(--shadow-deep);
  max-width: 620px;
  width: 100%;
  border: 1px solid var(--rule);
  position: relative;
}

/* Gold rule top + bottom of the frontispiece, like a chancery seal */
.gate-box::before,
.gate-box::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 1px;
  background: var(--gold);
}
.gate-box::before { top: 14px; }
.gate-box::after  { bottom: 14px; }

.gate-box h1 {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 0.35rem;
  color: var(--oxblood);
}

.gate-sub {
  text-align: center;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
  position: relative;
}
.gate-sub::after {
  content: '';
  display: block;
  width: 60px;
  height: 1px;
  background: var(--gold);
  margin: 1rem auto 0;
}

.gate-cover {
  text-align: center;
  margin: 0.5rem 0 1.5rem;
}
.gate-cover img {
  max-width: 170px;
  width: 38%;
  border-radius: 2px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--rule);
}

.gate-blurb {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 0.85rem;
  color: var(--text);
}
.gate-blurb strong { color: var(--oxblood); font-weight: 600; }
.gate-blurb em { color: var(--text-muted); }

.gate-preview {
  background: var(--parchment-warm);
  border-left: 3px solid var(--gold);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.gate-preview-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold-deep);
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.gate-preview-list { list-style: none; margin: 0; padding: 0; }
.gate-preview-list li {
  font-size: 0.92rem;
  padding: 0.25rem 0;
  color: var(--text);
  line-height: 1.5;
}
.gate-preview-list strong { color: var(--oxblood); font-weight: 600; }

.gate-status {
  font-size: 0.92rem;
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
}
.gate-status.ok  { background: #f0ecdf; border-left: 3px solid var(--gold); color: var(--text); }
.gate-status.err { background: #f8e8e8; border-left: 3px solid var(--oxblood); color: var(--oxblood-deep); }

/* The in-page Supabase sign-in widget (.gate-signin / .gate-google-btn /
   .gate-magic-*) was removed when the sign-in flow moved to the dedicated
   /la/sign-in page (2026-05-20). The new sign-in card grid styles live
   below in the "Sign-in page" block. */

.gate-disclaimer,
.site-foot-disclaimer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-subtle);
  font-style: italic;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.gate-foot {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--text-subtle);
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}
.gate-foot a { color: var(--text-muted); }

/* ===== Header ===== */
header {
  background: var(--oxblood);
  color: var(--parchment);
  padding: 1.5rem 1.5rem 1.25rem;
  text-align: center;
  border-bottom: 3px double var(--gold);
}
.hdr-inner { max-width: 1200px; margin: 0 auto; }
header h1 {
  color: var(--parchment);
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
header .subtitle {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1rem;
  opacity: 0.92;
  margin-top: 0.4rem;
  font-style: italic;
  font-weight: 400;
  color: var(--parchment);
}
header .subsub {
  font-size: 0.82rem;
  opacity: 0.78;
  margin-top: 0.5rem;
  font-style: italic;
  color: var(--parchment);
}

/* ===== Tabs ===== */
#tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: var(--parchment);
  padding: 0 1rem;
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 9;
  box-shadow: 0 1px 6px rgba(40, 20, 10, 0.06);
}
.tab {
  padding: 0.8rem 1.1rem;
  background: transparent;
  color: var(--text-muted);
  border: 0;
  border-bottom: 3px solid transparent;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.tab:hover { background: var(--parchment-warm); color: var(--oxblood); }
.tab.active {
  color: var(--oxblood);
  border-bottom: 3px solid var(--gold);
  font-weight: 600;
}

/* ===== Controls ===== */
.controls {
  background: var(--parchment);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 49px; z-index: 8;
}
.search-wrap { position: relative; max-width: 1200px; margin: 0 auto; }
#search {
  width: 100%;
  padding: 0.65rem 1rem;
  padding-right: 6rem;
  border: 1px solid var(--rule);
  background: var(--parchment-warm);
  border-radius: var(--radius-sm);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1rem;
  outline: none;
  color: var(--text);
}
#search:focus { border-color: var(--gold); background: var(--parchment); }
.search-count {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
  pointer-events: none;
}

/* ===== Main / table ===== */
main { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }
.loading {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
  font-style: italic;
  font-size: 1.1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--parchment);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  font-size: 0.95rem;
}
thead th {
  background: var(--oxblood);
  color: var(--parchment);
  text-align: left;
  padding: 0.7rem 0.9rem;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  cursor: pointer;
  position: sticky; top: 0;
  border-bottom: 2px solid var(--gold);
}
thead th:hover { background: var(--oxblood-deep); }
tbody td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  color: var(--text);
}
tbody tr.row { cursor: pointer; }
tbody tr.row:hover { background: var(--parchment-warm); }
tbody tr.detail td {
  background: var(--parchment-deep);
  padding: 1.25rem;
  border-top: 2px solid var(--gold);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.65rem 1.5rem;
  font-size: 0.92rem;
}
.detail-grid > div { min-width: 0; }
.detail-grid dt {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--gold-deep);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
}
.detail-grid dd { color: var(--text); margin-bottom: 0.5rem; min-width: 0; overflow-wrap: anywhere; }
.detail-grid dd a { word-break: break-word; }
.detail-grid dd code { overflow-wrap: anywhere; word-break: break-word; }
.detail-note {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.5;
}
.detail-section {
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--rule);
}
.detail-section h3 {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.78rem;
  color: var(--oxblood);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.highlight {
  background: #f1e6c4;
  padding: 0 3px;
  border-radius: 2px;
  color: var(--oxblood-deep);
  font-weight: 500;
}
.age { color: var(--text-subtle); font-size: 0.85em; }

.site-icon {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.45rem;
  background: var(--parchment-warm);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--gold-deep);
  font-size: 0.7em;
  text-decoration: none;
  vertical-align: 0.15em;
}
.site-icon:hover { background: var(--gold); color: var(--parchment); border-color: var(--gold-deep); }

/* Parish history paragraphs (formatHistory) */
.history-p {
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0 0 0.65em;
  color: var(--text);
}
.history-p:last-child { margin-bottom: 0; }
.history-p .year {
  color: var(--oxblood);
  font-weight: 600;
  font-variant-numeric: oldstyle-nums;
}

/* ===== Map view ===== */
#map-view { max-width: 1200px; margin: 0 auto; }
.map-meta {
  background: var(--parchment);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-card);
}
.map-meta h2 {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--oxblood);
  border-bottom: 2px double var(--gold);
  padding-bottom: 0.5rem;
  margin-bottom: 0.85rem;
}
.map-meta p { color: var(--text); font-size: 0.95rem; line-height: 1.5; }
.leaflet-popup-content {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.45;
}

/* ===== Ontology view ===== */
#ontology-view {
  max-width: 980px;
  margin: 0 auto;
  background: var(--parchment);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-card);
}
.ontology-header h2 {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--oxblood);
  border-bottom: 2px double var(--gold);
  padding-bottom: 0.6rem;
  margin-bottom: 0.65rem;
}
.ontology-meta { color: var(--text-muted); font-size: 0.88rem; font-style: italic; margin-bottom: 0.85rem; }
.ontology-header p { font-size: 0.95rem; line-height: 1.55; margin-bottom: 1rem; }

.ontology-axis {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.ontology-axis h3 {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--gold-deep);
  margin-bottom: 0.5rem;
}
.ontology-desc { font-size: 0.92rem; color: var(--text-muted); font-style: italic; margin-bottom: 0.7rem; }
.ontology-terms {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.35rem 1.25rem;
}
.ontology-terms li {
  font-size: 0.88rem;
  padding: 0.15rem 0;
  line-height: 1.45;
  color: var(--text);
}
.ontology-terms code {
  font-family: 'Menlo', monospace;
  font-size: 0.82em;
  background: var(--parchment-warm);
  padding: 0.05rem 0.35rem;
  border-radius: 2px;
  color: var(--oxblood-deep);
}
.ontology-term-desc { color: var(--text-muted); font-size: 0.92em; }
.ontology-more { color: var(--text-subtle); font-style: italic; }

.ontology-invariants, .ontology-provenance {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 2px double var(--gold);
}
.ontology-invariants h3, .ontology-provenance h3 {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--oxblood);
  margin-bottom: 0.6rem;
}
.ontology-invariants ol, .ontology-provenance ul {
  margin: 0 0 0 1.3rem;
}
.ontology-invariants li, .ontology-provenance li {
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 0.4rem;
  color: var(--text);
}

/* ===== Pagination ===== */
#pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.5rem 0;
}
#pagination button {
  padding: 0.55rem 1.1rem;
  background: var(--parchment);
  color: var(--oxblood);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.95rem;
  cursor: pointer;
}
#pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
#pagination button:hover:not(:disabled) {
  background: var(--parchment-warm);
  border-color: var(--gold);
}
#page-info { color: var(--text-muted); font-size: 0.92rem; font-style: italic; }
#show-all-toggle {
  font-family: 'Cinzel', 'Trajan Pro', Georgia, serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-color: var(--gold);
}

/* Parish-detail clergy + schools lists (rendered in the expanded row) */
.staff-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.95rem;
  line-height: 1.6;
}
.staff-list li {
  padding: 0.35rem 0;
  border-bottom: 1px dotted var(--rule);
}
.staff-list li:last-child { border-bottom: 0; }
.staff-list code { font-size: 0.8rem; color: var(--text-muted); }

/* ===== LA Catholic Directory view ===== */
#directory-view {
  background: var(--parchment);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 2.25rem 2.5rem;
  box-shadow: var(--shadow-card);
  max-width: 900px;
  margin: 0 auto;
}
#directory-view h2 {
  color: var(--oxblood);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.3rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border-bottom: 2px double var(--gold);
  padding-bottom: 0.6rem;
  margin-bottom: 1.25rem;
}
.dir-card {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: var(--parchment-warm);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold);
}
.dir-card img {
  max-width: 220px;
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(40, 20, 10, 0.2);
  border: 1px solid var(--rule);
}
.dir-card-body { flex: 1; }
.dir-card-body h3 {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--oxblood);
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.06em;
}
.dir-card-body p {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.65rem;
  line-height: 1.55;
}
.dir-card-body .meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  font-style: italic;
}
.dir-btn {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  background: var(--oxblood);
  color: var(--parchment);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border: 1px solid var(--oxblood-deep);
}
.dir-btn:hover { background: var(--oxblood-deep); color: var(--parchment); }

/* ===== Footer ===== */
.site-foot {
  max-width: 1200px;
  margin: 2.5rem auto 1.5rem;
  padding: 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  border-top: 1px solid var(--rule);
}
.site-foot a { color: var(--text-muted); text-decoration-color: var(--gold); }

/* ===== Mobile ===== */
@media (max-width: 720px) {
  body { font-size: 16px; line-height: 1.5; }

  /* Gate */
  #gate { padding: 1rem 0.5rem; }
  .gate-box { padding: 1.75rem 1.25rem 1.5rem; }
  .gate-box::before { top: 10px; width: 60px; }
  .gate-box::after  { bottom: 10px; width: 60px; }
  .gate-box h1 { font-size: 1.1rem; letter-spacing: 0.12em; }
  .gate-sub { font-size: 0.88rem; }
  .gate-cover img { width: 50%; max-width: 140px; }
  .gate-blurb { font-size: 0.95rem; }
  .gate-preview { padding: 0.85rem 1rem; margin: 1.25rem 0 0.5rem; }
  .gate-preview-list li { font-size: 0.88rem; padding: 0.3rem 0; }

  /* Header */
  header { padding: 1.1rem 0.85rem 0.95rem; }
  header h1 { font-size: clamp(0.92rem, 4.8vw, 1.05rem); letter-spacing: 0.08em; line-height: 1.3; }
  header .subtitle { font-size: 0.88rem; }
  header .subsub { font-size: 0.75rem; overflow-wrap: anywhere; }

  /* Tabs: horizontal scroll instead of wrap */
  #tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
    scrollbar-width: thin;
  }
  #tabs::-webkit-scrollbar { height: 2px; }
  .tab {
    flex: 0 0 auto;
    padding: 0.85rem 0.95rem;
    font-size: 0.88rem;
    white-space: nowrap;
  }

  /* Controls + search */
  .controls { padding: 0.65rem 0.75rem; top: 47px; }
  #search { font-size: 16px; padding: 0.7rem 5rem 0.7rem 0.85rem; }

  /* Main */
  main { padding: 0.85rem 0.75rem; }

  /* Tables become card-stacks on phone */
  table { display: block; border: 0; box-shadow: none; background: transparent; }
  thead { display: none; }
  tbody, tbody tr { display: block; }
  tbody tr.row {
    background: var(--parchment);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    margin-bottom: 0.65rem;
    box-shadow: var(--shadow-card);
    cursor: pointer;
  }
  tbody tr.row td {
    display: block;
    border: 0;
    padding: 0.1rem 0;
    font-size: 0.95rem;
    line-height: 1.4;
  }
  /* First TD is the title; bigger */
  tbody tr.row td:first-child {
    font-size: 1.05rem;
    color: var(--oxblood);
    margin-bottom: 0.25rem;
  }
  /* Following TDs get muted color + smaller */
  tbody tr.row td:not(:first-child) {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: inline-block;
  }
  tbody tr.row td:not(:first-child):not(:empty)::after {
    content: '  ·  ';
    color: var(--rule);
    margin: 0 0.15rem;
  }
  tbody tr.row td:last-child::after { content: ''; }
  /* Detail row */
  tbody tr.detail { display: block; }
  tbody tr.detail td {
    display: block;
    background: var(--parchment-warm);
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    padding: 1rem;
    margin: -0.4rem 0 0.65rem;
  }
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .detail-grid dt { font-size: 0.65rem; }
  .detail-grid dd { font-size: 0.9rem; margin-bottom: 0.4rem; }

  /* Pagination: sticky bottom bar on mobile so Next/Prev is always reachable */
  #pagination {
    position: sticky;
    bottom: 0;
    background: var(--parchment);
    border-top: 1px solid var(--rule);
    box-shadow: 0 -2px 8px rgba(40, 20, 10, 0.08);
    padding: 0.6rem 0.75rem;
    margin: 0.5rem -0.75rem 0;
    gap: 0.85rem;
    flex-wrap: wrap;
    z-index: 5;
  }
  #pagination button { font-size: 0.85rem; padding: 0.55rem 0.95rem; min-width: 90px; }
  #page-info { font-size: 0.82rem; width: 100%; text-align: center; order: -1; margin-bottom: 0.2rem; }

  /* Directory view */
  #directory-view { padding: 1.5rem 1.25rem; }
  #directory-view h2 { font-size: 1.1rem; letter-spacing: 0.1em; }
  .dir-card { flex-direction: column; padding: 1.1rem; }
  .dir-card img { max-width: 100%; width: 55%; margin: 0 auto 0.85rem; }
  .dir-card-body h3 { font-size: 0.95rem; }
  .dir-card-body p { font-size: 0.92rem; }
  .dir-btn { display: block; text-align: center; padding: 0.8rem 1rem; }

  /* Footer */
  .site-foot { font-size: 0.78rem; padding: 1rem 0.5rem; }
}

/* ===== Sign-in page: two equal first-class options side by side =====
   Used by /la/sign-in/ and /hi/sign-in/. Both auth methods (Google OAuth and
   email magic-link) get the same visual weight: no "primary" + "buried"
   asymmetry. The vertical divider in the middle reads "or" to make the
   peerness explicit. On mobile the grid collapses to a single column and
   the divider becomes a horizontal rule. */
.signin-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.25rem;
  align-items: stretch;
  margin: 1.5rem 0 0.75rem;
}
.signin-card {
  background: var(--parchment-warm);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.1rem 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.signin-card-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--oxblood);
  font-weight: 700;
  margin: 0;
}
.signin-card-blurb {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
  font-style: italic;
}
.signin-divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
}
.signin-divider::before {
  content: '';
  position: absolute;
  top: 8%;
  bottom: 8%;
  left: 50%;
  width: 1px;
  background: var(--rule);
}
.signin-divider span {
  position: relative;
  background: var(--parchment);
  padding: 0.25rem 0.4rem;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gold-deep);
  font-weight: 700;
}
.signin-google-btn {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.7rem 1.1rem;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, box-shadow 120ms;
}
.signin-google-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.15);
}
.signin-google-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.signin-google-btn[disabled] { opacity: 0.55; cursor: wait; }
.signin-magic-form {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.signin-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-deep);
  font-weight: 700;
}
.signin-magic-form input[type="email"] {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.95rem;
  background: var(--parchment);
  color: var(--text);
}
.signin-magic-form input[type="email"]:focus {
  outline: 2px solid var(--gold);
  outline-offset: 0;
  border-color: var(--gold);
}
.signin-magic-form button {
  padding: 0.65rem 1rem;
  background: var(--oxblood);
  color: var(--parchment);
  border: 0;
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
}
.signin-magic-form button:hover { background: var(--oxblood-deep); }
.signin-magic-form button[disabled] { opacity: 0.55; cursor: wait; }

@media (max-width: 720px) {
  .signin-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .signin-divider { min-width: 0; min-height: 1.5rem; }
  .signin-divider::before {
    top: 50%;
    bottom: auto;
    left: 8%;
    right: 8%;
    width: auto;
    height: 1px;
  }
}

/* ===== Library: brief cards (data-driven from data/{la,hi}/briefs.json) =====
   Used by /la/library/ and /hi/library/. Each card surfaces date + title +
   description + page count + filesize + direct PDF link. Mirrors the
   parchment/oxblood/gold palette used everywhere else. */
.library-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.25rem;
}
.library-header {
  background: var(--parchment);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}
.library-header h1 {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.35rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--oxblood);
  border-bottom: 2px double var(--gold);
  padding-bottom: 0.6rem;
  margin-bottom: 0.75rem;
}
.library-header p {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 0.5rem;
}
.library-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.5rem;
}
.library-controls {
  margin-bottom: 1rem;
}
.library-controls input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--rule);
  background: var(--parchment-warm);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
}
.library-controls input:focus { border-color: var(--gold); background: var(--parchment); outline: none; }
.library-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}
.brief-card {
  background: var(--parchment);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 0.5rem 1.1rem;
  align-items: start;
}
.brief-date {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--gold-deep);
  font-weight: 700;
  text-transform: uppercase;
  padding-top: 0.15rem;
}
.brief-body { min-width: 0; }
.brief-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.02rem;
  color: var(--oxblood);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.3rem;
  letter-spacing: 0.02em;
  word-wrap: break-word;
}
.brief-desc {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 0.35rem;
}
.brief-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}
.brief-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 110px;
}
.brief-btn {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  background: var(--oxblood);
  color: var(--parchment);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-align: center;
}
.brief-btn:hover { background: var(--oxblood-deep); color: var(--parchment); }
.brief-btn.brief-btn-download {
  background: var(--parchment);
  color: var(--oxblood);
  border: 1px solid var(--rule);
}
.brief-btn.brief-btn-download:hover { background: var(--parchment-warm); border-color: var(--gold); }
.library-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-style: italic;
}
.library-nav-back {
  display: inline-block;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.06em;
}
.library-nav-back:hover { color: var(--oxblood); }

@media (max-width: 720px) {
  .library-wrap { padding: 0.85rem 0.75rem; }
  .library-header { padding: 1.1rem 1.1rem; }
  .library-header h1 { font-size: 1.1rem; letter-spacing: 0.1em; }
  .brief-card {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.95rem 1rem;
  }
  .brief-date { padding-top: 0; }
  .brief-actions { flex-direction: row; flex-wrap: wrap; }
  .brief-btn { flex: 1 1 auto; }
}

/* Site mark: favicon + CMS badge (replaces ↗ arrow) */
.site-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  background: var(--parchment-warm);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  text-decoration: none;
  vertical-align: 0.05em;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.1;
}
.site-mark:hover { background: var(--parchment-deep); border-color: var(--gold); color: var(--text); }
.site-favicon { display: inline-block; width: 14px; height: 14px; vertical-align: middle; border-radius: 2px; background: var(--parchment); }
.cms-badge {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--oxblood);
}
.bulletin-badge {
  display: inline-block;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--oxblood);
  border-radius: 2px;
  padding: 0 3px;
  margin-left: 3px;
  vertical-align: middle;
  line-height: 1.4;
}

/* ===== Mobile-first refinements =====
   Small phones, touch-coarse devices, accessibility floors. */
@media (max-width: 380px) {
  body { font-size: 15px; }
  header h1 { font-size: 0.95rem; letter-spacing: 0.12em; }
  header .subtitle { font-size: 0.8rem; }
  .tab { padding: 0.75rem 0.7rem; font-size: 0.82rem; }
  #search { padding: 0.65rem 4.5rem 0.65rem 0.75rem; }
  tbody tr.row { padding: 0.65rem 0.85rem; }
  .cms-badge { font-size: 0.58rem; }
}

/* Touch devices: ensure 44pt+ tap targets regardless of viewport size */
@media (hover: none) and (pointer: coarse) {
  .tab { min-height: 2.75rem; }
  button, .btn, a.primary, a.button { min-height: 2.75rem; }
  tbody tr.row,
  tbody tr.row td.row-toggle,
  tbody tr.row td.row-name { min-height: 2.75rem; }
  /* Larger tap area on the site-mark favicon link */
  .site-mark { padding: 0.35rem 0.5rem; }
  .site-favicon { width: 18px; height: 18px; }
}

/* Tablets in landscape: cap content width for readability */
@media (min-width: 721px) and (max-width: 1100px) {
  main { max-width: 980px; margin: 0 auto; }
}

/* Prefers-reduced-motion: kill all transitions */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High-contrast mode (Windows): preserve borders */
@media (forced-colors: active) {
  .cms-badge, .bulletin-badge {
    border: 1px solid currentColor;
  }
  .tab.active { border-bottom-color: CanvasText; }
}

/* ===== Global product chrome =====
   One persistent bar across every diocese page so a reader is never
   stranded on a single diocese. Wordmark -> home, All Dioceses -> the
   register, Map -> the global map. Injected just inside <body>. */
.ci-topbar {
  position: sticky;
  top: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.5rem 1.5rem;
  background: linear-gradient(180deg, #4a0e0e 0%, #3d1010 100%);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 1px 8px rgba(40, 20, 10, 0.28);
  font-family: 'EB Garamond', Georgia, serif;
}
.ci-topbar a { text-decoration: none; }
.ci-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: #f5ecd6;
  white-space: nowrap;
}
.ci-brand:hover { color: #fff; }
.ci-brand .ci-cross { color: var(--gold); font-size: 1.05rem; line-height: 1; }
.ci-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-left: 0.75rem;
}
.ci-nav a {
  color: #e8dcc2;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}
.ci-nav a:hover { color: #fff; border-bottom-color: var(--gold); }
.ci-spacer { flex: 1; }
.ci-account {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.ci-account a {
  color: #cdbfa3;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.ci-account a:hover { color: var(--gold); }

/* Client-injected (topbar-session.js) account controls on public, cached pages.
   Renders signed-in continuity without breaking the shared CDN cache. */
.ci-acct {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  padding-left: 0.95rem;
  margin-left: 0.1rem;
  border-left: 1px solid rgba(205, 191, 163, 0.28);
}
.ci-acct-link {
  color: #cdbfa3;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ci-acct-link:hover { color: var(--gold); }
.ci-acct-admin { color: var(--gold); font-weight: 600; }
.ci-acct-signout { color: #b79f80; }
.ci-acct-signin { color: var(--gold); }

@media (max-width: 640px) {
  .ci-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 0.75rem;
    padding: 0.48rem 0.85rem;
  }
  .ci-spacer { display: none; }
  .ci-nav {
    grid-column: 1 / -1;
    gap: 0.85rem;
    margin-left: 0;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 0.05rem;
    scrollbar-width: none;
  }
  .ci-nav::-webkit-scrollbar { display: none; }
  .ci-brand { font-size: 0.82rem; }
  .ci-nav a, .ci-account a { font-size: 0.82rem; white-space: nowrap; }
  .ci-account { justify-content: flex-end; gap: 0.65rem; min-width: 0; }
  .ci-acct { padding-left: 0.7rem; gap: 0.65rem; }
  .ci-acct-link { font-size: 0.82rem; max-width: 9rem; }
}
