/* sPROUT — folha de estilo
   Princípios de movimento: ver DESIGN.md (Emil Kowalski). */

:root {
  --paper: #F5F6EF;
  --paper-2: #ECEEE3;
  --paper-3: #E2E6D6;
  --ink: #1E271C;
  --ink-2: #4A5446;
  --ink-3: #6E7868;
  --rule: #D3D8C8;
  --sprout: #4C7526;
  --sprout-bright: #79A83B;
  --sprout-tint: rgba(76, 117, 38, 0.07);
  --berry: #8E2C3A;
  --berry-tint: rgba(142, 44, 58, 0.06);
  --ochre: #8A5E0E;
  --ochre-tint: rgba(170, 120, 20, 0.08);
  --root: #6B4A2E;
  --kraft: #EEE5D0;
  --kraft-line: #D6C7A6;
  --header-bg: rgba(245, 246, 239, 0.82);
  --shadow-pop: 0 1px 2px rgba(30, 39, 28, 0.08), 0 8px 24px -6px rgba(30, 39, 28, 0.18);
  --shadow-dialog: 0 2px 4px rgba(30, 39, 28, 0.06), 0 24px 60px -12px rgba(30, 39, 28, 0.32);

  --serif: "Alegreya", "Iowan Old Style", Georgia, serif;
  --sans: "Alegreya Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --header-h: 3.75rem;
  --sidebar-w: 17rem;
  --measure: 34em;
  --margin-w: 15rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131811;
    --paper-2: #192017;
    --paper-3: #222B1F;
    --ink: #E4E8DA;
    --ink-2: #B3BCA9;
    --ink-3: #8C9683;
    --rule: #2F3A2B;
    --sprout: #9CCB5E;
    --sprout-bright: #8DBE4F;
    --sprout-tint: rgba(156, 203, 94, 0.08);
    --berry: #E58A97;
    --berry-tint: rgba(229, 138, 151, 0.08);
    --ochre: #E0B45A;
    --ochre-tint: rgba(224, 180, 90, 0.08);
    --root: #B48A60;
    --kraft: #2A2619;
    --kraft-line: #4A4230;
    --header-bg: rgba(19, 24, 17, 0.8);
    --shadow-pop: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -6px rgba(0, 0, 0, 0.6);
    --shadow-dialog: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 60px -12px rgba(0, 0, 0, 0.7);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.6;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--sprout); text-decoration-thickness: 0.06em; text-underline-offset: 0.18em; }
a:visited { color: var(--sprout); }
button, a, [role="button"], summary { touch-action: manipulation; }
button { font: inherit; color: inherit; }
button, [role="button"], .btn { user-select: none; -webkit-user-select: none; }
input, textarea, select { font-size: 16px; }
:focus-visible { outline: 2px solid var(--sprout); outline-offset: 3px; border-radius: 3px; }
::selection { background: color-mix(in srgb, var(--sprout) 28%, transparent); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
kbd {
  font-family: var(--sans); font-size: 0.75rem; line-height: 1;
  padding: 0.2rem 0.4rem; border: 1px solid var(--rule); border-bottom-width: 2px;
  border-radius: 4px; color: var(--ink-3);
}
.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 0.5rem 0.9rem; border-radius: 6px;
  font-family: var(--sans);
}
.skip:focus { top: 0.75rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(1rem, env(safe-area-inset-right, 0px)) 0 max(1rem, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 70%, transparent);
  font-family: var(--sans);
}
@media (prefers-reduced-transparency: reduce) {
  .site-header { background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--ink); text-decoration: none; margin-right: auto;
  font-family: var(--serif); font-weight: 700; font-size: 1.375rem; letter-spacing: -0.01em;
}
.brand:visited { color: var(--ink); }
.brand svg { width: 1.6rem; height: 1.6rem; flex-shrink: 0; }
.wordmark .s { font-style: italic; color: var(--sprout); font-weight: 700; margin-right: 0.02em; }
.wordmark .p { letter-spacing: 0.02em; }
.header-actions { display: flex; align-items: center; gap: 0.35rem; }
.icon-btn, .text-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  height: 2.5rem; padding: 0 0.75rem; border-radius: 999px;
  border: 1px solid transparent; background: transparent; cursor: pointer;
  color: var(--ink-2); font-family: var(--sans); font-size: 1rem; text-decoration: none;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}
