/* trivium · graphite dark + amber highlights.
 *
 * Surface is warm graphite (#161519) — near-black with a slight warm
 * tilt so it reads as aged paper rather than clinical charcoal. Body
 * text is off-white with a faint warm cast (#e6e0d6), never pure #fff.
 * Highlights, brand, links, primary buttons, and roles use a softened
 * gold-amber (#d4af6a) — descaled from the previous mustard so it sits
 * next to the warm graphite without going neon. Top and bottom strips
 * share the same graphite; the amber lives in the foreground.
 *
 * Previously this was a chalkboard-green slate (#1d3329 + #c8a84b
 * mustard) — replaced because the green-on-amber read as casino-felt
 * rather than scholarly.
 *
 * Type system follows the t34ch.tech presentation deck: Bebas Neue for
 * the trivium brand, page titles, h3 section labels, and badges. Libre
 * Baskerville for body prose (anything markdown-rendered — feedback,
 * assignment description). IBM Plex Sans for the dense form/table
 * chrome. IBM Plex Mono for sha-256s, JWS, code, signal names, table
 * data, form inputs.
 *
 * @font-face declarations point at /static/fonts/. Run
 * scripts/fetch-fonts.sh after a fresh checkout to populate them; if any
 * file is missing, the stack falls back to system serif/sans/mono. */

@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/IBMPlexSans-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/IBMPlexMono-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/IBMPlexMono-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "Bebas Neue";
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/BebasNeue-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Libre Baskerville";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/LibreBaskerville-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Libre Baskerville";
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url("/static/fonts/LibreBaskerville-Italic.woff2") format("woff2");
}
@font-face {
  font-family: "Libre Baskerville";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/LibreBaskerville-Bold.woff2") format("woff2");
}

:root {
  /* Graphite dark + amber highlights. Warm near-black canvas, off-white
   * body, softened gold-amber accents. Replaces the prior chalkboard-
   * green slate (the green read as casino-felt rather than scholarly).
   *
   * Two themes ship: graphite (default, dark) and Linen (light, applied
   * via prefers-color-scheme: light). color-scheme is set to `light
   * dark` so the user agent renders form controls + scrollbars in the
   * correct mode for whichever theme is active.
   *
   * Contrast: every text colour pairs ≥4.5:1 against the surfaces it
   * lives on (AA), and every link/badge colour ≥4.5:1 against the
   * darkest card it can appear in. */
  color-scheme: light dark;
  --bg:        #161519;   /* deepest — warm near-black */
  --bg-soft:   #1d1c21;   /* panels, top bar */
  --bg-card:   #232228;   /* cards, raised surfaces */
  --line:      rgba(228, 222, 213, 0.07);
  --line-2:    rgba(228, 222, 213, 0.18);
  --text:      #e6e0d6;   /* primary off-white, faint warm cast */
  --text-dim:  #b1aaa0;   /* secondary text — AA on bg-soft + bg-card */
  --text-mute: #948e83;   /* tertiary — meta, crumbs (AA on bg/bg-soft) */
  --amber:     #d4af6a;   /* brand accent, links, primary buttons */
  --amber-2:   #e8c182;   /* hover state */
  --blue:      #7da7d4;   /* info / role-grader */
  --orange:    #db9a68;   /* terracotta — warn / late */
  --good:      #8fb87a;   /* sage success — no longer the chalkboard green */
  --warn:      #db9a68;
  --err:       #e89090;   /* salmon */
  --link:      #d4af6a;
  /* RGB triplets for rgba(...) tints. Theme-switched alongside the named
   * variables above so opacity-blended highlights track the active palette. */
  --accent-rgb:  212, 175, 106;  /* amber */
  --warn-rgb:    219, 154, 104;  /* orange / terracotta */
  --success-rgb: 143, 184, 122;  /* sage — used by the grade-cell flash */
  /* Text-on-amber colour. Stays as the page bg so the contrast inverts
   * cleanly when the palette flips to Linen. */
  --on-amber: var(--bg);
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --sans:    "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif:   "Libre Baskerville", Georgia, "Times New Roman", serif;
  --display: "Bebas Neue", "IBM Plex Sans Condensed", "Inter", system-ui, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    /* Linen: cool stone paper + sepia ink. Replaces an earlier
     * Vellum draft that was too yellow-cream. Paper hex stays in
     * the neutral-warm-grey range (low chroma); accent shifts from
     * mustard to sepia-brown so amber tints stop reading as cream. */
    --bg:        #e8e6df;
    --bg-soft:   #d6d3cb;
    --bg-card:   #f1eee7;
    --line:      rgba(40, 32, 22, 0.12);
    --line-2:    rgba(40, 32, 22, 0.26);
    --text:      #1c1a14;
    --text-dim:  #5a5447;
    --text-mute: #5e594b;  /* bumped from #8a8478 to hit WCAG AA on bg-soft */
    --amber:     #5e4a14;
    --amber-2:   #6c5719;  /* hover — darkened from #76601f to hit AA on bg-soft */
    --blue:      #2a4a6b;
    --orange:    #8a3a0e;
    --good:      #3e5a22;
    --warn:      #8a3a0e;
    --err:       #762020;
    --link:      #2a4a6b;
    --accent-rgb:  94, 74, 20;
    --warn-rgb:    138, 58, 14;
    --success-rgb: 100, 138, 70;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--amber-2); text-decoration: underline; }

