/* Branching Comics — comic player styles */
:root {
  --paper: #fbf3e2;
  --paper-deep: #f3e6c9;
  --ink: #2b2622;
  --ink-soft: #5c5249;
  --line: #2b2622;
  --accent: #2a5bd7;
  --accent-ink: #ffffff;
  --juno: #c4561b;
  --theo: #1f6f6a;
  --caption: #fff1a8;
  --bubble: #ffffff;
  --focus: #2a5bd7;
  --radius: 10px;
  --panel-border: 3px;
  --gutter: 16px;
  --max: 980px;
  --font-body: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Avenir Next", "Futura", "Trebuchet MS", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.5;
}
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 800; }
p { margin: 0 0 .75em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.scene-title:focus { outline: none; }
.scene-title:focus-visible { outline: 3px solid var(--focus); outline-offset: 6px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip-link:focus { left: 8px; }

/* ── chrome ─────────────────────────────────────────── */
.site-header { border-bottom: var(--panel-border) solid var(--line); background: var(--paper-deep); }
.brand {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px var(--gutter);
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none;
}
.brand-mark { color: var(--juno); }
.page { max-width: var(--max); margin: 0 auto; padding: 20px var(--gutter) 48px; }
.site-footer { border-top: 2px dashed #c8b99a; color: var(--ink-soft); font-size: .9rem; text-align: center; padding: 16px var(--gutter) 32px; }
.flash-region { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.flash { margin: 12px 0 0; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--radius); background: #fff; }
.flash--alert { background: #ffe0dc; }
.crumbs { font-size: .95rem; margin-bottom: 12px; color: var(--ink-soft); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 800; color: var(--ink-soft); margin-bottom: .3em; }
.lede { font-size: 1.2rem; }
.section-title, .small-title { margin-top: 1.4em; }
.small-title { font-size: 1.05rem; }
.narrow { max-width: 640px; }

/* ── buttons ────────────────────────────────────────── */
.button, .button-to button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px;
  font: inherit; font-weight: 800; color: var(--ink); text-decoration: none;
  background: #fff; border: var(--panel-border) solid var(--line); border-radius: 999px;
  box-shadow: 3px 3px 0 var(--line); cursor: pointer;
}
.button:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }
.button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }
.button--primary { background: var(--accent); color: var(--accent-ink); }
.button--small { min-height: 40px; padding: 6px 14px; font-size: .95rem; }
.button[disabled] { opacity: .6; cursor: progress; }
.inline-form { display: inline-block; margin: 0; }
.actions, .replay__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }

/* ── subject + lesson pages ─────────────────────────── */
.subject-hero { max-width: 720px; }
.card-list, .lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; }
.card, .lesson-card { background: #fff; border: var(--panel-border) solid var(--line); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--line); overflow: hidden; }
.card { padding: 16px; }
.lesson-card { display: grid; grid-template-columns: minmax(0, 1fr); }
.lesson-card__art { width: 100%; border-bottom: var(--panel-border) solid var(--line); }
.lesson-card__body { padding: 16px; }
.lesson-card h3 { font-size: 1.4rem; }
.lesson-card .meta { color: var(--ink-soft); font-weight: 700; margin: 0; }
@media (min-width: 720px) {
  .lesson-card { grid-template-columns: 320px minmax(0, 1fr); }
  .lesson-card__art { border-bottom: 0; border-right: var(--panel-border) solid var(--line); height: 100%; object-fit: cover; }
}
.lesson-intro { display: grid; gap: 24px; align-items: start; }
.lesson-intro__art { border: var(--panel-border) solid var(--line); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--line); }
@media (min-width: 860px) { .lesson-intro { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.advisors { padding-left: 1.1em; }
.found ul { padding-left: 1.1em; }
.evidence-chip { display: inline-block; font-size: .85rem; font-weight: 700; background: var(--paper-deep); border: 1.5px solid var(--line); border-radius: 999px; padding: 1px 10px; margin: 2px 0; }

/* ── the comic ──────────────────────────────────────── */
.replay-banner { background: #e4f1ff; border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.scene-title { scroll-margin-top: 12px; }
.comic {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px;
  counter-reset: panel;
}
@media (min-width: 760px) {
  /* 2×2 in reading order: 1 2 / 3 4 */
  .comic { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
.panel { counter-increment: panel; min-width: 0; }
.panel figure {
  margin: 0; height: 100%; display: flex; flex-direction: column;
  background: #fff; border: var(--panel-border) solid var(--line); border-radius: 6px;
  box-shadow: 4px 4px 0 var(--line); overflow: hidden;
}
.panel__art { width: 100%; aspect-ratio: 4 / 3; border-bottom: var(--panel-border) solid var(--line); background: var(--paper); }
.panel__text { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.panel__text p { margin: 0; }
.caption {
  background: var(--caption); border: 2px solid var(--line); padding: 6px 10px;
  font-weight: 650; box-shadow: 2px 2px 0 var(--line);
}
.bubble {
  --fill: var(--bubble);
  position: relative; background: var(--fill); border: 2px solid var(--line); border-radius: 18px;
  padding: 8px 12px; margin-top: 18px;
}
/* Tail pointing up at the art: an ink triangle with a slightly smaller fill
   triangle over it, which also covers the bubble's border where they join. */
.bubble::before, .bubble::after {
  content: ""; position: absolute; clip-path: polygon(0 100%, 28% 0, 100% 100%);
}
.bubble::before { top: -14px; left: 24px; width: 24px; height: 14px; background: var(--line); }
.bubble::after { top: -9.5px; left: 27.5px; width: 17px; height: 11.5px; background: var(--fill); }
.speaker { display: block; font-family: var(--font-display); font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.bubble--juno { --fill: #fff4ea; }
.bubble--juno .speaker { color: var(--juno); }
.bubble--theo { --fill: #eef9f6; }
.bubble--theo .speaker { color: var(--theo); }

/* ── decisions ──────────────────────────────────────── */
.decision, .continue-form { margin-top: 24px; }
.decision {
  background: #fff; border: var(--panel-border) solid var(--line); border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--line); padding: 18px 16px;
}
.decision__prompt { font-size: 1.35rem; }
.decision__note { color: var(--ink-soft); }
.choices { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
@media (min-width: 760px) { .choices { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
.choice {
  width: 100%; height: 100%; min-height: 56px; text-align: left;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 12px 14px; font: inherit; color: var(--ink);
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--line); cursor: pointer;
}
.choice:hover { background: #fffaf0; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }
.choice:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }
.choice[disabled] { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; background: #ece6da; }
.choice__label { font-weight: 650; }
/* Category label (e.g. "Service", "B2B"). Same neutral look on every choice. */
.choice__tag { font-family: var(--font-display); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); }
.tag { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; border: 1.5px solid var(--line); border-radius: 999px; padding: 1px 8px; background: #fff; }
.tag--muted { background: transparent; }
.continue-button { min-width: 180px; }

/* ── debrief ────────────────────────────────────────── */
.debrief, .replay, .sources { margin-top: 28px; }
.debrief {
  background: #fff; border: var(--panel-border) solid var(--line); border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--line); padding: 20px 18px;
}
.evidence { background: var(--caption); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px; }
.evidence__label { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.evidence__value { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; margin: 2px 0 6px; }
.evidence__established { margin: 0; }
.debrief__list { margin: 0; display: grid; gap: 14px; }
.debrief__list dt { font-weight: 800; }
.debrief__list dd { margin: 2px 0 0; }
@media (min-width: 760px) { .debrief__list { grid-template-columns: 1fr 1fr; } }
.sample-ask { margin: 18px 0 0; }
.sample-ask figcaption { font-weight: 800; }
.sample-ask blockquote { margin: 6px 0 0; padding: 12px 16px; background: #eef4ff; border-left: 5px solid var(--accent); border-radius: 6px; font-size: 1.05rem; }
.sample-ask blockquote p { margin: 0; }
.principle { margin: 18px 0 0; padding-top: 12px; border-top: 2px dashed #c8b99a; }
.comparison { border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 18px; background: #f4f0ff; }
.comparison__grid { display: grid; gap: 12px; }
@media (min-width: 760px) { .comparison__grid { grid-template-columns: 1fr 1fr; } }
.comparison__side { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; }
.recommend { background: #fff; border: 2px dashed var(--line); border-radius: var(--radius); padding: 14px; }
.recommend__prompt { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; }
.forks summary, .history summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; }
.forks ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.fork { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.fork p { margin: 0; }
.fork__scene { font-weight: 800; }
.sources ul { list-style: none; padding: 0; display: grid; gap: 12px; }
.sources li { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.sources li p:last-child { margin: 0; }
.history { margin-top: 32px; border-top: 2px dashed #c8b99a; padding-top: 8px; color: var(--ink-soft); }
.history ol { padding-left: 1.3em; }
.history__scene { font-weight: 700; }

/* ── playback (JS only) ───────────────────────────── */
.panel figure { transition: filter .25s ease, transform .25s ease, box-shadow .25s ease; }
.panel.is-dim figure { filter: brightness(.42) saturate(.55); }
/* Not reached yet: same size and place, greyed out, words hidden until it plays. */
.panel.is-pending figure { filter: grayscale(1) brightness(.62) contrast(.85); box-shadow: 4px 4px 0 #8a8178; }
.panel.is-pending .panel__text { visibility: hidden; }
.panel.is-active figure { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--line), 0 0 0 4px #ffd84d; }
.panel__text p { transition: box-shadow .2s ease; }
.is-speaking { box-shadow: 0 0 0 4px #ffd84d, 2px 2px 0 var(--line); }
/* Outline the whole bubble shape, tail included (a box-shadow would skip the tail). */
.bubble.is-speaking {
  box-shadow: none;
  filter: drop-shadow(3px 0 0 #ffd84d) drop-shadow(-3px 0 0 #ffd84d) drop-shadow(0 3px 0 #ffd84d) drop-shadow(0 -3px 0 #ffd84d);
}
.player-bar {
  position: sticky; bottom: 0; z-index: 5; margin: 18px calc(-1 * var(--gutter)) 0; padding: 10px var(--gutter);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  background: color-mix(in srgb, var(--paper-deep) 94%, transparent); border-top: var(--panel-border) solid var(--line);
  backdrop-filter: blur(4px);
}
@media (min-width: 760px) { .player-bar { margin-inline: 0; border: var(--panel-border) solid var(--line); border-radius: var(--radius); bottom: 12px; } }
.player-bar__status { margin: 0; font-weight: 800; min-height: 1.5em; flex: 1 1 160px; }
.player-bar__buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.button--quiet { box-shadow: none; border-width: 2px; background: transparent; }

@media (prefers-reduced-motion: reduce) {
  .panel figure, .panel__text p { transition: none; }
  * { scroll-behavior: auto !important; transition: none !important; }
  .button:hover, .choice:hover, .button:active, .choice:active { transform: none; }
}

/* ── debrief deck ───────────────────────────────────── */
.deck { display: grid; gap: 28px; }
.deck.is-deck { gap: 0; }
.slide {
  background: #fff; border: var(--panel-border) solid var(--line); border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--line); padding: 22px 18px 26px;
}
.deck.is-deck .slide { min-height: min(68vh, 620px); display: flex; flex-direction: column; justify-content: center; }
.slide__title { font-size: clamp(1.6rem, 4.2vw, 2.4rem); }
.slide__title:focus { outline: none; }
.slide__title:focus-visible { outline: 3px solid var(--focus); outline-offset: 6px; }
.duo { display: grid; gap: 18px; align-items: start; }
.duo .talker { align-items: start; }
@media (min-width: 760px) { .duo { grid-template-columns: 1fr 1fr; } }
.talker { margin: 0; display: grid; gap: 14px; align-items: center; }
.talker figcaption { min-width: 0; }
@media (min-width: 760px) { .talker--wide { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); } }
.talker__art { width: 100%; border: var(--panel-border) solid var(--line); border-radius: 6px; }
.talker__note { color: var(--ink-soft); margin-top: 10px; }
.bubble--big { font-size: 1.2rem; padding: 14px 18px; }
.sample-message {
  margin: 0; padding: 16px 18px; font-size: 1.2rem; background: #dff3e4;
  border: 2px solid var(--line); border-radius: 18px 18px 18px 4px; box-shadow: 3px 3px 0 var(--line);
}
.sample-message p { margin: 0; }
.deck__nav {
  position: sticky; bottom: 0; z-index: 5; margin-top: 16px; padding: 10px 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--paper-deep) 94%, transparent);
  border: var(--panel-border) solid var(--line); border-radius: var(--radius);
}
@media (min-width: 760px) { .deck__nav { bottom: 12px; } }
.deck__progress { margin: 0 auto 0 0; font-weight: 800; }
.deck__nav [data-slideshow-target="back"] { order: -1; }
.shelf { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.shelf__item { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; align-items: start; background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; }
@media (min-width: 760px) { .shelf__item { grid-template-columns: 150px minmax(0, 1fr); } }
.shelf__image { width: 100%; border: 2px solid var(--line); border-radius: 4px; box-shadow: 4px 4px 0 var(--line); }
.shelf__item h3 { margin-bottom: 2px; font-size: 1.3rem; }
.shelf__author { color: var(--ink-soft); font-weight: 700; }
.shelf__links { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.disclosure { color: var(--ink-soft); font-size: .9rem; margin: 14px 0 0; }

/* ── accounts ───────────────────────────────────────── */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-right: var(--gutter); }
.site-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.site-nav__link { color: var(--ink); font-weight: 700; }
.site-nav__button { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.auth-card, .account { max-width: 520px; margin: 0 auto; }
.auth-card { background: #fff; border: var(--panel-border) solid var(--line); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--line); padding: 22px 18px; }
.auth-options { display: grid; gap: 10px; margin: 16px 0; }
.auth-form { margin: 0; }
.auth-button, .auth-form .auth-button { width: 100%; justify-content: flex-start; }
.auth-button__mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--paper-deep); border: 2px solid var(--line); font-size: .85rem; }
.auth-button__mark--google_oauth2 { background: #fff; color: #4285f4; }
.auth-button__mark--facebook { background: #1877f2; color: #fff; }
.auth-button__mark--github { background: #24292f; color: #fff; }
.auth-button__mark--twitter2 { background: #000; color: #fff; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 2px dashed #c8b99a; }
.stack-form { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; }
.field label { font-weight: 800; }
.field input { font: inherit; padding: 10px 12px; border: 2px solid var(--line); border-radius: 8px; background: #fff; min-height: 46px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0; }
.form-error { background: #ffe0dc; border: 2px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.form-error ul { margin: 4px 0 0; padding-left: 1.2em; }
.hint { color: var(--ink-soft); font-size: .92rem; margin: 2px 0 0; }
.auth-links { margin: 16px 0 0; }
.account__section { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 16px; }
.account__section h2 { font-size: 1.15rem; }
.method-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.method { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed #c8b99a; }
.save-prompt { margin-top: 24px; background: #fff; border: var(--panel-border) solid var(--line); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--line); padding: 18px 16px; }
.save-prompt h2, .save-prompt h3 { margin-bottom: .3em; }
.quiet-link { color: var(--ink-soft); font-weight: 700; }
.saved-note { font-weight: 800; color: #2e7d4f; margin: 0 0 10px; }
