/*
 * Psychedelic Safety Guide — page layout on top of YungStufi Neon 2.1.
 * tokens.css holds the design tokens, neon.css the design system's components (ej-*).
 * This file only places them on the page: page width, sections, grids and the few page-specific pieces.
 * Every value is a token; nothing here restyles a component.
 */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--surface-100); scroll-behavior: smooth; scroll-padding-top: calc(var(--layout-topbar-h) + var(--space-4)); }
body { margin: 0; background: var(--surface-100); color: var(--ink); font: 400 16px/24px var(--font-sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote { margin: 0; }
a { color: inherit; text-decoration: none; }
.ln, .sources a { color: var(--link); overflow-wrap: anywhere; }
.ln { font-weight: 700; }
.ln:hover, .sources a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ln:focus-visible, .sources a:focus-visible, .ej-fact-link:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.ej-fact-link:focus-visible { border-radius: var(--radius-md); }
.page { width: 100%; max-width: calc(var(--layout-page-max) + var(--layout-gutter) * 2); margin-inline: auto; padding-inline: var(--layout-gutter); }

/* ---------- Type roles (Support and Text styles) ---------- */
.lead { max-width: 40em; font-size: 18px; line-height: 28px; color: var(--ink-muted); }
.title-1 { font-size: 28px; line-height: 34px; font-weight: 800; }
.heading { margin-top: var(--space-2); font-size: 15px; line-height: 20px; font-weight: 700; color: var(--ink); }
.block-text { max-width: 44em; color: var(--ink-muted); }
.block-text strong { color: var(--ink); }
.fact-desc { font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.ej-neon { display: block; }

/* ---------- Hero ---------- */
.hero-inner { display: flex; flex-direction: column; align-items: center; gap: var(--space-6); padding-block: 112px 72px; text-align: center; }
.hero-name { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.hero .lead { max-width: 36em; }
.hero-facts { width: 100%; margin-top: var(--space-8); text-align: left; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); }

/* ---------- Parts and chapters ---------- */
.part { padding-top: 128px; }
.part .ej-chips { margin-top: var(--space-2); }
.section { display: flex; flex-direction: column; gap: var(--space-6); padding-top: var(--layout-section-gap); }
.ej-sechead .lead { margin-top: var(--space-1); }
.block { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.block > .facts, .block > .ej-table-wrap, .block > .ej-timeline { margin-top: var(--space-2); }

/* Auto-fitting grids (Layout: cards two-up at 320px+, facts and stages at 220–240px) */
.grid, .stages, .facts { display: grid; gap: var(--layout-grid-gap); grid-template-columns: repeat(auto-fit, minmax(min(var(--min, 320px), 100%), 1fr)); }
.grid--3 { --min: 280px; }
.stages { --min: 240px; gap: var(--space-3); }
.facts { --min: 220px; gap: var(--space-3); }
.grid > .block { align-self: start; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.items { row-gap: var(--space-4); }

/* Works cited: the accordion built on <details> so it opens without script */
.sources summary { list-style: none; }
.sources summary::-webkit-details-marker { display: none; }
.sources summary .ej-caption { margin-left: var(--space-2); font-weight: 400; }
.sources .acc-minus, .sources details[open] .acc-plus { display: none; }
.sources details[open] .acc-minus { display: inline-block; }

/* Combination chart: a wide matrix that scrolls sideways inside its box on narrow screens */
.combo .ej-table { min-width: 760px; }
.combo tbody th { white-space: nowrap; }
/* twelve columns: tighter side padding so the matrix fits the page width before it needs to scroll */
.combo .ej-table th, .combo .ej-table td { padding-inline: var(--space-2); }
.combo abbr { text-decoration: none; }

/* Maslow's hierarchy: deep pairs stacked into a pyramid */
.tiers { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.tier { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px var(--space-4); border-radius: var(--radius-control); background: var(--ej-lo); text-align: center; }
.tier__t { font-weight: 800; color: var(--ink); }
.tier__d { font-size: 14px; line-height: 20px; color: var(--ink-muted); }

/* ---------- Closing ---------- */
.closing { position: relative; isolation: isolate; overflow: hidden; margin-top: var(--layout-section-gap); }
.closing-ripple { position: absolute; z-index: -1; left: -180px; bottom: -220px; width: 560px; aspect-ratio: 1; }
.closing-inner { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding-block: 112px var(--layout-section-gap); text-align: center; }
.closing .lead { max-width: 34em; margin-bottom: var(--space-4); }
.closing .facts { width: 100%; margin-top: var(--space-8); text-align: left; }

/* ---------- Responsive (bp-mid 860, 760 top-bar wrap, bp-narrow 600) ---------- */
@media (max-width: 760px) {
  html { scroll-padding-top: 104px; } /* the top bar wraps to two rows */
  .part { padding-top: 96px; }
}
@media (max-width: 600px) {
  html { scroll-padding-top: calc(var(--layout-topbar-h) + var(--space-4)); }
  body { padding-bottom: var(--layout-tabbar-h); }
  .ej-topnav { display: none; }
  .lead { font-size: 16px; line-height: 24px; }
  .hero-inner { padding-block: var(--space-16) var(--space-12); }
  .hero .actions { align-self: stretch; flex-direction: column; }
  .closing-ripple { width: 360px; left: -140px; bottom: -160px; }
  .closing-inner { padding-block: 80px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
