/* Paul AI app: the website's heritage family, adapted for work (see PRODUCT.md and DESIGN.md).
   Navy bookcloth shell, parchment working ground, burgundy for the main action, gold for the
   ribbon that marks where you are. EB Garamond for headings and lesson text, Source Sans 3 for
   controls, tables, labels and numbers. Light and dark follow the device.
   WCAG 2.2 AA: text contrast >= 4.5:1, visible focus, 44px targets on touch screens.
   The fonts are served from this app, never from a font service. */

@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: block; }
@font-face { font-family: "Source Sans 3"; src: url("/fonts/source-sans-3-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }

:root {
  color-scheme: light dark;

  /* Ground and surfaces */
  --paper: #f6f1e4;        /* working ground */
  --page: #fffdf6;         /* panels, inputs, cards */
  --band: #ece3cc;         /* second neutral layer: table heads, toolbars */
  --ink: #1f1b16;
  --muted: #5a4f40;
  --rule: #d8ccb0;         /* hairlines */
  --rule-strong: #8a7a5c;  /* control borders (3:1) */

  /* The bookcloth shell */
  --rail: #1f2d4a;
  --rail-raised: #2a3b5e;
  --rail-ink: #f5efe0;
  --rail-muted: #b8b3a6;
  --rail-rule: #34466b;

  /* Action, selection, ribbon */
  --burgundy: #7b2433;
  --burgundy-dark: #5f1a27;
  --on-burgundy: #fffdf6;
  --link: #7b2433;
  --gold: #a5813f;
  --gold-light: #e3c98f;
  --gold-ink: #6f5219;
  --rubric: #7b2433;       /* burgundy as text: labels, today, the current week */
  --focus: #7b2433;

  /* States */
  --ok: #2c6a3c;
  --ok-bg: #e4efe0;
  --warn-bg: #f6ebc8;
  --warn-line: #a5813f;
  --error: #a12a20;
  --error-bg: #f8e4df;
  --info-bg: #eceff5;
  --info-line: #9aa6bd;
  --faith-bg: #f4ecd8;
  --writing: #efe8d6;

  /* Subjects: bookcloth colours */
  --s-english: #2d5b7a;
  --s-maths: #8a4a1d;
  --s-science: #23655f;
  --s-history: #765716;
  --s-humanities: #4f6328;
  --s-bible: #5d3a6c;

  /* Type */
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wordmark: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --t-xs: .8125rem;
  --t-sm: .9375rem;
  --t-md: 1rem;
  --t-lg: 1.125rem;
  --t-xl: 1.375rem;
  --t-2xl: 1.75rem;
  --t-3xl: 2.25rem;

  /* Space */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4rem;
  --radius: 4px;
  --rail-w: 15rem;
  --chat-w: 25rem;
  --target: 2.5rem;
  --shadow-overlay: 0 12px 32px rgba(18, 22, 32, .28);
}

@media (pointer: coarse) { :root { --target: 2.75rem; } }

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141a26;
    --page: #1c2331;
    --band: #232b3b;
    --ink: #ece3cc;
    --muted: #b3a88f;
    --rule: #323b4e;
    --rule-strong: #6f7a91;
    --rail: #0e131d;
    --rail-raised: #1b2436;
    --rail-ink: #ece3cc;
    --rail-muted: #a9a291;
    --rail-rule: #222b3d;
    --burgundy: #8e2b3b;
    --burgundy-dark: #6d1f2c;
    --on-burgundy: #fff8ee;
    --link: #e9a3ad;
    --gold: #c9a55c;
    --gold-light: #d9b86c;
    --gold-ink: #d9b86c;
    --rubric: #e9a3ad;
    --focus: #d9b86c;
    --ok: #86c597;
    --ok-bg: #1d3125;
    --warn-bg: #352d18;
    --warn-line: #a5813f;
    --error: #f29386;
    --error-bg: #3a1f1f;
    --info-bg: #1f2738;
    --info-line: #4f5d7a;
    --faith-bg: #262217;
    --writing: #20283a;
    --s-english: #8fb7d6;
    --s-maths: #e2a477;
    --s-science: #79c2b9;
    --s-history: #d8b56a;
    --s-humanities: #a9c27a;
    --s-bible: #c9a6dc;
    --shadow-overlay: 0 12px 32px rgba(0, 0, 0, .55);
  }
}

/* ---- Base ------------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-md)/1.5 var(--sans);
  caret-color: var(--burgundy);
  text-rendering: optimizeLegibility;
}
::selection { background: var(--gold-light); color: #1f1b16; }
img, svg { max-width: 100%; }
p { margin: 0 0 var(--s4); }
ul, ol { margin: 0 0 var(--s4); padding-left: 1.25rem; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 var(--s3); text-wrap: balance; }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s5) 0; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: var(--s2); z-index: 50; background: var(--page); color: var(--ink); padding: var(--s2) var(--s4); }
.skip:focus { left: var(--s2); }
.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.25em; }

/* ---- Shell -------------------------------------------------------------------------------- */

.app { min-height: 100vh; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); align-content: start; }
/* The rail's cloth runs the full height of a long page. */
@media (min-width: 64rem) { .app { background: linear-gradient(90deg, var(--rail) var(--rail-w), transparent var(--rail-w)); } }
.app.chat-open { grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--chat-w); }

