/*
 * The PHIL 1115 argument-form encyclopedia — browse and practice.
 *
 * Like assets/games/ui/*.css this lives outside assets/css/, so purgecss never
 * sees it and never strips the class names that only ever appear in JS string
 * templates. Nothing here is generated by Jekyll; the pages link it directly.
 *
 * Everything is scoped to `.ae-scope`, the wrapper the Jekyll pages put around
 * their content. A Jekyll page cannot own <body>, so tokens go on the wrapper
 * rather than on :root, exactly as the game pages do.
 *
 * Dark mode reads al-folio's own `data-theme` attribute on <html> — the theme
 * writes the reader's choice there, and the toggle must beat the OS preference
 * in both directions, so the palette is declared three times: bare (light),
 * under prefers-color-scheme guarded against an explicit light choice, and
 * under an explicit dark choice.
 */

/* ---------------------------------------------------------------- palette */

.ae-scope {
  --ae-paper: #ffffff;
  --ae-desk: #f6f5f2;
  --ae-panel: #f0eeea;
  --ae-card: #ffffff;
  --ae-ink: #16181d;
  --ae-body: #2b2f38;
  --ae-muted: #6b7280;
  --ae-faint: #9aa1ad;
  --ae-rule: #e0ddd7;
  --ae-rule-2: #cfcbc3;

  /* Yale/Oxford navy, the same accent _pages/../assets/css/main.scss sets. */
  --ae-accent: #002147;
  --ae-accent-soft: #e8eef6;
  --ae-accent-ink: #002147;

  /* Verdict colours. Deliberately not red/green alone — the badges carry a
     word as well, because a colour-blind reader must still read the verdict. */
  --ae-valid: #1c5c3b;
  --ae-valid-bg: #e6f2ec;
  --ae-invalid: #8c2f22;
  --ae-invalid-bg: #fbeae7;

  --ae-warn: #7a5a1e;
  --ae-warn-bg: #fbf3e0;

  --ae-serif: Georgia, "Times New Roman", serif;
  --ae-sans:
    system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Formulas are set in a mono family so that ∼ & ∨ ⊃ ≡ ⊥ line up in a table
     column and parentheses of different depths stay the same width. */
  --ae-mono: "SF Mono", "JetBrains Mono", "IBM Plex Mono", Menlo, Consolas,
    monospace;

  --ae-radius: 8px;
  --ae-shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 12px rgb(0 0 0 / 4%);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .ae-scope {
    --ae-paper: #14161a;
    --ae-desk: #1a1d22;
    --ae-panel: #21252c;
    --ae-card: #1c2027;
    --ae-ink: #e9ecf1;
    --ae-body: #c7ccd6;
    --ae-muted: #939aa6;
    --ae-faint: #6d747f;
    --ae-rule: #2f353e;
    --ae-rule-2: #3d444f;

    --ae-accent: #7fb2e5;
    --ae-accent-soft: #1b2836;
    --ae-accent-ink: #a8cbef;

    --ae-valid: #7fd0a5;
    --ae-valid-bg: #16281f;
    --ae-invalid: #f0a396;
    --ae-invalid-bg: #2c1a17;

    --ae-warn: #e0c082;
    --ae-warn-bg: #2a2417;

    --ae-shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 14px rgb(0 0 0 / 30%);
  }
}

html[data-theme="dark"] .ae-scope {
  --ae-paper: #14161a;
  --ae-desk: #1a1d22;
  --ae-panel: #21252c;
  --ae-card: #1c2027;
  --ae-ink: #e9ecf1;
  --ae-body: #c7ccd6;
  --ae-muted: #939aa6;
  --ae-faint: #6d747f;
  --ae-rule: #2f353e;
  --ae-rule-2: #3d444f;

  --ae-accent: #7fb2e5;
  --ae-accent-soft: #1b2836;
  --ae-accent-ink: #a8cbef;

  --ae-valid: #7fd0a5;
  --ae-valid-bg: #16281f;
  --ae-invalid: #f0a396;
  --ae-invalid-bg: #2c1a17;

  --ae-warn: #e0c082;
  --ae-warn-bg: #2a2417;

  --ae-shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 14px rgb(0 0 0 / 30%);
}

/* ------------------------------------------------------------------ base */

.ae-scope {
  font-family: var(--ae-sans);
  color: var(--ae-body);
  line-height: 1.55;
}

