:root {
  --paper: #f6f1e5;
  --paper-strong: #efe5d1;
  --ink: #243127;
  --muted: #5f6f5e;
  --line: #cdbfa0;
  --accent: #bf5700;
  --accent-deep: #8d4200;
  --sage: #7c915e;
  --sage-deep: #556844;
  --cream: #fbf7ef;
  --card: rgba(255, 251, 243, 0.88);
  --shadow: 0 18px 40px rgba(46, 35, 16, 0.12);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --site-width: min(1300px, calc(100vw - 2rem));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(191, 87, 0, 0.14), transparent 28%),
    radial-gradient(circle at right 12% top 24%, rgba(124, 145, 94, 0.18), transparent 24%),
    linear-gradient(180deg, #fdfaf3 0%, #f5eedf 100%);
  font-family: "Trebuchet MS", "Gill Sans", "Gill Sans MT", sans-serif;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: var(--site-width);
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.masthead {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  border: 1px solid rgba(95, 111, 94, 0.16);
  border-radius: 28px;
  background-color: #fff;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.brand img {
  max-width: 330px;
  width: auto;
  height: auto;
}

.brand-copy h1 {
  margin: 0;
  font-family: Baskerville, "Palatino Linotype", Palatino, serif;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.brand-copy p {
  margin: 0.5rem 0 0;
  max-width: 50rem;
  color: var(--muted);
  font-size: 1rem;
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pill-link,
.button-link,
.pagination-link,
.alpha-link {
  text-decoration: none;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0;
  color: var(--sage-deep);
  font-size: 0.92rem;
  font-weight: 700;
  position: relative;
  transition: color 180ms ease;
}

.pill-link::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.pill-link:hover,
.pill-link:focus-visible,
.pill-link[aria-current="page"] {
  color: var(--accent-deep);
}

.pill-link:hover::after,
.pill-link:focus-visible::after,
.pill-link[aria-current="page"]::after {
  transform: scaleX(1);
}

.top-nav {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 1.25rem;
  position: relative;
  z-index: 1;
}

.nav-toggle {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hamburger-button {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(95, 111, 94, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  position: relative;
  z-index: 3;
}

.hamburger-button span {
  display: block;
  width: 19px;
  height: 2px;
  border-radius: 999px;
  background: var(--sage-deep);
  transition:
    transform 160ms ease,
    opacity 160ms ease;
}

.nav-toggle:focus-visible + .hamburger-button {
  outline: 3px solid rgba(191, 87, 0, 0.28);
  outline-offset: 3px;
}

.nav-toggle:checked + .hamburger-button span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle:checked + .hamburger-button span:nth-child(2) {
  opacity: 0;
}

.nav-toggle:checked + .hamburger-button span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.layout {
  display: grid;
  gap: 1.4rem;
  margin-top: 1.4rem;
}

.panel {
  background: #fff;
  border: 1px solid rgba(120, 99, 66, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 1.5rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.2rem;
  align-items: stretch;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-copy h2,
.section-title,
.detail-hero-copy h2 {
  margin: 0;
  font-family: Baskerville, "Palatino Linotype", Palatino, serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.96;
}

.section-title {
  margin-bottom: 20px;
}

.hero-copy p,
.section-copy,
.detail-description {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.hero-actions,
.results-actions,
.detail-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.button-link,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.8rem 1.15rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 20px rgba(191, 87, 0, 0.18);
}

.button-link.secondary,
.button.secondary {
  background: white;
  color: var(--sage-deep);
  border: 1px solid rgba(95, 111, 94, 0.24);
  box-shadow: none;
}

.stats-grid,
.card-grid,
.specimen-grid,
.chips {
  display: grid;
  gap: 0.85rem;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1.2rem;
}

.stat-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 236, 219, 0.92));
  border: 1px solid rgba(120, 99, 66, 0.12);
}

.stat-card strong {
  display: block;
  font-size: 1.8rem;
  font-family: Baskerville, "Palatino Linotype", Palatino, serif;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

.feature-stack {
  display: grid;
  gap: 0.85rem;
}

.feature-card {
  position: relative;
  overflow: hidden;
  min-height: 11rem;
  border-radius: var(--radius-lg);
  background: #e3dccf;
}

.feature-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feature-card figcaption {
  position: absolute;
  inset: auto 0 0;
  padding: 1rem;
  background: linear-gradient(180deg, transparent, rgba(16, 24, 17, 0.84));
  color: white;
}

.feature-card h3,
.species-card h3,
.detail-hero-copy h2 {
  margin: 0;
}

.feature-card p,
.species-card p,
.detail-meta p {
  margin: 0.35rem 0 0;
}

.content-section {
  padding: 1.4rem;
}

.legacy-content {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.65;
  overflow: hidden;
}

.legacy-content img {
  max-width: 100%;
  height: auto;
}

.legacy-content p {
  margin: 0 0 1rem;
}

.legacy-content iframe {
  display: block;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 640 / 361;
  height: auto;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.collection-slideshow {
  position: relative;
  overflow: hidden;
  min-height: 22rem;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
}

.collection-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: opacity 360ms ease;
}

.collection-slide.is-active {
  opacity: 1;
  z-index: 1;
}

.collection-slide-caption {
  display: grid;
  gap: 0.2rem;
  text-align: center;
}

.collection-slide-common {
  color: var(--ink);
  font-family: Baskerville, "Palatino Linotype", Palatino, serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.1;
}

.collection-slide-scientific {
  color: var(--sage-deep);
  font-size: 1rem;
  font-style: italic;
}

.collection-slide-media {
  flex: 1;
  min-height: 0;
}

.collection-slide-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slideshow-controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.slideshow-button {
  min-height: 42px;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(95, 111, 94, 0.24);
  border-radius: 999px;
  background: white;
  color: var(--sage-deep);
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.slideshow-button:hover,
.slideshow-button:focus-visible {
  border-color: rgba(191, 87, 0, 0.4);
  color: var(--accent-deep);
  transform: translateY(-1px);
}

.card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.species-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 100%;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(120, 99, 66, 0.12);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.species-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(46, 35, 16, 0.12);
}

.species-card-media {
  aspect-ratio: 4 / 3;
  background: linear-gradient(180deg, rgba(124, 145, 94, 0.15), rgba(191, 87, 0, 0.1));
}

.species-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.species-card-body {
  padding: 1rem;
}

.species-card-body h2 {
  font-family: Baskerville, "Palatino Linotype", Palatino, serif;
  font-size: 1.35rem;
}

.species-card-body .latin {
  color: var(--sage-deep);
  font-style: italic;
}

.chips {
  grid-template-columns: repeat(auto-fit, minmax(110px, max-content));
  margin-top: 0.9rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(124, 145, 94, 0.12);
  color: var(--sage-deep);
  font-size: 0.86rem;
}

.toolbar,
.search-layout,
.detail-layout,
.detail-panels {
  display: grid;
  gap: 1rem;
}

.toolbar {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.browse-controls,
.search-form {
  display: grid;
  gap: 0.9rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.field input,
.field select {
  min-height: 44px;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(95, 111, 94, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  width: 100%;
}

.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.alpha-link {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(124, 145, 94, 0.1);
  color: var(--sage-deep);
  font-weight: 700;
}

.alpha-link.active {
  background: var(--accent);
  color: white;
}

.results-summary,
.empty-state,
.loading-state,
.error-state {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.76);
  border: 1px dashed rgba(95, 111, 94, 0.3);
  color: var(--muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.pagination-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-link {
  display: inline-flex;
  min-width: 2.5rem;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  background: rgba(124, 145, 94, 0.1);
  color: var(--sage-deep);
  font-weight: 700;
}

.pagination-link.active {
  background: var(--accent);
  color: white;
}

.search-layout {
  grid-template-columns: 320px minmax(0, 1fr);
}

.detail-layout {
  grid-template-columns: minmax(0, 1.25fr) 340px;
  align-items: start;
}

.detail-hero {
  display: grid;
  gap: 1.2rem;
}

.detail-hero-card {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(124, 145, 94, 0.12), rgba(191, 87, 0, 0.1));
  border: 1px solid rgba(120, 99, 66, 0.12);
}

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

.detail-hero-copy {
  padding: 1.35rem;
}

.detail-meta {
  display: grid;
  gap: 0.85rem;
  padding: 1.2rem;
}

.detail-meta-group strong {
  display: block;
  margin-bottom: 0.35rem;
}

.detail-panels {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.specimen-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.specimen-card {
  overflow: hidden;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(120, 99, 66, 0.12);
  text-decoration: none;
}

.specimen-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: rgba(124, 145, 94, 0.08);
}

.specimen-card-body {
  padding: 0.9rem;
}

.map-card {
  position: relative;
  min-height: 240px;
  padding: 1rem;
}

.map-frame {
  position: relative;
  width: 200px;
  height: 193px;
  margin: 0 auto 1rem;
  background: url("../images/map.gif") center / contain no-repeat;
}

.map-layer {
  position: absolute;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0;
}

.map-layer.active {
  opacity: 1;
}

.map-layer.central {
  background-image: url("../images/map-central_over.gif");
}

.map-layer.coast {
  background-image: url("../images/map-coast_over.gif");
}

.map-layer.east {
  background-image: url("../images/map-east_over.gif");
}

.map-layer.rolling {
  background-image: url("../images/map-rolling_over.gif");
}

.map-layer.edwards {
  background-image: url("../images/map-edwards_over.gif");
}

.map-layer.high {
  background-image: url("../images/map-high_over.gif");
}

.map-layer.south {
  background-image: url("../images/map-south_over.gif");
}

.map-layer.trans {
  background-image: url("../images/map-trans_over.gif");
}

.map-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

.footer {
  margin-top: 1.5rem;
  padding: 1rem 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.92rem;
}

@media (max-width: 1099px) {
  .masthead {
    align-items: center;
    overflow: visible;
  }

  .hamburger-button {
    display: inline-flex;
  }

  .top-nav {
    display: none;
    position: absolute;
    top: calc(100% - 0.75rem);
    right: 1.5rem;
    left: 1.5rem;
    z-index: 2;
    margin-top: 0;
    padding: 0.9rem;
    border: 1px solid rgba(95, 111, 94, 0.18);
    border-radius: var(--radius-md);
    background: rgba(255, 251, 243, 0.98);
    box-shadow: var(--shadow);
  }

  .nav-toggle:checked ~ .top-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .top-nav .pill-link {
    justify-self: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.65rem 0;
  }
}

@media (max-width: 1024px) {
  .hero-grid,
  .detail-layout,
  .search-layout,
  .detail-panels,
  .field-row,
  .card-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 1rem, 100%);
  }

  .masthead,
  .content-section,
  .hero-panel,
  .detail-hero-copy,
  .detail-meta {
    padding: 1rem;
  }

  .brand-row {
    align-items: start;
    flex-direction: column;
  }

  .brand img {
    max-width: min(260px, calc(100vw - 6.5rem));
  }

  .top-nav {
    right: 1rem;
    left: 1rem;
  }

  .collection-slideshow {
    min-height: 12rem;
    aspect-ratio: 4 / 3;
  }

  .nav-toggle:checked ~ .top-nav {
    grid-template-columns: 1fr;
  }

  .card-grid,
  .specimen-grid {
    grid-template-columns: 1fr;
  }

  .pagination {
    align-items: start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .collection-slide {
    transition: none;
  }
}