.icon-btn:visited, .text-btn:visited { color: var(--ink-2); }
.icon-btn svg { width: 1.15rem; height: 1.15rem; }
.icon-btn:active, .text-btn:active, .btn:active { transform: scale(0.97); }
.search-btn { border-color: var(--rule); background: var(--paper); min-width: 2.5rem; }
.search-btn kbd { display: none; }
.menu-btn { display: none; }
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover, .text-btn:hover { background: var(--paper-2); color: var(--ink); }
  .search-btn kbd { display: inline-block; }
  .brand:hover .wordmark .p { color: var(--ink-2); }
}

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  max-width: 92rem; margin: 0 auto;
}
.sidebar {
  position: sticky; top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  align-self: start;
  height: calc(100dvh - var(--header-h) - env(safe-area-inset-top, 0px));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 1.75rem 1rem 3rem 1.25rem;
  border-right: 1px solid var(--rule);
  font-family: var(--sans); font-size: 0.96875rem; line-height: 1.35;
  scrollbar-width: thin;
}
.main { min-width: 0; padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 5rem; }

/* sidebar tree */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree > li { margin-bottom: 0.35rem; }
.tree a { color: var(--ink-2); text-decoration: none; display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.3rem 0.5rem; border-radius: 6px; }
.tree a:visited { color: var(--ink-2); }
.tree .sec > a { color: var(--ink); font-weight: 500; }
.tree .sec > a .part { display: block; font-weight: 400; font-size: 0.8125rem; color: var(--ink-3); }
.tree .ico { width: 1.15rem; height: 1.15rem; flex-shrink: 0; margin-top: 0.1rem; color: var(--sprout); }
.tree ul { margin: 0.15rem 0 0.6rem 1.15rem; border-left: 1px solid var(--rule); }
.tree ul a { padding-left: 0.85rem; font-size: 0.9375rem; }
.tree a[aria-current="page"] { color: var(--sprout); background: var(--sprout-tint); font-weight: 500; }
.tree .seen::after {
  content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50% 0; margin: 0.42rem 0 0 auto; flex-shrink: 0;
  background: var(--sprout-bright); opacity: 0.8; transform: rotate(-45deg);
}
.tree .onpage { margin: 0.1rem 0 0.4rem 0.85rem; border-left: 0; }
.tree .onpage a { font-size: 0.875rem; color: var(--ink-3); padding: 0.18rem 0.5rem; }
.tree .onpage a:visited { color: var(--ink-3); }
@media (hover: hover) and (pointer: fine) {
  .tree a:hover { background: var(--paper-2); color: var(--ink); }
}
.sidebar-foot { margin-top: 1.5rem; padding: 1rem 0.5rem 0; border-top: 1px solid var(--rule); color: var(--ink-3); font-size: 0.875rem; }
.progress-line { display: flex; align-items: center; gap: 0.6rem; font-variant-numeric: tabular-nums; }
.progress-bar { flex: 1; height: 4px; background: var(--paper-3); border-radius: 2px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 100%; background: var(--sprout-bright); transform-origin: left; transform: scaleX(var(--p, 0)); }

/* ---------- page head ---------- */
.page { max-width: calc(var(--measure) + 1px); }
.crumbs { font-family: var(--sans); font-size: 0.9375rem; color: var(--ink-3); margin: 0 0 1rem; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:visited { color: var(--ink-3); }
.crumbs span[aria-hidden] { margin: 0 0.4rem; }
@media (hover: hover) and (pointer: fine) { .crumbs a:hover { color: var(--sprout); } }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.15; text-wrap: balance; color: var(--ink); }
h1 { font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.25rem); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 1rem; }
.lede { font-size: 1.3125rem; line-height: 1.5; color: var(--ink-2); margin: 0 0 1.75rem; text-wrap: pretty; }
.page-head { margin-bottom: 2.5rem; }
.label-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem 1.5rem; }

/* herbarium label */
.etiqueta {
  font-family: var(--sans); font-size: 0.875rem; line-height: 1.3;
  background: var(--kraft); border: 1px solid var(--kraft-line); border-radius: 3px;
  padding: 0.6rem 0.8rem 0.65rem; min-width: 14rem;
  display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.9rem; margin: 0;
  color: var(--ink-2);
}
.etiqueta dt { color: var(--ink-3); }
.etiqueta dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.etiqueta dd em { font-style: italic; }