.ae-scope *,
.ae-scope *::before,
.ae-scope *::after {
  box-sizing: border-box;
}

/*
 * The `hidden` attribute is how the two page scripts swap between the
 * catalogue and an entry. The UA stylesheet's `[hidden] { display: none }` is
 * author-origin-beatable, so any rule here that sets `display` on one of those
 * containers — `.ae-list` is a grid, `.ae-status` is a flex row — silently
 * wins and leaves the "hidden" element on screen. Restating it at author
 * origin is what actually makes `el.hidden = true` mean what it says.
 */
.ae-scope [hidden] {
  display: none !important;
}

/* Lecture 3 construction practice. Values and formula symbols share actual
   table columns, so the intermediate work stays aligned at any text size. */
.ae-practice-modes,
.ae-ct-navigation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin: 1.2rem 0 1.6rem;
}

.ae-practice-modes a,
.ae-ct-navigation .ae-btn,
.ae-ct-stages a {
  text-decoration: none;
}

.ae-ct-stages {
  margin: 1rem 0;
}

.ae-scope .ae-practice-modes a.ae-btn-primary {
  color: var(--ae-paper);
}

.ae-scope .ae-ct-stages a {
  border: 1px solid var(--ae-rule-2);
  padding: 0.4rem 0.7rem;
  font-size: 0.84rem;
}

.ae-scope .ae-ct-stages a[aria-current="step"] {
  background: var(--ae-accent-soft);
  border-color: var(--ae-accent);
  color: var(--ae-accent-ink);
}

.ae-scope .ae-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.ae-scope a:focus-visible,
.ae-scope button:focus-visible,
.ae-scope summary:focus-visible,
.ae-ct-scroll:focus-visible {
  outline: 3px solid var(--ae-accent);
  outline-offset: 3px;
}

.ae-ct-formula {
  font-family: var(--ae-serif);
  font-size: 1.65rem;
  color: var(--ae-ink);
  margin: 1.4rem 0;
}

.ae-ct-formulas {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 0.25rem;
}

.ae-ct-formulas > span {
  flex: none;
}

.ae-ct-scroll {
  overflow-x: auto;
  margin: 1rem 0;
}

.ae-scope .ae-construction-table {
  border-collapse: collapse;
  width: auto;
  margin: 0.5rem auto 1.2rem;
  font-family: var(--ae-serif);
  font-size: 1.45rem;
  color: var(--ae-ink);
  white-space: nowrap;
}

.ae-scope .ae-construction-table th,
.ae-scope .ae-construction-table td {
  border: 0;
  padding: 0.22rem 0;
  text-align: center;
  font-weight: normal;
  background: transparent;
}

.ae-scope .ae-construction-table .ae-ct-atom {
  padding-inline: 0.55rem;
}

.ae-scope .ae-construction-table .ae-ct-divider {
  border-right: 1px solid var(--ae-ink);
}

.ae-scope .ae-construction-table .ae-ct-syntax.ae-ct-divider {
  padding-right: 0.6rem;
}

.ae-scope .ae-construction-table .ae-ct-op {
  padding-inline: 0.28rem;
  min-width: 1.4rem;
}

.ae-scope .ae-construction-table .ae-ct-divider + * {
  padding-left: 0.6rem;
}

.ae-scope .ae-construction-table thead th,
.ae-scope .ae-construction-table tbody tr:last-child td {
  border-bottom: 1px solid var(--ae-ink);
}

.ae-scope .ae-construction-table .ae-ct-main {
  background: var(--ae-accent-soft);
  font-weight: bold;
}

.ae-scope .ae-construction-table tfoot .ae-ct-main {
  font-style: italic;
}

.ae-scope h2,
.ae-scope h3,
.ae-scope h4 {
  font-family: var(--ae-serif);
  color: var(--ae-ink);
  line-height: 1.25;
  margin: 0;
}

.ae-scope code {
  font-family: var(--ae-mono);
  font-size: 0.92em;
  background: var(--ae-panel);
  border-radius: 3px;
  padding: 0.1em 0.32em;
  color: inherit;
}

.ae-scope a {
  color: var(--ae-accent-ink);
}

/* Formulas. `.ae-f` is the single hook for anything in house glyphs; it must
   never be applied to prose, because the mono family kerns prose badly. */
.ae-f {
  font-family: var(--ae-mono);
  font-size: 0.95em;
  white-space: nowrap;
}

.ae-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------- controls */