.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--s5);
  padding: var(--s5) var(--s3) var(--s4);
  background: var(--rail); color: var(--rail-ink);
  scrollbar-width: thin; scrollbar-color: var(--rail-rule) transparent;
}
.rail :focus-visible { outline-color: var(--gold-light); }
.wordmark { display: block; padding: 0 var(--s3); color: inherit; text-decoration: none; font: 500 1.875rem/1 var(--wordmark); letter-spacing: .01em; }
.wordmark:hover { text-decoration: none; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-nav a, .rail-foot a, .rail-foot button {
  position: relative; display: flex; align-items: center; gap: var(--s3);
  min-height: var(--target); padding: 0 var(--s3) 0 var(--s4);
  border: 0; border-radius: var(--radius); background: none;
  color: var(--rail-muted); font: 500 var(--t-md)/1.2 var(--sans); text-decoration: none; text-align: left; cursor: pointer;
  transition: background-color .15s ease-out, color .15s ease-out;
}
.rail-nav a:hover, .rail-foot a:hover, .rail-foot button:hover { color: var(--rail-ink); background: var(--rail-raised); }
.rail-nav a[aria-current="page"], .rail-foot a[aria-current="page"] { color: var(--rail-ink); background: var(--rail-raised); font-weight: 600; }
/* The ribbon on the active item: a gold silk marker hanging from the top edge. */
.rail-nav a[aria-current="page"]::before, .rail-foot a[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 0; width: 6px; height: calc(100% + 6px);
  background: var(--gold-light);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
}
.rail-generate { margin: 0 var(--s1); }
.rail-generate .btn { width: 100%; justify-content: center; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: var(--s4); border-top: 1px solid var(--rail-rule); }
.rail-family { padding: var(--s2) var(--s4) 0; color: var(--rail-muted); font-size: var(--t-xs); }

.topbar { display: none; }
.main { min-width: 0; }
.page { max-width: 76rem; margin: 0 auto; padding: var(--s6) var(--s6) var(--s8); }
.page.narrow { max-width: 46rem; }
.page.wide { max-width: none; }

@media (max-width: 63.99rem) {
  .app, .app.chat-open { grid-template-columns: minmax(0, 1fr); }
  .topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s2);
    padding: var(--s2) var(--s3); background: var(--rail); color: var(--rail-ink);
  }
  .topbar .wordmark { margin-right: auto; padding: 0 var(--s2); font-size: 1.625rem; }
  .topbar button { display: inline-flex; align-items: center; gap: var(--s2); min-height: 2.75rem; min-width: 2.75rem; justify-content: center; padding: 0 var(--s3); border: 1px solid var(--rail-rule); border-radius: var(--radius); background: none; color: var(--rail-ink); font: 600 var(--t-sm) var(--sans); cursor: pointer; }
  .topbar :focus-visible { outline-color: var(--gold-light); }
  .rail { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: min(18rem, 86vw); height: auto; transform: translateX(-105%); transition: transform .2s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-overlay); }
  .app.menu-open .rail { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 30; background: rgba(14, 19, 29, .45); border: 0; }
  .page { padding: var(--s5) var(--s4) var(--s7); }
}

/* ---- Chat panel ---------------------------------------------------------------------------- */

.chat {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--page); border-left: 1px solid var(--rule);
}
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s4) var(--s3); border-bottom: 1px solid var(--rule); }
.chat-head h2 { margin: 0; font-size: var(--t-xl); }
.chat-messages { flex: 1; overflow-y: auto; padding: var(--s4); scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
.chat-hint { color: var(--muted); font-size: var(--t-sm); }
.msg { margin: 0 0 var(--s3); padding: var(--s3) var(--s4); border-radius: 10px; white-space: pre-wrap; line-height: 1.5; }
.msg.parent { margin-left: var(--s7); background: var(--band); border-bottom-right-radius: 2px; }
.msg.assistant { margin-right: var(--s5); background: var(--paper); border: 1px solid var(--rule); border-bottom-left-radius: 2px; font-family: var(--serif); font-size: var(--t-lg); }
.msg.assistant:empty::before { content: "Writing…"; color: var(--muted); font-family: var(--sans); font-size: var(--t-sm); }
.proposal { margin: 0 0 var(--s3); padding: var(--s3) var(--s4); border: 1px solid var(--gold); border-radius: var(--radius); background: var(--faith-bg); }
.chat-form { display: flex; gap: var(--s2); padding: var(--s3) var(--s4) var(--s4); border-top: 1px solid var(--rule); }
.chat-form input { flex: 1; max-width: none; }
@media (max-width: 63.99rem) {
  .chat { position: fixed; z-index: 45; inset: 0; height: auto; border: 0; }
}

/* ---- Page head ------------------------------------------------------------------------------ */

.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s5); margin: 0 0 var(--s5); }
.head h1 { margin: 0; }
.head-sub { margin: var(--s1) 0 0; color: var(--muted); }
.head-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.crumbs { margin: 0 0 var(--s3); font-size: var(--t-sm); color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--link); }
.section { margin: 0 0 var(--s7); }
.section > h2 { padding-bottom: var(--s2); border-bottom: 1px solid var(--rule); }
.lead { font-size: var(--t-lg); max-width: 40rem; }

/* ---- Buttons ----------------------------------------------------------------------------- */

.btn, button.link {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--target); padding: 0 var(--s4);
  border: 1px solid var(--burgundy-dark); border-radius: 3px;
  background: var(--burgundy); color: var(--on-burgundy);
  font: 600 var(--t-md)/1.1 var(--sans); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out;
}
.btn:hover { background: var(--burgundy-dark); text-decoration: none; }
.btn.secondary { background: var(--page); color: var(--link); border-color: var(--rule-strong); }
.btn.secondary:hover { border-color: var(--link); background: var(--page); }
.btn.quiet { background: none; border-color: transparent; color: var(--link); padding: 0 var(--s2); }
.btn.quiet:hover { background: var(--band); }
.btn.danger { background: var(--page); color: var(--error); border-color: var(--error); }
.btn.danger:hover { background: var(--error-bg); }
.btn.small { min-height: 2rem; padding: 0 var(--s3); font-size: var(--t-sm); }
@media (pointer: coarse) { .btn.small { min-height: var(--target); } }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--link); font-weight: 400; text-decoration: underline; text-underline-offset: .18em; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: var(--s4) 0; }

/* ---- Forms ------------------------------------------------------------------------------- */