code, pre, .sha, .jws { font-family: var(--mono); }
pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12px;
}
.sha { font-size: 11px; color: var(--text-dim); }
.sha.tiny { font-size: 10px; }
.jws { font-size: 11px; word-break: break-all; }

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.brand {
  display: inline-flex;
  align-items: center;
  color: var(--amber);
  line-height: 0;
}
.brand:hover { color: var(--amber-2); text-decoration: none; }
.brand-logo {
  /* SVG paints with fill=currentColor, so the link's `color` rules the
     hover state. The mon is square (viewBox 200x200) so width = height.
     The topbar's overall height grows with this value — the nav still
     centers because .brand is inline-flex with align-items: center. */
  display: block;
  height: 72px;
  width: 72px;
}
.topnav { display: flex; gap: 14px; align-items: center; }
.topnav a { font-size: 12px; color: var(--amber); }
.topnav a:hover { color: var(--amber-2); }
.topnav .inline { margin: 0; padding: 0; }
.topnav .link {
  background: none; border: 0; padding: 0;
  color: var(--link); font: inherit; cursor: pointer;
  font-size: 12px;
}
.topnav .link:hover { color: var(--amber-2); text-decoration: underline; }

/* ── Layout ── */
.container {
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 22px 80px;
}
h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 34px;
  margin: 0 0 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--amber);
}
h2 { font-size: 16px; font-weight: 600; margin: 18px 0 10px; }
h3 {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 400;
  margin: 14px 0 6px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.dim, .muted { color: var(--text-dim); }
.empty { color: var(--text-mute); font-style: italic; }

.crumbs { font-size: 11px; color: var(--text-mute); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--text-dim); margin: 4px 0 18px; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 16px 18px;
  margin: 18px 0;
}
.card h2:first-child { margin-top: 0; }
.flash {
  padding: 8px 12px;
  background: rgba(var(--accent-rgb), 0.08);
  border-left: 2px solid var(--amber);
  font-size: 13px;
}
.dev-banner {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(var(--warn-rgb), 0.08);
  border-left: 2px solid var(--warn);
  font-size: 12px;
}
.dev-banner a { word-break: break-all; }
.alt { font-size: 12px; margin-top: 14px; color: var(--text-dim); }

/* ── Forms ── */
form { margin: 0; }
form.inline { display: inline; }
label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 12px 0 4px;
}
input[type=text], input[type=email], input[type=url], input[type=number], select, textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 10px;
}
textarea { font-family: var(--mono); font-size: 12px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--amber); outline-offset: -1px; }

button, .btn {
  display: inline-block;
  background: var(--amber);
  color: var(--on-amber);
  border: 0;
  padding: 8px 16px;
  font: inherit;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 14px;
}
button:hover { background: var(--amber-2); }
button.link {
  background: none;
  color: var(--link);
  font: inherit;
  padding: 0;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
button.link:hover { color: var(--amber-2); text-decoration: underline; }

/* ── Tables / Grids ── */
table.grid {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  margin: 14px 0;
  font-size: 13px;
}
table.grid th, table.grid td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
table.grid th {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  background: var(--bg-soft);
}
table.grid tbody tr:hover { background: rgba(var(--accent-rgb), 0.04); }

/* ── Badges / status ── */
.role, .status {
  display: inline-block;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 2px 7px 1px;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
}
.role-instructor { color: var(--amber); border-color: var(--amber); }
.role-grader     { color: var(--blue);  border-color: var(--blue); }
.role-student    { color: var(--text);  border-color: var(--line-2); }

.status-graded     { color: var(--amber);  border-color: var(--amber); }
.status-submitted  { color: var(--blue);   border-color: var(--blue); }
.status-missing    { color: var(--orange); border-color: var(--orange); }
.status-open       { color: var(--text-dim); }
.status-ungraded   { color: var(--text-mute); }

/* ── Course header ── */
.course-header { margin-bottom: 18px; }
.subnav {
  display: flex;
  gap: 14px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  margin-bottom: 18px;
}
.subnav a { color: var(--text); }
.subnav a:hover { color: var(--amber); }

/* ── Video player ── */
.video-player {
  width: 100%;
  max-width: 1080px;
  background: #000;
  display: block;
  margin: 16px 0;
}

/* ── Files ── */
ul.files {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
}
ul.files li {
  padding: 6px 0;
  border-bottom: 1px dotted var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ── Quiz form ── */
fieldset.quiz-q {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 12px 16px;
  margin: 12px 0;
}
fieldset.quiz-q legend {
  font-family: var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--amber);
  padding: 0 8px;
}
.quiz-opt {
  display: block;
  margin: 4px 0;
  padding: 4px 6px;
  cursor: pointer;
}
.quiz-opt:hover { background: rgba(var(--accent-rgb), 0.04); }
.quiz-short { width: 100%; max-width: 360px; }

/* ── Late badge ── */
.late-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  margin-left: 8px;
  border: 1px solid var(--orange);
  color: var(--orange);
  background: rgba(var(--warn-rgb), 0.08);
}

/* ── Class gradebook (inline-editable cells) ── */
.grade-cell-td {
  text-align: center;
  padding: 4px 6px !important;
  position: relative;
}
.grade-cell-form {
  display: inline-block;
  margin: 0;
}
.grade-cell-input {
  width: 56px;
  padding: 3px 6px;
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
}
.grade-cell-input:focus {
  outline: 1px solid var(--amber);
  outline-offset: -1px;
  background: var(--bg-card);
}
.grade-cell-input::-webkit-outer-spin-button,
.grade-cell-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.grade-cell-input { -moz-appearance: textfield; }
.grade-cell-link {
  font-size: 9px;
  margin-left: 3px;
  color: var(--text-mute);
  text-decoration: none;
  vertical-align: middle;
}
.grade-cell-link:hover { color: var(--amber); }
/* Brief flash after a successful save. The "saved" class is applied
 * server-side on the response fragment; the animation runs once. */
.gc-saved .grade-cell-input {
  animation: gc-flash 0.9s ease-out;
}
@keyframes gc-flash {
  0%   { background: rgba(var(--success-rgb), 0.45); }
  100% { background: var(--bg-soft); }
}