.ae-controls {
  background: var(--ae-desk);
  border: 1px solid var(--ae-rule);
  border-radius: var(--ae-radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1.5rem;
}

.ae-search {
  width: 100%;
  font-family: var(--ae-sans);
  font-size: 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--ae-rule-2);
  border-radius: 6px;
  background: var(--ae-paper);
  color: var(--ae-ink);
}

.ae-search:focus-visible,
.ae-scope button:focus-visible,
.ae-scope select:focus-visible,
.ae-scope a:focus-visible {
  outline: 2px solid var(--ae-accent);
  outline-offset: 2px;
}

.ae-search::placeholder {
  color: var(--ae-faint);
}

.ae-selects {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin-top: 0.85rem;
}

.ae-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.ae-field > span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ae-muted);
  font-weight: 600;
}

.ae-field select {
  font-family: var(--ae-sans);
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--ae-rule-2);
  border-radius: 5px;
  background: var(--ae-paper);
  color: var(--ae-ink);
  max-width: 15rem;
}

.ae-status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  margin-top: 0.85rem;
  font-size: 0.88rem;
  color: var(--ae-muted);
}

/* Buttons. `.ae-btn` is the quiet one, `.ae-btn-primary` the loud one; the
   random draw is the only loud button on either page. */
.ae-btn {
  font-family: var(--ae-sans);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--ae-rule-2);
  border-radius: 5px;
  background: var(--ae-paper);
  color: var(--ae-ink);
  cursor: pointer;
}

.ae-btn:hover {
  border-color: var(--ae-accent);
  color: var(--ae-accent-ink);
}

.ae-btn-primary {
  background: var(--ae-accent);
  border-color: var(--ae-accent);
  font-size: 1rem;
  padding: 0.6rem 1.4rem;
  color: #fff;
}

html[data-theme="dark"] .ae-btn-primary,
.ae-btn-primary {
  color: var(--ae-paper);
}

.ae-btn-primary:hover {
  filter: brightness(1.15);
  color: var(--ae-paper);
}

/* ------------------------------------------------------------------ cards */

.ae-list {
  display: grid;
  gap: 0.9rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

/*
 * A grid item's `min-width` is `auto`, which means it refuses to shrink below
 * its content — and a card's content includes a `white-space: nowrap` sequent
 * that can run to 500px. Without this the cards push the whole page sideways
 * on a phone instead of scrolling the sequent inside its own box.
 */
.ae-list > li,
.ae-card {
  min-width: 0;
}

.ae-card {
  display: block;
  background: var(--ae-card);
  border: 1px solid var(--ae-rule);
  border-radius: var(--ae-radius);
  padding: 0.95rem 1.1rem;
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.12s,
    transform 0.12s;
}

.ae-card:hover {
  border-color: var(--ae-accent);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.ae-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.ae-card-name {
  font-family: var(--ae-serif);
  font-size: 1.06rem;
  font-weight: 600;
  color: var(--ae-ink);
}

.ae-card-seq {
  display: block;
  margin: 0.3rem 0 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}

.ae-card-meta {
  font-size: 0.8rem;
  color: var(--ae-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
}

/* ------------------------------------------------------------------ chips */

.ae-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.13rem 0.5rem;
  border-radius: 999px;
  background: var(--ae-panel);
  color: var(--ae-muted);
  border: 1px solid transparent;
  white-space: nowrap;
}

.ae-chip-valid {
  background: var(--ae-valid-bg);
  color: var(--ae-valid);
}

.ae-chip-invalid {
  background: var(--ae-invalid-bg);
  color: var(--ae-invalid);
}

.ae-chip-warn {
  background: var(--ae-warn-bg);
  color: var(--ae-warn);
}

.ae-chip-accent {
  background: var(--ae-accent-soft);
  color: var(--ae-accent-ink);
}

/*
 * Chips are nowrap because a two-word tag reads badly broken across lines. But
 * `course.used_in` can join several lecture names into one long prose string
 * ("Lecture 7 (retired at V2.0), Lecture 8 (retired at V2.0)"), and a nowrap
 * chip that long pushes the whole page sideways on a phone. This one wraps.
 */
.ae-chip-wrap {
  white-space: normal;
  max-width: 100%;
}

/* A tag chip is a button: clicking it filters the catalogue by that value. */
button.ae-chip {
  cursor: pointer;
  font-family: var(--ae-sans);
}

button.ae-chip:hover {
  border-color: currentcolor;
}

.ae-tagrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: baseline;
  min-width: 0;
}

.ae-tagrow > span:first-child {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ae-faint);
  min-width: 6.5rem;
  font-weight: 600;
}

