:root {
  --accent:#8f001a;
  --accent-dark:#650012;
  --ink:#202124;
  --muted:#62666b;
  --line:#d9dcdf;
  --white:#ffffff;
  --shadow:0 3px 14px rgba(0,0,0,.07);
}

* { box-sizing:border-box; }

body {
  margin:0;
  background:#f2f3f4;
  color:var(--ink);
  font-family:Arial, Helvetica, sans-serif;
  line-height:1.5;
}

button, input, select { font:inherit; }

.site-header {
  background:var(--accent);
  color:white;
  border-bottom:6px solid var(--accent-dark);
}

.header-inner,
.page-shell {
  width:min(1180px, calc(100% - 32px));
  margin:0 auto;
}

.header-inner { padding:38px 0 34px; }

.eyebrow {
  margin:0 0 7px;
  font-size:.86rem;
  font-weight:700;
  letter-spacing:.055em;
  text-transform:uppercase;
}

h1 {
  margin:0;
  font-size:clamp(2rem, 4vw, 3.25rem);
  line-height:1.08;
}

.intro {
  max-width:820px;
  margin:14px 0 0;
  font-size:1.08rem;
}

.page-shell { padding:32px 0 56px; }

.search-panel,
.record-card {
  background:var(--white);
  border:1px solid var(--line);
  border-radius:8px;
  box-shadow:var(--shadow);
}

.search-panel { padding:24px; }

.search-panel h2,
.results-heading h2 { margin:0; }

.filter-grid {
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:18px;
  margin-top:20px;
}

label {
  display:flex;
  flex-direction:column;
  gap:6px;
  font-weight:700;
}

input, select {
  width:100%;
  min-height:44px;
  border:1px solid #aeb3b7;
  border-radius:5px;
  background:white;
  padding:9px 11px;
  color:var(--ink);
}

input:focus, select:focus {
  outline:3px solid rgba(143,0,26,.22);
  border-color:var(--accent);
}

.actions {
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:20px;
}

.actions button,
.pagination button {
  min-height:42px;
  border:0;
  border-radius:5px;
  padding:9px 17px;
  font-weight:700;
  cursor:pointer;
}

.primary { background:var(--accent); color:white; }
.primary:hover { background:#740015; }
.primary:active { background:#5d0011; }

.secondary { background:#e4e6e8; color:var(--ink); }
.secondary:hover { background:#d5d8da; }

.results-section { margin-top:30px; }

.results-heading {
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:20px;
  margin-bottom:14px;
}

#resultCount {
  margin:0;
  color:var(--muted);
  font-weight:700;
}

#results {
  display:grid;
  gap:16px;
}

.record-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 18px 20px;
}

.record-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: .9rem;
}

.record-title {
  margin: 8px 0 12px;
  color: #1f2022;
  font-size: 1.25rem;
  line-height: 1.3;
}

.record-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 12px;
  margin: 0;
}

.record-details dt { font-weight:700; }
.record-details dd { margin:0; min-width:0; }

.author-list {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:4px 10px;
}

.author-link {
  appearance:none;
  display:inline;
  padding:0;
  border:0;
  border-radius:2px;
  background:transparent;
  color:#7a0016;
  font:inherit;
  text-align:left;
  text-decoration:underline;
  cursor:pointer;
}

.author-link:hover {
  color:#4f000e;
  text-decoration-thickness:2px;
}

.author-link:focus,
.region-tag:focus,
.subject-tag:focus {
  outline:3px solid rgba(143,0,26,.25);
  outline-offset:2px;
}


.region-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
}

.region-tag {
  appearance: none;
  background: #8f001a;
  color: white;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 9px;   
  font-size: .88rem;    
  line-height: 1.4;     
  cursor: pointer;
}

.region-tag:hover {
  background: #740015;
  border-color: #740015;
  text-decoration: underline;
}

.region-list:empty {
  display: none;
}

.subject-list {
  display:flex;
  flex-wrap:wrap;
  gap:7px;
  margin-top:9px;
}

.subject-list:empty {
  display:none;
}

.subject-tag {
  appearance:none;
  background:#eceff1;
  color:var(--ink);
  border:1px solid transparent;
  border-radius:999px;
  padding:4px 9px;
  font-size:.88rem;
  line-height:1.4;
  cursor:pointer;
}

.subject-tag:hover {
  background:#dde2e5;
  border-color:#b7bdc1;
  text-decoration:underline;
}

.pagination {
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  gap:7px;
  margin-top:24px;
}

.pagination button {
  min-width:42px;
  background:white;
  border:1px solid #b9bdc1;
  color:var(--ink);
}

.pagination button:hover:not(:disabled) {
  border-color:var(--accent);
  color:var(--accent);
}

.pagination button[aria-current="page"] {
  background:var(--accent);
  border-color:var(--accent);
  color:white;
}

.pagination button:disabled {
  opacity:.48;
  cursor:not-allowed;
}

.pagination-ellipsis {
  min-width:25px;
  text-align:center;
  color:var(--muted);
}

.empty {
  margin:0;
  padding:30px;
  background:white;
  border:1px solid var(--line);
  border-radius:8px;
  text-align:center;
}

@media (max-width:800px) {
  .filter-grid { grid-template-columns:1fr 1fr; }
}

@media (max-width:560px) {
  .header-inner,
  .page-shell { width:min(100% - 20px, 1180px); }

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

  .actions {
    align-items:stretch;
    flex-direction:column;
  }

  .record-details { grid-template-columns:1fr; }
  .record-details dd { margin-bottom:7px; }

  .results-heading {
    align-items:flex-start;
    flex-direction:column;
    gap:3px;
  }
}
