/* Jellocat Learning — styled to the jellocat.com design system.
   Signature surface: the grain mesh (blue → violet → rose gradient field under
   two passes of SVG film grain). The mesh is rationed to two moments (the
   sign-in story panel and the dashboard welcome); everything else stays quiet
   surfaces stay quiet neutrals so the one mesh moment lands. Fonts are
   self-hosted so the strict CSP keeps style-src/font-src 'self'. */

/* ── Fonts (self-hosted variable woff2, latin subset) ───────────────────── */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/BricolageGrotesque-var.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('/fonts/PlusJakartaSans-var.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/Fraunces-italic-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ── Brand tokens ───────────────────────────────────────────────────────── */
:root {
  --blue: #2E6BE6;
  --blue-deep: #1E4FB8;
  --cream: #FCFDFC;
  --pale: #EFF3F9;
  --ink: #0B1220;
  --ink-soft: #172238;
  --ink-gray: #5A6678;
  --navy: #0b1733;
  --card: #FFFFFF;
  --line: #E7EBF2;
  --line-strong: #D6DCE7;
  --success: #1F9D55;
  --success-bg: #E7F7ED;
  --danger: #B23A2E;
  --danger-bg: #FBEAE8;
  --warning: #B7791F;
  --warning-bg: #FCF1DD;
  --r-block: 28px;
  --r-lg: 20px;
  --r-inner: 12px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.32, 0.72, 0, 1);
  --shadow: 0 1px 2px rgba(13, 20, 38, 0.04), 0 16px 40px -12px rgba(13, 20, 38, 0.1);
  --font-display: 'Bricolage Grotesque', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Fraunces', Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

/* Ambient film grain: the brand's paper tooth on every surface, so pages never
   read as flat dead-white between mesh moments. Fixed, subtle, non-interactive. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

a {
  color: inherit;
  text-decoration: none;
}

p {
  margin: 0 0 12px;
  color: var(--ink-gray);
  text-wrap: pretty;
}

::selection {
  background: var(--blue);
  color: #fff;
}

.grainmesh ::selection {
  background: #fff;
  color: var(--ink);
}

/* ── The signature: grain mesh ──────────────────────────────────────────────
   A soft gradient field drifting blue → violet → rose, oversized so it moves
   slowly under two fixed noise passes (coarse overlay + fine soft-light). The
   grain is mandatory: the gradient alone is not the brand. */
:root {
  --mesh-base: #1d3ea8;
  --mesh-blue:
    radial-gradient(76% 86% at 16% 16%, #5C99FF 0%, transparent 64%),
    radial-gradient(52% 62% at 66% 24%, #9D7DF0 0%, transparent 56%),
    radial-gradient(58% 68% at 90% 86%, #FF86B6 0%, transparent 56%),
    radial-gradient(88% 96% at 48% 54%, #2E6BE6 0%, transparent 74%);
}

.grainmesh {
  position: relative;
  overflow: hidden;
  color: var(--cream);
  background-color: var(--mesh-base);
  background-image: var(--mesh-blue);
  background-size: 165% 165%;
  background-position: 20% 26%;
}

@media (prefers-reduced-motion: no-preference) {
  .grainmesh {
    animation: meshDrift 26s ease-in-out -4s infinite alternate;
  }
}

@keyframes meshDrift {
  0% { background-position: 14% 22%; }
  50% { background-position: 60% 50%; }
  100% { background-position: 36% 80%; }
}

/* night: deep cinematic ground for the admin side. Blue and rose read as
   restrained glows on dark, not fields. */
.grainmesh.mesh-night {
  --mesh-base: #0b1733;
  --mesh-blue:
    radial-gradient(78% 88% at 16% 14%, rgba(46, 107, 230, 0.62) 0%, transparent 60%),
    radial-gradient(52% 62% at 64% 26%, rgba(157, 125, 240, 0.34) 0%, transparent 54%),
    radial-gradient(58% 68% at 90% 88%, rgba(255, 116, 182, 0.3) 0%, transparent 56%),
    radial-gradient(82% 94% at 56% 50%, rgba(46, 107, 230, 0.3) 0%, transparent 72%);
  animation-duration: 31s;
  animation-delay: -8s;
}

.grainmesh::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.62;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.grainmesh::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.0' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.grainmesh > * {
  position: relative;
  z-index: 1;
}

/* ── Layout scaffolding ─────────────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow {
  max-width: 560px;
}

main {
  padding: 40px 0 88px;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 8px;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: clamp(28px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 15px;
}

/* single italic-serif accent word inside a bold grotesk headline. Used once
   in the whole product (the sign-in story headline). */
.serif-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--ink-gray);
  font-weight: 700;
  margin-bottom: 6px;
}

/* ── Wordmark ───────────────────────────────────────────────────────────── */
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.wordmark__period {
  color: var(--blue);
}

/* ── Admin view-as banner ───────────────────────────────────────────────── */
.impersonation-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  max-width: 960px;
  margin: 14px auto 0;
  padding: 8px 10px 8px 18px;
  border-radius: 999px;
  background: var(--warning-bg);
  border: 1px solid rgba(183, 121, 31, 0.35);
  font-size: 13px;
  color: var(--ink-soft);
}

.impersonation-banner__btn {
  font: inherit;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.impersonation-banner__btn:hover {
  border-color: var(--ink-gray);
  color: var(--blue-deep);
}

/* ── Top nav: floating navy pill (signed-in pages only) ─────────────────── */
.topbar {
  background: var(--navy);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(11, 23, 51, 0.22);
  max-width: 960px;
  margin: 20px auto 0;
  position: sticky;
  top: 16px;
  z-index: 10;
}

.topbar .wordmark {
  color: #fff;
}

.topbar__inner {
  padding: 10px 12px 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 15px;
}

.brand__label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 500;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-link {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
  color: var(--navy);
  background: #fff;
  font-weight: 600;
}

.nav-link--button {
  display: inline-block;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
}

.inline-form {
  display: inline;
}

/* ── Panels ─────────────────────────────────────────────────────────────── */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.panel--tight {
  padding: 16px 20px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title h2 {
  margin: 0;
}

/* ── Progress ───────────────────────────────────────────────────────────── */
.progress-bar {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--pale);
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-bar::-webkit-progress-bar {
  background: var(--pale);
  border-radius: 999px;
}

.progress-bar::-webkit-progress-value {
  background: var(--blue);
  border-radius: 999px;
}

.progress-bar::-moz-progress-bar {
  background: var(--blue);
  border-radius: 999px;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}

.progress-row .progress-bar {
  flex: 1;
}

.progress-percent {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  min-width: 42px;
  text-align: right;
}

/* ── Lesson list: a completion-aware stepper rail ───────────────────────────
   The modules are a strict sequence, so the list draws it as one: numbered
   nodes on a vertical rail, the rail filling in behind completed steps. The
   node state carries completion; no status badges repeat it. */
.lesson-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lesson-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 12px 14px 4px;
  transition: background 0.25s var(--ease);
  border-radius: var(--r-inner);
}

.lesson-item:hover {
  background: var(--pale);
}

/* the rail segment below each node; the last item ends the rail */
.lesson-item::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 44px;
  bottom: -14px;
  width: 2px;
  border-radius: 1px;
  background: var(--line);
}

.lesson-item:last-child::before {
  display: none;
}

.lesson-item--done::before {
  background: var(--success);
  opacity: 0.45;
}

.lesson-item__index {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-gray);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.lesson-item__index--done {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.lesson-item__body {
  flex: 1;
  min-width: 0;
}

.lesson-item__title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.lesson-item__title a {
  transition: color 0.25s var(--ease);
}

.lesson-item__title a:hover {
  color: var(--blue);
}

.lesson-item__meta {
  font-size: 12.5px;
  color: var(--ink-gray);
  margin-top: 2px;
}

.lesson-item__quiz {
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-gray);
  font-variant-numeric: tabular-nums;
}

/* ── Badges (admin learner detail only) ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-gray);
  white-space: nowrap;
}

.badge--done {
  color: var(--success);
  border-color: var(--success);
  background: var(--success-bg);
}

.badge--pending {
  color: var(--warning);
  border-color: var(--warning);
  background: var(--warning-bg);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 20px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.25s var(--ease-soft), border-color 0.25s var(--ease-soft),
    color 0.25s var(--ease-soft), transform 0.25s var(--ease-soft), box-shadow 0.25s var(--ease-soft);
}

.btn:hover {
  background: var(--pale);
  border-color: var(--ink-gray);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(46, 107, 230, 0.5);
}

.btn--primary:hover {
  background: var(--blue-deep);
  border-color: var(--blue-deep);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -8px rgba(46, 107, 230, 0.55);
}

/* white pill on the mesh: the brand's canonical on-mesh CTA */
.btn--cream {
  background: #fff;
  border-color: #fff;
  color: var(--ink);
  box-shadow: 0 10px 26px -6px rgba(11, 18, 32, 0.35);
}

.btn--cream:hover {
  background: #fff;
  border-color: #fff;
  color: var(--blue-deep);
  transform: translateY(-2px);
  box-shadow: 0 18px 36px -8px rgba(11, 18, 32, 0.4);
}

.btn--danger {
  border-color: rgba(178, 58, 46, 0.4);
  color: var(--danger);
  background: transparent;
}

.btn--danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.btn--sm {
  padding: 6px 14px;
  font-size: 12px;
  min-height: 34px;
}

.btn--block {
  width: 100%;
}

.btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--ink-gray);
}