/* ----------------------------------------------------------------- detail */

.ae-detail {
  max-width: 100%;
}

.ae-back {
  display: inline-block;
  font-size: 0.86rem;
  margin-bottom: 1rem;
  color: var(--ae-muted);
  text-decoration: none;
}

.ae-back:hover {
  color: var(--ae-accent-ink);
}

.ae-title {
  font-family: var(--ae-serif);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--ae-ink);
  margin: 0 0 0.3rem;
  line-height: 1.2;
}

.ae-akas {
  font-size: 0.9rem;
  color: var(--ae-muted);
  margin: 0 0 0.9rem;
}

/* The sequent gets the most visual weight on the page: on the practice page it
   is very nearly the whole problem. */
.ae-sequent {
  background: var(--ae-desk);
  border: 1px solid var(--ae-rule);
  border-left: 3px solid var(--ae-accent);
  border-radius: var(--ae-radius);
  padding: 1rem 1.15rem;
  margin: 0 0 1.25rem;
  overflow-x: auto;
}

.ae-sequent .ae-f {
  font-size: 1.12rem;
  color: var(--ae-ink);
}

.ae-seq-stack {
  display: grid;
  gap: 0.3rem;
}

.ae-seq-prem {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
}

.ae-seq-num {
  font-family: var(--ae-mono);
  font-size: 0.8rem;
  color: var(--ae-faint);
  min-width: 1.4rem;
  text-align: right;
  flex: none;
}

.ae-seq-bar {
  border-top: 1px solid var(--ae-rule-2);
  margin: 0.45rem 0 0.45rem 2rem;
}

.ae-seq-concl {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
}

.ae-seq-concl .ae-seq-num {
  color: var(--ae-accent);
  font-weight: 700;
}

.ae-seq-note {
  font-size: 0.78rem;
  color: var(--ae-faint);
  margin-top: 0.7rem;
  font-family: var(--ae-sans);
}

/* -------------------------------------------------------------- sections */

.ae-section {
  margin: 1.6rem 0;
}

.ae-section > h3 {
  font-size: 1.05rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--ae-rule);
}

.ae-prose p {
  margin: 0 0 0.7rem;
}

.ae-prose p:last-child {
  margin-bottom: 0;
}

.ae-prose strong {
  color: var(--ae-ink);
}

/* ---------------------------------------------------------- reveal panels */

/* Every answer lives inside a <details>. Closed is the default in the markup,
   so a reader who has JS disabled still gets the whole entry, just expanded by
   hand — nothing here is JS-gated. */
.ae-reveal {
  border: 1px solid var(--ae-rule);
  border-radius: var(--ae-radius);
  background: var(--ae-card);
  margin: 0.7rem 0;
  overflow: hidden;
}

.ae-reveal > summary {
  cursor: pointer;
  padding: 0.7rem 1rem;
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--ae-ink);
  background: var(--ae-panel);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.ae-reveal > summary::-webkit-details-marker {
  display: none;
}

.ae-reveal > summary::before {
  content: "▸";
  color: var(--ae-accent);
  font-size: 0.8em;
  flex: none;
  transition: transform 0.12s;
}

.ae-reveal[open] > summary::before {
  transform: rotate(90deg);
}

.ae-reveal > summary:hover {
  color: var(--ae-accent-ink);
}

.ae-reveal-hint {
  margin-left: auto;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--ae-muted);
}

.ae-reveal-body {
  padding: 1rem;
  border-top: 1px solid var(--ae-rule);
}

/* -------------------------------------------------------- verdict banner */

.ae-verdict {
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.94rem;
}

.ae-verdict-valid {
  background: var(--ae-valid-bg);
  color: var(--ae-valid);
}

.ae-verdict-invalid {
  background: var(--ae-invalid-bg);
  color: var(--ae-invalid);
}

.ae-verdict strong {
  color: inherit;
}

.ae-verdict .ae-f {
  color: inherit;
}

/* ------------------------------------------------------------ truth table */

/* Up to 6 atoms means up to 64 rows and 11 columns, so the table scrolls
   inside its own box rather than pushing the page sideways. */
.ae-table-wrap {
  overflow-x: auto;
  max-height: 30rem;
  overflow-y: auto;
  border: 1px solid var(--ae-rule);
  border-radius: 6px;
}