/* ---------- prose ---------- */
.prose { position: relative; }
.prose > * { max-width: var(--measure); }
.prose p { margin: 0 0 1.15rem; text-wrap: pretty; hyphens: auto; }
.prose h2 { font-size: 1.875rem; font-weight: 700; letter-spacing: -0.015em; margin: 3rem 0 1rem; }
.prose h3 { font-size: 1.375rem; font-weight: 700; margin: 2.25rem 0 0.6rem; letter-spacing: -0.005em; }
.prose h4 { font-family: var(--sans); font-size: 1.0625rem; font-weight: 700; margin: 1.75rem 0 0.4rem; }
.prose ul, .prose ol { padding-left: 1.35rem; margin: 0 0 1.25rem; }
.prose li { margin-bottom: 0.4rem; }
.prose li::marker { color: var(--ink-3); }
.prose ol > li::marker { font-family: var(--sans); font-weight: 500; color: var(--sprout); }
.prose strong { font-weight: 700; }
.prose blockquote {
  margin: 1.75rem 0; padding: 0 0 0 1.25rem; border-left: 2px solid var(--rule);
  font-style: italic; color: var(--ink-2);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose blockquote cite { display: block; margin-top: 0.4rem; font-style: normal; font-family: var(--sans); font-size: 0.9375rem; color: var(--ink-3); }
.prose .principio {
  font-size: 1.5rem; line-height: 1.35; font-style: italic; color: var(--ink);
  border-left: 3px solid var(--sprout); padding: 0.25rem 0 0.25rem 1.25rem; margin: 0 0 2rem;
}
.prose .principio p { margin: 0; }
.prose .principio small { display: block; font-style: normal; font-family: var(--sans); font-size: 0.875rem; color: var(--ink-3); margin-top: 0.6rem; }

/* tables */
.table-wrap { overflow-x: auto; margin: 1.5rem 0 2rem; max-width: var(--measure); }
.prose table { border-collapse: collapse; width: 100%; font-size: 1rem; line-height: 1.4; }
.prose th { font-family: var(--sans); font-weight: 700; text-align: left; font-size: 0.9375rem; color: var(--ink-2); border-bottom: 1.5px solid var(--ink-3); padding: 0.5rem 0.75rem 0.5rem 0; vertical-align: bottom; }
.prose td { border-bottom: 1px solid var(--rule); padding: 0.6rem 0.75rem 0.6rem 0; vertical-align: top; }
.prose td:first-child { font-weight: 500; }

/* blocks */
.bloco { margin: 2rem 0; padding: 1.1rem 1.3rem 0.35rem; border-radius: 0 8px 8px 0; border-left: 3px solid; }
.bloco > .rotulo { display: flex; align-items: center; gap: 0.45rem; font-family: var(--sans); font-weight: 700; font-size: 0.9375rem; margin: 0 0 0.55rem; }
.bloco > .rotulo svg { width: 1.05rem; height: 1.05rem; flex-shrink: 0; }
.bloco p { margin-bottom: 0.85rem; }
.bloco ul, .bloco ol { margin-bottom: 0.85rem; }
.bloco-lente { border-color: var(--sprout); background: var(--sprout-tint); }
.bloco-lente > .rotulo { color: var(--sprout); }
.bloco-espinho { border-color: var(--berry); background: var(--berry-tint); }
.bloco-espinho > .rotulo { color: var(--berry); }
.bloco-roda { border-color: var(--ochre); background: var(--ochre-tint); }
.bloco-roda > .rotulo { color: var(--ochre); }
.bloco-roda ol { padding-left: 1.2rem; }
.bloco-roda ol > li::marker { color: var(--ochre); }
.bloco-nota { border-color: var(--ink-3); background: var(--paper-2); }
.bloco-nota > .rotulo { color: var(--ink-2); }

/* margin notes: inline on narrow screens, in the margin on wide */
.margem {
  font-family: var(--sans); font-size: 0.96875rem; line-height: 1.45; color: var(--ink-2);
  border-left: 2px solid var(--sprout-bright); padding: 0.1rem 0 0.1rem 0.9rem; margin: 0 0 1.25rem;
}
.margem p { margin: 0 0 0.5rem; hyphens: manual; }
.margem p:last-child { margin-bottom: 0; }
.margem .rotulo { display: block; font-weight: 700; color: var(--sprout); font-size: 0.875rem; margin-bottom: 0.2rem; }
@media (min-width: 1340px) {
  .page { max-width: calc(var(--measure) + var(--margin-w) + 3rem); }
  .page-head, .page-foot { max-width: var(--measure); }
  .page .prose { padding-right: calc(var(--margin-w) + 3rem); }
  .page .prose > .table-wrap { clear: right; max-width: calc(var(--measure) + var(--margin-w) + 3rem); margin-right: calc(-1 * (var(--margin-w) + 3rem)); }
  .page .prose > .margem {
    float: right; clear: right; width: var(--margin-w);
    margin: 0.3rem calc(-1 * (var(--margin-w) + 3rem)) 1rem 0;
    border-left: 0; border-top: 2px solid var(--sprout-bright); padding: 0.55rem 0 0;
  }
}

/* figures */
.fig { margin: 2.25rem 0; max-width: var(--measure); }
.fig svg { display: block; width: 100%; height: auto; overflow: visible; }
.fig figcaption { font-family: var(--sans); font-size: 0.9375rem; line-height: 1.4; color: var(--ink-3); margin-top: 0.75rem; }
.fig .lbl { font-family: var(--sans); font-size: 15px; fill: var(--ink); }
.fig .lbl-s { font-family: var(--sans); font-size: 13px; fill: var(--ink-2); }
.fig .lbl-b { font-family: var(--sans); font-size: 15px; font-weight: 700; fill: var(--ink); }
.fig .lbl-t { font-family: var(--serif); font-size: 20px; font-weight: 700; fill: var(--ink); }

/* catalog of subpages */
.prose .catalogo, .catalogo { list-style: none; padding: 0; margin: 1.5rem 0 2.5rem; border-top: 1px solid var(--rule); }
.catalogo li { margin: 0; padding: 1.1rem 0 1.15rem; border-bottom: 1px solid var(--rule); }
.catalogo a { font-size: 1.3125rem; font-weight: 700; text-decoration: none; color: var(--ink); letter-spacing: -0.005em; }
.catalogo a:visited { color: var(--ink); }
.catalogo p { margin: 0.25rem 0 0.35rem; color: var(--ink-2); }
.catalogo .meta { font-family: var(--sans); font-size: 0.875rem; color: var(--ink-3); }
@media (hover: hover) and (pointer: fine) { .catalogo a:hover { color: var(--sprout); } }

/* glossary */
.glossario dt { font-weight: 700; font-size: 1.1875rem; margin-top: 1.4rem; scroll-margin-top: calc(var(--header-h) + 2rem); }
.glossario dt .orig { font-family: var(--sans); font-weight: 400; font-size: 0.875rem; color: var(--ink-3); margin-left: 0.4rem; }
.glossario dd { margin: 0.25rem 0 0; color: var(--ink-2); }
.glossario dd a.ver { font-family: var(--sans); font-size: 0.9375rem; }
.glossario dt:target { color: var(--sprout); }
.alfabeto { display: flex; flex-wrap: wrap; gap: 0.25rem; font-family: var(--sans); margin: 0 0 1rem; }
.alfabeto a { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 6px; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .alfabeto a:hover { background: var(--paper-2); } }

/* term links */
a.termo { color: inherit; text-decoration: underline dotted; text-decoration-color: var(--sprout); text-decoration-thickness: 1.5px; text-underline-offset: 0.22em; }
a.termo:visited { color: inherit; }
.termo-pop {
  position: absolute; z-index: 40; max-width: 21rem; width: max-content;
  background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: 0.75rem 0.9rem 0.8rem; font-family: var(--sans); font-size: 0.96875rem; line-height: 1.45;
  opacity: 0; transform: scale(0.97); pointer-events: none;
  transition: opacity 125ms var(--ease-out), transform 125ms var(--ease-out);
}
.termo-pop[data-open] { opacity: 1; transform: none; pointer-events: auto; }
.termo-pop[data-instant] { transition-duration: 0ms; }
.termo-pop b { display: block; font-family: var(--serif); font-size: 1.0625rem; margin-bottom: 0.2rem; }
.termo-pop a { font-size: 0.9375rem; }

/* pager & sources */
.page-foot { margin-top: 3.5rem; }
.fontes { font-family: var(--sans); font-size: 0.96875rem; color: var(--ink-2); border-top: 1px solid var(--rule); padding-top: 1.25rem; }
.fontes h2 { font-family: var(--sans); font-size: 1rem; font-weight: 700; margin: 0 0 0.6rem; color: var(--ink-2); letter-spacing: 0; }
.fontes ul { margin: 0; padding-left: 1.1rem; }
.fontes li { margin-bottom: 0.35rem; overflow-wrap: anywhere; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.5rem; }
.pager a {
  display: block; padding: 1rem 1.1rem; border: 1px solid var(--rule); border-radius: 10px;
  text-decoration: none; color: var(--ink);
  transition: transform 160ms var(--ease-out), border-color 150ms ease;
}
.pager a:visited { color: var(--ink); }
.pager a:active { transform: scale(0.98); }
.pager .dir { display: block; font-family: var(--sans); font-size: 0.875rem; color: var(--ink-3); margin-bottom: 0.2rem; }
.pager .t { font-weight: 700; line-height: 1.25; }
.pager .next { text-align: right; grid-column: 2; }
@media (hover: hover) and (pointer: fine) { .pager a:hover { border-color: var(--sprout); } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 3rem; padding: 0 1.25rem;
  border-radius: 999px; font-family: var(--sans); font-size: 1.0625rem; font-weight: 500; text-decoration: none;
  border: 1px solid var(--rule); color: var(--ink); background: var(--paper); cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease;
}
.btn:visited { color: var(--ink); }
.btn-primary { background: var(--sprout); border-color: var(--sprout); color: var(--paper); }
.btn-primary:visited { color: var(--paper); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: var(--ink-3); }
  .btn-primary:hover { background: color-mix(in srgb, var(--sprout) 88%, var(--ink)); border-color: transparent; }
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 0.96875rem; color: var(--ink-3);
  padding: 2rem max(1.25rem, env(safe-area-inset-right, 0px)) calc(2.5rem + env(safe-area-inset-bottom, 0px)) max(1.25rem, env(safe-area-inset-left, 0px));
}
.site-footer .inner { max-width: 92rem; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; justify-content: space-between; }
.site-footer p { margin: 0 0 0.4rem; max-width: 40rem; }
.site-footer a { color: var(--ink-2); }
.site-footer a:visited { color: var(--ink-2); }

