:root {
  --bg: #f6f1e6;
  --surface: #fbf8f1;
  --ink: #2b2a25;
  --ink-soft: #5d5a50;
  --muted: #8a857a;
  --line: #e2d9c6;
  --line-strong: #cfc3aa;
  --green: #3f6b3a;
  --green-soft: #e3ebd9;
  --amber: #8a5a12;
  --amber-soft: #f4e6c8;
  --red: #9b3a2e;
  --red-soft: #f6e1da;
  --radius: 10px;
  --sans: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Noto Serif Thai", Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

a { color: var(--green); text-underline-offset: 3px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header */
.site-header { background: var(--bg); }
.tabs-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  margin: 18px 0 0;
  color: var(--green);
}
.tagline {
  margin: 2px 0 10px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.plant-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 16px 10px;
  max-width: 760px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.plant-nav::-webkit-scrollbar { display: none; }
.plant-nav[hidden] { display: none; }
.plant-nav a {
  flex: 0 0 auto;
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 3px 12px;
  white-space: nowrap;
}
.plant-nav a.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.tabs a {
  padding: 8px 12px 10px;
  text-decoration: none;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-weight: 500;
}
.tabs a[aria-current="page"] {
  color: var(--green);
  border-bottom-color: var(--green);
}

main { padding-top: 16px; padding-bottom: 32px; }

.notice {
  font-size: 0.9rem;
  color: var(--ink-soft);
  border-left: 3px solid var(--line-strong);
  padding: 2px 0 2px 12px;
  margin: 4px 0 16px;
}

.toolbar { margin-bottom: 8px; }
#search {
  width: 100%;
  font: inherit;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
#search:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* Tags */
.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.tag-confirmed { background: var(--green-soft); color: var(--green); }
.tag-probable { background: var(--amber-soft); color: var(--amber); }

/* Plant list */
.plant-list { border-top: 1px solid var(--line); }
.plant { border-bottom: 1px solid var(--line); }
.plant > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 2.2em 1fr auto;
  gap: 4px 10px;
  align-items: baseline;
  padding: 14px 4px;
}
.plant > summary::-webkit-details-marker { display: none; }
.plant > summary:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.plant-no { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.plant-name { font-weight: 600; font-size: 1.08rem; }
.plant-sci { grid-column: 2 / 3; color: var(--ink-soft); font-size: 0.88rem; font-style: italic; }
.plant-row-tag { grid-column: 2 / 4; }
.plant-aka { grid-column: 2 / 4; color: var(--muted); font-size: 0.85rem; }
.chev {
  grid-column: 3; grid-row: 1;
  width: 10px; height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin: 0 6px 3px;
  transition: transform 0.15s;
}
.plant[open] .chev { transform: rotate(225deg); margin-bottom: -3px; }
.plant[open] > summary { padding-bottom: 6px; }

.plant-body { padding: 4px 4px 22px calc(2.2em + 14px); }

.figure { margin: 8px 0 4px; }
.figure img {
  display: block;
  width: 100%;
  max-width: 440px;
  height: auto;
  border-radius: var(--radius);
  background: var(--line);
}
.figure figcaption {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 6px;
  max-width: 440px;
}
.figure + .figure { margin-top: 14px; }
.no-image {
  font-size: 0.88rem;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 18px;
  max-width: 440px;
  text-align: center;
}

.block { padding: 14px 0 2px; border-top: 1px solid var(--line); margin-top: 14px; }
.block:first-child { border-top: 0; margin-top: 0; }
.block h3 {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--green);
  margin: 0 0 6px;
}
.block p { margin: 0 0 6px; }
.block ul { margin: 0; padding-left: 1.1em; }
.block li { margin: 2px 0; }

.facts { margin: 0; }
.facts > div {
  display: grid;
  grid-template-columns: 5.5em 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--ink-soft); font-size: 0.9rem; }
.facts dd { margin: 0; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 1px 10px;
  background: var(--surface);
}

.name-note { font-size: 0.88rem; color: var(--ink-soft); }

.block-caution {
  background: var(--red-soft);
  border: 0;
  border-radius: var(--radius);
  padding: 12px 14px;
}
.block-caution h3 { color: var(--red); }

.block-unverified {
  background: var(--amber-soft);
  border: 0;
  border-radius: var(--radius);
  padding: 12px 14px;
}
.block-unverified h3 { color: var(--amber); }
.block-unverified p.hint { font-size: 0.85rem; color: var(--ink-soft); }

.refs { list-style: none; padding: 0 !important; }
.refs li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.refs li:last-child { border-bottom: 0; }
.refs .pub { display: block; color: var(--muted); font-size: 0.8rem; }
.refs .kind { color: var(--amber); }

.empty { color: var(--muted); text-align: center; padding: 24px 0; }

/* Recipes / prose */
.section-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 4px 0 12px;
}
.recipe { padding-bottom: 8px; }
.recipe h3.recipe-title { font-size: 1.1rem; margin: 0; }
.recipe .meta { color: var(--muted); font-size: 0.88rem; margin: 2px 0 10px; }
.ingredients { list-style: none; padding: 0 !important; margin: 0; }
.ingredients li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.ingredients li:last-child { border-bottom: 0; }
.ingredients .amt { color: var(--ink-soft); white-space: nowrap; }
ol.steps { padding-left: 1.3em; margin: 0; }
ol.steps li { margin: 4px 0; }

.prose h3 { font-size: 1rem; margin: 22px 0 6px; color: var(--green); }
.prose p, .prose li { color: var(--ink); }
.prose ul { padding-left: 1.1em; }
.muted { color: var(--muted); font-size: 0.88rem; }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  padding-top: 12px;
  padding-bottom: 28px;
}

@media (min-width: 640px) {
  .brand { font-size: 1.9rem; margin-top: 24px; }
  .facts > div { grid-template-columns: 7em 1fr; }
}
@media (max-width: 420px) {
  .plant-body { padding-left: 4px; }
}
@media (min-width: 640px) {
  .plant-nav { flex-wrap: wrap; overflow-x: visible; }
}