label { display: block; margin: 0 0 var(--s1); font-weight: 600; }
.field { margin: 0 0 var(--s4); }
.field-row { display: flex; flex-wrap: wrap; gap: var(--s4); }
.field-row > .field { flex: 1 1 12rem; }
.hint { display: block; margin: var(--s1) 0 0; color: var(--muted); font-size: var(--t-sm); font-weight: 400; }
input, select, textarea {
  width: 100%; max-width: 32rem; min-height: var(--target);
  padding: .5rem .625rem;
  border: 1px solid var(--rule-strong); border-radius: 3px;
  background: var(--page); color: var(--ink); font: 400 var(--t-md)/1.4 var(--sans);
}
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
textarea { min-height: 7rem; max-width: 100%; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 1.125rem; height: 1.125rem; min-height: 0; margin: .15rem 0 0; flex: none; accent-color: var(--burgundy); }
.check { display: flex; gap: var(--s3); align-items: flex-start; margin: var(--s2) 0; font-weight: 400; cursor: pointer; }
.check.target { min-height: var(--target); align-items: center; }
fieldset { margin: 0 0 var(--s4); padding: 0; border: 0; }
legend { margin: 0 0 var(--s2); padding: 0; font-weight: 600; }
.choices { display: grid; gap: var(--s2); }
.choice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--page); font-weight: 400; cursor: pointer; transition: border-color .15s ease-out, background-color .15s ease-out; }
.choice:hover { border-color: var(--ink); }
.choice:has(input:checked) { border-color: var(--rubric); background: color-mix(in srgb, var(--rubric) 7%, var(--page)); }
.choice strong { display: block; }
.choice span { display: block; color: var(--muted); }
.done-field { display: inline-flex; flex-direction: column; align-items: flex-end; }
.done-box { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--target); margin: 0; padding: 0 var(--s3); border: 1px solid var(--rule-strong); border-radius: 3px; background: var(--page); color: var(--ink); font: 600 var(--t-md)/1.1 var(--sans); white-space: nowrap; cursor: pointer; transition: border-color .15s ease-out, background-color .15s ease-out; }
.done-box:hover { border-color: var(--ink); }
.done-box:has(input:checked) { border-color: var(--rubric); background: color-mix(in srgb, var(--rubric) 7%, var(--page)); }
.done-box input { margin: 0; }
.done-field .error-line { margin: var(--s1) 0 0; font-size: var(--t-xs); white-space: nowrap; }
.error-line { color: var(--error); font-weight: 600; margin: var(--s2) 0; }
.error-line:empty { display: none; }
.ok-line { color: var(--ok); font-weight: 600; }

/* ---- Panels and notices -------------------------------------------------------------------------- */

.panel { padding: var(--s5); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); }
.section > .panel + .panel { margin-top: var(--s4); }
.notice { margin: var(--s4) 0; padding: var(--s3) var(--s4); border: 1px solid var(--info-line); border-radius: var(--radius); background: var(--info-bg); }
.notice.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.notice.error { border-color: var(--error); background: var(--error-bg); }
.notice.ok { border-color: var(--ok); background: var(--ok-bg); }
.notice > :last-child { margin-bottom: 0; }
.notice ul { margin-top: var(--s2); }
.faith { margin: var(--s5) 0; padding: var(--s4) var(--s5); border: 1px solid var(--gold); border-radius: var(--radius); background: var(--faith-bg); }
.faith > h2, .faith > h3 { color: var(--gold-ink); }
.faith blockquote { margin: var(--s3) 0; font-family: var(--serif); font-size: var(--t-lg); }

/* ---- Subject keys, status, codes, the ribbon -------------------------------------------- */