/* ---------- drawer (mobile nav) ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 45; background: rgba(12, 16, 11, 0.42);
  opacity: 0; pointer-events: none; transition: opacity 200ms ease;
}
.scrim[data-open] { opacity: 1; pointer-events: auto; transition-duration: 300ms; }

@media (max-width: 959px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; height: 100dvh;
    width: min(21rem, 86vw); background: var(--paper); border-right: 1px solid var(--rule);
    padding: calc(1.25rem + env(safe-area-inset-top, 0px)) 1rem calc(2rem + env(safe-area-inset-bottom, 0px)) max(1.1rem, env(safe-area-inset-left, 0px));
    transform: translateX(-100%); visibility: hidden;
    transition: transform 200ms var(--ease-out), visibility 0s linear 200ms;
    box-shadow: var(--shadow-dialog);
  }
  .sidebar[data-open] {
    transform: none; visibility: visible;
    transition: transform 300ms var(--ease-drawer), visibility 0s;
  }
  .drawer-head { display: flex !important; }
  .main { padding-top: 1.75rem; }
  .search-btn .txt { display: none; }
}
.drawer-head { display: none; align-items: center; justify-content: space-between; margin: 0 0 1rem 0.4rem; }
.drawer-head .brand { font-size: 1.25rem; }

/* home: the plant is the map, so the tree lives in the drawer at every width */
.home .shell { grid-template-columns: minmax(0, 1fr); }
.home .menu-btn { display: inline-flex; }
@media (min-width: 960px) {
  .home .sidebar {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; height: 100dvh;
    width: 21rem; background: var(--paper); border-right: 1px solid var(--rule);
    padding: calc(1.25rem + env(safe-area-inset-top, 0px)) 1rem 2rem 1.1rem;
    transform: translateX(-100%); visibility: hidden;
    transition: transform 200ms var(--ease-out), visibility 0s linear 200ms;
    box-shadow: var(--shadow-dialog);
  }
  .home .sidebar[data-open] { transform: none; visibility: visible; transition: transform 300ms var(--ease-drawer), visibility 0s; }
  .home .drawer-head { display: flex; }
}

