/* K20: the evidence page (ibogaine-research.html). Evidence ladder, condition map, the papers' own figures
   (CC BY, enlarged by js/gallery.js) and our own charts drawn from their numbers. Chart widths come from inline
   custom properties (--v, --a, --b, --c, --w, --n), so the numbers live in the HTML next to their labels. */
.ev-note { max-width: 46rem; margin-top: 1.5rem; font-size: var(--text-small); line-height: 1.65; color: var(--color-text-2); }
.ev-note a, .ev-table a, .ev-cases a, .ev-fig figcaption a, .ev-refs a { text-decoration: underline; text-underline-offset: 3px; }

/* Evidence strength: one colour per level, used in the map and its key */
.ev-pill { display: inline-block; padding: .2rem .6rem; border-radius: var(--r-pill); font-size: .75rem; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.ev-pill--most { background: var(--color-accent); color: var(--color-white); }
.ev-pill--some { background: var(--color-gold); color: var(--color-text); }
.ev-pill--case { border: 1.5px solid var(--color-accent); color: var(--color-accent); }
.ev-pill--animal { border: 1.5px dashed var(--color-text-3); color: var(--color-text-2); }
.ev-key { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; margin: 0 0 1.25rem; padding: 0; list-style: none; font-size: var(--text-small); color: var(--color-text-2); }
.ev-key li { display: flex; align-items: center; gap: .5rem; }

/* Ladder: rungs from strongest (top) to weakest; filled where human research exists */
.ev-ladder { margin: 0; }
.ev-ladder__rungs { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; counter-reset: rung; }
.ev-ladder__rung { position: relative; display: grid; grid-template-columns: minmax(0, 17rem) 1fr; gap: 1.25rem; align-items: center; padding: 1rem 1.25rem 1rem 3.25rem; border: 1px solid var(--color-border); border-radius: 14px; background: var(--color-bg-card); }
.ev-ladder__rung::before { counter-increment: rung; content: counter(rung); position: absolute; left: 1.1rem; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; font-size: .75rem; font-weight: 600; background: var(--color-bg); color: var(--color-text-2); }
.ev-ladder__name { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.25; letter-spacing: var(--tracking-headliner); }
.ev-ladder__where { font-size: var(--text-small); line-height: 1.5; color: var(--color-text-2); }
.ev-ladder__rung--full { border-color: transparent; background: linear-gradient(90deg, rgba(233, 68, 23, .12), rgba(255, 176, 32, .08)); }
.ev-ladder__rung--full::before { background: var(--color-accent); color: var(--color-white); }
.ev-ladder__rung--thin { background: linear-gradient(90deg, rgba(233, 68, 23, .12) 0 18%, var(--color-bg-card) 18%); }
.ev-ladder__rung--empty { border-style: dashed; }
.ev-ladder__rung--empty .ev-ladder__name { color: var(--color-text-2); }
.ev-ladder__rung--animal { border-style: dashed; background: var(--color-bg); }
.ev-ladder figcaption, .ev-chart figcaption { margin-top: .9rem; font-size: var(--text-small); line-height: 1.6; color: var(--color-text-2); }
@media (max-width: 640px) { .ev-ladder__rung { grid-template-columns: 1fr; gap: .3rem; } }

/* Map table */
.ev-table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--r-card); background: var(--color-bg-card); }
.ev-table-wrap:focus-visible { outline: 2px solid var(--color-ember); outline-offset: 3px; }
.ev-table { width: 100%; min-width: 40rem; border-collapse: collapse; font-size: var(--text-small); line-height: 1.5; }
.ev-table th, .ev-table td { padding: .85rem 1rem; text-align: left; vertical-align: top; border-top: 1px solid var(--color-border); }
.ev-table thead th { border-top: 0; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-3); }
.ev-table tbody th { font-weight: 600; color: var(--color-text); }
.ev-table td { color: var(--color-text-2); }
.ev-table tbody tr:hover { background: var(--color-bg); }

