:root {
  color-scheme: light;
  --ink: #1c2329;
  --muted: #63707a;
  --line: #d6dde2;
  --paper: #f7f8f5;
  --panel: #ffffff;
  --accent: #0f6b5f;
  --accent-strong: #094a44;
  --warm: #b85c38;
  --focus: #1f7ab8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 22px;
  border-bottom: 1px solid var(--line);
  background: #fffdf9;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--warm);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.12;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
}

.count {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 34px);
  padding: 24px clamp(18px, 4vw, 48px) 48px;
}

.filters {
  align-self: start;
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 25%, transparent);
  outline-offset: 2px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  background: var(--accent-strong);
}

.results {
  min-width: 0;
}

.result-list {
  display: grid;
  gap: 10px;
}

.reading {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.reading-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.reading h3 {
  font-size: 1.08rem;
}

.reading p {
  margin: 0;
  color: var(--muted);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf4f1;
  color: #174d45;
  font-size: 0.78rem;
  font-weight: 800;
}

.open-detail {
  flex: 0 0 auto;
  align-self: start;
  padding: 0 12px;
}

.load-more {
  width: 100%;
  margin-top: 16px;
}

.load-more[hidden] {
  display: none;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgb(0 0 0 / 0.28);
}

dialog::backdrop {
  background: rgb(28 35 41 / 0.42);
}

.detail {
  position: relative;
  padding: clamp(20px, 4vw, 34px);
  background: #fff;
}

.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  min-height: 36px;
  background: #e8ecef;
  color: var(--ink);
}

.close:hover {
  background: #d9e0e5;
}

dl {
  display: grid;
  grid-template-columns: minmax(110px, max-content) 1fr;
  gap: 6px 14px;
  margin: 18px 0;
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0;
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 820px) {
  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
  }

  .reading-header {
    flex-direction: column;
  }

  .open-detail {
    width: 100%;
  }
}