/* ---------- search dialog ---------- */
.busca {
  border: 0; padding: 0; margin: 10vh auto auto; width: min(42rem, calc(100vw - 2rem));
  max-height: 76vh; border-radius: 14px; background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-dialog); overflow: hidden;
  font-family: var(--sans);
}
.busca::backdrop { background: rgba(12, 16, 11, 0.45); }
.busca[open].animar { animation: busca-in 150ms var(--ease-out); }
.busca[open].animar::backdrop { animation: fade-in 150ms ease; }
@keyframes busca-in { from { opacity: 0; transform: scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }
.busca form { display: flex; align-items: center; gap: 0.6rem; padding: 0.9rem 1rem; border-bottom: 1px solid var(--rule); }
.busca form svg { width: 1.2rem; height: 1.2rem; color: var(--ink-3); flex-shrink: 0; }
.busca input {
  flex: 1; border: 0; background: transparent; color: var(--ink); font-family: var(--sans); font-size: 1.1875rem; outline: none; min-width: 0;
}
.busca input::placeholder { color: var(--ink-3); }
.busca input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.busca .fechar { height: 2rem; padding: 0 0.6rem; font-size: 0.875rem; }
.resultados { list-style: none; margin: 0; padding: 0.4rem; overflow-y: auto; max-height: calc(76vh - 4.5rem); overscroll-behavior: contain; }
.resultados li a { display: block; padding: 0.7rem 0.8rem; border-radius: 8px; text-decoration: none; color: var(--ink); }
.resultados li a:visited { color: var(--ink); }
.resultados li[aria-selected="true"] a { background: var(--sprout-tint); }
.resultados .r-t { font-family: var(--serif); font-weight: 700; font-size: 1.125rem; display: block; }
.resultados .r-s { font-size: 0.875rem; color: var(--ink-3); display: block; margin-bottom: 0.15rem; }
.resultados .r-x { font-size: 0.96875rem; color: var(--ink-2); display: block; line-height: 1.4; }
.resultados mark { background: color-mix(in srgb, var(--sprout-bright) 30%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.resultados .vazio { padding: 1.25rem 1rem; color: var(--ink-2); line-height: 1.45; }
@media (hover: hover) and (pointer: fine) { .resultados li a:hover { background: var(--paper-2); } }

/* ---------- home ---------- */
.home .main { padding-top: 0; }
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 2rem 3rem; align-items: center;
  min-height: calc(100svh - var(--header-h)); padding: 2rem 0 1rem;
}
.hero-text { max-width: 34rem; }
.hero .display {
  font-family: var(--serif); font-weight: 800; letter-spacing: -0.035em; line-height: 0.9;
  font-size: clamp(4.25rem, 2rem + 9vw, 8.5rem); margin: 0 0 1.25rem; color: var(--ink);
}
.hero .display .s { font-style: italic; color: var(--sprout); font-weight: 700; letter-spacing: -0.02em; }
.hero .display .gloss { display: block; font-family: var(--sans); font-weight: 400; font-size: 1.0625rem; letter-spacing: 0; line-height: 1.3; color: var(--ink-3); margin-top: 0.9rem; }
.hero .tagline { font-size: clamp(1.375rem, 1.1rem + 0.9vw, 1.75rem); line-height: 1.35; margin: 0 0 1rem; font-weight: 500; text-wrap: balance; letter-spacing: -0.01em; }
.hero .sub { color: var(--ink-2); margin: 0 0 2rem; max-width: 32rem; text-wrap: pretty; }
.hero .ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.plant { width: 100%; max-height: calc(100svh - var(--header-h) - 3rem); }
.plant svg { width: 100%; height: 100%; max-height: inherit; display: block; overflow: visible; }
.plant .soil { stroke: none; }
.plant .soil-line { stroke: var(--root); stroke-width: 1.5; opacity: 0.5; }
.plant .stem { stroke: var(--sprout); stroke-width: 5; fill: none; stroke-linecap: round; }
.plant .branch { stroke: var(--sprout); stroke-width: 3; fill: none; stroke-linecap: round; }
.plant .root { stroke: var(--root); stroke-width: 2.4; fill: none; stroke-linecap: round; }
.plant .root.fine { stroke-width: 1.3; }
.plant .myc { stroke: var(--ochre); stroke-width: 1.1; fill: none; stroke-dasharray: 2 4; stroke-linecap: round; opacity: 0.9; }
.plant .myc-node { fill: var(--ochre); }
.plant .leaf { fill: var(--sprout-bright); stroke: var(--sprout); stroke-width: 1.5; }
.plant .leaf-vein { stroke: var(--sprout); stroke-width: 1; fill: none; opacity: 0.6; }
.plant .thorn { fill: var(--berry); }
.plant .fruit { fill: var(--berry); }
.plant .fruit-hi { fill: #fff; opacity: 0.25; }
.plant .seed { fill: var(--root); }
.plant .seed-coat { fill: none; stroke: var(--root); stroke-width: 1.4; }
.plant .node { fill: var(--paper); stroke: var(--sprout); stroke-width: 2.5; }
.plant .falling { fill: var(--root); opacity: 0.85; }
.plant a { text-decoration: none; cursor: pointer; }
.plant .tag { font-family: var(--sans); font-size: 21px; font-weight: 700; fill: var(--ink); }
.plant .tag-s { font-family: var(--sans); font-size: 16px; fill: var(--ink-2); }
.plant .tick { stroke: var(--ink-3); stroke-width: 1; opacity: 0.55; }
.plant a:focus-visible { outline: none; }
.plant a:focus-visible .tag { fill: var(--sprout); text-decoration: underline; }
@media (hover: hover) and (pointer: fine) {
  .plant .tag { transition: fill 150ms ease; }
  .plant a:hover .tag { fill: var(--sprout); }
}

/* germination: one orchestrated moment, first visit per session only */
.germinar .plant .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw var(--dur, 700ms) var(--ease-out) var(--delay, 0ms) both; }
.germinar .plant .pop { transform-box: fill-box; transform-origin: var(--origin, 50% 100%); animation: pop 420ms var(--ease-out) var(--delay, 0ms) both; }
.germinar .plant .appear { animation: appear 360ms ease var(--delay, 0ms) both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.9); } }
@keyframes appear { from { opacity: 0; } }