.btn--quiet:hover {
  background: var(--pale);
  border-color: var(--pale);
  color: var(--ink);
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.field .hint {
  font-size: 12px;
  color: var(--ink-gray);
  margin-top: 4px;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='url'],
textarea,
select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-inner);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 11px 14px;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46, 107, 230, 0.14);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* on navy or mesh, a blue ring is invisible: use white */
.topbar :focus-visible,
.grainmesh :focus-visible {
  outline-color: #fff;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 16px;
}

.status-text {
  color: var(--success);
  font-size: 13px;
}

/* ── Quiz: custom radio controls ────────────────────────────────────────── */
.quiz-question {
  margin-bottom: 24px;
}

.quiz-question > p {
  color: var(--ink);
  margin-bottom: 2px;
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.quiz-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-inner);
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.quiz-choice:hover {
  border-color: var(--blue);
}

.quiz-choice input[type='radio'] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  flex-shrink: 0;
  cursor: pointer;
  transition: border 0.2s var(--ease-soft);
}

.quiz-choice input[type='radio']:checked {
  border: 5.5px solid var(--blue);
}

.quiz-choice:has(input:checked) {
  border-color: var(--blue);
  background: #EEF3FD;
}

.quiz-choice--correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.quiz-choice--correct input[type='radio']:checked {
  border-color: var(--success);
}

