:root {
  color-scheme: dark;
  --ink: #edf4ed;
  --muted: #a9b9ac;
  --line: #304438;
  --panel: #142019;
  --wash: #0b100d;
  --field: #101a14;
  --card: #17251d;
  --hero-overlay-strong: rgba(4, 9, 6, 0.74);
  --hero-overlay-mid: rgba(4, 9, 6, 0.28);
  --hero-overlay-soft: rgba(4, 9, 6, 0.04);
  --leaf: #6dbb7a;
  --leaf-dark: #9bd6a4;
  --gold: #d5a84a;
  --rose: #db7e8b;
  --sky: #8bb7df;
  --chip-bg: #183044;
  --badge-bg: #203d2a;
  --hint-bg: #251a1a;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.36);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --ink: #1d2420;
  --muted: #617067;
  --line: #d9e0d8;
  --panel: #ffffff;
  --wash: #f4f7f2;
  --field: #fbfcfa;
  --card: #ffffff;
  --hero-overlay-strong: rgba(17, 29, 23, 0.68);
  --hero-overlay-mid: rgba(17, 29, 23, 0.14);
  --hero-overlay-soft: rgba(17, 29, 23, 0.02);
  --leaf: #2f6f4e;
  --leaf-dark: #244f3d;
  --gold: #b98927;
  --rose: #8d4e57;
  --sky: #4a6f8f;
  --chip-bg: #eef3f7;
  --badge-bg: #edf6ef;
  --hint-bg: #fff8f6;
  --shadow: 0 18px 55px rgba(33, 45, 38, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
}

html.modal-open,
body.modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.modal-open {
  position: fixed;
  left: 0;
  right: 0;
  height: 100%;
  width: 100%;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  outline-color: var(--leaf);
}

a {
  color: inherit;
}

.app-header {
  background: var(--wash);
}

.ghost-button,
.primary-link,
.tag-button,
.icon-button,
.theme-toggle {
  min-height: 2.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.ghost-button,
.primary-link,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0 0.9rem;
}

.theme-toggle {
  gap: 0.5rem;
  font-weight: 800;
}

.theme-icon {
  display: grid;
  width: 1.25rem;
  height: 1.25rem;
  place-items: center;
  color: var(--gold);
  font-size: 1rem;
}

.primary-link {
  background: var(--leaf);
  border-color: var(--leaf);
  color: var(--wash);
  font-weight: 700;
}

.hero {
  min-height: 280px;
  max-height: 400px;
  display: grid;
  align-items: end;
  padding: 2.5rem clamp(1rem, 5vw, 5rem) 2.25rem;
  background:
    linear-gradient(90deg, var(--hero-overlay-strong), var(--hero-overlay-mid) 56%, var(--hero-overlay-soft)),
    url("assets/botanical-header-banner.png") center / cover;
}

.hero-copy {
  max-width: 680px;
  color: #fff;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #f4d48f;
}

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

h1 {
  margin-bottom: 0.6rem;
  font-size: clamp(2.1rem, 4.2vw, 3.8rem);
  line-height: 1;
}

.wordmark {
  width: min(680px, 92vw);
  margin-bottom: 0.85rem;
}

.wordmark-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.wordmark svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.wordmark-main {
  fill: #f9fff8;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0;
}

.wordmark-main {
  font-size: 76px;
}

.wordmark-domain {
  fill: #d7efbd;
  font-style: italic;
}

.wordmark-leaf {
  fill: #7fcf83;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.28));
}

.wordmark-stem {
  fill: none;
  stroke: #d7efbd;
  stroke-linecap: round;
}

.wordmark-stem {
  stroke-width: 5;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

h3 {
  margin-bottom: 0.45rem;
  font-size: 1rem;
}

.hero p:not(.eyebrow) {
  max-width: 620px;
  margin-bottom: 0;
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
  line-height: 1.55;
}

main {
  position: relative;
  padding: clamp(1rem, 4vw, 3rem);
}

main::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  right: 0;
  height: 96px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(109, 187, 122, 0.1), rgba(109, 187, 122, 0)),
    var(--wash);
}

main.legal-page::before {
  content: none;
}

main > * {
  position: relative;
  z-index: 1;
}

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

.search-panel {
  margin-top: 0;
  padding: clamp(1rem, 3vw, 2rem);
}

.section-heading {
  margin-bottom: 1.4rem;
}

.section-heading.compact,
.section-heading.inline {
  margin-bottom: 1rem;
}

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