.home-sec { max-width: 76rem; margin: 0; padding: 3.5rem 0; border-top: 1px solid var(--rule); }
.home-sec .prose > .como-ler, .home-sec .prose > .trilha { max-width: none; }
.prose .trilha { padding-left: 0; }
.prose .trilha > li { margin: 0; }
.home-sec > h2 { font-size: clamp(1.875rem, 1.4rem + 1.6vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 1.25rem; }
.home-sec .prose > * { max-width: 36em; }
.minuto { columns: 2 20rem; column-gap: 3rem; }
.minuto p { break-inside: avoid; margin: 0 0 1.1rem; }
.como-ler { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 0 2rem; }
.como-ler .bloco { margin: 0.5rem 0 1rem; }
.trilha { list-style: none; padding: 0; margin: 0; counter-reset: etapa; display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 0 2.5rem; }
.trilha > li { counter-increment: etapa; display: grid; grid-template-columns: 2.25rem 1fr; gap: 0 0.9rem; padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.trilha .ico { width: 2rem; height: 2rem; color: var(--sprout); margin-top: 0.15rem; }
.trilha h3 { margin: 0; font-size: 1.25rem; }
.trilha h3 a { color: var(--ink); text-decoration: none; }
.trilha h3 a:visited { color: var(--ink); }
.trilha h3 small { display: block; font-family: var(--sans); font-weight: 400; font-size: 0.875rem; color: var(--ink-3); margin-bottom: 0.1rem; }
.trilha h3 small::before { content: counter(etapa) ". "; font-variant-numeric: tabular-nums; }
.trilha p { margin: 0.3rem 0 0; color: var(--ink-2); font-size: 1.0625rem; line-height: 1.5; }
@media (hover: hover) and (pointer: fine) { .trilha h3 a:hover { color: var(--sprout); } }
.progress-home { font-family: var(--sans); color: var(--ink-3); margin: -0.5rem 0 1.25rem; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .plant .lbls { display: none; }
}
@media (max-width: 959px) {
  .hero { grid-template-columns: minmax(0, 1fr); min-height: 0; padding-top: 2.5rem; }
  .plant { max-height: none; max-width: 34rem; margin: 0 auto; }
}

/* ---------- interactive figures ---------- */
.ciclo { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: 1.5rem 2rem; align-items: center; }
.ciclo svg .seg { cursor: pointer; }
.ciclo svg .seg path { fill: var(--paper-2); stroke: var(--paper); stroke-width: 3; transition: fill 150ms ease; }
.ciclo svg .seg[aria-pressed="true"] path { fill: var(--sprout-tint); stroke: var(--sprout); stroke-width: 2; }
.ciclo svg .seg text { font-family: var(--sans); font-size: 15px; font-weight: 700; fill: var(--ink); pointer-events: none; }
.ciclo svg .seg text.sm { font-size: 12px; font-weight: 400; fill: var(--ink-3); }
.ciclo svg .seg:focus-visible { outline: none; }
.ciclo svg .seg:focus-visible path { stroke: var(--sprout); stroke-width: 3; }
.ciclo .centro { fill: var(--paper); stroke: var(--berry); stroke-width: 1.5; stroke-dasharray: 3 3; }
.ciclo .centro-t { font-family: var(--sans); font-size: 12px; fill: var(--berry); }
.ciclo .seta { fill: var(--ink-3); stroke: none; opacity: .8; }
.ciclo svg .seg { outline: none; }
.ciclo .orbita { fill: none; stroke: var(--ink-3); stroke-width: 1; opacity: .45; }
.ciclo-painel { min-height: 11rem; }
.ciclo-painel h4 { font-family: var(--serif); font-size: 1.375rem; margin: 0 0 0.35rem; }
.ciclo-painel p { margin: 0 0 0.6rem; font-size: 1.0625rem; }
.ciclo-painel .sub { font-family: var(--sans); font-size: 0.9375rem; color: var(--ink-3); }
.ciclo-painel > div { transition: opacity 200ms ease, filter 200ms ease; }
.ciclo-painel > div.troca { opacity: 0.2; filter: blur(2px); transition-duration: 0ms; }
@media (hover: hover) and (pointer: fine) { .ciclo svg .seg:hover path { fill: var(--paper-3); } .ciclo svg .seg[aria-pressed="true"]:hover path { fill: var(--sprout-tint); } }
@media (max-width: 720px) { .ciclo { grid-template-columns: minmax(0, 1fr); } .ciclo svg { max-width: 18rem; margin: 0 auto; } }

.piso-teto { border: 1px solid var(--rule); border-radius: 12px; padding: 1.1rem 1.2rem 1rem; }
.piso-teto svg { display: block; width: 100%; height: auto; }
.piso-teto .faixa { fill: var(--sprout-tint); stroke: none; }
.piso-teto .linha-piso { stroke: var(--sprout); stroke-width: 2.5; }
.piso-teto .linha-teto { stroke: var(--berry); stroke-width: 2.5; }
.piso-teto .linha-eco { stroke: var(--ochre); stroke-width: 2; stroke-dasharray: 6 5; }
.piso-teto .eixo { stroke: var(--ink-3); stroke-width: 1; fill: none; }
.piso-teto text { font-family: var(--sans); font-size: 13px; fill: var(--ink-2); }
.piso-teto .controles { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; font-family: var(--sans); font-size: 1rem; margin-top: 0.75rem; }
.piso-teto label { display: inline-flex; align-items: center; gap: 0.6rem; }
.piso-teto input[type="range"] { width: min(16rem, 60vw); accent-color: var(--sprout); touch-action: pan-y; }
.piso-teto input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--ochre); }
.piso-teto output { font-variant-numeric: tabular-nums; color: var(--ink); min-width: 9ch; }