.ae-tt {
  border-collapse: collapse;
  font-family: var(--ae-mono);
  font-size: 0.82rem;
  width: 100%;
}

.ae-tt th,
.ae-tt td {
  padding: 0.28rem 0.6rem;
  text-align: center;
  border-bottom: 1px solid var(--ae-rule);
  white-space: nowrap;
}

.ae-tt thead th {
  position: sticky;
  top: 0;
  background: var(--ae-panel);
  color: var(--ae-ink);
  font-weight: 600;
  z-index: 1;
  border-bottom: 2px solid var(--ae-rule-2);
}

/* The vertical rule between the atom block and the formula block, and again
   before the conclusion — the two places a reader's eye needs to stop. */
.ae-tt .ae-tt-split {
  border-left: 2px solid var(--ae-rule-2);
}

.ae-tt tbody tr.ae-tt-live {
  background: var(--ae-accent-soft);
}

.ae-tt tbody tr.ae-tt-cm {
  background: var(--ae-invalid-bg);
  font-weight: 700;
}

.ae-tt tbody tr.ae-tt-cm td {
  color: var(--ae-invalid);
}

.ae-tt-mark {
  font-family: var(--ae-sans);
  font-size: 0.72rem;
  color: var(--ae-invalid);
  font-weight: 700;
}

.ae-tt-legend {
  font-size: 0.8rem;
  color: var(--ae-muted);
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
}

.ae-swatch {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  border-radius: 2px;
  vertical-align: -0.05em;
  margin-right: 0.35em;
  border: 1px solid var(--ae-rule-2);
}

/* ------------------------------------------------------------------ tree */

/*
 * The tableau is a branching diagram, not a list: a fork means two
 * alternatives, and a list cannot say that. Nodes are laid out with flexbox --
 * each subtree centred over its own children -- and the connectors are drawn
 * with borders: a stub down out of the parent, a rule spanning the children,
 * and a stub down into each child. No SVG, so the formulas stay selectable and
 * the whole thing reflows and recolours like ordinary text.
 */
.ae-t-scroll {
  overflow-x: auto;
  padding: 0.5rem 0 0.75rem;
}

.ae-t {
  display: flex;
  justify-content: center;
  min-width: min-content;
  font-family: var(--ae-mono);
  font-size: 0.84rem;
}

.ae-t-node {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ae-t-box {
  padding: 0.3rem 0.55rem;
  text-align: center;
  white-space: nowrap;
}

.ae-t-root {
  border: 1px solid var(--ae-rule);
  border-radius: 6px;
  background: var(--ae-desk);
  text-align: left;
  padding: 0.55rem 0.8rem;
}

.ae-t-line {
  padding: 0.08rem 0;
  color: var(--ae-ink);
}

.ae-t-n {
  color: var(--ae-faint);
  font-size: 0.78em;
  margin-right: 0.4rem;
}

.ae-t-tick {
  color: var(--ae-valid);
  margin-left: 0.45rem;
  font-family: var(--ae-sans);
}

.ae-t-mark {
  font-family: var(--ae-sans);
  font-weight: 700;
  padding-top: 0.15rem;
}

.ae-t-closed {
  color: var(--ae-valid);
}

.ae-t-open {
  color: var(--ae-invalid);
}

.ae-t-model {
  font-size: 0.78rem;
  color: var(--ae-invalid);
  background: var(--ae-invalid-bg);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  margin-top: 0.25rem;
  white-space: nowrap;
}

/* --- the connectors --- */

.ae-t-kids {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  padding-top: 1.4rem;
}

/* The stub dropping out of the parent node. */
.ae-t-kids::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 0.7rem;
  background: var(--ae-rule-2);
}

.ae-t-kid {
  position: relative;
  padding: 0 0.6rem;
}

/* The stub dropping into each child. */
.ae-t-kid::before {
  content: "";
  position: absolute;
  top: -0.7rem;
  left: 50%;
  width: 1px;
  height: 0.7rem;
  background: var(--ae-rule-2);
}

/* The rule spanning the children: half from the first, half from the last, so
   it reaches exactly between the two stubs however wide the subtrees are. */
.ae-t-kid::after {
  content: "";
  position: absolute;
  top: -0.7rem;
  height: 1px;
  background: var(--ae-rule-2);
}

