:root {
  color-scheme: light;
  --paper: #ffffff;
  --surface: #f4f7f4;
  --text: #15281f;
  --muted: #52665c;
  --rule: #d6e0d9;
  --accent: #20563e;
  --hover: #e5eee8;
  --focus: #a36d25;
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--paper); }
button, input, textarea { font: inherit; }
button, input, textarea { border-radius: .45rem; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: .15rem solid var(--focus);
  outline-offset: .15rem;
}
a { color: var(--accent); }
button { cursor: pointer; background: var(--accent); color: white; border: 1px solid var(--accent); padding: .65rem .95rem; }
button:disabled { opacity: .65; cursor: wait; }
button.secondary { background: var(--paper); color: var(--accent); border-color: var(--rule); }
button.secondary:hover { background: var(--surface); }
input, textarea { width: 100%; color: var(--text); background: var(--paper); border: 1px solid var(--rule); padding: .65rem .75rem; }
label { display: block; font-weight: 600; margin-bottom: .4rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .9rem clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--rule); gap: 1rem; }
.brand { color: var(--text); font-family: Georgia, serif; font-size: 1.75rem; letter-spacing: -.04em; text-decoration: none; }
#actions, .buttons { display: flex; gap: .6rem; }
.access { margin: min(12vh, 7rem) auto; padding: 0 1rem; max-width: 29rem; }
.access h1, .reader h2 { font-family: Georgia, serif; font-weight: 400; letter-spacing: -.035em; font-size: clamp(1.9rem, 4vw, 3rem); }
.access form button { margin-top: .75rem; }
.library { display: grid; grid-template-columns: minmax(15rem, 24rem) minmax(0, 1fr); min-height: calc(100dvh - 4.75rem); }
.catalog { background: var(--surface); border-right: 1px solid var(--rule); padding: 1.4rem clamp(1rem, 3vw, 2rem); }
.catalog h1 { font-size: 1.35rem; margin: 0 0 1.2rem; }
.catalog ul { list-style: none; margin: 0; padding: 0; }
.catalog li { border-bottom: 1px solid var(--rule); }
.catalog li button { display: block; width: 100%; text-align: left; background: transparent; color: var(--text); padding: .8rem .4rem; border: 0; overflow-wrap: anywhere; }
.catalog li button[aria-current="true"], .catalog li button:hover { background: var(--hover); }
.catalog li span { display: block; margin-top: .3rem; color: var(--muted); font-size: .875rem; }
.catalog #more { margin-top: 1rem; }
.reader { padding: 2rem clamp(1rem, 5vw, 5.5rem); }
.reader h2 { margin: .4rem 0; overflow-wrap: anywhere; }
.location, .muted { color: var(--muted); overflow-wrap: anywhere; }
.body { font-size: 1.06rem; white-space: pre-wrap; line-height: 1.65; overflow-wrap: anywhere; max-width: 74ch; margin-top: 1.75rem; }
dialog { width: min(calc(100% - 2rem), 42rem); border: 1px solid var(--rule); border-radius: .75rem; padding: 1.5rem; color: var(--text); }
dialog::backdrop { background: #13241bb0; }
dialog h2 { margin-top: 0; }
dialog label:not(:first-child) { margin-top: 1rem; }
dialog textarea { resize: vertical; }
.buttons { justify-content: end; }
[role="status"]:empty { display: none; }

@media (max-width: 44rem) {
  .brand { font-size: 1.35rem; }
  .library { display: block; }
  .catalog { border-right: 0; border-bottom: 1px solid var(--rule); }
  .catalog ul { max-height: 15rem; overflow: auto; }
  .reader { padding-block: 1.4rem; }
}
