:root {
  --bg: #f4efe6;
  --surface: #fffdf8;
  --surface-soft: #f8f2e8;
  --text: #2f2a24;
  --muted: #6e6459;
  --accent: #7a4a24;
  --accent-dark: #533119;
  --green: #566b3f;
  --green-dark: #3f512e;
  --border: #ddcfbc;
  --warning-bg: #fff5d9;
  --warning-border: #d6b455;
  --shadow: 0 16px 42px rgba(63, 43, 24, 0.11);
  --radius: 18px;
  --content-width: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(122, 74, 36, 0.10), transparent 34rem),
    linear-gradient(180deg, #eee5d8 0, var(--bg) 23rem, var(--bg) 100%);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid rgba(122, 74, 36, 0.35);
  outline-offset: 3px;
}

.site-header {
  color: #fff;
  background: linear-gradient(135deg, #3f512e, #60391f);
}
.header-inner {
  width: min(var(--content-width), calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 38px;
}
.eyebrow {
  margin: 0 0 8px;
  color: #eadbbd;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 500;
  line-height: 1.08;
  text-wrap: balance;
}
.header-description {
  max-width: 760px;
  margin: 16px 0 0;
  color: #f1e7d6;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
}

.site-nav {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(83, 49, 25, .18);
  background: rgba(255, 253, 248, .96);
  backdrop-filter: blur(10px);
}
.site-nav-inner {
  display: flex;
  width: min(var(--content-width), calc(100% - 24px));
  margin: 0 auto;
  overflow-x: auto;
}
.site-nav a {
  flex: 0 0 auto;
  padding: 14px 15px;
  color: var(--text);
  font-size: .94rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  color: #fff;
  background: var(--accent);
}

.page {
  width: min(var(--content-width), calc(100% - 32px));
  margin: 30px auto 58px;
}
.panel {
  padding: clamp(20px, 4vw, 34px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(250px, .6fr);
  gap: 24px;
  align-items: start;
}
h2 {
  margin: 0 0 14px;
  color: var(--accent-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 4vw, 2.3rem);
  font-weight: 500;
  line-height: 1.2;
}
.lead {
  color: #453d34;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
}
.meta { color: var(--muted); font-size: .94rem; }

.archive-note, .scan-unavailable {
  margin: 22px 0;
  padding: 18px 20px;
  color: #4c432f;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-left: 5px solid #a68734;
  border-radius: 10px;
}

.search-box {
  display: grid;
  gap: 8px;
}
.search-box label { font-weight: 700; }
.search-box input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid #bea98f;
  border-radius: 10px;
  font: inherit;
}
.search-status { min-height: 1.5em; color: var(--muted); font-size: .92rem; }

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
}
.pagination a, .pagination span {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-weight: 700;
  text-decoration: none;
}
.pagination a:hover, .pagination .current {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.table-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.table-scroll { overflow-x: auto; }
.census-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .98rem;
}
.census-table th, .census-table td {
  padding: 13px 15px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #e8ddce;
}
.census-table th {
  color: #fff;
  background: var(--green-dark);
  font-size: .88rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.census-table tbody tr:nth-child(even) { background: var(--surface-soft); }
.census-table tbody tr:hover { background: #f3e5cc; }
.census-table tbody tr:last-child td { border-bottom: 0; }
.census-table td:first-child { font-weight: 700; }
.census-table .page-link {
  display: inline-flex;
  min-width: 48px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  text-decoration: none;
}
.census-table .page-link:hover { background: var(--accent-dark); }
.no-results { display: none; padding: 24px; text-align: center; color: var(--muted); }

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 22px;
}
.button, button.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}
.button.secondary { color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.button:hover { color: #fff; background: var(--accent-dark); }
.button.secondary:hover { color: #fff; background: var(--green); }

.scan-shell {
  overflow: hidden;
  background: #27231f;
  border: 1px solid #1d1916;
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.scan-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px;
  color: #eee6da;
  background: #3a332d;
}
.scan-toolbar .spacer { flex: 1 1 auto; }
.scan-toolbar button {
  min-height: 38px;
  padding: 7px 12px;
  color: #fff;
  background: #5d4b3d;
  border: 1px solid #756252;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.scan-toolbar button:hover { background: var(--accent); }
.scan-viewport {
  overflow: auto;
  padding: 18px;
  text-align: center;
  background:
    linear-gradient(45deg, #25211e 25%, transparent 25%),
    linear-gradient(-45deg, #25211e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #25211e 75%),
    linear-gradient(-45deg, transparent 75%, #25211e 75%), #2d2925;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}
.scan-image {
  display: block;
  width: min(100%, 1100px);
  height: auto;
  margin: 0 auto;
  transform-origin: top center;
  transition: width .15s ease;
  background: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
}
.scan-caption { margin-top: 12px; color: #ded4c6; font-size: .92rem; }

.site-footer {
  padding: 28px 16px;
  color: #e9dfd0;
  text-align: center;
  background: #33291f;
}
.site-footer p { margin: 5px 0; }
.site-footer a { color: #f2d6ad; }

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

@media (max-width: 650px) {
  .header-inner { padding: 38px 0 32px; }
  .page { width: min(100% - 18px, var(--content-width)); margin-top: 18px; }
  .panel { padding: 20px 17px; border-radius: 14px; }
  .table-scroll { overflow: visible; }
  .census-table, .census-table tbody, .census-table tr, .census-table td { display: block; width: 100%; }
  .census-table thead { display: none; }
  .census-table tr {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
  }
  .census-table tr:last-child { border-bottom: 0; }
  .census-table td {
    display: grid;
    grid-template-columns: 94px minmax(0, 1fr);
    gap: 10px;
    padding: 6px 0;
    border: 0;
  }
  .census-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .census-table .page-link { justify-self: start; }
  .scan-viewport { padding: 10px; }
}