.s-english { --subject: var(--s-english); }
.s-maths { --subject: var(--s-maths); }
.s-science { --subject: var(--s-science); }
.s-history { --subject: var(--s-history); }
.s-humanities { --subject: var(--s-humanities); }
.s-bible { --subject: var(--s-bible); }
/* The subject's colour key: a flat 4 px bar in its bookcloth colour. */
.key { display: inline-block; flex: none; width: 4px; height: .875rem; border-radius: 1px; background: var(--subject, var(--muted)); vertical-align: -.1em; }
.subject { display: inline-flex; align-items: center; gap: .4rem; color: var(--subject, var(--muted)); font: 600 var(--t-xs)/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.codes { color: var(--muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.status { display: inline-flex; align-items: center; gap: .3rem; font-size: var(--t-xs); font-weight: 600; }
.status .icon { width: 1rem; height: 1rem; }
.status.ready { color: var(--ok); }
.status.writing { color: var(--muted); }
.status.failed { color: var(--error); }
.status.personal { color: var(--gold-ink); }
.status.done { color: var(--ok); }
.ribbon {
  position: absolute; top: 0; width: 14px; height: 44px; pointer-events: none;
  background: var(--burgundy);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}

/* ---- Tables, meters, loading, empty --------------------------------------------------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
thead th { background: var(--band); color: var(--muted); font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
td.right, th.right { text-align: right; }
.meter { margin: 0 0 var(--s4); }
.meter-label { display: flex; justify-content: space-between; gap: var(--s3); margin: 0 0 var(--s1); }
.bar { height: 6px; border-radius: 3px; background: var(--band); overflow: hidden; }
.bar > div { height: 100%; background: var(--burgundy); transition: width .3s ease-out; }
.bar.gold > div { background: var(--gold); }
.skeleton { display: grid; gap: var(--s3); }
.skeleton span { display: block; height: 1rem; border-radius: 3px; background: var(--band); animation: breathe 1.4s ease-in-out infinite; }
.skeleton span:nth-child(2n) { width: 72%; }
.skeleton span:nth-child(3n) { width: 54%; }
@keyframes breathe { 50% { opacity: .55; } }
.empty { padding: var(--s6) var(--s5); border: 1px dashed var(--rule-strong); border-radius: var(--radius); text-align: center; }
.empty h2, .empty h3 { margin-bottom: var(--s2); }
.empty p { max-width: 34rem; margin-left: auto; margin-right: auto; color: var(--muted); }

/* ---- Today ---------------------------------------------------------------------------------- */

.today-head { position: relative; margin: 0 0 var(--s6); padding-left: var(--s6); }
.today-head .ribbon { left: 0; top: calc(-1 * var(--s6)); height: calc(var(--s6) + 3.25rem); }
.today-head h1 { font-size: var(--t-3xl); margin: 0; }
.today-head h1 .date { font-weight: 400; }
.today-head .head-sub { margin-top: var(--s2); }
.today-tools { position: absolute; right: 0; top: 0; }
.sheets { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); align-items: start; gap: var(--s5); margin: 0 0 var(--s7); }
.sheet { padding: var(--s4) var(--s5) var(--s2); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding-bottom: var(--s3); border-bottom: 1px solid var(--rule); }
.sheet-head h2 { margin: 0; }
.sheet-head span { color: var(--muted); font-size: var(--t-sm); }
.lessons { list-style: none; margin: 0; padding: 0; }
.lessons li + li { border-top: 1px solid var(--rule); }
.lessons li { display: flex; align-items: center; gap: var(--s3); }
.lessons .lesson-row { flex: 1; min-width: 0; }
.is-done .lesson-title { color: var(--muted); }
.lesson-row { display: grid; gap: .2rem; padding: var(--s3) 0; color: inherit; text-decoration: none; }
a.lesson-row:hover .lesson-title { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.lesson-row-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.lesson-title { font: 400 var(--t-lg)/1.3 var(--serif); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); color: var(--muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.sheet .empty-day { padding: var(--s4) 0; color: var(--muted); }
.notice.live { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s4); align-items: center; }

/* The rest of the week: days down, children across. */
.week-table th[scope="row"] { width: 9rem; white-space: nowrap; font-weight: 600; }
.week-table td ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.week-table td a { display: inline-flex; align-items: center; gap: .45rem; color: var(--ink); text-decoration: none; line-height: 1.3; }
.week-table td a:hover { color: var(--link); text-decoration: underline; }
.week-table tr.is-today th[scope="row"] { color: var(--rubric); }

/* ---- Week (timetable) --------------------------------------------------------------------- */

.week-nav { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.timetable { margin: 0 0 var(--s6); }
.timetable h2 { display: flex; align-items: baseline; gap: var(--s3); }
.timetable h2 span { color: var(--muted); font: 400 var(--t-sm) var(--sans); }
.timetable table { table-layout: fixed; min-width: 46rem; }
.timetable thead th { position: relative; }
.timetable thead th.is-today { color: var(--rubric); }
.timetable thead th.is-today .ribbon { right: var(--s2); width: 10px; height: 30px; }
.timetable td { height: 4.5rem; }
.timetable td a { display: block; color: var(--ink); text-decoration: none; font: 400 var(--t-md)/1.3 var(--serif); }
.timetable td a:hover { color: var(--link); text-decoration: underline; }
.timetable th[scope="row"] { width: 9.5rem; }

/* ---- Terms ---------------------------------------------------------------------------------- */

.child-group { margin: 0 0 var(--s6); }
.child-group > h2 { display: flex; align-items: baseline; gap: var(--s3); }
.child-group > h2 span { color: var(--muted); font: 400 var(--t-sm) var(--sans); }
.term-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.term-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s5); align-items: center; padding: var(--s4) var(--s5); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); color: inherit; text-decoration: none; transition: border-color .15s ease-out; }
.term-item:hover { border-color: var(--rule-strong); }
.term-item:hover h3 { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.term-item h3 { margin: 0 0 var(--s1); }
.term-item .bar { width: 10rem; }
.term-progress { display: grid; gap: var(--s1); justify-items: end; font-size: var(--t-sm); color: var(--muted); }
@media (max-width: 40rem) { .term-item { grid-template-columns: 1fr; } .term-progress { justify-items: start; } }

/* ---- Term board ------------------------------------------------------------------------------- */

.toolbar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: 0 0 var(--s4); }
.toolbar details { position: relative; }
.toolbar summary { list-style: none; }
.toolbar summary::-webkit-details-marker { display: none; }
.menu { position: absolute; z-index: 15; top: calc(100% + 4px); left: 0; min-width: 15rem; padding: var(--s2); border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--page); box-shadow: var(--shadow-overlay); }
.menu a { display: block; padding: var(--s2) var(--s3); border-radius: 3px; color: var(--ink); text-decoration: none; }
.menu a:hover { background: var(--band); color: var(--link); }
.progress-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin: 0 0 var(--s4); font-variant-numeric: tabular-nums; }
.progress-line .bar { flex: 1 1 12rem; max-width: 28rem; }
.board { overflow: auto; max-height: calc(100vh - 6rem); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
.board table { min-width: 100%; border-collapse: separate; border-spacing: 0; }
.board th, .board td { border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); padding: var(--s2); }
.board thead th { position: sticky; top: 0; z-index: 3; min-width: 12.5rem; padding: var(--s3); background: var(--band); color: var(--subject, var(--muted)); }
.board thead th:first-child { left: 0; z-index: 4; min-width: 6.5rem; }
.board tbody th { position: sticky; left: 0; z-index: 2; background: var(--page); font-family: var(--serif); font-size: var(--t-lg); white-space: nowrap; }
.board tbody th small { display: block; font: 600 var(--t-xs) var(--sans); color: var(--rubric); letter-spacing: .02em; }
.board tr.is-current th { padding-left: var(--s5); }
.board tr.is-current th .ribbon { left: var(--s2); width: 10px; height: 34px; }
.board tr.is-current > * { background: color-mix(in srgb, var(--gold-light) 18%, var(--page)); }
.board td { vertical-align: top; }
.card { display: block; position: relative; margin: 0 0 var(--s2); padding: var(--s2) var(--s3); border: 1px solid var(--rule); border-radius: 3px; background: var(--page); color: var(--ink); text-decoration: none; transition: background-color .25s ease-out, border-color .25s ease-out; }
.card:last-child { margin-bottom: 0; }
a.card:hover { border-color: var(--rule-strong); }
a.card:hover .card-title { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; }
.card-day { display: flex; justify-content: space-between; gap: var(--s2); font-size: var(--t-xs); color: var(--muted); font-weight: 600; }
.card-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: .15rem 0; font: 400 var(--t-md)/1.3 var(--serif); }
.card.writing { background: var(--writing); border-style: dashed; color: var(--muted); }
.card.writing .card-title { font-style: italic; }
.card.failed { border-color: var(--error); }
.card.failed .card-title { color: var(--error); font-family: var(--sans); font-size: var(--t-sm); }
.card.fresh { animation: ink-in .5s ease-out; }
@keyframes ink-in { from { background: var(--writing); } }
.board-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: var(--s4); margin: var(--s6) 0 0; }

/* ---- Lesson ---------------------------------------------------------------------------------- */