/* ---------- language chooser (root) ---------- */
.chooser { min-height: 100svh; display: grid; place-items: center; padding: 2rem 1.25rem; text-align: center; }
.chooser .display { font-family: var(--serif); font-weight: 800; letter-spacing: -0.035em; line-height: 0.9; font-size: clamp(4rem, 3rem + 6vw, 7rem); margin: 1rem 0; }
.chooser .display .s { font-style: italic; color: var(--sprout); font-weight: 700; }
.chooser p { color: var(--ink-2); margin: 0 auto 0.4rem; max-width: 30rem; }
.chooser .ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 2rem; }
.chooser .mark { width: 4.5rem; height: 4.5rem; margin: 0 auto; color: var(--sprout); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .germinar .plant .draw { animation: none; stroke-dashoffset: 0; }
  .germinar .plant .pop, .germinar .plant .appear { animation: appear 200ms ease both; }
  .sidebar, .sidebar[data-open] { transition: visibility 0s, opacity 200ms ease; }
  .sidebar:not([data-open]) { opacity: 0; }
  .sidebar[data-open] { opacity: 1; }
  .termo-pop { transform: none !important; }
  .busca[open].animar { animation: fade-in 150ms ease; }
  .icon-btn:active, .text-btn:active, .btn:active, .pager a:active { transform: none; }
}

@media print {
  .site-header, .sidebar, .pager, .scrim, .site-footer { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .margem { float: none !important; margin: 0 0 1rem !important; }
  .prose { padding-right: 0 !important; }
}