.ae-t-kid:first-child::after {
  left: 50%;
  right: 0;
}

.ae-t-kid:last-child::after {
  left: 0;
  right: 50%;
}

.ae-t-kid:only-child::after {
  display: none;
}

.ae-tree-key {
  font-size: 0.84rem;
  color: var(--ae-muted);
  margin: 0 0 0.5rem;
}

/* ------------------------------------------------------------------- ND */

.ae-nd-profile {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.ae-stat {
  background: var(--ae-panel);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
}

.ae-stat-k {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ae-muted);
  font-weight: 600;
}

.ae-stat-v {
  display: block;
  font-size: 1.05rem;
  color: var(--ae-ink);
  font-family: var(--ae-serif);
}

.ae-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* A note explaining that the entry's data does not (yet) carry the proof
   lines. Deliberately styled as an editorial aside, not as an error. */
.ae-missing {
  background: var(--ae-warn-bg);
  color: var(--ae-warn);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  font-size: 0.86rem;
}

.ae-missing code {
  background: rgb(0 0 0 / 8%);
}

/* -------------------------------------------------- Fitch derivations */

/*
 * The scope lines are the grammar of a Fitch proof, not decoration: a vertical
 * rule per open subproof, and a stroke under the last assumption of each,
 * marking off what is assumed from what is derived. Drawn with borders rather
 * than indentation so a nested proof still reads as nested on a phone.
 */
.ae-nd {
  font-family: var(--ae-mono);
  font-size: 0.86rem;
  overflow-x: auto;
}

.ae-nd-line {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  min-height: 1.7em;
}

.ae-nd-n {
  flex: none;
  min-width: 1.8rem;
  text-align: right;
  color: var(--ae-faint);
  font-size: 0.8rem;
  padding-top: 0.25em;
}

.ae-nd-scope {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
}

.ae-nd-bar {
  flex: none;
  width: 0.9rem;
  border-left: 1px solid var(--ae-rule-2);
  margin-right: 0.15rem;
}

/* Content-width, so the assumption stroke below spans the formula rather than
   the whole row -- which is how a Fitch proof is actually drawn. */
.ae-nd-body {
  flex: none;
  padding: 0.25em 1.2rem 0.25em 0.4rem;
  border-left: 1px solid var(--ae-rule-2);
  white-space: nowrap;
}

/* Takes up the slack so the justification column still sits to the right. */
.ae-nd-fill {
  flex: 1;
  min-width: 0.5rem;
}

/* The horizontal stroke under the last assumption. */
.ae-nd-assumed {
  border-bottom: 1px solid var(--ae-rule-2);
}

.ae-nd-cite {
  flex: none;
  text-align: left;
  font-family: var(--ae-sans);
  font-size: 0.76rem;
  color: var(--ae-muted);
  padding-top: 0.45em;
  min-width: 6rem;
}

/* ---------------------------------------------------------- appearances */

.ae-appearance {
  border-left: 2px solid var(--ae-rule-2);
  padding: 0 0 0 0.9rem;
  margin: 0 0 1.1rem;
}

.ae-appearance:last-child {
  margin-bottom: 0;
}

.ae-app-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.ae-app-who {
  font-weight: 600;
  color: var(--ae-ink);
}

.ae-app-where {
  font-size: 0.86rem;
  color: var(--ae-muted);
}

/* Fidelity is styled, not just labelled: a verbatim quotation is set as a
   quotation, a paraphrase is plain, and our own reconstruction is visibly
   marked as ours so it is never mistaken for something a source said. */
.ae-app-quote {
  font-size: 0.9rem;
  margin: 0.3rem 0 0;
  padding: 0.45rem 0.7rem;
  border-radius: 5px;
  background: var(--ae-desk);
}

/* A pending provenance is a gap the entry is admitting to, so it is set like
   the warnings rather than like a quotation: the reader should register that
   something is missing, not skim past a paragraph shaped like a citation. */
.ae-app-pending {
  font-size: 0.9rem;
  padding: 0.45rem 0.7rem;
  border-radius: 5px;
  border-left: 2px dotted var(--ae-warn);
  background: var(--ae-warn-bg);
  color: var(--ae-warn);
}

.ae-app-pending p {
  margin: 0;
}

.ae-app-verbatim {
  font-family: var(--ae-serif);
  font-style: italic;
  border-left: 2px solid var(--ae-accent);
}

.ae-app-paraphrase {
  border-left: 2px dashed var(--ae-rule-2);
}

