/* Neuroemergent Lab Training Hub: colors and fonts from the Neuroemergent Lab
   brand profile. Fraunces for large headings only, Atkinson Hyperlegible for
   everything people read. Fonts are served from this site (no Google requests). */

@font-face { font-family: 'Fraunces'; font-weight: 500; font-display: swap; src: url('/static/fonts/fraunces-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-weight: 600; font-display: swap; src: url('/static/fonts/fraunces-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-weight: 400; font-style: italic; font-display: swap; src: url('/static/fonts/fraunces-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 400; font-display: swap; src: url('/static/fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 400; font-style: italic; font-display: swap; src: url('/static/fonts/atkinson-hyperlegible-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 700; font-display: swap; src: url('/static/fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 700; font-style: italic; font-display: swap; src: url('/static/fonts/atkinson-hyperlegible-latin-700-italic.woff2') format('woff2'); }

/* ---------- Colors: warm (the standard), and the three comfort modes ---------- */
:root {
  --bg: #FBF3E8;          /* cream */
  --card: #FFFDF9;
  --tint: #F8E6D3;        /* banners and quiet cards */
  --line: #EADBC8;
  --text: #4A2E22;        /* Earth */
  --muted: #6B4C3F;
  --heading: #4A2E22;
  --label: #A63F1F;       /* Ember deep: links, labels, small headings */
  --accent: #A63F1F;      /* buttons */
  --accent-hover: #873216;
  --on-accent: #FFFFFF;
  --dark: #4A2E22;        /* dark cards, footer */
  --on-dark: #FBF3E8;
  --on-dark-muted: #F2D9C4;
  --done: #A63F1F;
  --open: #F7C96A;
  --focus: #A63F1F;
  --focus-on-dark: #F7C96A;
  --sun: #F7C96A; --rays: #F29A62; --hill1: #D9CDEA; --hill2: #F29A62; --hill3: #C4512F;
  --shadow: rgba(74, 46, 34, .18);
  --mark: #C4512F;
  --radius: 20px;
  --lh: 1.6;
  --gap: 16px;
  --gap-lg: 32px;
  color-scheme: light;
}
:root[data-theme="contrast"] {
  --bg: #FFFFFF; --card: #FFFFFF; --tint: #FFFFFF; --line: #000000;
  --text: #000000; --muted: #1F1F1F; --heading: #000000; --label: #7A260C;
  --accent: #7A260C; --accent-hover: #000000; --on-accent: #FFFFFF;
  --dark: #000000; --on-dark: #FFFFFF; --on-dark-muted: #FFFFFF;
  --done: #000000; --open: #E8B23A; --focus: #0040C0; --focus-on-dark: #FFD24A;
  --sun: #F7C96A; --rays: #7A260C; --hill1: #6B5A90; --hill2: #7A260C; --hill3: #000000;
  --shadow: rgba(0, 0, 0, .35);
  --mark: #7A260C;
}
:root[data-theme="dark"] {
  --bg: #1C1411; --card: #2A1F1A; --tint: #352720; --line: #4A382E;
  --text: #F6EBDD; --muted: #D9C4B1; --heading: #FBF3E8; --label: #F5A877;
  --accent: #F29A62; --accent-hover: #F7C96A; --on-accent: #1C1411;
  --dark: #43261A; --on-dark: #FBF3E8; --on-dark-muted: #F2D9C4;
  --done: #F29A62; --open: #E0B04F; --focus: #F7C96A; --focus-on-dark: #F7C96A;
  --sun: #C99A3A; --rays: #A0522D; --hill1: #4A3F5E; --hill2: #7A3A20; --hill3: #4A2318;
  --shadow: rgba(0, 0, 0, .5);
  --mark: #F29A62;
  color-scheme: dark;
}
:root[data-theme="calm"] {
  --bg: #F3F0EB; --card: #FBFAF7; --tint: #EBE5DC; --line: #DDD5CA;
  --text: #3F3631; --muted: #5C524C; --heading: #3F3631; --label: #5A4C78;
  --accent: #5A4C78; --accent-hover: #463B5F; --on-accent: #FFFFFF;
  --dark: #4A4456; --on-dark: #F7F4EF; --on-dark-muted: #E6E0EE;
  --done: #5A4C78; --open: #D8CCB0; --focus: #5A4C78; --focus-on-dark: #F1E3B8;
  --sun: #EBDDB8; --rays: #DCC7B4; --hill1: #DCD5E8; --hill2: #E4CDBB; --hill3: #B8AA9F;
}

/* ---------- Text size and spacing ---------- */
html { font-size: 106.25%; -webkit-text-size-adjust: 100%; }
:root[data-text="l"] { font-size: 118.75%; }
:root[data-text="xl"] { font-size: 131.25%; }
:root[data-space="roomy"] { --lh: 1.9; --gap: 22px; --gap-lg: 44px; }
:root[data-space="roomy"] body { letter-spacing: .02em; word-spacing: .1em; }
:root[data-space="roomy"] p, :root[data-space="roomy"] li { max-width: 68ch; }

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Atkinson Hyperlegible', system-ui, sans-serif; font-size: 1rem; line-height: var(--lh);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: var(--label); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; color: var(--heading); line-height: 1.2; margin: 0; letter-spacing: -.005em; }
h3 { font-family: 'Atkinson Hyperlegible', system-ui, sans-serif; font-weight: 700; color: var(--heading); line-height: 1.3; margin: 0; }
h1 { font-size: 2.05rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.12rem; }
p { margin: 0; }
strong, b { font-weight: 700; }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); color: var(--text); padding: 8px 12px; z-index: 30; }
.skip:focus { left: 8px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 660px; margin: 0 auto; padding: 0 20px; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack-lg { display: flex; flex-direction: column; gap: var(--gap-lg); }
.stack-tight { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--gap); }
.page { padding: 28px 0 48px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.label { font-weight: 700; font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--label); margin: 0; }

/* ---------- Top bar ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--heading); }
.brand-sun { flex: none; }
.bs-sun { fill: var(--mark); }
.bs-rays { stroke: var(--rays); }
.bs-ground { stroke: var(--heading); }
.brand-words { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.12rem; }
.brand-hub { font-size: .7rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--label); margin-top: 3px; }
.nav { display: flex; flex-wrap: wrap; gap: 2px 18px; flex: 1 1 420px; }
.nav a { text-decoration: none; color: var(--text); font-size: .92rem; padding: 8px 0; min-height: 44px; display: inline-flex; align-items: center; }
.nav a[aria-current="page"] { color: var(--heading); font-weight: 700; box-shadow: inset 0 -3px 0 var(--accent); }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }

/* ---------- The slim bar above the header ---------- */
.utility { background: var(--dark); color: var(--on-dark); }
.utility-inner { display: flex; justify-content: flex-end; align-items: center; gap: 4px 16px; flex-wrap: wrap; min-height: 44px; }
.utility-btn, .utility-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; background: none; border: 0; color: var(--on-dark);
  font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; text-decoration: none; }