/* ── Accessibility: skip link + focus ring ── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  background: var(--amber);
  color: var(--bg-card);
  padding: 8px 14px;
  z-index: 1000;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 8px; outline: 2px solid var(--text); }
/* High-contrast focus ring everywhere; browsers' default is too faint
 * on the dark chalkboard background. */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── Markdown live preview ── */
.md-preview-wrap {
  margin: -8px 0 14px;
  border: 1px solid var(--line);
  border-top: none;
  background: var(--bg-soft);
  padding: 10px 14px;
  font-size: 13px;
}
.md-preview-wrap::before {
  content: "preview";
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.md-preview { color: var(--text); }
.md-preview > :first-child { margin-top: 0; }
.md-preview > :last-child { margin-bottom: 0; }

/* ── SpeedGrader nav ── */
.speedgrader-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 13px;
  flex-wrap: wrap;
}
.speedgrader-nav a { font-weight: 600; }
.speedgrader-nav .sg-disabled { color: var(--text-mute); }
.speedgrader-nav .sg-pos { font-family: var(--mono); }
.speedgrader-nav .sg-shortcuts { margin-left: auto; font-size: 11px; }
.speedgrader-nav kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: 2px;
}
.grader-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.grader-actions button { margin: 0; }

/* ── Grader layout ── */
.grader-grid {
  display: grid;
  grid-template-columns: 1fr 360px 200px;
  gap: 18px;
}
.grader-grid section, .grader-grid aside { min-width: 0; }
.grader-grid .files-pane { background: var(--bg-card); border: 1px solid var(--line); padding: 14px 16px; }
.grader-grid .grade-pane { background: var(--bg-card); border: 1px solid var(--line); padding: 14px 16px; }
.grader-grid .queue-pane { background: var(--bg-soft); border: 1px solid var(--line); padding: 12px 14px; font-size: 12px; }
ul.queue { list-style: none; padding: 0; margin: 0; }
ul.queue li { padding: 4px 0; border-bottom: 1px dotted var(--line); }
ul.queue li.active { background: rgba(var(--accent-rgb), 0.06); padding-left: 6px; margin-left: -6px; }

ul.annotations { list-style: none; padding: 0; margin: 8px 0 14px; }
.annotation {
  border-left: 2px solid var(--amber);
  padding: 6px 10px;
  margin: 8px 0;
  background: rgba(var(--accent-rgb), 0.04);
  font-size: 12px;
}
.ann-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.annotation-form { background: var(--bg-soft); border: 1px solid var(--line); padding: 10px 12px; }

/* ── Markdown body prose ── feedback, rendered assignment descriptions,
 * anything that's actually paragraphs of writing rather than UI chrome.
 * Libre Baskerville reads at body sizes the way the slide deck reads
 * Baskerville on screen — generous, slightly old-fashioned, classroom. */
.feedback, .prose {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.feedback p:first-child, .prose p:first-child { margin-top: 0; }
.feedback code, .prose code {
  font-family: var(--mono);
  background: var(--bg-soft);
  padding: 1px 5px;
  font-size: 12px;
}
.feedback pre code, .prose pre code { background: none; padding: 0; }

/* ── Course list ── */
ul.course-list { list-style: none; padding: 0; margin: 0; }
ul.course-list li { padding: 6px 0; border-bottom: 1px dotted var(--line); font-size: 13px; }

/* ── Footer ── */
.footbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  text-align: center;
  padding: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--amber);
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  letter-spacing: 0.06em;
}

/* ── Error page ── */
main.err { max-width: 720px; margin: 60px auto; padding: 30px; background: var(--bg-card); border: 1px solid var(--err); }
main.err h1 { color: var(--err); margin: 0 0 12px; font-family: var(--mono); font-size: 18px; letter-spacing: 0.04em; }
main.err pre { color: var(--text-dim); font-size: 12px; }

/* The chalkboard palette applies regardless of prefers-color-scheme.
 * An earlier light-mode variant lived here (whiteboard with green
 * marker); removed because users on light-mode OSes were getting that
 * by default and reading it as "the theme didn't change". Chalkboard
 * everywhere is the right call — the surface IS dark by design. */

/* ── Utility classes — used to drop CSP `style-src 'unsafe-inline'`.
 * Templates previously sprinkled `style="…"` attributes for one-off
 * spacing/typography. Each recurring pattern now has a class here so
 * the CSP can stay strict. */

/* font sizes */
.fs-10 { font-size: 10px; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }

/* mono variants */
.mono-10 { font-family: var(--mono); font-size: 10px; }
.mono-12 { font-family: var(--mono); font-size: 12px; }

/* margins (vertical) */
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-24 { margin-top: 24px; }
.mb-14 { margin-bottom: 14px; }
.ml-14 { margin-left: 14px; }
.m-0   { margin: 0; }

