:root {
  --bg: #12140f;
  --bg2: #181c14;
  --paper: #21261c;
  --paper2: #282e22;
  --ink: #f3efe2;
  --muted: #b7b09f;
  --faint: #847e72;
  --line: rgba(243, 239, 226, 0.12);
  --leaf: #c5d58a;
  --resin: #e2a45a;
  --pepper: #e07a55;
  --lavender: #c9b6e4;
  --gold: #ead78a;
  --danger: #e08a84;
  --water: #8eb8c9;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", Helvetica, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(197, 213, 138, 0.08), transparent 50%),
    radial-gradient(900px 480px at 110% 0%, rgba(226, 164, 90, 0.07), transparent 46%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--resin); color: #1a140c; }
a { color: var(--resin); }
img, svg { max-width: 100%; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 22px;
  background: rgba(18, 20, 15, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.mark {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 22px;
  letter-spacing: 0.14em;
  text-decoration: none;
  color: var(--ink);
}
.marksub {
  margin: 0;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
nav { display: flex; gap: 6px; margin-left: 8px; }
nav button, .ghost, .preset, .chip {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
}
nav button.on, .preset.on {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper);
}
.search { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 13px; }
.search input {
  width: min(280px, 42vw);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  outline: none;
}
.search input:focus { border-color: rgba(226, 164, 90, 0.7); }

.layout {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  align-items: start;
}
.rail {
  position: sticky;
  top: 62px;
  max-height: calc(100vh - 62px);
  overflow: auto;
  padding: 22px 18px 40px;
  border-right: 1px solid var(--line);
}
.railkicker, .kicker, .sgroup {
  margin: 0 0 6px;
  color: var(--resin);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.rail h1 {
  font-family: var(--serif);
  font-weight: 520;
  font-size: 34px;
  line-height: 1.02;
  margin: 0 0 12px;
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.preset { border-color: var(--line); font-size: 13px; }
.preset:hover, nav button:hover, .ghost:hover { color: var(--ink); }

.slide {
  display: grid;
  grid-template-columns: 78px 1fr 22px;
  grid-template-rows: auto auto;
  gap: 0 8px;
  align-items: center;
  margin: 0 0 8px;
}
.slide span { font-size: 14px; }
.slide b { font-variant-numeric: tabular-nums; font-weight: 560; text-align: right; }
.slide small { grid-column: 1 / -1; color: var(--faint); font-size: 11px; margin-top: -2px; }
.sgroup { margin: 14px 0 8px; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--resin) calc(var(--p, 0) * 1%), rgba(243, 239, 226, 0.18) calc(var(--p, 0) * 1%));
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--resin);
  box-shadow: 0 0 0 4px rgba(226, 164, 90, 0.12);
}
input[type="range"]::-moz-range-track {
  height: 2px;
  background: rgba(243, 239, 226, 0.18);
  border: 0;
}
input[type="range"]::-moz-range-progress {
  height: 2px;
  background: var(--resin);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--resin);
  box-shadow: 0 0 0 4px rgba(226, 164, 90, 0.12);
}
.check { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 13px; margin-top: 14px; }
.ghost {
  border-color: var(--line);
  margin-top: 8px;
  color: var(--muted);
}

.stage, .page { padding: 22px 22px 80px; }
.lede {
  max-width: 68ch;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 17px;
}
.lede strong { color: var(--ink); font-weight: 560; }

.still {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.still button, .card, .plant, .region {
  background:
    linear-gradient(180deg, rgba(243, 239, 226, 0.035), transparent 42%),
    var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  color: inherit;
  text-align: left;
}
.still button { padding: 8px 12px 14px; }
.still h3, .card h3, .plant h3, .region h3 {
  font-family: var(--serif);
  font-weight: 520;
  font-size: 26px;
  margin: 4px 0;
  letter-spacing: -0.02em;
}
.still p, .card p { margin: 0; color: var(--muted); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 18px;
  margin-bottom: 16px;
  padding: 8px 8px 8px 0;
}
.hero h2 {
  font-family: var(--serif);
  font-weight: 520;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 0.95;
  margin: 6px 0 8px;
  letter-spacing: -0.03em;
}
.fit {
  font-family: var(--serif);
  font-size: 42px;
  color: var(--leaf);
  margin: 0;
}
.fit span { display: block; font-family: var(--sans); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }

.blend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 18px;
}
.blend article, .callout {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 14px 12px;
  background: var(--bg2);
}
.blend .n {
  font-family: var(--serif);
  color: var(--resin);
  font-size: 20px;
}
.blend h3 { margin: 4px 0; font-family: var(--serif); font-size: 24px; font-weight: 520; }
.blend p, .callout p { margin: 0; color: var(--muted); font-size: 14px; }
.callout { margin-bottom: 14px; border-color: rgba(224, 138, 132, 0.45); }
.callout strong { color: var(--danger); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.card { padding: 8px 12px 14px; display: block; width: 100%; }
.card:hover, .still button:hover, .plant:hover, .region:hover {
  border-color: rgba(226, 164, 90, 0.55);
}
.card .aroma, .still .aroma { color: var(--ink); font-size: 14px; }
.from { margin-top: 8px !important; font-size: 13px; }
.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tag.b { color: var(--water); }
.tag.a { color: var(--leaf); }
.tag.c { color: var(--gold); }
.tag.danger, .tag.neighbor { color: var(--pepper); }
.bars { display: grid; gap: 4px; margin-top: 10px; }
.barline { display: grid; grid-template-columns: 64px 1fr 18px; gap: 6px; align-items: center; color: var(--faint); font-size: 11px; }
.bar { height: 5px; background: rgba(243, 239, 226, 0.08); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--leaf); border-radius: 99px; }
.bar.pain i { background: var(--pepper); }
.bar.feel i { background: var(--lavender); }

.classhead {
  grid-column: 1 / -1;
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 520;
}
.more {
  margin-top: 14px;
}
.foot {
  margin-top: 28px;
  color: var(--faint);
  font-size: 13px;
  max-width: 78ch;
}
.foot a { color: var(--muted); }

.page h1, .pagehead {
  font-family: var(--serif);
  font-weight: 520;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.95;
  margin: 0 0 8px;
  letter-spacing: -0.03em;
}
.regions, .plants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.region, .plant { padding: 14px; width: 100%; }
.region p, .plant p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.latin { font-family: var(--serif); font-style: italic; color: var(--leaf) !important; }
.trees {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.tree {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 12px 18px;
  background: var(--paper);
  min-height: 420px;
}
.tree h2 { font-family: var(--serif); font-weight: 520; font-size: 32px; margin: 8px 0; }
.tree svg { width: 100%; height: 250px; color: var(--muted); }
.schema {
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  background: #0e100c;
  color: var(--leaf);
  font-family: var(--mono);
  font-size: 12px;
  overflow: auto;
  line-height: 1.55;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 7, 0.62);
  z-index: 30;
}
.sheet {
  position: fixed;
  z-index: 31;
  top: 0;
  right: 0;
  height: 100%;
  width: min(760px, 100%);
  overflow: auto;
  background: #161910;
  border-left: 1px solid var(--line);
  padding: 22px 22px 64px;
}
.sheet header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sheet h2 {
  font-family: var(--serif);
  font-weight: 520;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 0.95;
  margin: 6px 0;
  letter-spacing: -0.03em;
  padding-right: 8px;
}
.close {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
}
.struct { display: block; width: 100%; height: auto; }
.sheet .struct { background: #10130e; border-radius: 16px; border: 1px solid var(--line); }
.prose { font-size: 16.5px; max-width: 68ch; }
.prose p { color: var(--muted); }
.prose strong { color: var(--ink); font-weight: 600; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 8px 0 16px;
}
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--faint); font-weight: 500; width: 38%; }
td { font-variant-numeric: tabular-nums; }
.iupac { font-family: var(--mono); font-size: 12px; line-height: 1.45; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.links a, .textbtn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
  background: transparent;
}
.src { margin: 10px 0; padding-top: 8px; border-top: 1px solid var(--line); }
.src h4 { margin: 0 0 4px; font-size: 16px; }
.fullbars { display: grid; gap: 6px; margin: 10px 0 16px; }
.hrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .rail { position: relative; top: 0; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .still, .blend, .hero, .trees { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; }
  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; }
  .marksub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