.search-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.search-box,
.sort-control {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.search-field {
  position: relative;
  display: block;
}

.search-box input,
.sort-control select {
  width: 100%;
  min-height: 3.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 1rem;
  background: var(--field);
  color: var(--ink);
}

.search-box input {
  padding-right: 3.35rem;
}

.search-submit {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.search-submit:hover,
.search-submit:focus-visible {
  background: var(--badge-bg);
  color: var(--leaf-dark);
}

.search-submit svg {
  width: 1.2rem;
  height: 1.2rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.25rem;
}

.tag-button {
  padding: 0 0.85rem;
  color: var(--muted);
}

.tag-button.active {
  background: var(--leaf-dark);
  border-color: var(--leaf-dark);
  color: var(--wash);
}

.plant-directory {
  margin-top: 1.25rem;
}

.plant-directory {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.hint,
.search-warning {
  padding: 1rem;
  border-left: 4px solid var(--rose);
  background: var(--hint-bg);
}

.hint p,
.search-warning p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.plant-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
  gap: 0.9rem;
  align-items: stretch;
}

.plant-card {
  display: grid;
  gap: 1rem;
  min-height: 100%;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.plant-card:hover,
.plant-card:focus-visible {
  border-color: var(--leaf);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

.plant-card:focus-visible {
  outline: 2px solid var(--leaf);
  outline-offset: 3px;
}

.plant-photo,
.dialog-photo {
  margin: 0;
}

.plant-photo {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.plant-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plant-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.plant-card h3 {
  margin-bottom: 0.2rem;
  font-size: 1.2rem;
}

.botanical {
  margin-bottom: 0;
  color: var(--muted);
  font-style: italic;
}

.summary {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.card-evidence {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.evidence-dots {
  display: inline-flex;
  gap: 0.22rem;
}

.evidence-dot {
  width: 0.44rem;
  height: 0.44rem;
  border-radius: 999px;
  background: #174027;
}

.evidence-dot.active {
  background: var(--leaf);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0 0.55rem;
  border-radius: 8px;
  background: var(--chip-bg);
  color: var(--sky);
  font-size: 0.82rem;
  font-weight: 700;
}

.abbr-term {
  border-bottom: 1px dotted currentColor;
  color: inherit;
  cursor: help;
  text-decoration: none;
}

.abbr-tooltip {
  position: fixed;
  z-index: 10000;
  display: none;
  width: max-content;
  max-width: min(18rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  overflow: auto;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  pointer-events: auto;
}

.abbr-tooltip.is-visible {
  display: block;
}

.plant-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
  margin-top: auto;
}

.detail-hint {
  color: var(--leaf-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.evidence-detail {
  display: inline-flex;
  margin-bottom: 0.7rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: var(--badge-bg);
  color: var(--leaf-dark);
  font-size: 0.88rem;
  font-weight: 800;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.plant-dialog {
  position: relative;
  background: var(--panel);
  color: var(--ink);
  width: min(920px, calc(100vw - 2rem));
  max-height: min(88vh, 900px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  overscroll-behavior: contain;
}

.plant-dialog::backdrop {
  background: rgba(2, 5, 3, 0.72);
}

.dialog-shell {
  position: relative;
  max-height: min(88vh, 900px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: clamp(1rem, 3vw, 2rem);
}

.close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.4rem;
  padding: 0;
  font-weight: 900;
}

.dialog-header {
  padding-right: 3rem;
}

.dialog-header h2 {
  margin-bottom: 0.3rem;
}

.dialog-photo {
  margin-top: 1.25rem;
}

.zoom-trigger {
  display: flex;
  width: 100%;
  max-height: 420px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  cursor: zoom-in;
  overflow: hidden;
}

.dialog-photo img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 420px;
  height: auto;
  object-fit: contain;
}

.dialog-photo figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.dialog-photo a {
  color: var(--leaf-dark);
  font-weight: 800;
}

.image-dialog {
  place-items: center;
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  padding: clamp(1rem, 3vw, 2.5rem);
  border: 0;
  border-radius: 0;
  background: rgba(9, 14, 10, 0.96);
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
}

.image-dialog[open] {
  display: grid;
}

.image-dialog::backdrop {
  background: rgba(2, 5, 3, 0.86);
}

.image-dialog-close {
  position: fixed;
  top: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2rem);
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.image-dialog img {
  display: block;
  max-width: calc(100vw - clamp(2rem, 6vw, 5rem));
  max-height: calc(100vh - clamp(2rem, 6vw, 5rem));
  width: auto;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  cursor: zoom-out;
  object-fit: contain;
  transform-origin: center;
  transition: transform 120ms ease;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(260px, 0.55fr);
  gap: 1rem;
  margin-top: 1.4rem;
}

.detail-section {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.detail-section.hint {
  padding: 1rem;
}

.detail-section p,
.detail-section li {
  color: var(--muted);
  line-height: 1.6;
}

.key-data {
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

.key-data div {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.key-data dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.key-data dd {
  margin: 0.25rem 0 0;
}

.reference-list a {
  color: var(--leaf-dark);
  font-weight: 800;
}

.site-footer {
  padding: 1.25rem clamp(1rem, 4vw, 3rem) 2rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 1rem;
  max-width: 1180px;
  margin: 0 auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.footer-warning {
  padding: 0.85rem 1rem;
}

.footer-inner a {
  justify-self: end;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
}

.footer-inner a:hover,
.footer-inner a:focus-visible {
  color: var(--leaf-dark);
}

.legal-page {
  min-height: 100vh;
  display: grid;
  align-content: start;
  gap: 1rem;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(1.25rem, 5vw, 4rem);
}

.back-link {
  color: var(--leaf-dark);
  font-weight: 800;
  text-decoration: none;
}

.legal-content {
  padding: clamp(1rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.legal-content h1 {
  font-size: clamp(2rem, 6vw, 3.5rem);
}

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

  .footer-inner {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .footer-inner a {
    justify-self: start;
  }

  .theme-toggle {
    justify-content: center;
    width: 100%;
  }

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

@media (max-width: 560px) {
  .theme-toggle {
    padding: 0 0.7rem;
  }

  .plant-dialog {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border-radius: 0;
  }

  .dialog-shell {
    height: 100vh;
    height: 100dvh;
    max-height: none;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .filter-row {
    display: none;
  }

  .hero {
    min-height: 250px;
    max-height: 360px;
    align-items: stretch;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .hero-copy {
    display: grid;
    grid-template-rows: auto 1fr;
    width: 100%;
    min-height: 218px;
  }

  .hero .eyebrow {
    align-self: start;
  }

  .wordmark {
    align-self: center;
    margin-bottom: 0;
  }

  .hero p:not(.eyebrow) {
    display: none;
  }

  .plant-list {
    grid-template-columns: 1fr;
  }
}