.quiz-choice--incorrect {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.quiz-choice--incorrect input[type='radio']:checked {
  border-color: var(--danger);
}

/* ── Completion row ─────────────────────────────────────────────────────── */
.completion-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.completion-row p {
  margin: 0;
}

/* ── Lesson pager ───────────────────────────────────────────────────────── */
.lesson-pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
}

.lesson-pager__link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-inner);
  background: var(--card);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  max-width: 46%;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease-soft);
}

.lesson-pager__link:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-1px);
}

.lesson-pager__link--next {
  margin-left: auto;
  text-align: right;
}

.lesson-pager__dir {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-gray);
}

/* ── Tables (admin) ─────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th,
td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

td {
  font-variant-numeric: tabular-nums;
}

th {
  color: var(--ink-gray);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

tbody tr {
  transition: background 0.2s var(--ease);
}

tbody tr:hover {
  background: var(--pale);
}

tbody tr:last-child td {
  border-bottom: none;
}

.row-link {
  font-weight: 600;
  transition: color 0.2s var(--ease);
}

.row-link:hover {
  color: var(--blue);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow-x: auto;
  background: var(--card);
}

.table-wrap table {
  margin: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.stat-tile__value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.stat-tile__label {
  font-size: 12px;
  color: var(--ink-gray);
  margin-top: 4px;
}

/* ── Resource + note lists ──────────────────────────────────────────────── */
.resource-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.resource-list li {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.resource-list li:last-child {
  border-bottom: none;
}

.resource-list a {
  font-weight: 600;
  transition: color 0.25s var(--ease);
}

.resource-list a:hover {
  color: var(--blue);
}

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.note-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.note-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.note-list .hint {
  margin-bottom: 4px;
}

/* ── Empty states ───────────────────────────────────────────────────────── */
.empty-state {
  background: var(--pale);
  border-radius: var(--r-inner);
  padding: 22px 20px;
  text-align: center;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-gray);
}

