:root {
  --paper: #f5f4ef;
  --ink: #1a211d;
  --muted: #687069;
  --line: #d9ddd6;
  --card: #eceee8;
  --deep: #20372b;
  --deep-2: #14261c;
  --cream: #fbfaf6;
  --max-width: 1320px;
  --radius: 18px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: Iowan Old Style, Baskerville, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-sans);
  line-height: 1.5;
}

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

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 32px;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.site-name {
  font-size: 2.0rem;
  letter-spacing: 0.08em;
  font-weight: 800;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 28px;
  align-items: center;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--ink);
}

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: transparent;
  color: var(--ink);
}

.section {
  width: min(calc(100% - 64px), var(--max-width));
  margin: 0 auto;
  padding: 50px 0;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

h1 {
  max-width: 830px;
  font-size: clamp(3.7rem, 8vw, 7.8rem);
  margin-bottom: 28px;
}

h2 {
  max-width: 780px;
  font-size: clamp(2.6rem, 5vw, 5rem);
  margin-bottom: 24px;
}

h3 {
  font-size: 1.18rem;
  line-height: 1.2;
}

.hero {
  min-height: 720px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr);
  gap: clamp(44px, 7vw, 110px);
  align-items: center;
  padding-top: 76px;
}

.hero-text,
.section-intro {
  max-width: 650px;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border: 1px solid var(--deep);
  border-radius: 999px;
  color: white;
  background: var(--deep);
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--deep-2);
}

.button-secondary {
  color: var(--deep);
  background: transparent;
}

.button-secondary:hover {
  color: white;
}

.text-link {
  text-underline-offset: 4px;
}

.hero-panel {
  min-width: 0;
}

.hero-observation {
  min-height: 560px;
  overflow: hidden;
  border-radius: 220px 220px 18px 18px;
  background: var(--card);
}

.hero-observation-link {
  min-height: 560px;
  position: relative;
  display: block;
}

.hero-observation-link img {
  width: 100%;
  height: 560px;
  object-fit: cover;
}

.hero-observation-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 80px 28px 28px;
  color: white;
  background: linear-gradient(transparent, rgba(0,0,0,.78));
  display: flex;
  flex-direction: column;
}

.hero-observation-caption strong {
  font-size: 1.15rem;
}

.hero-observation-caption span {
  margin-top: 6px;
  opacity: .82;
  font-size: .85rem;
}

.loading-card {
  display: grid;
  place-items: center;
  padding: 40px;
}

.loading-message {
  max-width: 320px;
  color: var(--muted);
  text-align: center;
}

.loading-message strong,
.loading-message span {
  display: block;
}

.loading-message strong {
  margin-bottom: 8px;
  color: var(--ink);
}

.split-section {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(48px, 8vw, 120px);
}

.prose {
  max-width: 640px;
  color: var(--muted);
  font-size: 1.05rem;
}

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

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

.project-card {
  min-width: 0;
}