/* flex layout */
.row-between {
  display: flex;
  justify-content: space-between;
}
.row-between-center {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.row-gap-14 {
  display: flex;
  gap: 14px;
}

/* misc */
.fw-normal       { font-weight: normal; }
.pl-18           { padding-left: 18px; }
.bg-soft         { background: var(--bg-soft); }
.overflow-x-auto { overflow-x: auto; }
.clickable       { cursor: pointer; }
.text-clip-340 {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* themed surfaces (used in flashes + my-message highlight) */
.flash-amber {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: var(--amber);
}
.text-amber {
  border-color: var(--amber);
  color: var(--amber);
}
.message-mine {
  background: rgba(var(--accent-rgb), 0.04);
}
.check-row {
  display: block;
  font-weight: normal;
}
.text-error {
  color: var(--err);
}
.box-input {
  border: 1px solid var(--line);
  padding: 8px 12px;
  background: var(--bg-soft);
  min-height: 80px;
}
.card-padded {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 24px 32px;
}

/* htmx loading indicators — equivalent of the styles htmx would otherwise
 * inject at runtime via document.head.insertAdjacentHTML. We disable that
 * runtime injection (meta htmx-config includeIndicatorStyles:false) so the
 * CSP can keep style-src 'self' with no inline-style escape hatch. */
.htmx-indicator { opacity: 0; }
.htmx-request .htmx-indicator { opacity: 1; transition: opacity 200ms ease-in; }
.htmx-request.htmx-indicator { opacity: 1; transition: opacity 200ms ease-in; }

/* ─────────────────────────────────────────────────────────────────────────
 * iPad-first density.
 *
 * The previous pass put all of this behind @media (pointer: coarse), so
 * desktop pointer:fine viewports kept the old compact 14px-body density
 * while iPad got the comfortable one. That was a "responsive when
 * touch" stance — tablet was a variant.
 *
 * iPad-first inverts that: the iPad-comfortable surface IS the default.
 * Every interactive surface is ≥44pt tall, body type is 16px / line-
 * height 1.55, cards breathe at 20-22px, table rows are 12-14px tall.
 * Desktop mouse users see the same chunky UI iPad users see.
 *
 * Three things in one pass:
 *   1. Tap targets ≥44pt — Apple's accessibility minimum for touch.
 *      Anything tappable (links in nav, buttons, list rows, form
 *      fields) hits that bar.
 *   2. Body text 16px so iOS Safari does not auto-zoom on input focus
 *      (it zooms whenever input font-size <16px), and reading on a
 *      10–13" panel doesn't squint.
 *   3. Safe-area-inset clearance for iPad Pro home-indicator and side
 *      bezels in landscape (and notched iPads/iPhones, harmless
 *      elsewhere). */

html { -webkit-tap-highlight-color: rgba(var(--accent-rgb), 0.18); }
html, body { font-size: 16px; line-height: 1.55; }

/* Smooth corners — applied everywhere by default, no breakpoint. */
.card,
.flash, .dev-banner,
button, .btn,
input[type=text], input[type=email], input[type=url], input[type=number],
select, textarea,
.role, .status, .late-badge,
fieldset.quiz-q,
table.grid,
pre,
.skip-link {
  border-radius: 10px;
}
table.grid { overflow: hidden; }   /* contain rounded corners */
.grade-cell-input { border-radius: 6px; }
.brand { border-radius: 6px; }

/* Form fields: 16px font kills iOS focus-zoom; 12px vertical padding
 * pushes height past the 44pt minimum. Same look applies to textareas. */
input[type=text], input[type=email], input[type=url], input[type=number],
select, textarea {
  font-size: 16px;
  padding: 12px 14px;
  min-height: 44px;
}
textarea { font-size: 15px; line-height: 1.5; min-height: 88px; }

/* Buttons: 14px label, 12px/22px padding, 44pt min height. .btn-sm
 * escape hatch for crowded toolbars. */
button, .btn {
  font-size: 14px;
  padding: 12px 22px;
  min-height: 44px;
  transition: transform 80ms ease-out, background-color 120ms ease-out;
}
button:active, .btn:active { transform: scale(0.97); }
button.link { min-height: 0; padding: 0; }
.btn-sm { font-size: 12px; padding: 8px 14px; min-height: 0; }

/* Top + sub nav links become real tap targets with vertical padding. */
.topnav { gap: 4px; }
.topnav a, .topnav .link {
  font-size: 14px;
  padding: 10px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
}
.topnav a:hover, .topnav .link:hover {
  background: rgba(var(--accent-rgb), 0.08);
  text-decoration: none;
}
.subnav { gap: 4px; padding: 4px 0; }
.subnav a {
  font-size: 14px;
  padding: 10px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
}
.subnav a:hover { background: rgba(var(--accent-rgb), 0.08); text-decoration: none; }

/* File-list rows — finger-friendly hit area. */
ul.files li { padding: 12px 0; gap: 14px; }
ul.files { font-size: 14px; }

/* Quiz options become tappable rows, not text-spans. */
.quiz-opt {
  padding: 12px 14px;
  margin: 6px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.quiz-opt:hover { background: rgba(var(--accent-rgb), 0.08); }

/* Tables: bigger row height for inline-editable gradebook cells. */
table.grid { font-size: 14px; }
table.grid th, table.grid td { padding: 12px 14px; }
.grade-cell-input { width: 72px; padding: 8px 10px; font-size: 14px; }

/* Cards breathe more by default. */
.card { padding: 22px 24px; }

/* Inline label sizes stay small for hierarchy. */
label { font-size: 12px; }
.crumbs { font-size: 12px; }
.meta { font-size: 13px; gap: 18px; }

/* Topbar height grows with the new interactive sizing on touch.
 * Logo follows so it stays aligned with the larger tap targets. */
.topbar { padding: 12px 22px; gap: 16px; }
.brand-logo { height: 88px; width: 88px; }

/* Safe-area gutters on top bar + main container. max() falls back to
 * the original numeric padding on browsers without env() support. */
.topbar {
  padding-left:  max(22px, env(safe-area-inset-left));
  padding-right: max(22px, env(safe-area-inset-right));
  padding-top:    max(12px, env(safe-area-inset-top));
}
.container {
  padding-left:  max(22px, env(safe-area-inset-left));
  padding-right: max(22px, env(safe-area-inset-right));
  padding-bottom: max(80px, calc(env(safe-area-inset-bottom) + 80px));
}

/* prefers-reduced-motion: respect the OS hint. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Tablet+ viewport (≥ 768px). Keep container max-width, but loosen
 * the gutter and bump the page title. */
@media (min-width: 768px) {
  .container { padding-top: 28px; }
  h1 { font-size: 38px; }
  .card { padding: 26px 30px; }
}

/* Stage Manager / multi-window: very narrow single-pane on iPad
 * multitasking. Drop side gutter and stack the topbar. */
@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .container { padding-left: 14px; padding-right: 14px; }
  h1 { font-size: 28px; }
  .card { padding: 18px 18px; }
}

/* ── iOS-style toggle switch ──────────────────────────────────────────
 * Drop-in for checkbox booleans. Use:
 *   <label class="switch"><input type="checkbox" name="x"><span></span></label>
 * The actual checkbox stays in the form so submission semantics and
 * screen-reader behavior are unchanged. The <span> is the visual pill. */
.switch {
  display: inline-flex;
  align-items: center;
  width: 52px;
  height: 32px;
  position: relative;
  cursor: pointer;
  vertical-align: middle;
}
.switch input {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.switch span {
  width: 52px;
  height: 32px;
  background: var(--line-2);
  border-radius: 16px;
  position: relative;
  transition: background-color 160ms ease;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 160ms ease, background-color 160ms ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.switch input:checked + span { background: var(--amber); }
.switch input:checked + span::after {
  transform: translateX(20px);
  background: var(--on-amber);
}
.switch input:focus-visible + span {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ── iOS-style segmented control ──────────────────────────────────────
 * Use as:
 *   <div class="segmented" role="radiogroup">
 *     <label><input type="radio" name="x" value="a" checked><span>A</span></label>
 *     <label><input type="radio" name="x" value="b"><span>B</span></label>
 *   </div>
 * The radio inputs are visually hidden but reachable for keyboard +
 * screen-reader; the <span> is the visual button face. */
.segmented {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.segmented label {
  margin: 0;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  color: var(--text-dim);
}
.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 7px;
  min-width: 44px;
  min-height: 36px;
  transition: background-color 120ms ease, color 120ms ease;
}
.segmented input:checked + span {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.segmented input:focus-visible + span {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

/* ─────────────────────────────────────────────────────────────────────────
 * Pencil annotation (ink.js)
 *
 * .ink-figure  — outer figure wrapping image + caption
 * .ink-frame   — flex/positioning host; the .ink-host class gets added
 *                by JS once the canvas mounts; this provides a fallback
 *                style before the JS has run.
 * .ink-host    — image's parent at runtime; relatively positioned so
 *                the canvas can overlay absolutely.
 * .ink-layer   — the canvas; absolute, exactly atop the image, with
 *                touch-action:none so the browser doesn't steal Pencil
 *                strokes for page scroll.
 * .ink-toolbar — pill row above the image with tool + undo + save.
 */

.ink-figure { margin: 18px 0; }
.ink-figure figcaption {
  font-size: 12px;
  margin-bottom: 6px;
}

.ink-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  border-bottom: 0;
}
.ink-toolbar .ink-btn { margin: 0; }
.ink-toolbar .ink-btn.active {
  background: var(--amber-2);
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}
.ink-toolbar .ink-save { margin-left: auto; }

.ink-frame {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  line-height: 0;            /* kill descender gap under <img> */
}
.ink-frame img,
.ink-host img {
  display: block;
  max-width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.ink-host { position: relative; }
.ink-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;        /* required for Pencil + finger capture */
  cursor: crosshair;
}
.ink-layer.erase { cursor: cell; }

/* ─────────────────────────────────────────────────────────────────────────
 * Course shell — sticky vertical sidebar pattern (iPadOS-style left rail).
 *
 * On tablet+ widths (≥ 900px) the shell is a 240px sidebar + flexible
 * content area. The sidebar is `position: sticky` so it stays in view
 * while the content scrolls. On narrow viewports the sidebar collapses
 * behind a hamburger button (.drawer-toggle); JS (initDrawerToggles)
 * flips the .open class.
 *
 * No layout shift on initial paint: the sidebar element is in normal
 * flow on narrow widths and stacks above the content. CSS grid handles
 * both states with a single `grid-template-columns` rule per breakpoint.
 */

.course-shell { display: block; }
.drawer-toggle { display: inline-flex; margin: 6px 0 12px; }

.course-shell-nav {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 14px;
  margin-bottom: 14px;
}
.course-shell-nav.open { display: block; }

.course-shell-brand { margin-bottom: 12px; }
.course-shell-title {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amber);
}
.course-shell-meta {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.course-shell-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
}
.course-shell-links a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  border: 1px solid transparent;
}
.course-shell-links a:hover {
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--amber);
  text-decoration: none;
}
.course-shell-links a.active {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--amber);
  border-color: rgba(var(--accent-rgb), 0.25);
  font-weight: 600;
}
.course-shell-section {
  font-family: var(--display);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--text-dim);
  margin: 14px 0 4px;
  padding: 0 12px;
}
.course-shell-admin { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 4px; }
.course-shell-foot { margin-top: 12px; padding: 8px 12px; font-size: 12px; }

/* Tablet+ — pin the sidebar to the left as a sticky rail. */
@media (min-width: 900px) {
  .drawer-toggle { display: none; }
  .course-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }
  .course-shell-nav {
    display: block;
    position: sticky;
    top: 16px;
    align-self: start;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    margin-bottom: 0;
  }
  .course-shell-main { min-width: 0; }   /* let tables shrink */
  .course-shell-main .course-header h1 { margin-top: 0; }
}