.lesson-layout { display: grid; grid-template-columns: 12rem minmax(0, 42rem); justify-content: center; gap: var(--s7); align-items: start; }
.lesson-index { position: sticky; top: var(--s5); font-size: var(--t-sm); }
.lesson-index p { margin: 0 0 var(--s2); color: var(--muted); font-weight: 600; }
.lesson-index ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.lesson-index a { display: block; padding: .3rem var(--s3); margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.lesson-index a:hover { color: var(--link); border-left-color: var(--gold); }
.lesson-head h1 { font-size: 2rem; margin-bottom: var(--s2); }
.lesson-head .lesson-meta { font-size: var(--t-sm); margin-bottom: var(--s4); }
.lesson-toolbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: 0 0 var(--s5); padding: var(--s2) 0; background: var(--paper); border-bottom: 1px solid var(--rule); }
.lesson-toolbar details { position: relative; }
.lesson-toolbar summary { list-style: none; }
.lesson-toolbar summary::-webkit-details-marker { display: none; }
.lesson-toolbar .menu { width: 21rem; padding: var(--s3); }
.lesson-toolbar .menu .btn { width: 100%; justify-content: flex-start; margin: 0 0 var(--s2); }
/* Small controls keep the sticky toolbar on one line beside a 42rem lesson. */
.lesson-toolbar > .btn, .lesson-toolbar > details > summary.btn, .lesson-toolbar .done-box { min-height: 2rem; padding: 0 var(--s3); font-size: var(--t-sm); }
@media (pointer: coarse) { .lesson-toolbar > .btn, .lesson-toolbar > details > summary.btn, .lesson-toolbar .done-box { min-height: var(--target); } }
.prose { font: 400 1.1875rem/1.6 var(--serif); }
.prose h2 { margin-top: var(--s6); font-size: var(--t-xl); scroll-margin-top: 4rem; }
.prose h3 { margin-top: var(--s5); }
.prose li { margin: 0 0 var(--s2); }
.prose .lesson-meta, .prose .hint, .prose .codes { font-family: var(--sans); }
.objective { font-size: var(--t-xl); line-height: 1.45; }
.steps-list { list-style: none; padding: 0; counter-reset: step; }
.steps-list li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--rule); }
.steps-list li:first-child { border-top: 0; }
.step-phase { font: 600 var(--t-xs)/1.4 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--rubric); padding-top: .3rem; }
.step-phase span { display: block; color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 400; font-variant-numeric: tabular-nums; }
.answer { color: var(--muted); font-size: var(--t-md); }
.sources li { font-size: var(--t-md); }
.reading-card { margin: var(--s5) 0; padding: var(--s4) var(--s5); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); font-family: var(--sans); font-size: var(--t-md); }
.reading-card h3 { font-size: var(--t-lg); margin: 0 0 var(--s1); }
.personal-version { margin-top: var(--s6); padding: var(--s4) var(--s5); border: 1px solid var(--gold); border-radius: var(--radius); background: var(--page); }
@media (max-width: 63.99rem) {
  .lesson-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .lesson-index { display: none; }
  .steps-list li { grid-template-columns: 1fr; gap: var(--s1); }
}

/* Book readings: keep the line breaks of poems. */
.reading { max-width: 40rem; }
.reading-text { white-space: pre-line; }
.chapter-nav { display: flex; justify-content: space-between; gap: var(--s3); margin: var(--s6) 0 var(--s4); padding-top: var(--s4); border-top: 1px solid var(--rule); }

/* ---- Wizards ------------------------------------------------------------------------------------ */

.steps { list-style: none; display: flex; gap: 0; margin: 0 0 var(--s6); padding: 0; counter-reset: wstep; border-bottom: 1px solid var(--rule); overflow-x: auto; }
.steps li { position: relative; counter-increment: wstep; flex: 1 1 auto; padding: var(--s3) var(--s4) var(--s3) 0; color: var(--muted); font-size: var(--t-sm); white-space: nowrap; }
.steps li::before { content: counter(wstep); display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-right: var(--s2); border: 1px solid var(--rule-strong); border-radius: 50%; font-size: var(--t-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.steps li.done { color: var(--ink); }
.steps li.done::before { background: var(--band); border-color: var(--band); }
.steps li[aria-current="step"] { color: var(--ink); font-weight: 600; }
.steps li[aria-current="step"]::before { background: var(--burgundy); border-color: var(--burgundy); color: var(--on-burgundy); }
.steps li[aria-current="step"] { padding-left: var(--s4); }
.steps li[aria-current="step"]::after { content: ""; position: absolute; left: 0; top: 0; width: 8px; height: 1.75rem; background: var(--burgundy); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }
.wizard { max-width: 44rem; }
.wizard-nav { display: flex; gap: var(--s2); justify-content: space-between; margin: var(--s6) 0 0; padding-top: var(--s4); border-top: 1px solid var(--rule); }
.summary { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s2) var(--s5); margin: 0 0 var(--s5); }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; }
.subject-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: var(--s2); }
.subject-picks .choice { align-items: center; }

/* ---- Children, progress, account ---------------------------------------------------------------- */

.child-cards { list-style: none; margin: 0 0 var(--s6); padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--s4); }
.child-card { display: block; padding: var(--s4) var(--s5); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); color: inherit; text-decoration: none; }
.child-card:hover { border-color: var(--rule-strong); }
.child-card:hover h2 { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.child-card h2 { margin: 0 0 var(--s1); }
.child-card p { margin: 0; color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: var(--s5); align-items: start; }
.code-box { padding: var(--s3) var(--s4); border: 1px solid var(--gold); border-radius: var(--radius); background: var(--faith-bg); font-size: var(--t-lg); }
.code-box strong { font-size: var(--t-xl); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.coverage-stat { font: 600 var(--t-xl) var(--serif); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s1); margin: 0; padding: 0; list-style: none; }
.chips li { padding: .1rem .45rem; border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.transcript p { margin: 0 0 var(--s2); }
.links-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }

/* ---- Sign in ----------------------------------------------------------------------------------- */

.threshold { min-height: 100vh; display: grid; place-items: center; padding: var(--s6) var(--s4); background: var(--paper); }
.threshold-inner { width: min(30rem, 100%); }
.threshold .wordmark { padding: 0; margin: 0 0 var(--s2); color: var(--rail); font-size: 3.25rem; text-align: center; }
/* The website hero's lockup: the quill beside "paul" in Cormorant, lowercase. */
.threshold-brand { display: flex; align-items: center; justify-content: center; gap: clamp(.75rem, 2vw, 1.5rem); margin: 0 0 var(--s6); }
.threshold-logo { width: 5.75rem; height: auto; }
.threshold-name { margin: 0; color: var(--rail); font-family: var(--wordmark); font-size: clamp(3.5rem, 2rem + 5vw, 5.5rem); font-weight: 500; letter-spacing: .01em; line-height: 1.05; text-transform: lowercase; }
@media (max-width: 22rem) { .threshold-brand { flex-direction: column; } }
.threshold .panel { padding: var(--s5) var(--s6); }
.threshold .panel h1 { font-size: var(--t-xl); }
.threshold input { max-width: none; }
.threshold-foot { margin: var(--s5) 0 0; text-align: center; }
@media (prefers-color-scheme: dark) { .threshold .wordmark, .threshold-name { color: var(--ink); } }

/* ---- Student view: warmer, simpler, bigger --------------------------------------------------- */

.student { min-height: 100vh; font-size: 1.1875rem; }
.student-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); padding: var(--s3) var(--s5); background: var(--band); border-bottom: 1px solid var(--rule); }
.student-top .who { margin-right: auto; font: 600 var(--t-2xl)/1.1 var(--serif); }
.student-top a, .student-top button.link { display: inline-flex; align-items: center; min-height: var(--target); font-size: var(--t-lg); }
.student .page { max-width: 52rem; }
.student h1 { font-size: 2.25rem; }
.student .btn { min-height: 3rem; font-size: var(--t-lg); }
.day { margin: 0 0 var(--s6); }
.day > h2 { font-size: var(--t-xl); }
.day.is-today { position: relative; }
.day.is-today > h2 { padding-left: var(--s5); color: var(--rubric); }
.day.is-today .ribbon { left: 0; top: -2px; width: 10px; height: 2.25rem; }
.student-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.student-list a {
  display: flex; align-items: center; gap: var(--s4); min-height: 4.5rem; padding: var(--s3) var(--s5);
  border: 1px solid color-mix(in srgb, var(--subject, var(--rule)) 45%, var(--rule)); border-radius: 8px;
  background: color-mix(in srgb, var(--subject, var(--page)) 9%, var(--page)); color: var(--ink); text-decoration: none;
}
.student-list a:hover { border-color: var(--subject, var(--rule-strong)); }