.utility-link { font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
.utility-btn:hover, .utility-link:hover { color: var(--on-dark); text-decoration: underline; }
.utility-btn[aria-expanded="true"] { text-decoration: underline; text-decoration-thickness: 2px; }
.utility :focus-visible { outline-color: var(--focus-on-dark); }
.utility-sep { width: 1px; height: 18px; background: var(--on-dark-muted); opacity: .5; }
.utility form { display: inline; }

/* ---------- Comfort settings ---------- */
.comfort { background: var(--tint); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.comfort-inner { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px 32px; padding-top: 16px; padding-bottom: 16px; align-items: start; }
.comfort-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.comfort-name { font-weight: 700; font-size: .85rem; flex-basis: 100%; }
.comfort-hint { font-size: .8rem; color: var(--muted); flex-basis: 100%; }
.comfort-opt { font: inherit; font-size: .85rem; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--text); background: var(--card); color: var(--text); cursor: pointer; }
.comfort-opt[aria-pressed="true"] { background: var(--dark); border-color: var(--dark); color: var(--on-dark); font-weight: 700; }
.comfort-opt[aria-pressed="true"]::before { content: '\2713\00a0'; }

/* Focus mode: everything but the section in use softens */
:root[data-focus="on"] main :is(.banner, .card, .slide-embed, .schedule):not(:is(.banner, .card) *) { opacity: .38; transition: opacity .2s ease; }
:root[data-focus="on"] main :is(.banner, .card, .slide-embed, .schedule):not(:is(.banner, .card) *):is(.is-focused, :hover, :focus-within) { opacity: 1; }

/* Read aloud buttons, one per section */
.read-btn { align-self: flex-end; order: -1; font: inherit; font-size: .8rem; font-weight: 700; min-height: 36px; padding: 4px 12px; border-radius: 999px;
  border: 1.5px solid currentColor; background: transparent; color: inherit; cursor: pointer; margin-bottom: -4px; }
.read-btn[aria-pressed="true"] { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
.card-dark .read-btn[aria-pressed="true"] { background: var(--on-dark); color: var(--dark); }
.banner .read-btn { position: absolute; top: 14px; right: 14px; margin: 0; z-index: 1; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px; border-radius: 999px;
  font-family: inherit; font-weight: 700; font-size: 1rem; text-decoration: none; border: 2px solid var(--accent);
  background: var(--accent); color: var(--on-accent); cursor: pointer; line-height: 1.2; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { background: var(--card); color: var(--heading); border-color: var(--heading); }
.btn-ghost:hover { background: var(--tint); color: var(--heading); border-color: var(--heading); }
.btn-small { min-height: 40px; padding: 6px 14px; font-size: .85rem; }
.btn-link { background: none; border: 0; padding: 0; color: var(--label); text-decoration: underline; font: inherit; cursor: pointer; min-height: 0; }
.topbar .btn-link { min-height: 40px; padding: 0 4px; }

/* ---------- Cards ---------- */
.card { position: relative; background: var(--card); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); }
.card-quiet { background: var(--tint); }
.card-dark { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
.card-dark h1, .card-dark h2, .card-dark h3, .card-dark .label, .card-dark a { color: var(--on-dark); }
.card-dark .muted { color: var(--on-dark-muted); }
.card-dark .btn-ghost { background: var(--on-dark); color: var(--dark); border-color: var(--on-dark); }
.card-dark .btn-ghost:hover { background: var(--tint); color: var(--text); }
.card-dark :focus-visible { outline-color: var(--focus-on-dark); }
.card-dark .notice { color: var(--text); }
:root[data-theme="contrast"] .card { border: 2px solid #000; }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--tint); color: var(--text); }
.tag-open { background: var(--dark); color: var(--on-dark); }
.tag-done { background: var(--done); color: var(--on-accent); }
.tag-draft { background: var(--open); color: #2B1A12; }
:root[data-theme="dark"] .tag-draft { color: #1C1411; }
a.tag { text-decoration: none; }

/* ---------- Banner with the rising sun ---------- */
.banner { position: relative; overflow: hidden; border-radius: 24px; background: var(--tint); padding: 30px 28px 100px; display: flex; flex-direction: column; gap: 10px; }
.banner > :not(.landscape) { position: relative; }
.banner .landscape { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 120px; }
.banner p { max-width: 640px; }
.ls-sun { fill: var(--sun); }
.ls-rays path { stroke: var(--rays); stroke-width: 3; stroke-linecap: round; opacity: .55; }
.ls-hill1 { fill: var(--hill1); }
.ls-hill2 { fill: var(--hill2); opacity: .85; }
.ls-hill3 { fill: var(--hill3); }
.banner-program .label { font-size: .78rem; }

/* ---------- Sign in and welcome ---------- */
.arrive { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.arrive-sky { position: relative; height: 210px; background: linear-gradient(var(--tint), var(--bg)); }
.arrive-sky .landscape { position: absolute; inset: auto 0 0 0; width: 100%; height: 160px; }
.arrive-sky .brand { position: absolute; top: 16px; left: 20px; z-index: 1; }
.arrive-body { padding: 12px 20px 40px; }
.care { font-size: .88rem; color: var(--muted); line-height: 1.5; }

/* ---------- Progress and programs ---------- */
.progress { display: flex; gap: 5px; }
.progress span { flex: 1 1 0; height: 10px; border-radius: 5px; background: var(--line); }
.progress span.done { background: var(--done); }
.progress span.open { background: var(--open); }
:root[data-theme="contrast"] .progress span { border: 1px solid #000; }
.program-card h2 { font-size: 1.45rem; }
.coming-card { border-style: dashed; }
.kind { display: inline-flex; gap: 8px; align-items: center; }

/* ---------- Journey list ---------- */
.module { display: flex; gap: 16px; align-items: center; text-decoration: none; color: var(--text); }
.module-num { flex: 0 0 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.3rem; background: var(--tint); color: var(--heading); }
.module.is-open .module-num { background: var(--dark); color: var(--on-dark); }
.module.is-done .module-num { background: var(--done); color: var(--on-accent); }
.module.is-locked { color: var(--muted); }

/* ---------- Part page ---------- */
.prose { display: flex; flex-direction: column; gap: 14px; }
.threads { margin: 0; padding-left: 22px; display: grid; gap: 4px; }
.threads.own-numbers { list-style: none; padding-left: 0; }
.reflection { font-family: 'Fraunces', Georgia, serif; font-style: italic; font-weight: 400; font-size: 1.3rem; line-height: 1.4; color: var(--heading); }
.list-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item-link { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--tint); text-decoration: none; color: var(--text); }
.item-link:hover { color: var(--text); box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------- Ask Lana ---------- */
details.qa { background: var(--card); border-radius: 16px; padding: 4px 18px; border: 1px solid var(--line); }
details.qa summary { cursor: pointer; padding: 12px 0; font-weight: 700; list-style-position: outside; }
details.qa div { padding: 0 0 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 700; color: var(--heading); flex: 1 1 180px; }
.field input, .field select, .field textarea { font: inherit; font-weight: 400; font-size: 1rem; color: var(--text); padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--muted); background: var(--card); width: 100%; }
.field textarea { min-height: 110px; resize: vertical; }
details.ask-part { border-top: 1px solid var(--line); padding: 4px 0; }
details.ask-part > summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 4px; font-weight: 700; font-size: 1.05rem; list-style: none; }
details.ask-part > summary::-webkit-details-marker { display: none; }
details.ask-part > summary::before { content: '\25B8'; margin-right: 8px; transition: transform .2s; display: inline-block; }
details.ask-part[open] > summary::before { transform: rotate(90deg); }
details.ask-part > summary > span:first-child { flex: 1; }
.ask-count { font-size: .8rem; font-weight: 700; min-width: 28px; height: 24px; padding: 0 8px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--tint); color: var(--text); }
details.ask-part > .stack { padding: 0 0 16px; }
.ask-topic-name { font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin: 8px 0 0; color: var(--label); }
.ask-program { margin-top: 8px; }
.qa ul, .qa ol, .prose > ul, .prose > ol:not(.threads) { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; }

/* ---------- Calls ---------- */
.card.call { flex-direction: row; flex-wrap: wrap; gap: 12px 18px; align-items: center; }
.call-date { flex: 0 0 auto; min-width: 74px; text-align: center; background: var(--tint); border-radius: 14px; padding: 8px 10px; font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.3rem; color: var(--heading); line-height: 1.15; }
.call-date small { display: block; font-family: 'Atkinson Hyperlegible', sans-serif; font-weight: 700; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.call-body { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.call.is-past { opacity: .85; }
.calls-mini .call-mini { display: flex; gap: 14px; align-items: flex-start; }
.calls-mini .call-date { flex: none; }
.calls-mini .row { margin-top: 6px; }
.calls-mini .is-past { opacity: .75; }

.schedule { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.schedule-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto 64px; gap: 4px 16px; align-items: center;
  padding: 12px 18px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.schedule-row:first-child { border-top: 0; }
.schedule-row.is-next { background: var(--tint); box-shadow: inset 4px 0 0 var(--accent); }
.schedule-row.is-past { color: var(--muted); }
.schedule-date { font-weight: 700; font-size: .92rem; }
.schedule-what { min-width: 0; }
.schedule-status { text-align: right; }
@media (max-width: 640px) {
  .schedule-row { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 16px; }
  .schedule-date { grid-column: 1; }
  .schedule-status { grid-column: 2; grid-row: 1; }
  .schedule-what, .schedule-time { grid-column: 1 / -1; }
}

/* ---------- Forum ---------- */
.post { display: flex; flex-direction: column; gap: 8px; }
.post-meta { font-size: .85rem; color: var(--muted); }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.replies { border-left: 3px solid var(--line); padding-left: 14px; display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; background: var(--card);
  color: var(--heading); text-decoration: none; font-size: .85rem; font-weight: 700; border: 1.5px solid var(--line); }
.chip:hover { border-color: var(--heading); color: var(--heading); }
.chip[aria-current="true"] { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
.chip-count { font-size: .74rem; font-weight: 700; background: var(--tint); color: var(--text); border-radius: 999px; padding: 0 7px; }
.chips-sub .chip { min-height: 36px; font-weight: 400; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details.qa > summary { list-style: revert; }
.form-gap { margin-top: 16px; }
@media (max-width: 560px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin-right: -20px; padding-right: 20px; scrollbar-width: thin; }
  .chip { flex: 0 0 auto; }
}

.notice { background: var(--card); color: var(--text); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 10px; }
.avatar { width: 84px; height: 84px; border-radius: 50%; background: var(--tint); border: 3px solid var(--open); display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.6rem; color: var(--heading); flex-shrink: 0; }

/* ---------- Footer ---------- */
.footer { background: var(--dark); color: var(--on-dark); margin-top: 24px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding-top: 20px; padding-bottom: 20px; font-size: .85rem; }
.footer a { color: var(--on-dark); }
.footer :focus-visible { outline-color: var(--focus-on-dark); }
.footer-brand { display: inline-flex; align-items: center; gap: 8px; font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1rem; margin-right: 8px; }
.footer .bs-ground { stroke: var(--on-dark); }
.footer .bs-sun, .utility .bs-sun { fill: #F29A62; }

@media (max-width: 560px) {
  html { font-size: 100%; }
  :root[data-text="l"] { font-size: 112.5%; }
  :root[data-text="xl"] { font-size: 125%; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.35rem; }
  .banner { padding: 24px 20px 92px; }
}

/* ---------- Side panels: Ask Lana and the companion guide ---------- */
.float-bar { position: fixed; right: 16px; bottom: 16px; z-index: 20; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.float-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 999px; border: 2px solid var(--heading);
  background: var(--card); color: var(--heading); font: 700 .9rem 'Atkinson Hyperlegible', sans-serif; cursor: pointer; box-shadow: 0 6px 18px var(--shadow); }
.float-btn-dark { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
:root[data-theme="dark"] .float-btn-dark { border-color: var(--on-dark-muted); }
.float-btn:hover { transform: translateY(-1px); }
body { padding-bottom: 72px; }
body:not(:has(.float-bar)) { padding-bottom: 0; }

dialog.drawer { margin: 0 0 0 auto; padding: 0; border: 0; width: min(460px, 100vw); max-width: 100vw; height: 100%; max-height: 100%;
  background: var(--bg); color: var(--text); box-shadow: -12px 0 32px var(--shadow); }
dialog.drawer[open] { display: flex; flex-direction: column; animation: slide-in .22s ease-out; }
dialog.drawer::backdrop { background: rgba(43, 26, 18, .4); }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 20px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.drawer-dark .drawer-head { background: var(--dark); border-color: var(--dark); }
.drawer-dark .drawer-head h2, .drawer-dark .drawer-head .label { color: var(--on-dark); }
.drawer-close { flex: 0 0 44px; height: 44px; border-radius: 50%; border: 2px solid currentColor; background: transparent; color: var(--heading); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.drawer-dark .drawer-close { color: var(--on-dark); }
.drawer-dark .drawer-close:focus-visible { outline-color: var(--focus-on-dark); }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.stack > .field, .drawer-body .field { flex: 0 0 auto; }
@media (max-width: 560px) {
  .float-bar { left: 12px; right: 12px; bottom: 12px; flex-direction: row; justify-content: center; }
  .float-btn { flex: 1 1 0; justify-content: center; padding: 10px 12px; font-size: .85rem; }
  dialog.drawer { width: 100vw; }
}

/* ---------- Admin area ---------- */
.admin-list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.card .admin-list { background: var(--tint); }
.admin-item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 20px; padding: 14px 18px; border-top: 1px solid var(--line); }
.admin-item:first-child { border-top: 0; }
.admin-item.is-past { color: var(--muted); }
.admin-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 260px; overflow-wrap: anywhere; }
.admin-item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.admin-item-form form { flex: 2 1 420px; }
.admin-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; background: var(--tint); border-radius: 12px; }
.admin-programs { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.admin-program { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; background: var(--tint); border-radius: 12px; }
.row-tight { gap: 8px 14px; }
.form-row { align-items: flex-end; }
.select-small { font: inherit; font-size: .85rem; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--muted); background: var(--card); color: var(--text); min-height: 40px; }
.hint { font-weight: 400; font-size: .8rem; color: var(--muted); }
.stat { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 2.2rem; color: var(--heading); line-height: 1.1; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 400; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
summary.btn.fit { width: fit-content; }
.tend .item-link { background: var(--card); border: 1px solid var(--line); }
.subnav { margin-top: -8px; }

/* ---------- Slides and HTML materials ---------- */
.viewer-head { justify-content: space-between; }
.viewer { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.viewer iframe { display: block; width: 100%; height: min(78vh, 900px); min-height: 480px; border: 0; background: #fff; }
.viewer:fullscreen { border-radius: 0; border: 0; }
.viewer:fullscreen iframe { height: 100vh; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; }
body.viewing .float-bar { display: none; }
body.viewing { padding-bottom: 0; }
.slide-embed .viewer-head h2 { margin: 0; }
.viewer.viewer-169 { aspect-ratio: 16 / 9; width: 100%; }
.viewer.viewer-169 iframe { height: 100%; min-height: 0; }
.viewer.viewer-169:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.viewer.viewer-169:fullscreen { aspect-ratio: auto; background: #000; display: flex; align-items: center; }
.viewer.viewer-169:fullscreen iframe { height: 100vh; }

/* Formatting buttons above admin text boxes */
.fmt-bar { display: flex; gap: 6px; margin: 6px 0 4px; flex-wrap: wrap; }
.fmt-btn { font: inherit; font-size: .85rem; min-width: 36px; height: 32px; padding: 0 10px; border: 1.5px solid var(--heading); border-radius: 8px; background: var(--card); color: var(--heading); cursor: pointer; }
.fmt-btn:hover, .fmt-btn:focus-visible { background: var(--tint); }
.fmt-b { font-weight: 700; }
.fmt-i { font-style: italic; }
.fmt-u { text-decoration: underline; }
.prose u, p u { text-decoration-thickness: 1px; text-underline-offset: 2px; }

/* ---------- Guide ---------- */
.guide-card { flex-direction: row; gap: 28px; align-items: flex-start; }
.guide-card > .stack { flex: 1; min-width: 0; }
.guide-photo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; flex: none; border: 3px solid var(--open); background: var(--tint); }
@media (max-width: 560px) { .guide-card { flex-direction: column; gap: 16px; } .guide-photo { width: 104px; height: 104px; } }

/* ---------- Part page cards: three across, the calls card widens to fill the last row ---------- */
@media (min-width: 900px) {
  .arc-grid { grid-template-columns: repeat(3, 1fr); }
  .calls-mini.span-2 { grid-column: span 2; }
  .calls-mini.span-3 { grid-column: 1 / -1; }
  .calls-mini.span-2 > ul, .calls-mini.span-3 > ul { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .arc-grid > .span-2-wide { grid-column: span 2; }
}
@media (min-width: 600px) and (max-width: 899px) {
  .arc-grid { grid-template-columns: repeat(2, 1fr); }
  .calls-mini { grid-column: 1 / -1; }
  .calls-mini > ul { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
}
@media (max-width: 599px) { .arc-grid { grid-template-columns: 1fr; } }

/* Admin preview of a part that is not open yet */
.preview-bar { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--dark); color: var(--on-dark); }
.preview-bar strong { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; padding: 2px 10px; border: 1.5px solid currentColor; border-radius: 999px; }
.preview-bar a { color: var(--on-dark); margin-left: auto; }
.preview-bar :focus-visible { outline-color: var(--focus-on-dark); }

/* ---------- Subparts ---------- */
.row-between { justify-content: space-between; }
.subpart-link { justify-content: flex-start; }
.subpart-link .sub-title { flex: 1; min-width: 0; }
.sub-num { flex: 0 0 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', Georgia, serif; font-weight: 600; background: var(--card); color: var(--heading); border: 1px solid var(--line); }
.subpart-link.is-done .sub-num { background: var(--done); color: var(--on-accent); border-color: var(--done); }
.crumbs a { color: var(--label); }
.sub-nav .btn { max-width: 100%; white-space: normal; text-align: left; }

/* ---------- Arriving and closing ---------- */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border-radius: 16px; background: var(--card);
  border: 2px solid var(--line); color: var(--heading); font: inherit; text-align: left; cursor: pointer; min-height: 92px; }
.choice strong { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.15rem; }
.choice span { font-size: .88rem; color: var(--muted); line-height: 1.4; }
.choice:hover { border-color: var(--accent); }
.choices-wide .choice { min-height: 64px; justify-content: center; }
.closing .arrive-sky { background: linear-gradient(var(--tint), var(--bg)); }
.closing .ls-sun { opacity: .8; }
.btn-link.small, .small .btn-link { font-size: .85rem; }

.arrive-wide { max-width: 760px; margin: 0 auto; }
.choices-form { display: contents; }
.choices { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.choice { min-height: 104px; }
.choice strong { font-size: 1.3rem; }
.choice { justify-content: center; }
.choice-own { cursor: default; border-style: dashed; justify-content: flex-start; gap: 8px; }
.choice-own .field { flex: 0 0 auto; width: 100%; font-family: 'Fraunces', Georgia, serif; font-size: 1.05rem; }
.choice-own input { font-family: 'Atkinson Hyperlegible', sans-serif; padding: 8px 10px; }
.choices { grid-auto-rows: 1fr; }