/* Wide desktop — extra room for the table. */
@media (min-width: 1280px) {
  .course-shell { grid-template-columns: 260px minmax(0, 1fr); gap: 32px; }
}

/* ── Module item rows ───────────────────────────────────────────────── */
.module-items { list-style: none; padding: 0; margin: 12px 0 0; }
.module-items .module-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.module-items .module-item:last-child { border-bottom: 0; }
.module-items .module-item a { flex: 1 1 auto; }
.module-items .module-item .role { font-size: 10px; opacity: 0.7; }

/* ─────────────────────────────────────────────────────────────────────────
 * App polish: confirm dialog, toasts, empty states
 * (Pass-2 UX work — replaces native confirm(), surfaces HTMX success.) */

/* ── <dialog id="confirm-dialog"> ── */
.confirm-dialog {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 24px 24px 18px;
  max-width: 420px;
  min-width: 280px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.confirm-dialog[open] { animation: confirm-in 160ms ease-out; }
@keyframes confirm-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.confirm-title {
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 8px;
}
.confirm-message {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
/* Secondary button variant — used by Cancel. Looks like a button but
 * sits on bg-card with a muted border instead of solid amber. */
.btn-secondary, button.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-2);
  font-weight: 500;
}
.btn-secondary:hover, button.btn-secondary:hover {
  background: rgba(228, 222, 213, 0.06);
}
/* Danger variant — used by destructive confirm-OK. Salmon background
 * + dark text. Pairs with the salmon --err for a consistent meaning. */