.student-list .subject { font-size: var(--t-sm); }
.student-title { display: block; font: 600 var(--t-xl)/1.25 var(--serif); }
.student .worksheet > li { margin: 0 0 var(--s5); }
.student .worksheet .options { list-style: upper-alpha; }
.answer-space { height: 3rem; border-bottom: 1px dashed var(--rule-strong); }
.large-print { font-size: 1.4rem; line-height: 1.7; }
.large-print h1 { font-size: 2.6rem; }
.code-entry input { max-width: 16rem; font-size: var(--t-xl); letter-spacing: .08em; text-transform: uppercase; }

/* ---- Staff console: compact, sans, tables first --------------------------------------------- */

.staff { font-size: var(--t-sm); }
.staff h1, .staff h2, .staff h3 { font-family: var(--sans); font-weight: 650; }
.staff h1 { font-size: 1.5rem; }
.staff h2 { font-size: 1.125rem; }
.staff-band { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); padding: var(--s2) var(--s5); background: var(--burgundy); color: var(--on-burgundy); font-size: var(--t-sm); }
.staff-band strong { letter-spacing: .08em; text-transform: uppercase; font-size: var(--t-xs); }
.staff-band span { margin-right: auto; }
.staff-band button { min-height: 2rem; padding: 0 var(--s3); border: 1px solid rgba(255, 253, 246, .6); border-radius: 3px; background: none; color: inherit; font: 600 var(--t-sm) var(--sans); cursor: pointer; }
@media (pointer: coarse) { .staff-band button { min-height: var(--target); } }
.staff-band :focus-visible { outline-color: var(--gold-light); }
.rail-label { padding: var(--s4) var(--s4) var(--s1); color: var(--rail-muted); font-size: var(--t-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
@media (max-width: 63.99rem) {
  .staff .rail { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); width: auto; height: auto; padding: var(--s3); transform: none; box-shadow: none; }
  .staff .rail .wordmark { font-size: 1.5rem; }
  .staff .rail-nav { flex-direction: row; flex-wrap: wrap; }
  .staff .rail-label { display: none; }
}
.staff .page { padding: var(--s5) var(--s5) var(--s7); max-width: 84rem; }
.staff th, .staff td { padding: .4rem .6rem; }
.staff .section { margin-bottom: var(--s6); }
.queue { list-style: none; margin: 0 0 var(--s5); padding: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); }
.queue li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); padding: var(--s3) var(--s4); border-top: 1px solid var(--rule); }
.queue li:first-child { border-top: 0; }
.queue a { font-weight: 600; }
.over { color: var(--error); font-weight: 600; }
.report { padding: var(--s4); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); }
.report + .report { margin-top: var(--s3); }
.report pre { overflow-x: auto; padding: var(--s3); border-radius: 3px; background: var(--paper); font-size: var(--t-xs); }
.staff .threshold .panel h1 { font-family: var(--sans); }
.search { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0 0 var(--s5); }
.search input { flex: 1 1 18rem; max-width: 32rem; }
.staff code.detail { font-size: var(--t-xs); overflow-wrap: anywhere; }
.staff form.field-row { align-items: flex-end; }
.staff form.field-row .actions { margin: 0 0 var(--s4); }
.staff .panel { margin-top: var(--s5); }

/* ---- Dialog ---------------------------------------------------------------------------------- */

dialog { width: min(30rem, calc(100vw - 2rem)); padding: var(--s5); border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--page); color: var(--ink); box-shadow: var(--shadow-overlay); }
dialog::backdrop { background: rgba(14, 19, 29, .5); }
dialog h2 { margin-top: 0; }

/* ---- Motion ---------------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---- Print ----------------------------------------------------------------------------------- */