.ae-app-reconstruction {
  border-left: 2px dotted var(--ae-warn);
  background: var(--ae-warn-bg);
  color: var(--ae-warn);
}

/* The quote disclosure used on the practice page only. Quieter than a section
   reveal — it is one sentence of source text, not a truth table. */
.ae-app-reveal {
  margin: 0.35rem 0 0;
  border-color: var(--ae-rule);
}

.ae-app-reveal > summary {
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 500;
  background: transparent;
  color: var(--ae-muted);
}

.ae-app-reveal .ae-reveal-body {
  padding: 0.5rem 0.6rem;
  border-top: none;
}

/* ----------------------------------------------------------- relations */

.ae-relations {
  display: grid;
  gap: 0.6rem;
}

.ae-relation {
  display: block;
  border: 1px solid var(--ae-rule);
  border-left: 3px solid var(--ae-accent);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  text-decoration: none;
  color: inherit;
  background: var(--ae-card);
  /* Grid item: without this it refuses to shrink below its nowrap sequent. */
  min-width: 0;
}

/* The related form's sequent scrolls inside the card rather than widening it. */
.ae-rel-seq {
  margin-top: 0.25rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}

.ae-relation:hover {
  border-color: var(--ae-accent);
  text-decoration: none;
  color: inherit;
}

.ae-rel-kind {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ae-muted);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.ae-rel-name {
  font-family: var(--ae-serif);
  font-weight: 600;
  color: var(--ae-ink);
}

/* ------------------------------------------------- premises + instructor */

.ae-premise-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.ae-premise-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}

.ae-instructor {
  margin-top: 1.5rem;
  border: 1px dashed var(--ae-rule-2);
  border-radius: var(--ae-radius);
  background: transparent;
}

.ae-instructor > summary {
  background: transparent;
  color: var(--ae-muted);
  font-size: 0.84rem;
  font-weight: 500;
}

/* ------------------------------------------------------------- practice */

/*
 * The practice page is two questions and a button. The chips are toggles, so
 * their state has to be readable at a glance: the pressed one is filled with
 * the accent, not merely tinted, because a pale tint against a white chip is
 * not a difference a student will notice in a hurry.
 */
.ae-choices {
  background: var(--ae-desk);
  border: 1px solid var(--ae-rule);
  border-radius: var(--ae-radius);
  padding: 1.15rem 1.25rem 1.25rem;
  margin-bottom: 1.75rem;
}

.ae-choice + .ae-choice {
  margin-top: 1.15rem;
}

/* Beats `.ae-scope h3`, which is the serif section heading. */
.ae-scope .ae-choice h3 {
  font-family: var(--ae-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ae-ink);
  margin: 0 0 0.55rem;
  padding: 0;
  border: none;
}

.ae-chiprow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ae-scope button.ae-chip-toggle {
  font-size: 0.86rem;
  padding: 0.42rem 0.9rem;
  border: 1px solid var(--ae-rule-2);
  background: var(--ae-paper);
  color: var(--ae-muted);
  font-weight: 500;
}

.ae-scope button.ae-chip-toggle:hover {
  border-color: var(--ae-accent);
  color: var(--ae-accent-ink);
}

.ae-scope button.ae-chip-on {
  background: var(--ae-accent);
  border-color: var(--ae-accent);
  color: var(--ae-paper);
  font-weight: 600;
}

.ae-drawrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--ae-rule);
}

.ae-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.ae-task {
  font-size: 1.02rem;
  color: var(--ae-ink);
  margin: 0 0 0.85rem;
}

.ae-problem .ae-reveal {
  margin-top: 1.15rem;
}

.ae-entry-link {
  margin: 1.3rem 0 0;
  font-size: 0.88rem;
}

/*
 * The theme's navbar is fixed, so scrolling a freshly drawn argument to the
 * top of the viewport tucks its title underneath. Reserve the navbar's height
 * so `scrollIntoView` lands below it.
 */
#ae-stage {
  scroll-margin-top: 5rem;
}

.ae-practice-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.9rem;
}

.ae-progress {
  font-size: 0.82rem;
  color: var(--ae-muted);
}

.ae-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ae-muted);
  background: var(--ae-desk);
  border: 1px dashed var(--ae-rule-2);
  border-radius: var(--ae-radius);
}