.btn-danger, button.btn-danger {
  background: var(--err);
  color: var(--bg);
}
.btn-danger:hover, button.btn-danger:hover {
  background: #f0a0a0;   /* slight lift — same hue, lower saturation drop */
}

/* ── #toast-region ── */
.toast-region {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  right:  max(20px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.4;
  min-width: 220px;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 180ms ease-out;
}
.toast-success { border-left-color: var(--good); }
.toast-error   { border-left-color: var(--err); }
.toast-info    { border-left-color: var(--amber); }
.toast.toast-out {
  animation: toast-out 400ms ease-in forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

/* Stage-Manager / phone: toast region snaps to full-width along the
 * bottom edge with side gutters, instead of a corner stack. */
@media (max-width: 480px) {
  .toast-region {
    left: max(14px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
  }
  .toast { max-width: 100%; }
}

/* ── Empty-state cards ──────────────────────────────────────────────
 * Old: <p class="empty">no foo yet.</p>
 * New: same selector, now displays as a centered card with calmer
 *      type and breathing room. Templates can also use:
 *      <div class="empty-state">
 *        <div class="empty-state-glyph">📭</div>
 *        <p>no announcements yet</p>
 *        <a class="btn" href="...">post the first one →</a>
 *      </div>
 * The richer pattern is the one to migrate to over time; the bare
 * <p class="empty"> stays valid so we don't have to sweep every
 * template at once. */
.empty {
  display: block;
  text-align: center;
  padding: 28px 18px;
  color: var(--text-mute);
  font-style: italic;
  background: rgba(228, 222, 213, 0.025);
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  margin: 14px 0;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 36px 22px;
  text-align: center;
  background: rgba(228, 222, 213, 0.025);
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  margin: 14px 0;
}
.empty-state-glyph {
  font-size: 40px;
  line-height: 1;
  opacity: 0.7;
}
.empty-state p { margin: 0; color: var(--text-dim); }
.empty-state .btn,
.empty-state a.btn {
  margin-top: 4px;
  text-decoration: none;
}

/* ── Gradebook responsive: grid → cards under 760px ─────────────────── */
.gradebook-cards { display: none; }
@media (max-width: 760px) {
  .gradebook-grid { display: none; }
  .gradebook-cards {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 14px 0;
  }
}
.gradebook-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.gradebook-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 8px;
}
.gradebook-card-head strong { font-size: 16px; }
.gradebook-card-total { text-align: right; font-size: 15px; }
.gradebook-card-total .status { margin-left: 6px; }

.gradebook-card-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.gradebook-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.gradebook-card-row:last-child { border-bottom: 0; }
.gradebook-card-asgn { font-family: var(--mono); font-size: 13px; }
.gradebook-card-cell { display: inline-flex; align-items: center; gap: 6px; }
.gradebook-card-cell .grade-cell-input { width: 84px; }

/* ── Dropzone (assignment submission) ─────────────────────────────── */
.dropzone {
  position: relative;
  border: 2px dashed var(--line-2);
  border-radius: 12px;
  background: rgba(228, 222, 213, 0.025);
  padding: 24px 22px;
  margin: 4px 0 14px;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--amber);
  background: rgba(var(--accent-rgb), 0.06);
}
.dropzone.has-files { padding-bottom: 12px; }
.dropzone-input-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  opacity: 0;
  pointer-events: none;
}
.dropzone-hint {
  display: block;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
}
.dropzone-hint strong { color: var(--amber); }
.dropzone.has-files .dropzone-hint { margin-bottom: 14px; }

.dropzone-preview {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dropzone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
}
.dropzone-row-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-soft);
  flex-shrink: 0;
}
.dropzone-row-name {
  flex: 1 1 auto;
  word-break: break-all;
}
.dropzone-row-size { flex-shrink: 0; }
.dropzone-row-rm { flex-shrink: 0; margin: 0; }

/* ─────────────────────────────────────────────────────────────────────
 * Iconography (icons.svg sprite)
 *
 * Inline-SVG <use> references the static sprite at /static/icons.svg.
 * Glyphs inherit currentColor so they tint with the surrounding text.
 * The base .icon is 18×18; .icon-sm 14×14; .icon-lg 24×24. */
.icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: -3px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
}
.icon-sm { width: 14px; height: 14px; vertical-align: -2px; }
.icon-lg { width: 24px; height: 24px; vertical-align: -5px; }

/* Sidebar nav rows lay out icon + label as a flex row. */
.course-shell-links a {
  display: flex;
  align-items: center;
  gap: 10px;
}
.course-shell-links a .icon { color: var(--text-mute); }
.course-shell-links a:hover .icon,
.course-shell-links a.active .icon { color: var(--amber); }
.course-shell-foot a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Drawer toggle button picks up the icon + label naturally. The base
 * `.drawer-toggle` rule already sets display:inline-flex; we don't
 * re-declare display here because the wide-viewport `display: none`
 * rule lives in an earlier media query block — re-declaring display
 * unconditionally would lose to source-order and the rail layout
 * would break. Just add alignment and gap. */
.drawer-toggle {
  align-items: center;
  gap: 8px;
}

