:root {
  color-scheme: light;
  --ink: #162039;
  --muted: #667085;
  --paper: #f3f0e9;
  --card: #fffefa;
  --line: #d8d3c7;
  --accent: #d64b32;
  --accent-dark: #a83220;
  --blue: #244f9e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
}
.brand, .home-link { color: inherit; text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: .65rem; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--ink); color: white; font-family: Georgia, serif; font-style: italic; }
.home-link { border-bottom: 1px solid currentColor; font-size: .88rem; font-weight: 700; }

main { max-width: 1120px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem) 4rem; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .8fr); gap: .8rem 3rem; align-items: end; padding: clamp(2.8rem, 6vw, 4.5rem) 0 clamp(2rem, 4vw, 3rem); }
.kicker { grid-column: 1 / -1; margin: 0 0 .25rem; color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .16em; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.5rem, 5vw, 4.2rem); font-weight: 500; letter-spacing: -.045em; line-height: 1; }
.hero-copy { margin: 0 0 .25rem; max-width: 30rem; color: #4d5565; font-size: .98rem; line-height: 1.65; }
.library-count { grid-column: 1 / -1; margin: .5rem 0 0; color: var(--muted); font-size: .78rem; }
.library-count strong { color: var(--ink); font-size: .9rem; }

.explorer { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); padding: 1rem 0; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: .8rem; }
.search-box { position: relative; }
.search-icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 1.2rem; }
.search-box input { width: 100%; border: 1px solid var(--line); border-radius: 0; padding: .72rem .85rem .72rem 2.35rem; color: var(--ink); background: transparent; }
.clear-button, .filter-button, .primary-button { border: 1px solid var(--line); padding: .58rem .85rem; background: transparent; color: var(--ink); font-weight: 680; }
.clear-button:hover, .filter-button:hover { border-color: var(--ink); }
.filter-group { display: grid; grid-template-columns: 6rem 1fr; gap: .8rem; align-items: start; padding: .85rem 0 .15rem; }
.filter-label { margin: .55rem 0 0; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.filter-options { display: flex; flex-wrap: wrap; gap: .35rem; }
.filter-button { border-radius: 999px; padding: .36rem .68rem; font-size: .8rem; }
.filter-button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: white; }
.tag-filter { border-top: 1px dashed var(--line); margin-top: .85rem; padding-top: .85rem; }
.tag-filter summary { display: flex; justify-content: space-between; padding: .25rem 0; font-size: .86rem; font-weight: 760; cursor: pointer; }
.selection-summary { color: var(--accent); font-weight: 700; }
.tag-options { padding: .8rem 0 .1rem 6.8rem; }

.results { padding-top: 2rem; }
.results-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.results-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 500; }
.results-heading p { margin: 0; color: var(--muted); font-size: .86rem; }
.article-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.article-card { display: grid; align-content: start; padding: clamp(1rem, 2vw, 1.35rem); border-bottom: 1px solid var(--line); background: transparent; }
.article-card:nth-child(odd) { border-right: 1px solid var(--line); }
.card-meta { display: flex; justify-content: space-between; gap: .8rem; margin-bottom: .75rem; color: var(--muted); font-size: .7rem; }
.category-name { color: var(--blue); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.article-title { margin: 0; font-family: Georgia, serif; font-size: clamp(1.2rem, 2vw, 1.55rem); font-weight: 500; line-height: 1.25; }
.article-title a { color: inherit; text-decoration: none; }
.article-title a:hover { color: var(--accent); }
.recommendation { margin: .65rem 0; color: #4d5565; font-size: .9rem; line-height: 1.6; white-space: pre-line; }
.card-footer { display: flex; justify-content: space-between; align-items: end; gap: .8rem; margin-top: auto; padding-top: .55rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.card-tag { border: 0; padding: 0; color: var(--muted); font-size: .68rem; }
.card-tag + .card-tag::before { content: "·"; margin-right: .35rem; color: var(--line); }
.source-link { flex: none; color: var(--accent); font-size: .76rem; font-weight: 750; text-decoration: none; }
.source-link:hover { color: var(--accent-dark); }

.state-panel { padding: 5rem 1rem; border-top: 1px solid var(--ink); text-align: center; background: var(--card); }
.state-symbol { margin: 0; color: var(--accent); font-family: Georgia, serif; font-size: 4rem; }
.state-panel h3 { margin: .5rem 0; font-family: Georgia, serif; font-size: 1.8rem; }
.state-panel p:not(.state-symbol) { color: var(--muted); }
.primary-button { margin-top: .8rem; border-color: var(--ink); background: var(--ink); color: white; }
.primary-button:hover { background: var(--accent); border-color: var(--accent); }

footer { border-top: 1px solid var(--line); padding: 1.3rem; color: var(--muted); text-align: center; font-size: .8rem; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgb(214 75 50 / 32%); outline-offset: 3px; }
.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; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 4rem; }
  .hero-copy { max-width: 38rem; }
  .library-count { grid-column: auto; }
  .article-grid { grid-template-columns: 1fr; }
  .article-card:nth-child(odd) { border-right: 0; }
  .tag-options { padding-left: 0; }
}

@media (max-width: 520px) {
  .search-row { grid-template-columns: 1fr; }
  .filter-group { grid-template-columns: 1fr; gap: .5rem; }
  .filter-label { margin-top: 0; }
  .results-heading, .card-footer { align-items: flex-start; flex-direction: column; }
  .article-card { min-height: auto; }
}