.ae-loading {
  padding: 2rem 0;
  color: var(--ae-muted);
  font-style: italic;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 576px) {
  .ae-controls {
    padding: 0.8rem;
  }

  .ae-field select {
    max-width: 100%;
  }

  .ae-selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ae-title {
    font-size: 1.4rem;
  }

  .ae-tagrow > span:first-child {
    min-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ae-scope * {
    transition: none !important;
  }
}

/* ---------------------------------------------------------- typeset LaTeX
 *
 * The table, the tree and the derivation are shown as the LaTeX output itself,
 * compiled by `EncyclopediaOfArguments/latexgen/svg.py` and inlined into the
 * page. Inlined rather than an `<img>`, because an `<img>` cannot see the
 * page's colour and this site has a dark mode: every glyph and rule in the SVG
 * is painted `currentColor`, so the diagram simply follows the surrounding
 * text.
 *
 * The generator writes the width in `em`, taken from the block's real width at
 * 11pt, so a table sits at the same size relative to the prose as it does in
 * the course notes. A block too wide for the column scrolls rather than
 * shrinking: a truth table at 40% scale is not a truth table anyone can read.
 */
.ae-svg-scroll {
  overflow-x: auto;
  padding: 0.6rem 0 0.4rem;
}

.ae-svg-scroll .ae-svg {
  display: block;
  /* The width is set inline, per block, in `em` taken from the block's real
     typeset width -- so the LaTeX comes out at the same size relative to the
     prose as it has in the handouts.

     Deliberately *not* capped at the container. A six-premise truth table is
     about 44em wide, and squeezing that into a phone would put it at 40% scale,
     which is not a truth table anyone can read. It scrolls instead, which is
     what the HTML tables and trees beside it have always done. */
  max-width: none;
}

/* Until (or unless) the SVG arrives, the HTML rendering stands in. */
.ae-svg-fallback {
  min-width: 0;
}

/* The verdict, at the top of a revealed answer. Whatever the student worked,
   the first thing they want is whether they got it right. */
.ae-answer {
  margin: 0 0 1rem;
  padding: 0.55rem 0.8rem;
  border-radius: 4px;
  border-left: 3px solid;
  font-family: var(--ae-sans);
  font-size: 1.02rem;
}

.ae-answer-valid {
  border-left-color: var(--ae-valid);
  background: var(--ae-valid-bg);
  color: var(--ae-valid);
}

.ae-answer-invalid {
  border-left-color: var(--ae-invalid);
  background: var(--ae-invalid-bg);
  color: var(--ae-invalid);
}

/* "One correct answer, not the only one" — trees and derivations both. */
.ae-alt {
  margin: 0.5rem 0 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ae-muted);
}

/* Where one subproof ends and its sibling begins — the second half of a
   biconditional proof, the second case of a proof by cases. They sit at the
   same depth with nothing between them, so without a break the two scope
   lines read as one. */
.ae-nd-restart {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
}

/* Intermediate calculations: both views keep every row. */
.ae-views {
  display: flex;
  gap: 0;
  margin: 0 0 0.5rem;
  border: 1px solid var(--ae-rule-2);
  border-radius: 4px;
  overflow: hidden;
  width: max-content;
  max-width: 100%;
}

.ae-view-btn {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--ae-rule-2);
  background: var(--ae-card);
  color: var(--ae-muted);
  font-family: var(--ae-sans);
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
}

.ae-view-btn:last-child {
  border-right: 0;
}

.ae-view-btn:hover {
  color: var(--ae-accent-ink);
}

.ae-view-on {
  background: var(--ae-accent-soft);
  color: var(--ae-accent-ink);
  font-weight: 600;
}

.ae-view-btn:focus-visible {
  outline: 2px solid var(--ae-accent);
  outline-offset: -2px;
}

/* Match the constructing-tables activity: legible values aligned under their
   connectives, with horizontal scrolling for longer formulas. */
.ae-assessment-table .ae-svg-scroll {
  font-size: 1.45rem;
  margin: 1rem 0;
}
.ae-assessment-table .ae-svg {
  margin-inline: auto;
}
.ae-worked-argument .ae-tt-labels th {
  font-family: var(--ae-sans);
  font-size: .7rem;
  color: var(--ae-muted);
  border-bottom: 0;
  padding-bottom: .5rem;
}
.ae-worked-argument .ae-tt-cm td {
  background: var(--ae-invalid-bg);
}
.ae-tt-note {
  font-size: .9rem;
  line-height: 1.6;
}

.ae-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
