/* catholicpubs.com — one stylesheet for the public library and the admin portal.
   No framework, no build step, no web fonts. */

:root {
  --ink: #1a1815;
  --ink-soft: #56514a;
  --ink-faint: #7d766c;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --rule: #e2ddd3;
  --accent: #6b2d2d;
  --accent-soft: #f3ebe7;
  --ok: #2f6b45;
  --ok-soft: #e8f2ea;
  --warn: #8a5a12;
  --warn-soft: #fbf2e0;
  --stop: #97341f;
  --stop-soft: #fbeae6;
  --focus: #2b5f9e;
  --radius: 6px;
  --measure: 38rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece7de;
    --ink-soft: #b3aca0;
    --ink-faint: #8b8478;
    --paper: #16150f;
    --panel: #1f1e17;
    --rule: #35322a;
    --accent: #d9a3a3;
    --accent-soft: #2c2020;
    --ok: #8fce9f;
    --ok-soft: #1d2a21;
    --warn: #e3bd76;
    --warn-soft: #2c2517;
    --stop: #e8a08d;
    --stop-soft: #2e1d18;
    --focus: #8ab4e8;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.wrap {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.prose { max-width: var(--measure); }

/* --- links ------------------------------------------------------------ */

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--panel);
  padding: 0.6rem 1rem;
  z-index: 10;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* --- masthead --------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
}
.masthead .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.masthead .brand {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
}
.masthead .brand a { color: inherit; text-decoration: none; }
.masthead nav { margin-left: auto; }
.masthead nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
}

main { padding: 2rem 0 4rem; }

/* --- typography ------------------------------------------------------- */

h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.9rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.35rem; margin: 2.25rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
.lede { font-size: 1.1rem; color: var(--ink-soft); margin-top: 0; }
.subtitle { color: var(--ink-soft); font-style: italic; font-size: 1.15rem; margin: 0 0 0.75rem; }
.meta { color: var(--ink-faint); font-size: 0.9rem; }
.muted { color: var(--ink-soft); }

/* --- cards and listings ----------------------------------------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.stack { display: grid; gap: 1rem; }
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}

.doclist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.doclist > li {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.9rem;
}
.doclist > li:last-child { border-bottom: 0; }
.doclist h3 { margin: 0 0 0.15rem; font-size: 1.08rem; }
.doclist p { margin: 0.25rem 0 0; color: var(--ink-soft); font-size: 0.95rem; }

/* --- table of contents ------------------------------------------------ */

.toc, .toc ol { list-style: none; margin: 0; padding: 0; }
.toc ol { margin-left: 1.1rem; border-left: 1px solid var(--rule); padding-left: 0.9rem; }
.toc li { margin: 0.2rem 0; }
.toc > li { font-size: 0.98rem; }

/* --- editions / downloads --------------------------------------------- */

.edition {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: var(--panel);
}
.edition + .edition { margin-top: 0.9rem; }
.edition h3 { margin: 0 0 0.35rem; }
.edition dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.75rem;
  margin: 0.5rem 0;
  font-size: 0.92rem;
}
.edition dt { color: var(--ink-faint); }
.edition dd { margin: 0; }

.rights-notice {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.8rem;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* --- buttons ---------------------------------------------------------- */

.btn,
button,
input[type="submit"] {
  display: inline-block;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .btn, button, input[type="submit"] { color: #1a1512; }
}
.btn:hover, button:hover { filter: brightness(1.08); }
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--rule);
}
.btn-danger { background: var(--stop); border-color: var(--stop); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

/* --- badges ----------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.badge-stop { background: var(--stop-soft); color: var(--stop); border-color: var(--stop); }
.badge-idle { background: var(--accent-soft); color: var(--ink-soft); border-color: var(--rule); }

/* --- notices ---------------------------------------------------------- */

.notice {
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin: 1rem 0;
  border-left: 4px solid;
  font-size: 0.95rem;
}
.notice-warn { background: var(--warn-soft); border-color: var(--warn); }
.notice-stop { background: var(--stop-soft); border-color: var(--stop); }
.notice-ok { background: var(--ok-soft); border-color: var(--ok); }
.notice ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }

/* --- forms ------------------------------------------------------------ */

form .field { margin-bottom: 1rem; }
form label { display: block; font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 0.25rem; }
form .hint { font-size: 0.82rem; color: var(--ink-faint); margin-top: 0.2rem; }

input[type="text"],
input[type="url"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.55; }
fieldset { border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; margin: 0 0 1.25rem; }
legend { padding: 0 0.4rem; font-size: 0.9rem; color: var(--ink-soft); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.3rem 1rem; }
.checks label { display: flex; gap: 0.45rem; align-items: baseline; font-size: 0.9rem; color: var(--ink); }
.checks input { width: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 34rem) { .row2 { grid-template-columns: 1fr; } }

/* --- tables ----------------------------------------------------------- */

table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--ink-faint); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }

/* --- admin ------------------------------------------------------------ */

body.admin { background: #f4f2ee; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 1rem; }
@media (prefers-color-scheme: dark) { body.admin { background: #121109; } }
.admin-bar { background: var(--ink); font-size: 0.9rem; }
.admin-bar .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; padding: 0.6rem 1.25rem; }
.admin-bar a { color: var(--paper); text-decoration: none; opacity: 0.85; }
.admin-bar a:hover { opacity: 1; text-decoration: underline; }
.admin-bar .who { margin-left: auto; opacity: 0.6; font-size: 0.82rem; color: var(--paper); }

.tiles { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.9rem 1rem; }
.tile .n { font-size: 1.9rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .k { font-size: 0.8rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }

/* --- footer ----------------------------------------------------------- */

footer.site {
  border-top: 1px solid var(--rule);
  padding: 2rem 0 3rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  background: var(--panel);
}
footer.site ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.9rem; padding: 0; margin: 0 0 0.75rem; }

/* --- utilities -------------------------------------------------------- */

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.pill-row { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0.5rem 0 0; }
.pill-row a {
  font-size: 0.85rem; padding: 0.15rem 0.6rem;
  border: 1px solid var(--rule); border-radius: 100px;
  text-decoration: none; color: var(--ink-soft); background: var(--panel);
}
.pill-row a:hover { border-color: var(--accent); color: var(--accent); }