/* ─────────────────────────────────────────────────────────────────────
 * Course hero band
 *
 * Sits at top of the course-shell-main on every course page. Renders
 * a tinted band carrying the course title + term + role. Replaces the
 * empty space where the duplicate course-header H1 used to live.
 *
 * Tint is deterministic from the course slug via `.hero-tint-N`
 * (N = 0..7) — picked by the route handler. Twelve options were
 * overkill; eight read distinctly enough.
 *
 * The band uses a linear gradient (bg-card → bg-soft with a subtle
 * hue wash) so it feels like a real visual surface, not flat.
 */
.course-hero {
  position: relative;
  border-radius: 14px;
  padding: 24px 28px;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: linear-gradient(
    135deg,
    var(--hero-tint-1, var(--bg-card)) 0%,
    var(--hero-tint-2, var(--bg-soft)) 100%
  );
}
.course-hero-title {
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.1;
}
.course-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-dim);
  align-items: center;
}
.course-hero-meta .role { color: inherit; }

/* Eight tints, picked deterministically from the course slug. Each
 * pair (--hero-tint-1, --hero-tint-2) is a near-neighbour gradient
 * so the hero is tinted, not garish. */
.hero-tint-0 { --hero-tint-1: #2a1f1c; --hero-tint-2: #1d1c21; } /* warm graphite */
.hero-tint-1 { --hero-tint-1: #1c2230; --hero-tint-2: #1d1c21; } /* slate */
.hero-tint-2 { --hero-tint-1: #1f2a25; --hero-tint-2: #1d1c21; } /* moss */
.hero-tint-3 { --hero-tint-1: #2a1f2a; --hero-tint-2: #1d1c21; } /* plum */
.hero-tint-4 { --hero-tint-1: #2a2820; --hero-tint-2: #1d1c21; } /* ochre */
.hero-tint-5 { --hero-tint-1: #1c2a2a; --hero-tint-2: #1d1c21; } /* teal */
.hero-tint-6 { --hero-tint-1: #2a2027; --hero-tint-2: #1d1c21; } /* rose */
.hero-tint-7 { --hero-tint-1: #251f2a; --hero-tint-2: #1d1c21; } /* indigo */

/* Linen light theme — the gradient should still feel like tinted
 * paper, not muddy. Use much lighter neighbour pairs. */
@media (prefers-color-scheme: light) {
  .hero-tint-0 { --hero-tint-1: #ebe6db; --hero-tint-2: #e8e6df; }
  .hero-tint-1 { --hero-tint-1: #e2e5eb; --hero-tint-2: #e8e6df; }
  .hero-tint-2 { --hero-tint-1: #e3eae2; --hero-tint-2: #e8e6df; }
  .hero-tint-3 { --hero-tint-1: #ebe3e8; --hero-tint-2: #e8e6df; }
  .hero-tint-4 { --hero-tint-1: #ece8d8; --hero-tint-2: #e8e6df; }
  .hero-tint-5 { --hero-tint-1: #ddeaea; --hero-tint-2: #e8e6df; }
  .hero-tint-6 { --hero-tint-1: #eddfe4; --hero-tint-2: #e8e6df; }
  .hero-tint-7 { --hero-tint-1: #e6e0ec; --hero-tint-2: #e8e6df; }
}

/* ─────────────────────────────────────────────────────────────────────
 * Analytics charts
 *
 * Pure SVG, computed server-side. Two visualizations:
 *   .chart-distribution — per-assignment histogram (bars 0-100% in
 *                          10% buckets)
 *   .chart-sparkline    — class-average trend across assignments
 */
.chart-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.chart-row:last-child { border-bottom: 0; }
.chart-row-label {
  flex: 0 0 28%;
  font-size: 13px;
}
.chart-row-stats {
  flex: 0 0 18%;
  font-size: 12px;
  color: var(--text-dim);
}
.chart-distribution {
  flex: 1 1 auto;
  height: 48px;
  display: block;
}
.chart-bar { fill: var(--amber); opacity: 0.85; }
.chart-bar-empty { fill: var(--line-2); opacity: 0.3; }
.chart-axis-line { stroke: var(--line); stroke-width: 1; }
.chart-axis-text { font-family: var(--mono); font-size: 9px; fill: var(--text-mute); }

.chart-sparkline {
  display: block;
  width: 100%;
  height: 120px;
}
.chart-sparkline-line {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-sparkline-fill {
  fill: rgba(var(--accent-rgb), 0.12);
  stroke: none;
}
.chart-sparkline-dot { fill: var(--amber-2); }
.chart-sparkline-grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

/* Module conditional-release lock styling. The card stays in the
 * page so students see the structure of what's coming, but the items
 * are non-clickable spans and the title carries a clock glyph. */
.module-locked { opacity: 0.85; border-style: dashed; }
.module-locked .module-item-locked { color: var(--text-mute); }

/* ── Notifications list ─────────────────────────────────────────────── */
.notification-list { list-style: none; margin: 0; padding: 0; }
.notification-row {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.notification-row.notification-unread { border-left: 4px solid var(--amber); }
.notification-link {
  display: block;
  padding: 14px 18px;
  color: var(--text);
  text-decoration: none;
}
.notification-link:hover { background: rgba(228, 222, 213, 0.04); text-decoration: none; }
.notification-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.notification-body { margin: 4px 0; line-height: 1.4; }
.notification-meta { display: flex; gap: 8px; margin-top: 6px; }

/* Unread count badge in the topbar. */
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--err);
  color: var(--bg);
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: 1px;
}

/* Sidebar "Join meeting" CTA — slightly louder than the other nav
 * links so it reads as the live-class entry point. */
.course-shell-links a.course-shell-cta {
  background: rgba(var(--accent-rgb), 0.10);
  color: var(--amber);
  border: 1px solid rgba(var(--accent-rgb), 0.30);
  margin-bottom: 6px;
}
.course-shell-links a.course-shell-cta:hover {
  background: rgba(var(--accent-rgb), 0.18);
}
.course-shell-links a.course-shell-cta .icon { color: var(--amber); }

/* Question bank items. */
.bank-items { list-style: decimal inside; padding: 0; margin: 12px 0 0; }
.bank-item {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0;
}
.bank-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.bank-item-body { white-space: pre-wrap; font-size: 14px; }
.bank-item-meta {
  background: var(--bg-card);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11px;
  margin: 6px 0 0;
}

/* ─────────────────────────────────────────────────────────────────────
 * Skeleton loading placeholders.
 *
 * Use as <div class="skeleton skeleton-row">  for a single line, or
 *        <div class="skeleton skeleton-block"> for a block of body
 *        text, or wrap an HTMX target in a .skeleton-card so the
 *        loading state has shape.
 *
 * The shimmer is a single linear-gradient sweep — pure CSS, no JS,
 * no extra requests. Respects prefers-reduced-motion (the gradient
 * stops animating and the placeholder stays a flat grey-amber).
 *
 * Pair with htmx-indicator: hide the skeleton when content is loaded
 * by toggling a parent class, or simply ship the skeleton in the
 * initial HTML and let the HTMX swap replace it with real content. */
.skeleton {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    var(--bg-soft) 0%,
    rgba(var(--accent-rgb), 0.10) 50%,
    var(--bg-soft) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
  color: transparent !important;
  user-select: none;
}
@keyframes skeleton-shimmer {
  0%   { background-position: -100% 0; }
  100% { background-position:  100% 0; }
}
.skeleton-row   { height: 1em; margin: 6px 0; }
.skeleton-row.short { width: 40%; }
.skeleton-row.medium { width: 70%; }
.skeleton-block { height: 4em; margin: 12px 0; }
.skeleton-card  {
  height: 120px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 14px 0;
}
.skeleton-row + .skeleton-row { margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* ─────────────────────────────────────────────────────────────────────
 * Print stylesheet.
 *
 * Goal: a gradebook, transcript, or grader summary that prints
 * cleanly to a registrar's filing cabinet. Hide the app chrome
 * (topbar, sidebar, drawer toggle, footbar, toasts, dialog),
 * collapse the page to a single column, switch to a serif text
 * face on a white page, and let tables span the full width.
 *
 * No `display: none` on the .container — we want to print *what
 * the user sees*, just without the navigation around it. */
@media print {
  :root {
    color-scheme: only light;
    --bg: #ffffff;
    --bg-soft: #ffffff;
    --bg-card: #ffffff;
    --text: #000000;
    --text-dim: #333333;
    --text-mute: #555555;
    --line: #cccccc;
    --line-2: #888888;
    --amber: #000000;
    --amber-2: #000000;
    --link: #000000;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: var(--serif), Georgia, "Times New Roman", serif !important;
    font-size: 11pt;
  }
  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide app chrome. */
  .topbar,
  .footbar,
  .drawer-toggle,
  .course-shell-nav,
  .course-hero,
  .toast-region,
  .confirm-dialog,
  .skip-link,
  .topnav,
  form button,
  .grade-cell-link,
  .ink-toolbar,
  .ink-layer,
  .empty,
  .empty-state,
  .dev-banner,
  nav.subnav { display: none !important; }

  /* Collapse the shell to single column so content uses the full
   * page width — printers don't need a sidebar. */
  .course-shell { display: block !important; }
  .course-shell-main { display: block !important; }
  .container { max-width: 100% !important; padding: 0 !important; }
  main.container { padding-bottom: 0 !important; }

  /* Tables span full width with a real border so the registrar
   * can fold the page. */
  table.grid {
    width: 100% !important;
    border: 1px solid #888 !important;
    page-break-inside: auto;
  }
  table.grid th, table.grid td {
    border-bottom: 1px solid #ccc !important;
    color: #000 !important;
    background: #fff !important;
    padding: 6px 8px !important;
  }
  table.grid thead { display: table-header-group; }
  tr, .card { page-break-inside: avoid; }

  /* No rounded corners or shadows on paper. */
  .card, .role, .status, .late-badge, button, .btn,
  input, select, textarea, pre {
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  /* Show full URLs after every <a>. The instructor printing the
   * gradebook should be able to find the linked submission later. */
  a[href^="http"]::after,
  a[href^="/"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
  }
  a[href^="#"]::after { content: ""; }
  /* Internal grade-cell ↗ link clutters tables — strip its URL trail. */
  .grade-cell-td a::after { content: "" !important; }
}

/* At-risk dashboard. .num right-aligns numerics; .at-risk-row tints
   the entire row using the same amber-on-dim band the late-badge
   uses elsewhere. */
.grid td.num, .grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.at-risk-row td { background: rgba(var(--warn-rgb), 0.10); }
.at-risk-row td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* Demo-mode badge in the topbar. Stamped, not subtle: amber on
   ink with the same monospace face the footer uses so it reads
   as a state marker not a brand element. */
.demo-badge {
  display: inline-block;
  padding: 3px 8px;
  margin-left: 12px;
  background: var(--amber);
  color: var(--bg);
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 600;
  border-radius: 4px;
}

/* Discreet admin-console entry: a small π pinned to the bottom-right,
   rendered only for admins (see base.html). Sits at low opacity until
   hovered/focused so it doesn't compete with page content. */
.pi-admin {
  position: fixed;
  right: 0.7rem;
  bottom: 0.6rem;
  z-index: 50;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: var(--display);
  font-size: 1.15rem;
  line-height: 1;
  text-decoration: none;
  background: var(--bg);
  color: var(--amber);
  border: 1px solid var(--amber);
  opacity: 0.4;
  transition: opacity 0.15s ease;
}
.pi-admin:hover,
.pi-admin:focus-visible {
  opacity: 1;
}