.callout {
  border: 1px solid var(--line-strong);
  border-radius: var(--r-inner);
  padding: 14px 18px;
  background: #EEF3FD;
  font-size: 13px;
  color: var(--ink-gray);
  margin-bottom: 20px;
}

.callout--placeholder {
  border-color: rgba(183, 121, 31, 0.35);
  background: var(--warning-bg);
}

.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: start;
}

.markdown-body {
  color: var(--ink);
  white-space: pre-wrap;
  max-width: 68ch;
  line-height: 1.65;
}

.markdown-body p {
  color: var(--ink);
}

.hint {
  font-size: 12.5px;
  color: var(--ink-gray);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-gray);
  min-height: 44px;
  transition: color 0.25s var(--ease);
}

.back-link:hover {
  color: var(--blue);
}

.back-link svg {
  width: 13px;
  height: 13px;
  transition: transform 0.3s var(--ease-soft);
}

.back-link:hover svg {
  transform: translateX(-2px);
}

/* ── Centered pages (error, 404) ────────────────────────────────────────── */
.center-page {
  min-height: calc(100dvh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.centered-card {
  width: 100%;
  max-width: 400px;
}

.centered-card__mark {
  margin-bottom: 18px;
}

.centered-card__mark .wordmark {
  font-size: 20px;
}

/* ── Auth: the front door. Mesh identity panel beside a white form card ─── */
.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.auth-story {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 60px;
  color: #fff;
}

.auth-story__mark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
}

.auth-story__mark .wordmark {
  color: #fff;
  font-size: 21px;
}

/* on the mesh the brand-blue period vanishes: lift it to white */
.auth-story__mark .wordmark__period {
  color: #fff;
}

.auth-story__mark-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13.5px;
  font-weight: 500;
}

.auth-story__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 3.2vw, 40px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: #fff;
  margin: 0;
  max-width: 420px;
  text-wrap: balance;
}

/* one quiet rise on the sign-in story, once per visit; nothing else animates
   on page load */
@media (prefers-reduced-motion: no-preference) {
  .auth-story > * {
    animation: storyRise 0.7s var(--ease) backwards;
  }

  .auth-story > *:nth-child(1) { animation-delay: 0.04s; }
  .auth-story > *:nth-child(2) { animation-delay: 0.1s; }
}

@keyframes storyRise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-card-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 28px;
  background: var(--cream);
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-card__panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--r-lg) + 4px);
  padding: 32px;
  box-shadow: var(--shadow);
}

.auth-card__panel h1 {
  margin-bottom: 20px;
}

.auth-help {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--ink-gray);
  text-align: center;
}

/* ── Learner portal shell ───────────────────────────────────────────────────
   A working application, not a marketing page: navy sidebar carrying identity
   and progress on the left, quiet gray canvas with white cards on the right.
   The sidebar navy is the same surface jellocat.com uses for its nav. */
.portal {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100dvh;
  background: #F2F4F8;
}

.sidebar {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  flex-direction: column;
  padding: 26px 18px 20px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

.sidebar__brand a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 10px;
}

.sidebar__brand .wordmark {
  color: #fff;
  font-size: 18px;
}

.sidebar__brand-label {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12.5px;
  font-weight: 500;
}

.sidebar__progress {
  margin: 24px 0 20px;
  padding: 14px 14px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-inner);
}

.sidebar__progress-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.sidebar__progress-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
}

.sidebar__progress-pct {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.progress-bar--sidebar {
  height: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.14);
}

.progress-bar--sidebar::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.14);
}

.progress-bar--sidebar::-webkit-progress-value {
  background: var(--blue);
}

.progress-bar--sidebar::-moz-progress-bar {
  background: var(--blue);
}