@media print {
  :root { --paper: #fff; --page: #fff; --ink: #000; --muted: #333; --rule: #bbb; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .app, .app.chat-open { display: block; }
  .rail, .topbar, .chat, .scrim, .no-print, .lesson-index, .lesson-toolbar, .ribbon, .skip { display: none !important; }
  .page { max-width: none; padding: 0; }
  .lesson-layout { display: block; }
  .board { max-height: none; overflow: visible; border: 0; }
  .timetable table { min-width: 0; }
  a { color: inherit; text-decoration: none; }
  .sheet, .panel, .card, .table-wrap { break-inside: avoid; }
}

/* A statement quoted inside a warning: a quote, not a box in a box. */
.statement { margin: var(--s3) 0; padding-left: var(--s4); border-left: 1px solid var(--gold); font-family: var(--serif); font-size: var(--t-lg); }

/* ---- Phones: the top bar carries "Ask"; the week reads as a list ---------------------------- */

@media (max-width: 63.99rem) {
  .chat-btn, .today-tools { display: none; }
}
@media (max-width: 40rem) {
  .week-table thead { display: none; }
  .week-table, .week-table tbody, .week-table tr, .week-table th, .week-table td { display: block; width: auto; }
  .week-table tr { border-bottom: 1px solid var(--rule); }
  .week-table th[scope="row"] { padding-bottom: 0; border: 0; font-size: var(--t-lg); }
  .week-table td { border: 0; padding-top: var(--s1); }
  .week-table td::before { content: attr(data-child); display: block; margin: 0 0 var(--s1); color: var(--muted); font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
}

/* ---- Onboarding band ---------------------------------------------------------------------- */

.band-top { padding: var(--s3) var(--s5); background: var(--rail); color: var(--rail-ink); }
.band-top .wordmark { padding: 0; font-size: 1.75rem; }
.links-list .icon { color: var(--ok); }

/* Onboarding: one question per screen, centred, keyboard-first. */
.ob { min-height: 100vh; background: var(--paper); }
.ob-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 1.5rem; padding: .9rem 1.5rem; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.ob-mark { font: 500 1.75rem/1 var(--wordmark); color: var(--ink); line-height: 1; letter-spacing: -.01em; }
.ob-top nav { flex: 1; min-width: 0; }
.ob-progress { display: flex; gap: .4rem; list-style: none; margin: 0; padding: 0; max-width: 46rem; }
.ob-seg { flex: 1; min-width: 0; }
.ob-seg button { all: unset; box-sizing: border-box; display: block; width: 100%; padding: .35rem 0; cursor: pointer; min-height: 32px; }
.ob-seg button:disabled { cursor: default; }
.ob-seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.ob-seg-bar { display: block; height: 4px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.ob-seg-bar > span { display: block; height: 100%; background: var(--gold); border-radius: 4px; transition: width .35s cubic-bezier(.2,.8,.2,1); }
.ob-seg-label { display: block; margin-top: .35rem; font-size: .75rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-seg.current .ob-seg-label { color: var(--ink); }
.ob-main { max-width: 36rem; margin: 0 auto; padding: 3.5rem 1.25rem 4rem; }
.ob-step { animation: ob-in .32s cubic-bezier(.2,.8,.2,1) both; }
@keyframes ob-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ob-step { animation: none; } .ob-seg-bar > span, .ob-choice, .ob-switch, .ob-switch::after { transition: none; } }
.ob-eyebrow { margin: 0 0 .5rem; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--rubric); }
.ob h1 { font-size: clamp(var(--t-2xl), 4.5vw, var(--t-3xl)); line-height: 1.15; margin: 0 0 .6rem; }
.ob h1:focus { outline: none; }
/* The heading gets focus on each new screen for screen readers; it is not a control. */
.ob-lede { color: var(--muted); font-size: 1.05rem; margin: 0 0 1.75rem; }
.ob-note { color: var(--muted); font-size: .9rem; margin: 1rem 0; }
.ob-muted { color: var(--muted); font-weight: 500; }
.ob-label { display: block; font-size: .85rem; font-weight: 600; margin: 1.25rem 0 .4rem; color: var(--ink); }
.ob-input { display: block; width: 100%; max-width: none; font-size: 1.1rem; padding: .8rem .9rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page);  transition: border-color .15s, box-shadow .15s; }
.ob-input:focus { outline: none; border-color: var(--rubric); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
textarea.ob-input { min-height: 5.5rem; resize: vertical; }

.ob-choices { display: grid; gap: .6rem; }
.ob-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ob-choice { all: unset; box-sizing: border-box; display: flex; align-items: flex-start; gap: .85rem; width: 100%; padding: .9rem 1rem; min-height: 56px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); cursor: pointer;  transition: border-color .15s, box-shadow .15s, transform .15s, background .15s; }
.ob-choice:hover { border-color: var(--rule-strong);  transform: translateY(-1px); }
.ob-choice:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ob-choice.on { border-color: var(--rubric); background: color-mix(in srgb, var(--rubric) 7%, var(--page)); box-shadow: 0 0 0 1px var(--rubric); }
.ob-key, .ob kbd { font: 600 .75rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.ob-key { flex: none; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; margin-top: .05rem; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 6px; color: var(--muted); background: var(--paper); }
.ob-choice.on .ob-key { border-color: var(--rubric); color: var(--rubric); background: var(--page); }
.ob-choice-body { flex: 1; min-width: 0; display: grid; gap: .15rem; }
.ob-choice-label { font-weight: 600; color: var(--ink); }
.ob-choice-desc { font-size: .9rem; color: var(--muted); line-height: 1.4; }
.ob-badge { display: inline-block; margin-left: .5rem; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; color: var(--rubric); background: var(--band); vertical-align: .1em; }
.ob-check { flex: none; display: grid; place-items: center; width: 1.4rem; height: 1.4rem; margin-top: .1rem; border-radius: 50%; border: 1.5px solid var(--rule); color: transparent; transition: all .15s; }
.ob-choice.on .ob-check { background: var(--burgundy); border-color: var(--burgundy); color: var(--on-burgundy); }
.ob-arrow { font-size: 1.2rem; color: var(--rubric); align-self: center; }

.ob-pills { display: flex; flex-wrap: wrap; gap: .45rem; }
.ob-pill, .ob-chip { all: unset; box-sizing: border-box; cursor: pointer; padding: .55rem .9rem; min-height: 44px; display: inline-flex; align-items: center; border: 1px solid var(--rule); border-radius: 999px; background: var(--page); font-size: .95rem; font-weight: 500; transition: all .15s; }
.ob-pill:hover, .ob-chip:hover { border-color: var(--rule-strong); }
.ob-pill:focus-visible, .ob-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ob-pill.on, .ob-chip.on { background: var(--burgundy); border-color: var(--burgundy); color: var(--on-burgundy); }
.ob-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .5rem; }
.ob-chip::before { content: "+"; margin-right: .4rem; font-weight: 700; opacity: .6; }
.ob-chip.on::before { content: "✓"; opacity: 1; }

.ob-toggle { display: flex; align-items: center; gap: 1rem; margin: 1rem 0 0; padding: .9rem 1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); font-weight: normal; cursor: pointer; position: relative; }
.ob-toggle-text { flex: 1; display: grid; gap: .15rem; }
.ob-toggle-label { font-weight: 600; }
.ob-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ob-switch { flex: none; width: 2.6rem; height: 1.5rem; border-radius: 999px; background: var(--rule); position: relative; transition: background .2s; }
.ob-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: calc(1.5rem - 6px); height: calc(1.5rem - 6px); border-radius: 50%; background: var(--page); box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .2s; }
.ob-toggle input:checked + .ob-switch { background: var(--burgundy); }
.ob-toggle input:checked + .ob-switch::after { transform: translateX(1.1rem); }
.ob-toggle input:focus-visible + .ob-switch { outline: 2px solid var(--focus); outline-offset: 2px; }