/* The papers' own figures */
.ev-fig { margin: 0 0 1.75rem; }
.ev-fig--narrow { max-width: 46rem; }
.ev-fig--lead .ev-zoom { max-width: 46rem; }
.ev-zoom { display: block; padding: .6rem; border: 1px solid var(--color-border); border-radius: var(--r-card); background: #fff; cursor: zoom-in; transition: transform var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal); }
.ev-zoom img { display: block; width: 100%; height: auto; border-radius: 4px; }
.ev-zoom:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.ev-zoom:focus-visible { outline: 2px solid var(--color-ember); outline-offset: 3px; }
.ev-fig figcaption { max-width: 46rem; margin-top: .8rem; font-size: var(--text-small); line-height: 1.6; color: var(--color-text-2); }
.ev-fig figcaption strong { color: var(--color-text); }
.ev-pair { display: grid; gap: 1.5rem; align-items: start; margin-bottom: 1.75rem; }
.ev-pair .ev-fig, .ev-pair .ev-chart { margin: 0; }
@media (min-width: 800px) { .ev-pair { grid-template-columns: 1fr 1.25fr; } .ev-pair--even { grid-template-columns: 1fr 1fr; } }

/* Our charts */
.ev-chart { margin: 0 0 1.75rem; padding: 1.4rem 1.4rem 1.2rem; border: 1px solid var(--color-border); border-radius: var(--r-card); background: var(--color-bg-card); }
.ev-chart__title { margin: 0 0 1.1rem; font-family: var(--font-display); font-size: 1.2rem; line-height: 1.3; letter-spacing: var(--tracking-headliner); }
.ev-chart__legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin: 1rem 0 0; padding: 0; list-style: none; font-size: .8rem; color: var(--color-text-2); }
.ev-chart__legend li { display: flex; align-items: center; gap: .4rem; }
.ev-sw { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; }
.ev-sw--a { background: #D6CFC6; }
.ev-sw--b { background: var(--color-ember); }
.ev-sw--c { background: var(--color-red); }
.ev-sw--none { background: var(--color-red); }
.ev-sw--low { background: var(--color-gold); }
.ev-sw--risk { background: #D6CFC6; }

/* Durability: three bars per scale, widths relative to the starting score */
.ev-dur { display: grid; gap: 1.1rem; margin: 0; }
.ev-dur__row { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; align-items: center; }
.ev-dur dt { font-weight: 600; font-size: var(--text-small); line-height: 1.3; }
.ev-dur dt small { display: block; font-weight: 400; color: var(--color-text-3); }
.ev-dur dd { display: grid; gap: 3px; margin: 0; }
.ev-dur__bar { position: relative; display: block; height: 1.15rem; border-radius: 3px; transform-origin: 0 50%; }
.ev-dur__bar b { position: absolute; left: calc(100% + .45rem); top: 50%; translate: 0 -50%; font-size: .75rem; font-weight: 600; white-space: nowrap; color: var(--color-text-2); }
.ev-dur__bar--a { width: calc(var(--a) * .88); background: #D6CFC6; }
.ev-dur__bar--b { width: calc(var(--b) * .88); background: var(--color-ember); }
.ev-dur__bar--c { width: calc(var(--c) * .88); background: var(--color-red); }
@media (max-width: 520px) { .ev-dur__row { grid-template-columns: 1fr; gap: .4rem; } }

/* Before/after bars */
.ev-bars { display: grid; gap: .35rem; margin: 0; }
.ev-bars > div { display: grid; grid-template-columns: 11rem 1fr; gap: .8rem; align-items: center; }
.ev-bars > div.is-after { margin-bottom: .7rem; }
.ev-bars dt { font-size: .8rem; line-height: 1.3; color: var(--color-text-2); }
.ev-bars .is-after dt { text-align: right; }
.ev-bars dd { margin: 0; }
.ev-bars dd span { position: relative; display: block; width: calc(var(--v) * .82); height: 1.2rem; border-radius: 3px; background: #D6CFC6; }
.ev-bars .is-after dd span { background: var(--color-ember); }
.ev-bars b { position: absolute; left: calc(100% + .4rem); top: 50%; translate: 0 -50%; font-size: .75rem; font-weight: 600; color: var(--color-text-2); }
@media (max-width: 520px) { .ev-bars > div { grid-template-columns: 1fr; gap: .25rem; } .ev-bars .is-after dt { text-align: left; } }

/* Big numbers with a line each */
.ev-stats { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.ev-stats li { display: grid; grid-template-columns: minmax(5.5rem, auto) 1fr; gap: 1rem; align-items: baseline; padding: .75rem 0; border-top: 1px solid var(--color-border); }
.ev-stats li:first-child { border-top: 0; padding-top: 0; }
.ev-stats strong { font-family: var(--font-display); font-size: 1.6rem; font-weight: 400; line-height: 1.1; color: var(--color-red); white-space: nowrap; }
.ev-stats span { font-size: var(--text-small); line-height: 1.5; color: var(--color-text-2); }

/* Dumbbell: one row per person, before (grey) to after (red) */
.ev-dots { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.ev-dots li { display: grid; grid-template-columns: 4.5rem 1fr 4.2rem; gap: .8rem; align-items: center; font-size: .8rem; color: var(--color-text-2); }
.ev-dots__track { position: relative; height: 1rem; background: linear-gradient(var(--color-border), var(--color-border)) 0 50% / 100% 1px no-repeat; }
.ev-dots__track::before { content: ""; position: absolute; top: 50%; left: var(--b); right: calc(100% - var(--a)); height: 3px; translate: 0 -50%; background: rgba(194, 0, 0, .25); }
.ev-dots__a, .ev-dots__b { position: absolute; top: 50%; width: .8rem; height: .8rem; border-radius: 50%; translate: -50% -50%; }
.ev-dots__a { left: var(--a); background: #BDB4A9; }
.ev-dots__b { left: var(--b); background: var(--color-red); }
.ev-dots__val { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Stacked bars */
.ev-stack__label { margin: .3rem 0 .35rem; font-size: .8rem; font-weight: 600; color: var(--color-text-2); }
.ev-stack__bar { display: flex; height: 2.1rem; overflow: hidden; border-radius: 6px; margin-bottom: .6rem; }
.ev-stack__seg { display: grid; place-items: center; width: var(--w); font-size: .78rem; font-weight: 600; }
.ev-stack__seg--none { background: var(--color-red); color: var(--color-white); }
.ev-stack__seg--low { background: var(--color-gold); color: var(--color-text); }
.ev-stack__seg--risk { background: #D6CFC6; color: var(--color-text); }

/* Icon array: 14 people per row, the first --n filled */
.ev-people > p { margin: .9rem 0 .4rem; font-size: .8rem; font-weight: 600; color: var(--color-text-2); }
.ev-people > p:first-child { margin-top: 0; }
.ev-people__row { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; max-width: 22rem; margin: 0; padding: 0; list-style: none; }
.ev-people__row li { aspect-ratio: 1; border-radius: 50%; border: 1.5px solid #D6CFC6; }
.ev-people__row li:nth-child(-n + 7) { border-color: #D6CFC6; }
.ev-people__row[style*="--n:7"] li:nth-child(-n + 7), .ev-people__row[style*="--n:8"] li:nth-child(-n + 8) { border-color: var(--color-ember); background: var(--color-ember); }

/* Caveats and protocol */
.ev-read, .ev-protocol { margin-top: 2rem; }
.ev-read__title { margin-bottom: 1rem; font-size: var(--text-small); font-weight: 600; color: var(--color-text-2); }
.ev-caveats { display: grid; gap: .65rem; max-width: 50rem; margin: 0; padding-left: 1.25rem; font-size: var(--text-small); line-height: 1.6; color: var(--color-text-2); }
.ev-caveats strong { color: var(--color-text); }
.ev-protocol__list { display: grid; gap: 0; max-width: 56rem; margin: 0; padding: 0; list-style: none; border: 1px solid var(--color-border); border-radius: var(--r-card); background: var(--color-bg-card); overflow: hidden; }
.ev-protocol__list li { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1.25rem; padding: 1rem 1.25rem; border-top: 1px solid var(--color-border); font-size: var(--text-small); line-height: 1.5; }
.ev-protocol__list li:first-child { border-top: 0; }
.ev-protocol__list span { color: var(--color-text-2); }
.ev-protocol__list span::after { content: " →"; color: var(--color-accent); }
.ev-protocol__list strong { font-weight: 500; color: var(--color-text); }
@media (max-width: 640px) { .ev-protocol__list li { grid-template-columns: 1fr; gap: .25rem; } }
@media (min-width: 768px) { .aud__grid.ev-cases, .aud__grid.ev-gaps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.ev-refs { display: grid; gap: .7rem; max-width: 54rem; margin: 0; padding-left: 1.25rem; font-size: var(--text-small); line-height: 1.6; color: var(--color-text-2); }
.ev-refs a { white-space: nowrap; }

/* Bars grow in when the chart scrolls into view (.is-inview from js/main.js); final frame without motion */
@media (prefers-reduced-motion: no-preference) {
  .js .ev-chart:not(.is-inview) .ev-dur__bar, .js .ev-chart:not(.is-inview) .ev-bars dd span { transform: scaleX(0); }
  .ev-dur__bar, .ev-bars dd span { transition: transform .9s var(--ease-out); }
  .ev-dur__bar--b, .ev-bars .is-after dd span { transition-delay: .15s; }
  .ev-dur__bar--c { transition-delay: .3s; }
}
@media (prefers-reduced-motion: reduce) { .ev-zoom { transition: none; } .ev-zoom:hover { transform: none; } }

/* Research box on condition pages: a short, sourced summary that links to the evidence page.
   .ev-box--none marks a condition with no human study yet. */
.ev-box { max-width: 52rem; padding: 1.4rem 1.5rem; border: 1px solid var(--color-border); border-left: 4px solid var(--color-accent); border-radius: 0 var(--r-card) var(--r-card) 0; background: var(--color-bg-card); }
.ev-box--none { border-left-style: dashed; border-left-color: var(--color-text-3); }
.ev-box__head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-bottom: .7rem; }
.ev-box__title { margin: 0; font-family: var(--font-display); font-size: 1.25rem; line-height: 1.3; letter-spacing: var(--tracking-headliner); }
.ev-box p { font-size: var(--text-small); line-height: 1.65; color: var(--color-text-2); }
.ev-box p + p, .ev-box p + ul, .ev-box ul + p { margin-top: .7rem; }
.ev-box ul { display: grid; gap: .4rem; margin: 0; padding-left: 1.2rem; font-size: var(--text-small); line-height: 1.6; color: var(--color-text-2); }
.ev-box a { text-decoration: underline; text-underline-offset: 3px; }
.ev-box strong { color: var(--color-text); }

* + .ev-box { margin-top: 1.75rem; }