.sidebar__progress-count {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}

.sidebar__section {
  margin-top: 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  padding: 0 10px;
  margin-bottom: 8px;
}

.sidebar__nav > .sidebar__section:first-child {
  margin-top: 0;
}

.sidebar__modules {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__module {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.sidebar__module:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.sidebar__module--active {
  background: #fff;
  color: var(--navy);
  font-weight: 600;
}

.sidebar__module--active:hover {
  background: #fff;
  color: var(--navy);
}

.sidebar__module-mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.sidebar__module--active .sidebar__module-mark {
  border-color: rgba(11, 23, 51, 0.35);
}

.sidebar__module-mark--done {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.sidebar__module--locked {
  color: rgba(255, 255, 255, 0.35);
  cursor: default;
}

.sidebar__module--locked:hover {
  background: none;
  color: rgba(255, 255, 255, 0.35);
}

.sidebar__module-mark--locked {
  border-color: rgba(255, 255, 255, 0.2);
}

.sidebar__module-mark--locked svg {
  width: 11px;
  height: 11px;
  display: block;
}

.sidebar__module-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__module--assignment {
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 0 8px 8px;
  padding-top: 12px;
}

.sidebar__footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 16px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__user {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.sidebar__signout {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  transition: color 0.2s var(--ease);
}

.sidebar__signout:hover {
  color: #fff;
}

.portal__main {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 44px 48px 80px;
}

.portal__header {
  margin-bottom: 24px;
}

.portal__header h1 {
  font-size: clamp(24px, 3vw, 30px);
}

.portal__header p {
  margin-bottom: 0;
}

.continue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.continue-card__kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  margin-bottom: 3px;
}

.continue-card__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.locked-panel {
  text-align: center;
  padding: 48px 28px;
}

.locked-panel__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--pale);
  color: var(--ink-gray);
  margin-bottom: 14px;
}

.locked-panel__icon svg {
  width: 20px;
  height: 20px;
}

.locked-panel p {
  max-width: 44ch;
  margin: 0 auto 20px;
}

@media (max-width: 900px) {
  .portal {
    grid-template-columns: 1fr;
  }

  /* the sidebar stacks above the content; the module nav stays reachable */
  .sidebar {
    position: static;
    height: auto;
    padding: 18px 16px;
  }

  .sidebar__progress {
    margin: 16px 0 14px;
  }

  .sidebar__footer {
    padding-top: 12px;
    margin-top: 14px;
  }

  .portal__main {
    padding: 24px 16px 64px;
  }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .two-col {
    grid-template-columns: 1fr;
  }

  .topbar {
    border-radius: var(--r-lg);
    margin: 12px 12px 0;
    top: 12px;
  }

  .topbar__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 16px;
  }

  .brand {
    justify-content: center;
  }

  .nav-links {
    justify-content: center;
  }

  .nav-link {
    padding: 10px 14px;
  }

  main {
    padding: 24px 0 64px;
  }

  .panel {
    padding: 20px;
  }


  .lesson-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: start;
    gap: 10px 14px;
    padding: 14px 8px 14px 4px;
  }

  .lesson-item::before {
    left: 17px;
    top: 46px;
  }

  .lesson-item__body {
    width: 100%;
  }

  .lesson-item__title {
    font-size: 15px;
    line-height: 1.4;
  }

  .lesson-item__meta {
    font-size: 13px;
    line-height: 1.55;
    margin-top: 4px;
  }

  .lesson-item__quiz {
    grid-column: 2;
  }

  .btn {
    min-height: 44px;
  }

  .lesson-pager {
    flex-direction: column;
  }

  .lesson-pager__link {
    max-width: none;
  }

  .lesson-pager__link--next {
    margin-left: 0;
    text-align: left;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  .auth-story {
    padding: 48px 28px;
    flex: 0 0 auto;
    justify-content: flex-end;
    min-height: 38dvh;
  }

  .auth-card-col {
    padding: 32px 20px 48px;
    align-items: flex-start;
  }

  .auth-card__panel {
    padding: 26px 22px;
  }
}

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

  html {
    scroll-behavior: auto;
  }
}