.ob-consent { display: flex; gap: .7rem; align-items: flex-start; margin: 1.25rem 0 0; font-weight: normal; font-size: .95rem; cursor: pointer; }
.ob-consent input { margin-top: .2rem; width: 1.15rem; height: 1.15rem; accent-color: var(--rubric); flex: none; }
.ob-callout { margin-top: 1.25rem; padding: 1rem; border-radius: var(--radius); background: var(--faith-bg); border: 1px solid var(--rule); }
.ob-callout p { margin: 0; font-size: .92rem; }
.ob-callout .ob-toggle { background: var(--page); }
.ob-sub { margin-top: 1.25rem; padding: 1rem 1.1rem 1.2rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.ob-sub h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem 0 .5rem; }
.ob-sub h2:first-child { margin-top: 0; }
.ob-seg-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; }
.ob-seg-choices .ob-choice { padding: .65rem .75rem; min-height: 48px; align-items: center; }
.ob-seg-choices .ob-choice-label { font-size: .9rem; }
.ob-seg-choices .ob-check { display: none; }
.ob-more { margin-top: 1.25rem; font-size: .92rem; color: var(--muted); }
.ob-more summary { cursor: pointer; font-weight: 600; color: var(--rubric); min-height: 32px; }
.ob-more ul { padding-left: 1.2rem; }

.ob-plan { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.ob-plan li { display: flex; gap: 1rem; padding: 1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); }
.ob-plan-n { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--band); color: var(--rubric); font-weight: 700; }
.ob-plan strong { display: block; }
.ob-plan small { display: block; color: var(--muted); font-size: .9rem; }

.ob-kids { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .5rem; }
.ob-kid { display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); flex-wrap: wrap; }
.ob-avatar { flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--rail); color: var(--rail-ink); font-weight: 700; }
.ob-kid-text { flex: 1; min-width: 8rem; display: grid; }
.ob-kid-text small { color: var(--muted); }
.ob-add { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .85rem; width: 100%; padding: .9rem 1rem; min-height: 56px; border: 1.5px dashed var(--rule-strong); border-radius: var(--radius); color: var(--rubric); font-weight: 600; cursor: pointer; }
.ob-add:hover { border-color: var(--rubric); background: color-mix(in srgb, var(--rubric) 7%, var(--page)); }
.ob-add:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ob-link { all: unset; cursor: pointer; color: var(--rubric); font-weight: 600; font-size: .9rem; padding: .4rem .5rem; border-radius: 6px; min-height: 32px; }
.ob-link:hover { background: var(--band); }
.ob-link:focus-visible { outline: 2px solid var(--focus); }
.ob-link.danger { color: var(--error); }

.ob-card { margin: 0 0 .9rem; padding: 1rem 1.1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); }
.ob-card h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.ob-card dl { margin: 0; }
.ob-row { display: grid; grid-template-columns: 8.5rem 1fr auto; gap: .75rem; align-items: baseline; padding: .45rem 0; border-top: 1px solid var(--rule); }
.ob-row:first-child { border-top: 0; }
.ob-row dt { color: var(--muted); font-size: .9rem; }
.ob-row dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.ob-warnings { margin-top: 1.5rem; }
.ob-warnings h2 { font-size: 1.2rem; margin: 0 0 .3rem; }
.ob-warning { margin: 0 0 .75rem; padding: 1rem 1.1rem; border: 1px solid var(--warn-line); border-radius: var(--radius); background: var(--warn-bg); }
.ob-warning > p { margin: .5rem 0; }
.ob-tag { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: var(--gold-light); color: var(--gold-ink); font-size: .75rem; font-weight: 700; }

.ob-actions { display: flex; align-items: center; gap: .75rem; margin-top: 2rem; }
.ob-next { margin-left: auto; gap: .6rem;  transition: transform .15s, box-shadow .15s, opacity .15s; }
.ob-next:not(:disabled):hover { transform: translateY(-1px); box-shadow: var(--shadow-overlay); }
.ob-next kbd { padding: .15rem .35rem; border-radius: 4px; background: color-mix(in srgb, var(--on-burgundy) 18%, transparent); color: var(--on-burgundy); }


.ob-hint { margin-top: 2.5rem; text-align: center; font-size: .8rem; color: var(--muted); }
.ob-hint kbd { padding: .1rem .35rem; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; background: var(--page); }
.ob-done-mark { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; margin-bottom: 1.25rem; border-radius: 50%; background: var(--burgundy); color: var(--on-burgundy); animation: ob-pop .5s cubic-bezier(.2,1.4,.4,1) both; }
.ob-done-mark svg { width: 28px; height: 28px; }
@keyframes ob-pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 40rem) {
  .ob-top { gap: .9rem; padding: .75rem 1rem; }
  .ob-seg-label { display: none; }
  .ob-seg.current .ob-seg-label { display: block; }
  .ob-main { padding-top: 2rem; }
  .ob-grid, .ob-seg-choices { grid-template-columns: 1fr; }
  .ob-row { grid-template-columns: 1fr auto; }
  .ob-row dt { grid-column: 1 / -1; }
  .ob-hint { display: none; }
}
@media (hover: none) { .ob-key, .ob-next kbd, .ob-hint { display: none; } }
/* Learning level for single subjects. */
.ob-levels { display: grid; gap: .5rem; margin-top: .75rem; }
.ob-level-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .6rem .8rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--page); }
.ob-level-name { flex: 1; min-width: 7rem; font-weight: 600; color: var(--ink); }
.ob-level-pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.ob-level-pills .ob-pill { padding: .4rem .75rem; min-height: 40px; font-size: .9rem; }