.project-image {
  aspect-ratio: 4 / 3;
  margin-bottom: 18px;
  border-radius: var(--radius);
  overflow: hidden;
}
.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.placeholder-image {
  display: grid;
  place-items: center;
  color: var(--muted);
  background:
    linear-gradient(130deg, #dfe4dc, #c8d2c8);
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.project-number {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: .78rem;
}

.project-copy p:not(.project-number) {
  color: var(--muted);
}

.observations-preview {
  width: 100%;
  max-width: none;
  padding-left: max(32px, calc((100vw - var(--max-width))/2));
  padding-right: max(32px, calc((100vw - var(--max-width))/2));
  color: white;
  background: var(--deep);
}

.observations-preview .eyebrow,
.observations-preview .section-intro {
  color: rgba(255,255,255,.66);
}

.observations-preview .button-secondary {
  color: white;
  border-color: rgba(255,255,255,.55);
}

.inat-grid {
  display: grid;
  gap: 10px;
}

.inat-grid-home {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  transition: opacity .18s ease;
}

.inat-grid.is-changing {
  opacity: .35;
}

.inat-card {
  min-width: 0;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  padding: 0;
  color: white;
  background: #d6d8d3;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}

.inat-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s ease;
}

.inat-card:hover img {
  transform: scale(1.035);
}

.inat-overlay {
  position: absolute;
  inset: auto 0 0 0;
  min-height: 38%;
  padding: 54px 13px 13px;
  background: linear-gradient(transparent, rgba(0,0,0,.78));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.common-name {
  font-size: .82rem;
  font-weight: 700;
}

.scientific-name {
  font-family: var(--font-serif);
  font-size: .98rem;
}

.observation-location {
  display: block;
  margin-top: 5px;
  color: rgba(255,255,255,.9);
  font-family: var(--font-sans);
  font-size: .72rem;
  font-style: normal;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: .015em;
}

.observation-meta {
  margin-top: 4px;
  font-size: .72rem;
  opacity: .78;
}

.gallery-placeholder {
  grid-column: 1 / -1;
  min-height: 180px;
  border: 1px dashed rgba(127,127,127,.5);
  border-radius: 12px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: inherit;
  opacity: .76;
  text-align: center;
}

.publication-section {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: .7fr 1.3fr;
  gap: 80px;
}

.publication-list {
  border-top: 1px solid var(--line);
}

.publication-item {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 70px 1fr 32px;
  gap: 24px;
  align-items: start;
}

.publication-item > span,
.publication-item p {
  color: var(--muted);
}

.publication-item h3 {
  margin-bottom: 7px;
}

.publication-item p {
  margin-bottom: 0;
}

.publication-item > a {
  text-decoration: none;
  font-size: 1.15rem;
}

.contact-section {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.contact-section p:not(.eyebrow) {
  max-width: 600px;
  color: var(--muted);
}

.site-footer {
  width: min(calc(100% - 64px), var(--max-width));
  margin: 0 auto;
  padding: 28px 0 46px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: .86rem;
}

.site-footer div {
  display: flex;
  gap: 20px;
}

.site-footer a {
  text-decoration: none;
}

.observations-hero {
  padding-bottom: 44px;
}

.observations-hero h1 {
  max-width: 1040px;
}

.observations-hero > p:last-child {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.07rem;
}

.observation-browser {
  padding-top: 24px;
}

.browser-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 16px 0;
  background: rgba(245,244,239,.94);
  backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
}

.browser-toolbar label {
  min-width: 0;
}

.browser-toolbar span {
  display: block;
  margin: 0 0 6px 4px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.browser-toolbar input,
.browser-toolbar select {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--cream);
}

.browser-status {
  padding: 18px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

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

.text-button {
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.inat-grid-browser {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.load-more-wrap {
  padding-top: 36px;
  text-align: center;
}

.observation-dialog {
  width: min(920px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  overflow: auto;
  border: 0;
  border-radius: 18px;
  padding: 0;
  color: var(--ink);
  background: var(--cream);
}

.observation-dialog::backdrop {
  background: rgba(10,16,12,.7);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: rgba(0,0,0,.62);
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
}

#dialog-content {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}

.dialog-image-wrap {
  min-height: 560px;
  background: #dde0da;
}

.dialog-image-wrap img {
  width: 100%;
  height: 100%;
  min-height: 560px;
  object-fit: cover;
}

.dialog-copy {
  padding: 54px 42px;
}

.dialog-copy h2 {
  font-size: clamp(2.3rem, 4vw, 4rem);
  margin-bottom: 10px;
}

.dialog-scientific {
  margin-bottom: 34px;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 1.2rem;
}

.dialog-copy dl {
  margin: 0 0 34px;
}

.dialog-copy dl div {
  padding: 13px 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 18px;
}

.dialog-copy dt {
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.dialog-copy dd {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

  .hero-observation,
  .hero-observation-link,
  .hero-observation-link img {
    min-height: 520px;
    height: 520px;
  }

  .hero-observation {
    border-radius: 18px;
  }

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

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

  .publication-section {
    grid-template-columns: 1fr;
    gap: 30px;
  }

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

@media (max-width: 720px) {
  .site-header {
    padding: 18px 20px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .site-nav {
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0 4px;
  }

  .site-nav.open {
    display: flex;
  }

  .section,
  .site-footer {
    width: min(calc(100% - 40px), var(--max-width));
  }

  .section {
    padding: 70px 0;
  }

  h1 {
    font-size: clamp(3.1rem, 15vw, 5rem);
  }

  h2 {
    font-size: clamp(2.4rem, 11vw, 3.6rem);
  }

  .split-section,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .observations-preview {
    width: 100%;
    padding-left: 20px;
    padding-right: 20px;
  }

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

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

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

  #dialog-content {
    grid-template-columns: 1fr;
  }

  .dialog-image-wrap,
  .dialog-image-wrap img {
    min-height: 360px;
  }

  .dialog-copy {
    padding: 34px 24px;
  }

  .site-footer {
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .inat-grid-home {
    gap: 6px;
  }

  .inat-overlay {
    padding: 44px 9px 9px;
  }

  .common-name {
    font-size: .74rem;
  }

  .scientific-name {
    font-size: .88rem;
  }

  .publication-item {
    grid-template-columns: 52px 1fr 22px;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .inat-card img,
  .inat-grid-home {
    transition: none;
  }
}

/* ---- iNaturalist full-history + map additions ---- */
.inat-no-photo {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  background:
    radial-gradient(circle at 28% 28%, rgba(255,255,255,.75), transparent 26%),
    linear-gradient(135deg, #e2e5de, #c9d0c8);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dialog-no-photo {
  width: 100%;
  min-height: 560px;
  display: grid;
  place-items: center;
  padding: 34px;
  color: var(--muted);
  background: linear-gradient(135deg, #e2e5de, #c9d0c8);
  text-align: center;
}

.observation-map-section {
  margin: 32px 0 30px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.map-heading-row {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.map-heading-row h3 {
  margin: 0;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--paper);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.observation-map {
  width: 100%;
  height: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #dde0da;
}

.map-privacy-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
}

.public-coordinate-text {
  font-variant-numeric: tabular-nums;
}

.observation-inat-link {
  margin-top: 4px;
}

.observation-map .leaflet-control-attribution {
  font-size: 9px;
}

@media (max-width: 720px) {
  .observation-map {
    height: 200px;
  }

  .dialog-no-photo {
    min-height: 360px;
  }
}
