:root {
  --text: #222;
  --muted: #666;
  --border: #ddd;
  --panel: #f5f5f5;
  --link: #0066cc;
  --accent: #337ab7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 16px 32px;
  background: #fff;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

/* --- Site header and navigation --- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin: 20px 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.site-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
}

.site-header nav {
  display: flex;
  gap: 20px;
  font-size: 15px;
}

.site-header nav a {
  text-decoration: none;
  padding-bottom: 2px;
}

.site-header nav a:hover {
  text-decoration: underline;
}

.site-header nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  border-bottom: 2px solid var(--accent);
}

.intro {
  margin: 0 0 16px;
  color: var(--muted);
}

h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 500;
}

a {
  color: var(--link);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* --- Catalog layout --- */

.catalog {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 3fr;
  gap: 24px;
  align-items: start;
}

.catalog[hidden],
#detail-view[hidden] {
  display: none;
}

.results {
  min-width: 0;  /* lets the table scroll instead of widening the page */
}

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

/* --- Sidebar --- */

.sidebar {
  background: var(--panel);
  border: 1px solid #e3e3e3;
  border-radius: 4px;
  padding: 16px;
}

.sidebar label {
  display: block;
  margin: 14px 0 5px;
  font-weight: 600;
}

.sidebar input[type="search"],
.sidebar select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font: inherit;
}

#year-slider {
  margin: 12px 8px 4px;
}

#year-slider .noUi-connect {
  background: var(--accent);
}

.year-values {
  margin: 8px 0 0;
  color: var(--muted);
  text-align: center;
}

button {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #e6e6e6;
}

button:disabled {
  cursor: default;
  opacity: 0.6;
}

/* --- Results table --- */

#record-count {
  margin: 0 0 12px;
}

table.dataTable td {
  vertical-align: top;
}

/* Minimum widths keep long text readable; the table scrolls sideways instead */
table.dataTable .col-objectid,
table.dataTable .col-date,
table.dataTable .col-pages {
  white-space: nowrap;
}

table.dataTable .col-object_location {
  min-width: 14em;
  word-break: break-all;
}

table.dataTable .col-fieldstation,
table.dataTable .col-creator {
  min-width: 9em;
}

table.dataTable .col-title,
table.dataTable .col-subject {
  min-width: 18em;
}

/* --- Detail view --- */

#record {
  max-width: 900px;
}

#record h2 {
  font-size: 24px;
  margin-top: 8px;
}

#record dl {
  margin: 0;
}

#record dt {
  font-weight: 600;
  margin-top: 12px;
}

/* Short fields sit on one line ("Date: 1996"); the abstract gets its own block */
#record dt:not(.block) {
  float: left;
  clear: left;
  margin-right: 6px;
}

#record dd {
  margin: 12px 0 0;
}

#record dt.block + dd {
  margin-top: 4px;
}

/* --- About page --- */

.about {
  max-width: 760px;
  font-size: 16px;
  line-height: 1.6;
}

.about-title {
  margin: 8px 0 4px;
  font-size: 26px;
}

.tagline {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 18px;
}

.about h3 {
  margin: 32px 0 8px;
  font-size: 20px;
  font-weight: 500;
}

.about figure {
  margin: 24px 0;
}

.about img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
}

.about figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.gallery figure {
  margin: 8px 0;
}

.gallery img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
}

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

.table-scroll {
  overflow-x: auto;
}

table.summary {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

table.summary th,
table.summary td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

table.summary th {
  border-bottom-width: 2px;
}

table.summary .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.summary td:last-child {
  white-space: nowrap;
}

/* Tall figures are kept narrower so they fit on screen */
.about figure.narrow {
  max-width: 520px;
}
