/* ==========================================================================
   LemSchool LMS — design system
   1. Tokens
   2. Base & typography
   3. Layout primitives
   4. App shell (topbar + sidebar)
   5. Components
   6. Landing page
   7. Auth pages
   8. Install wizard
   9. Utilities & responsive
   ========================================================================== */

/* 1. Tokens ============================================================== */
:root {
  /* Brand */
  --brand-900: #082d56;
  --brand-800: #0b3d72;
  --brand-700: #104d8f;
  --brand-600: #1559a7;
  --brand-500: #2876c7;
  --brand-200: #a9cff1;
  --brand-100: #dcecf9;
  --brand-50:  #eff7fd;

  /* Warm neutral paper scale */
  --paper:     #f7fafd;
  --paper-2:   #eaf3fa;
  --surface:   #ffffff;
  --surface-2: #f3f8fc;

  --ink:       #16201d;
  --ink-2:     #3d4a45;
  --muted:     #6a7873;
  --faint:     #93a09a;

  --line:      #d7e3ee;
  --line-2:    #e6eef5;

  /* Status */
  --ok:      #067647;
  --ok-bg:   #e8f8ee;
  --warn:    #b54708;
  --warn-bg: #fef6e7;
  --danger:  #b42318;
  --danger-bg: #fdefee;
  --info:    #175cd3;
  --info-bg: #eef5ff;

  /* Supporting scholarly accents */
  --teal:        #0f8a83;
  --teal-soft:   #e0f3f1;
  --gold:        #b97922;
  --gold-soft:   #fff2d9;
  --violet:      #675aa7;
  --violet-soft: #eeebfa;
  --coral:       #b95768;
  --coral-soft:  #fae9ec;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(8, 45, 86, 0.05);
  --shadow-sm: 0 1px 3px rgba(8, 45, 86, 0.06), 0 1px 2px rgba(8, 45, 86, 0.04);
  --shadow-md: 0 4px 12px rgba(8, 45, 86, 0.08), 0 1px 3px rgba(8, 45, 86, 0.05);
  --shadow-lg: 0 18px 40px -12px rgba(8, 45, 86, 0.2), 0 4px 12px rgba(8, 45, 86, 0.06);
  --ring: 0 0 0 3px rgba(21, 89, 167, 0.16);

  /* Geometry */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* Type */
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Rhythm */
  --shell-w: 1180px;
  --side-w: 250px;
  --topbar-h: 64px;

  /* Back-compat aliases (older markup) */
  --bg: var(--paper);
  --bg-deep: var(--paper-2);
  --card: var(--surface);
  --accent: var(--brand-600);
  --accent-dark: var(--brand-700);
  --accent-soft: var(--brand-100);
  --radius: var(--r-lg);
  --shadow: var(--shadow-md);
}

/* 2. Base & typography =================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 1rem);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin: 0 0 0.6rem;
  text-wrap: balance;
}
h1 { font-size: clamp(1.65rem, 1.2rem + 1.4vw, 2.1rem); }
h2 { font-size: 1.2rem; letter-spacing: -0.012em; }
h3 { font-size: 1.02rem; }

p { margin: 0 0 0.9rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--brand-700);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
a:hover { color: var(--brand-600); text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 0.1em 0.38em;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

::selection { background: var(--brand-100); color: var(--brand-900); }

:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 3. Layout primitives =================================================== */
.wrap {
  width: min(var(--shell-w), calc(100% - 2.5rem));
  margin-inline: auto;
}

.site-main {
  flex: 1 0 auto;
  padding: 2rem 0 3.5rem;
}
.site-main.wrap { width: min(var(--shell-w), calc(100% - 2.5rem)); }

.grid-2, .grid-3, .grid-4 {
  display: grid;
  gap: 1.15rem;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stack > * + * { margin-top: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* 4. App shell =========================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 248, 244, 0.86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topbar-h);
  padding: 0.5rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand:hover { color: var(--ink); text-decoration: none; }

.brand-mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.6rem;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--brand-500), var(--brand-700));
  color: #fff;
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 12px rgba(21, 89, 167, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  font-size: 0.93rem;
}
.nav > a:not(.btn) {
  color: var(--ink-2);
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: var(--r-full);
  transition: background 0.15s ease, color 0.15s ease;
}
.nav > a:not(.btn):hover {
  color: var(--brand-700);
  background: var(--brand-50);
  text-decoration: none;
}
.nav > a.is-active:not(.btn) { color: var(--brand-700); background: var(--brand-100); }

.nav-user {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-2);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.25rem 0.7rem 0.25rem 0.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
}
.avatar {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  line-height: 0;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}
.nav-toggle span + span { margin-top: 4px; }

/* Sidebar layout for signed-in pages */
.app-layout {
  flex: 1 0 auto;
  width: min(var(--shell-w), calc(100% - 2.5rem));
  margin-inline: auto;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  padding: 1.75rem 0 3.5rem;
}

/* Lesson pages keep a generous, persistent contents rail on the left. */
.app-layout.is-reader {
  width: min(1320px, calc(100% - 2.5rem));
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 2.25rem;
}
.app-layout.is-reader .app-main { grid-column: 2; grid-row: 1; }
.app-layout.is-reader .app-sidebar { grid-column: 1; grid-row: 1; }
.app-layout.is-reader .app-nav {
  max-height: calc(100vh - var(--topbar-h) - 2.5rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--brand-200) transparent;
}

.app-sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 1.25rem);
}

.app-nav {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 0.55rem;
}
.app-nav-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0.7rem 0.75rem 0.35rem;
  margin: 0;
}
.app-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.94rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.app-nav a:hover { background: var(--paper-2); color: var(--ink); text-decoration: none; }
.app-nav a.is-active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--brand-600);
}
.app-nav a .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  flex-shrink: 0;
}
.app-nav a.is-active .dot { opacity: 1; }

.app-main { min-width: 0; }

/* Footer */
.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  color: rgba(255, 255, 255, 0.82);
  background:
    radial-gradient(circle at 82% 15%, rgba(40, 118, 199, 0.36), transparent 28rem),
    linear-gradient(135deg, var(--brand-900), #0b477d 62%, #0b5e76);
  padding: 3rem 0 1.15rem;
}
.footer-inner {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(150px, 0.65fr) minmax(220px, 0.9fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}
.footer-brand {
  font-family: var(--display);
  color: #fff;
  font-weight: 700;
  font-size: 1.35rem;
  margin-bottom: 0.55rem;
}
.footer-about p { max-width: 44ch; margin: 0; }
.footer-links, .footer-contact { display: grid; gap: 0.45rem; align-content: start; }
.footer-links strong, .footer-contact strong {
  color: #fff;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.site-footer a { color: #d9efff; width: fit-content; }
.site-footer a:hover { color: #fff; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.82rem;
}
.footer-bottom a { color: #fff; font-weight: 600; }

/* Cookie choice is persistent, readable, and never blocks the full page. */
.cookie-consent {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 80;
  width: min(760px, calc(100% - 2rem));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.1rem 1rem 1.25rem;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--brand-200);
  border-radius: var(--r-lg);
  box-shadow: 0 22px 60px rgba(8, 45, 86, 0.28);
  backdrop-filter: blur(14px);
}
.cookie-consent[hidden] { display: none; }
.cookie-consent-copy { min-width: 0; }
.cookie-consent-copy strong { display: block; color: var(--brand-900); margin-bottom: 0.15rem; }
.cookie-consent-copy p { margin: 0; font-size: 0.88rem; line-height: 1.5; }
.cookie-consent-actions { display: flex; gap: 0.55rem; flex-shrink: 0; }

/* Ad containers become active only after the learner allows optional cookies. */
.ad-slot { display: none; }
body.cookies-optional .ad-slot { display: block; }

/* 5. Components ========================================================== */
.page-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  flex-wrap: wrap;
  padding-bottom: 1.1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.page-head h1 { margin-bottom: 0.15rem; }
.page-head p { margin: 0; color: var(--muted); font-size: 0.96rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.35rem 1.45rem;
  margin-bottom: 1.15rem;
}
.panel > h2:first-child,
.panel > h3:first-child { margin-top: 0; }
.panel h2 {
  font-size: 1.08rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--line-2);
}
.panel ul { margin: 0; padding-left: 1.1rem; }
.panel ul li { margin-bottom: 0.4rem; }

.stat {
  padding: 1.25rem 1.3rem;
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--brand-50) 160%);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--brand-100);
  opacity: 0.5;
}
.stat .label {
  position: relative;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.stat .value {
  position: relative;
  font-family: var(--display);
  font-size: 2.3rem;
  font-weight: 600;
  line-height: 1.1;
  margin-top: 0.35rem;
  color: var(--brand-700);
  font-variant-numeric: tabular-nums;
}

/* Forms */
label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-2);
  margin-bottom: 0.4rem;
}
.field { margin-bottom: 1.05rem; }
.field .hint { font-size: 0.83rem; color: var(--muted); margin-top: 0.35rem; }

input:not([type]),
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="datetime-local"],
input[type="time"], input[type="search"], input[type="url"], input[type="tel"],
input[type="file"],
select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.68rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover:not(:focus):not([type="checkbox"]):not([type="radio"]),
select:hover:not(:focus), textarea:hover:not(:focus) {
  border-color: var(--brand-200);
}
input:focus:not([type="checkbox"]):not([type="radio"]), select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: var(--ring);
}
textarea { min-height: 130px; resize: vertical; line-height: 1.6; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236a7873' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.3rem;
}

input[type="file"] {
  padding: 0.5rem;
  background: var(--surface-2);
  border-style: dashed;
  cursor: pointer;
}

/* Buttons */
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  padding: 0.58rem 1.1rem;
  font: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease,
              box-shadow 0.15s ease, transform 0.12s ease, color 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--brand-600);
  color: #fff;
  box-shadow: 0 1px 2px rgba(9, 82, 70, 0.25), inset 0 1px 0 rgba(255,255,255,0.12);
}
.btn-primary:hover { background: var(--brand-700); color: #fff; box-shadow: 0 6px 16px rgba(9, 82, 70, 0.25); }

.btn-ghost {
  background: var(--surface);
  border-color: #d6d0c2;
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
}
.btn-ghost:hover { border-color: var(--brand-200); background: var(--brand-50); color: var(--brand-700); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #94190f; color: #fff; }

.btn-on-dark {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(6px);
}
.btn-on-dark:hover { background: rgba(255, 255, 255, 0.18); border-color: #fff; color: #fff; }

.btn-sm { padding: 0.36rem 0.8rem; font-size: 0.85rem; }
.btn-lg { padding: 0.82rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Flash / alerts */
.flash {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.85rem 1.1rem;
  border-radius: var(--r-md);
  border: 1px solid;
  margin-bottom: 1.2rem;
  font-size: 0.94rem;
  font-weight: 500;
  box-shadow: var(--shadow-xs);
}
.flash-success { background: var(--ok-bg); border-color: #b7e7cb; color: #05613a; }
.flash-error   { background: var(--danger-bg); border-color: #f3c3bf; color: #8f1d13; }
.flash-info    { background: var(--info-bg); border-color: #c2dbff; color: #14509b; }

/* Tables */
.panel > table { margin-bottom: -0.35rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
th, td {
  text-align: left;
  padding: 0.8rem 0.7rem;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td:first-child, th:first-child { padding-left: 0.15rem; }
td:last-child, th:last-child { padding-right: 0.15rem; text-align: right; }

.table-scroll { overflow-x: auto; margin-inline: -0.25rem; padding-inline: 0.25rem; }

.enrol-picker {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(260px, 1.35fr) auto;
  gap: 0.8rem;
  align-items: end;
  padding: 0.45rem 0;
}
.enrol-picker .field { margin: 0; }
.enrol-picker-action { padding-bottom: 0.05rem; }
.enrol-picker .field:has(.student-live-results) { position: relative; }
.student-live-results {
  position: absolute;
  z-index: 30;
  top: calc(100% - 1.35rem);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--brand-200);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}
.student-live-result {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.75rem;
  padding: 0.68rem 0.7rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  text-align: left;
  cursor: pointer;
}
.student-live-result:hover, .student-live-result:focus-visible { background: var(--brand-50); }
.student-live-result strong { font-size: 0.9rem; }
.student-live-result span { grid-column: 1; color: var(--muted); font-size: 0.78rem; }
.student-live-result em { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--muted); font-size: 0.72rem; font-style: normal; }
.student-live-result.is-enrolled { cursor: not-allowed; opacity: 0.65; }
.student-live-empty { padding: 0.8rem; color: var(--muted); font-size: 0.85rem; text-align: center; }

/* Lesson administration */
.admin-lessons-head { align-items: end; }
.admin-page-kicker {
  margin: 0 0 0.35rem;
  color: var(--brand-600);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.admin-head-actions { display: flex; align-items: center; gap: 0.7rem; }
.admin-count {
  padding: 0.35rem 0.7rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  font-size: 0.78rem;
  font-weight: 600;
}
.lesson-editor-panel { padding: 0; overflow: hidden; }
.lesson-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  background: linear-gradient(135deg, var(--brand-50), var(--surface));
  border-bottom: 1px solid var(--line-2);
}
.lesson-panel-heading span {
  display: block;
  color: var(--brand-600);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lesson-panel-heading h2 { margin: 0.15rem 0 0; font-size: 1.22rem; }
.lesson-editor-panel > form { padding: 1.35rem; }
.lesson-form-meta { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 1rem; }
.lesson-order-field input { text-align: center; font-weight: 700; }
.lesson-editor-actions { justify-content: flex-end; padding-top: 0.25rem; }

.lesson-list-panel { padding: 0; overflow: hidden; }
.lesson-list-heading > p { max-width: 48ch; margin: 0; color: var(--muted); font-size: 0.82rem; text-align: right; }
.lesson-admin-list { display: grid; }
.lesson-admin-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 185px auto;
  gap: 1.1rem;
  align-items: center;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--line-2);
  transition: background 0.15s ease;
}
.lesson-admin-item:last-child { border-bottom: 0; }
.lesson-admin-item:hover { background: #fbfdff; }
.lesson-sequence {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: var(--brand-800);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: var(--r-md);
  line-height: 1;
}
.lesson-sequence span { color: var(--muted); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.lesson-sequence strong { font-family: var(--display); font-size: 1.22rem; }
.lesson-admin-summary { min-width: 0; }
.lesson-admin-summary h3 { margin: 0 0 0.22rem; font-family: var(--font); font-size: 0.94rem; line-height: 1.4; }
.lesson-admin-summary p { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.lesson-admin-summary > span { display: block; margin-top: 0.38rem; color: var(--faint); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.lesson-attendance-admin {
  display: grid;
  gap: 0.55rem;
  padding: 0.7rem;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}
.attendance-state { display: flex; align-items: center; gap: 0.55rem; color: var(--muted); font-size: 0.7rem; line-height: 1.3; }
.attendance-state i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 4px rgba(147, 160, 154, 0.12); }
.attendance-state b { display: block; color: var(--ink-2); font-size: 0.76rem; }
.lesson-attendance-admin.is-enabled { background: var(--ok-bg); border-color: #b7e7cb; }
.lesson-attendance-admin.is-enabled .attendance-state { color: var(--ok); }
.lesson-attendance-admin.is-enabled .attendance-state i { background: var(--ok); box-shadow: 0 0 0 4px rgba(6, 118, 71, 0.12); }
.lesson-attendance-button { width: 100%; color: var(--brand-700); background: #fff; border: 1px solid var(--brand-200); box-shadow: var(--shadow-xs); }
.lesson-attendance-button:hover { color: #fff; background: var(--brand-700); }
.lesson-attendance-admin.is-enabled .lesson-attendance-button { color: var(--ok); border-color: #9bd7b5; }
.lesson-attendance-admin.is-enabled .lesson-attendance-button:hover { color: #fff; background: var(--ok); }
.lesson-admin-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.45rem; }
.lesson-admin-actions form { margin: 0; }
.lesson-delete-button { color: var(--danger); background: transparent; border: 1px solid transparent; }
.lesson-delete-button:hover { color: #fff; background: var(--danger); }

/* Course administration */
.course-create-panel { padding: 0; }
.course-create-panel > summary,
.course-roster > summary { list-style: none; cursor: pointer; }
.course-create-panel > summary::-webkit-details-marker,
.course-roster > summary::-webkit-details-marker { display: none; }
.course-create-panel > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.35rem;
  background: linear-gradient(135deg, var(--brand-50), var(--surface));
  border-radius: var(--r-lg);
}
.course-create-panel[open] > summary {
  border-bottom: 1px solid var(--line-2);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.course-create-panel > summary strong { display: block; color: var(--brand-900); font-size: 0.98rem; }
.course-create-panel > summary em { display: block; margin-top: 0.1rem; color: var(--muted); font-size: 0.8rem; font-style: normal; }
.disclosure-hint {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.15s ease;
}
details[open] > summary .disclosure-hint { transform: rotate(-135deg); }

.course-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 160px;
  gap: 0.85rem 1rem;
  padding: 1.25rem 1.35rem;
}
.course-create-form .field { margin: 0; }
.course-create-description { grid-column: 1 / -1; }
.course-create-action { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

.course-list-panel { padding: 0; overflow: hidden; }
.course-filter-field { margin: 0; min-width: 250px; }
.course-filter-field input { padding-block: 0.45rem; font-size: 0.85rem; }
#course-filter-empty { margin: 1.1rem 1.35rem; }

.course-admin-list { display: grid; }
.course-admin-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.3rem 1.2rem;
  align-items: start;
  padding: 0.95rem 1.35rem;
  border-bottom: 1px solid var(--line-2);
  transition: background 0.15s ease;
}
.course-admin-item[hidden] { display: none; }
.course-admin-item:last-child { border-bottom: 0; }
.course-admin-item:hover { background: #fbfdff; }
.course-admin-main { min-width: 0; }
.course-admin-main h3 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin: 0 0 0.22rem;
  font-family: var(--font);
  font-size: 0.98rem;
  line-height: 1.35;
}
.course-admin-main p { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.course-admin-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.78rem;
}
.course-admin-meta .code-pill { padding: 0.2rem 0.58rem; font-size: 0.78rem; letter-spacing: 0.12em; box-shadow: none; }
.course-admin-meta b { color: var(--ink-2); font-weight: 700; }
.course-admin-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.course-admin-actions form, .roster-member form, .unit-card-actions form { margin: 0; }
.course-quiet-button { color: var(--brand-700); background: transparent; border: 1px solid transparent; }
.course-quiet-button:hover { color: var(--brand-700); background: var(--brand-50); border-color: var(--brand-200); }
.course-delete-button { color: var(--danger); background: transparent; border: 1px solid transparent; }
.course-delete-button:hover { color: #fff; background: var(--danger); }

.course-roster { grid-column: 1 / -1; margin-top: 0.3rem; }
.course-roster > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.6rem;
  margin-left: -0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  border-radius: var(--r-sm);
}
.course-roster > summary:hover, .course-roster[open] > summary { color: var(--brand-700); background: var(--brand-50); }
.course-roster > summary b { color: var(--ink-2); }
.course-roster > summary .disclosure-hint { width: 7px; height: 7px; border-width: 1.5px; }
.course-roster .enrol-picker { padding: 0.75rem 0 0.35rem; }
.roster-empty { margin: 0.45rem 0 0.35rem; color: var(--muted); font-size: 0.82rem; }
.roster-list { display: grid; gap: 0.3rem; margin: 0.55rem 0 0.35rem; padding: 0; list-style: none; }
.roster-member {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.45rem 0.6rem;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
}
.roster-identity { min-width: 0; }
.roster-identity strong { display: block; font-size: 0.86rem; line-height: 1.35; }
.roster-identity > span { display: block; color: var(--muted); font-size: 0.76rem; word-break: break-word; }
.roster-date { color: var(--faint); font-size: 0.74rem; white-space: nowrap; }


.unit-card {
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.2rem 1.2rem;
  border-top: 3px solid var(--unit-a);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.unit-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* Six stable accents, assigned per unit id, so cards read as distinct. */
.unit-accent-0 { --unit-a: #1559a7; --unit-b: #2876c7; }
.unit-accent-1 { --unit-a: #0f8a83; --unit-b: #17a89f; }
.unit-accent-2 { --unit-a: #6b4ea8; --unit-b: #8a6bc9; }
.unit-accent-3 { --unit-a: #b54708; --unit-b: #d97316; }
.unit-accent-4 { --unit-a: #067647; --unit-b: #129c62; }
.unit-accent-5 { --unit-a: #0b3d72; --unit-b: #104d8f; }

.unit-card-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.75rem; }
.unit-monogram {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(135deg, var(--unit-a), var(--unit-b));
  border-radius: 13px;
  box-shadow: 0 2px 8px -2px var(--unit-a);
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
/* Card titles opt out of the panel heading rule and its underline. */
.unit-card .unit-card-head h2 {
  margin: 0;
  padding: 0;
  border-bottom: 0;
  font-size: 1.02rem;
  line-height: 1.32;
}
.unit-card-desc {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}
.unit-card-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1rem; }
.unit-card-meta span {
  padding: 0.24rem 0.62rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-full);
  font-size: 0.74rem;
  font-weight: 500;
}
.unit-card-meta b { color: var(--ink-2); font-weight: 700; }

.unit-card-actions { margin-top: auto; padding-top: 0.1rem; }
.unit-join { margin-top: auto; }
.unit-join > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  color: var(--unit-a);
  background: var(--surface);
  border: 1px solid currentColor;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
  transition: color 0.14s ease, background 0.14s ease;
}
.unit-join > summary::-webkit-details-marker,
.unit-join > summary::marker { display: none; content: ""; }
.unit-join > summary:hover { color: #fff; background: var(--unit-a); }
.unit-join > summary .disclosure-hint { border-color: currentColor; }
.unit-join[open] > summary { margin-bottom: 0.8rem; }
.unit-join-form { display: flex; align-items: end; gap: 0.6rem; }
.unit-join-form .field { flex: 1; margin: 0; }
.unit-join-form input { text-transform: uppercase; letter-spacing: 0.08em; }


/* Attendance reporting */
.attendance-report-head { align-items: end; }
.attendance-unit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.attendance-unit-card { display: flex; flex-direction: column; align-items: flex-start; }
.attendance-unit-card h2 { margin: 0 0 1rem; }
.attendance-unit-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  margin: 0 0 1.2rem;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}
.attendance-unit-card dl div { padding: 0.85rem; border-right: 1px solid var(--line-2); }
.attendance-unit-card dl div:last-child { border-right: 0; }
.attendance-unit-card dt { color: var(--muted); font-size: 0.68rem; line-height: 1.35; }
.attendance-unit-card dd { margin: 0.2rem 0 0; color: var(--brand-900); font-family: var(--display); font-size: 1.45rem; font-weight: 700; }
.attendance-unit-card .btn { margin-top: auto; }
.attendance-unit-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.4rem 1.5rem;
  margin-bottom: 1rem;
  color: #fff;
  background: linear-gradient(125deg, var(--brand-900), var(--brand-700) 58%, #087f8c);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}
.attendance-unit-summary h2 { margin: 0; color: #fff; }
.attendance-unit-summary .admin-page-kicker { color: #9ee8e3; }
.attendance-summary-metrics { display: flex; align-items: stretch; }
.attendance-summary-metrics div { min-width: 115px; padding: 0.25rem 1rem; border-left: 1px solid rgba(255, 255, 255, 0.22); }
.attendance-summary-metrics strong, .attendance-summary-metrics span { display: block; }
.attendance-summary-metrics strong { font-family: var(--display); font-size: 1.55rem; }
.attendance-summary-metrics span { color: rgba(255, 255, 255, 0.76); font-size: 0.7rem; }
.student-attendance-detail { margin-bottom: 1rem; border-color: var(--brand-200); }
.student-performance-head, .attendance-table-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.student-performance-head h2, .attendance-table-toolbar h2 { margin: 0; }
.student-performance-head p { margin: 0.25rem 0 0; }
.student-performance-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin: 1.2rem 0; }
.student-performance-metrics div { padding: 0.9rem 1rem; background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--r-md); }
.student-performance-metrics span, .student-performance-metrics strong { display: block; }
.student-performance-metrics span { color: var(--muted); font-size: 0.72rem; }
.student-performance-metrics strong { margin-top: 0.15rem; color: var(--brand-900); font-family: var(--display); font-size: 1.35rem; }
.attendance-performance-panel { padding: 0; overflow: hidden; }
.attendance-table-toolbar { align-items: end; padding: 1.25rem 1.35rem; background: linear-gradient(135deg, var(--brand-50), #fff); border-bottom: 1px solid var(--line-2); }
.attendance-sort-form { display: flex; align-items: end; gap: 0.55rem; }
.attendance-sort-form label { color: var(--muted); font-size: 0.75rem; font-weight: 650; }
.attendance-sort-form select { min-width: 190px; }
.attendance-performance-panel > .table-scroll { padding: 0 1.35rem 1.1rem; }
.attendance-performance-table { min-width: 760px; }
.rank-pill { display: inline-grid; place-items: center; min-width: 38px; height: 38px; color: var(--brand-800); background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 50%; font-weight: 750; }
.attendance-percent-cell { min-width: 145px; }
.attendance-percent-cell > span { display: block; height: 6px; margin-top: 0.4rem; overflow: hidden; background: var(--line-2); border-radius: var(--r-full); }
.attendance-percent-cell i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--teal)); border-radius: inherit; }
.student-lesson-performance { min-width: 620px; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.62rem;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  text-transform: capitalize;
}
.badge-ok   { background: var(--ok-bg); color: var(--ok); border-color: #b7e7cb; }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--brand-200); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: #f5d9a8; }
.badge-off  { background: var(--paper-2); color: var(--muted); border-color: var(--line); }

/* Empty state */
.empty {
  padding: 2.2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.94rem;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
}

.code-pill {
  display: inline-block;
  font-family: var(--mono);
  letter-spacing: 0.16em;
  background: var(--brand-900);
  color: #fff;
  padding: 0.4rem 0.85rem;
  border-radius: var(--r-sm);
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Lessons */
.lesson-content { line-height: 1.72; color: var(--ink-2); font-size: 1rem; }
.lesson-content img { max-width: 100%; height: auto; border-radius: var(--r-md); margin: 0.5rem 0; }
.lesson-content h1, .lesson-content h2, .lesson-content h3 { margin-top: 1.5rem; color: var(--ink); }
.lesson-content ul, .lesson-content ol { padding-left: 1.3rem; }
.lesson-content li { margin-bottom: 0.35rem; }
.lesson-content p { margin: 0 0 0.95rem; }
.lesson-content a { text-decoration: underline; }
.lesson-content blockquote {
  margin: 1.1rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid var(--brand-200);
  color: var(--muted);
  font-style: italic;
}

.lesson-nav { list-style: none; padding: 0; margin: 0; }
.lesson-nav li { margin: 0; }
.lesson-nav a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: 0.94rem;
}
.lesson-nav a::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
}
.lesson-nav a:hover { background: var(--paper-2); text-decoration: none; color: var(--ink); }
.lesson-nav a.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
.lesson-nav a.active::before { background: var(--brand-600); }

/* Assessments */
.timer-bar {
  position: sticky;
  top: calc(var(--topbar-h) + 0.75rem);
  z-index: 15;
  background: var(--brand-900);
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: var(--r-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-md);
}
.timer-bar.warn { background: var(--warn); }
.timer-bar.danger { background: var(--danger); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.82; } }

.question-block {
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  margin-bottom: 1rem;
}
.choices label {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-weight: 500;
  font-size: 0.96rem;
  color: var(--ink-2);
  margin: 0.3rem 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.choices label:hover { border-color: var(--brand-200); background: var(--brand-50); }
.choices input[type="radio"], .choices input[type="checkbox"] {
  accent-color: var(--brand-600);
  margin-top: 0.22rem;
  flex-shrink: 0;
}

.matrix-wrap { overflow-x: auto; }
.matrix-wrap table { min-width: 640px; }
.matrix-wrap td { text-align: center; }
.matrix-wrap td:first-child { text-align: left; font-weight: 500; }
.matrix-wrap td.present { color: var(--ok); font-weight: 700; }
.matrix-wrap td.absent { color: var(--faint); }

/* Wizard */
.wizard-steps {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.wizard-steps span {
  padding: 0.4rem 0.9rem;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.wizard-steps .active {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
  font-weight: 600;
}

.ad-slot { min-height: 0; margin: 0.75rem auto; text-align: center; }
.tox-tinymce { border-radius: var(--r-md) !important; border-color: var(--line) !important; }

/* 6. Landing page ======================================================= */
body.landing {
  --muted: #526477;
  --faint: #718296;
  background:
    radial-gradient(circle at 90% 20%, rgba(101, 174, 230, 0.14), transparent 28rem),
    var(--paper);
}

.site-main-landing {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.hero {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  color: var(--ink);
  overflow: hidden;
  background: #eef7fd;
  border-bottom: 1px solid var(--line);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #f9fcff 0%, rgba(247, 251, 255, 0.98) 37%, rgba(235, 246, 253, 0.78) 61%, rgba(222, 239, 250, 0.36) 100%),
    linear-gradient(0deg, rgba(13, 70, 120, 0.12), rgba(13, 70, 120, 0.12)),
    url("../img/hero-campus.jpg") center / cover no-repeat,
    #edf7fd;
}
.hero-bg::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  right: -100px;
  top: -130px;
  border-radius: 50%;
  border: 54px solid rgba(255, 255, 255, 0.2);
}
.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  padding: clamp(3.5rem, 7vw, 5.5rem) 0;
}
.hero-copy { max-width: 720px; }
.hero-eyebrow {
  display: inline-block;
  margin: 0 0 1.1rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--brand-200);
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-700);
}
.hero h1 {
  color: var(--brand-900);
  font-size: clamp(2.35rem, 1.35rem + 3.5vw, 3.9rem);
  line-height: 1.03;
  max-width: 16ch;
  margin: 0 0 1.1rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.hero-lead {
  color: var(--ink-2);
  font-size: clamp(1.02rem, 0.95rem + 0.3vw, 1.18rem);
  max-width: 56ch;
  margin: 0 0 2rem;
  line-height: 1.65;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero-proof {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(21, 89, 167, 0.16);
  border-radius: var(--r-xl);
  box-shadow: 0 18px 42px rgba(8, 45, 86, 0.09);
}
.hero-proof > span { display: block; color: var(--teal); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.hero-proof > strong { display: block; margin: 0.6rem 0 1.25rem; color: var(--brand-900); font-family: var(--display); font-size: 1.3rem; line-height: 1.3; }
.hero-proof > div {
  position: relative;
  display: grid;
  gap: 0.12rem;
  padding: 0.7rem 0 0.7rem 1.45rem;
  color: var(--muted);
  border-top: 1px solid var(--line-2);
  font-size: 0.85rem;
}
.hero-proof > div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--teal));
  box-shadow: 0 0 0 4px rgba(15, 138, 131, 0.1);
}
.hero-proof b { color: var(--ink); font-weight: 700; }
.hero-proof small { color: var(--muted); font-size: 0.78rem; line-height: 1.42; }

.hero-stats {
  grid-column: 1 / -1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  margin-top: 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.hero-stat .n {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--brand-800);
  line-height: 1.1;
}
.hero-stat .t {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.lp-section { padding: clamp(3.5rem, 7vw, 6.5rem) 0; }
.lp-section-tint {
  background: linear-gradient(135deg, #e3f4f1 0%, #f5fbfa 52%, #e5effb 100%);
  border-block: 1px solid var(--line);
}

.values-section {
  color: #fff;
  background:
    radial-gradient(circle at 8% 10%, rgba(63, 182, 176, 0.28), transparent 22rem),
    radial-gradient(circle at 92% 88%, rgba(209, 99, 118, 0.25), transparent 25rem),
    linear-gradient(145deg, rgba(8, 47, 92, 0.84), rgba(23, 63, 120, 0.82) 52%, rgba(54, 44, 105, 0.88)),
    url("../img/founder-study.jpg") center / cover no-repeat;
  background-attachment: scroll;
}
.values-layout {
  display: block;
}
.values-intro { max-width: 900px; margin: 0 0 clamp(2rem, 4vw, 3.25rem); }
.values-intro .section-kicker { color: #9ee9e2; }
.values-intro h2 { color: #fff; font-size: clamp(2rem, 1.35rem + 2vw, 3rem); }
.values-section .values-intro p { color: rgba(255, 255, 255, 0.9); max-width: 78ch; }
.values-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.value-card {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  padding: 1.65rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 16px 32px rgba(4, 29, 57, 0.14);
}
.value-card:nth-child(1) { background: linear-gradient(145deg, #2871ad, #355ca1); }
.value-card:nth-child(2) { background: linear-gradient(145deg, #087f82, #126a88); }
.value-card:nth-child(3) { background: linear-gradient(145deg, #6752a5, #4d5ba3); }
.value-card:nth-child(4) { background: linear-gradient(145deg, #a84965, #81456f); }
.value-card:nth-child(5) { background: linear-gradient(145deg, #287457, #28666c); }
.value-card:nth-child(6) { background: linear-gradient(145deg, #9a641d, #80506a); }
.value-number { display: block; margin-bottom: auto; padding-bottom: 1.75rem; color: rgba(255, 255, 255, 0.82); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; }
.value-card h3 { color: #fff; font-size: 1.2rem; min-height: 2.35em; }
.value-card p { color: rgba(255, 255, 255, 0.94); margin: 0; line-height: 1.65; }

.lp-head { max-width: 620px; margin-bottom: 3rem; }
.lp-head h2 {
  font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.5rem);
  margin-bottom: 0.6rem;
}
.lp-head p { color: var(--ink-2); font-size: 1.05rem; }

.section-kicker {
  display: block;
  margin: 0 0 0.7rem;
  color: var(--brand-600);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.founder-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
/* Founder profile — the final evidence-led story before the footer */
.founder-band {
  background:
    radial-gradient(circle at 88% 18%, rgba(81, 156, 222, 0.2), transparent 23rem),
    linear-gradient(120deg, #eaf4fc, #f9fcff 52%, #deedf9);
  border-top: 1px solid var(--line);
  padding: clamp(4rem, 8vw, 7rem) 0;
}
.founder-band-inner {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.28fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5.5rem);
}
.founder-portrait {
  margin: 0;
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--brand-800);
  box-shadow: var(--shadow-lg);
}
.founder-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  border-radius: inherit;
  pointer-events: none;
}
.founder-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 22%;
}
.founder-band-copy { min-width: 0; }
.founder-band-copy h2 { font-size: clamp(2.2rem, 1.5rem + 2.6vw, 3.5rem); margin-bottom: 0.35rem; }
.founder-band-copy .founder-role {
  border-left: 3px solid var(--brand-500);
  padding-left: 1rem;
  margin: 0 0 1.5rem;
  font-size: 1rem;
  color: var(--brand-700);
  font-weight: 600;
}
.founder-band-copy > p:not(.founder-role) { color: var(--ink-2); max-width: 66ch; line-height: 1.72; }
.founder-band-copy > p a { color: var(--brand-700); font-weight: 600; text-decoration: underline; text-decoration-color: var(--brand-200); }
.founder-band-copy > p a:hover { color: var(--brand-900); text-decoration-color: currentColor; }
.founder-band-copy .founder-lead { font-size: 1.08rem; }
.scholar-evidence {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.75rem;
}
.scholar-evidence div {
  display: grid;
  align-content: start;
  gap: 0.2rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(16, 77, 143, 0.14);
  border-radius: var(--r-md);
}
.scholar-evidence strong { color: var(--brand-800); font-family: var(--display); font-size: 1.35rem; line-height: 1.15; }
.scholar-evidence span { color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.founder-contributions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.founder-contributions div { display: grid; gap: 0.3rem; }
.founder-contributions strong { color: var(--brand-700); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; }
.founder-contributions span { color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.scholar-links { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.75rem; }
.scholar-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.62rem 0.9rem;
  color: var(--brand-800);
  background: #fff;
  border: 1px solid var(--brand-200);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-xs);
  font-size: 0.88rem;
  font-weight: 600;
}
.scholar-links a:hover { color: #fff; background: var(--brand-700); border-color: var(--brand-700); text-decoration: none; }
.founder-impact {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(230px, 0.65fr) minmax(0, 1.35fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  margin-top: 1rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(103, 90, 167, 0.18);
  border-radius: var(--r-xl);
  box-shadow: 0 18px 40px rgba(70, 57, 110, 0.08);
}
.impact-summary h3 { font-size: clamp(1.5rem, 1.15rem + 1.3vw, 2rem); }
.impact-summary > p { color: var(--muted); max-width: 46ch; }
.impact-metrics { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 1.5rem 0 1rem; }
.impact-metrics div { min-width: 70px; }
.impact-metrics dt { color: var(--muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.impact-metrics dd { margin: 0.15rem 0 0; color: var(--brand-800); font-family: var(--display); font-size: 1.65rem; font-weight: 600; line-height: 1.1; }
.impact-source { font-size: 0.88rem; font-weight: 600; }
.citation-growth-chart { min-width: 0; margin: 0; }
.citation-growth-chart figcaption { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.citation-growth-chart figcaption strong { color: var(--ink); font-family: var(--display); font-size: 1.1rem; }
.citation-growth-chart figcaption span { color: var(--muted); font-size: 0.75rem; text-align: right; }
.citation-growth-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid line { stroke: #d9dfea; stroke-width: 1; }
.chart-grid text { fill: var(--faint); font-family: var(--font); font-size: 11px; text-anchor: end; }
.growth-area { fill: url(#citation-area); }
.growth-line { fill: none; stroke: url(#citation-line); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.growth-points circle { fill: #fff; stroke: var(--violet); stroke-width: 3; }
.growth-points text { fill: var(--ink-2); font-family: var(--font); font-size: 12px; font-weight: 700; text-anchor: middle; }
.growth-points .year { fill: var(--muted); font-size: 11px; font-weight: 500; }
.growth-points .latest circle { fill: var(--brand-600); stroke: #fff; stroke-width: 4; }
.growth-points .latest text:not(.year) { fill: var(--brand-800); font-size: 13px; }

/* Large portrait variant, kept for any page that still wants it */
.founder-photo {
  position: relative;
  margin: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--brand-800);
  box-shadow: var(--shadow-lg);
}
.founder-photo img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 22%;
}
.founder-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  pointer-events: none;
}

/* Legacy background-image variant, kept so older markup still renders */
.founder-photo-frame {
  min-height: 460px;
  border-radius: var(--r-lg);
  background:
    url("../img/founder-study.jpg") center/cover no-repeat,
    var(--brand-800);
  box-shadow: var(--shadow-lg);
  position: relative;
}
.founder-photo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.founder-copy h2 {
  font-size: clamp(1.9rem, 1.3rem + 2vw, 2.6rem);
  margin-bottom: 0.7rem;
}
.founder-role {
  color: var(--brand-700);
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.5;
  margin: 0 0 1.3rem;
  padding-left: 0.9rem;
  border-left: 3px solid var(--brand-200);
}
.founder-copy > p:not(.founder-role) {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.7;
  max-width: 52ch;
}

.approach-row, .platform-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}
.approach-row > div, .platform-row > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.75rem 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.platform-row > div:nth-child(1) { background: linear-gradient(145deg, var(--surface), var(--brand-50)); }
.platform-row > div:nth-child(2) { background: linear-gradient(145deg, var(--surface), var(--teal-soft)); }
.platform-row > div:nth-child(3) { background: linear-gradient(145deg, var(--surface), var(--gold-soft)); }
.approach-row > div:nth-child(1) { background: linear-gradient(145deg, var(--surface), var(--teal-soft)); }
.approach-row > div:nth-child(2) { background: linear-gradient(145deg, var(--surface), var(--violet-soft)); }
.approach-row > div:nth-child(3) { background: linear-gradient(145deg, var(--surface), var(--coral-soft)); }
.approach-row > div:hover, .platform-row > div:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-200);
}
.approach-row h3, .platform-row h3 {
  font-size: 1.22rem;
  margin-bottom: 0.55rem;
}
.approach-row h3::before, .platform-row h3::before {
  content: "";
  display: block;
  width: 34px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-200));
  margin-bottom: 0.9rem;
}
.approach-row p, .platform-row p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.98rem;
  line-height: 1.65;
}

.lp-cta-final {
  position: relative;
  background: linear-gradient(140deg, var(--brand-800) 0%, var(--brand-600) 100%);
  color: #fff;
  padding: clamp(3rem, 6vw, 5rem) 0;
  overflow: hidden;
}
.lp-cta-final::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 90% at 85% 20%, rgba(255, 255, 255, 0.12), transparent 70%);
}
.lp-cta-final h2 {
  color: #fff;
  font-size: clamp(1.8rem, 1.3rem + 1.8vw, 2.4rem);
  margin: 0;
}
.lp-cta-final p { margin: 0.35rem 0 0; color: rgba(255, 255, 255, 0.88); }
.lp-cta-final .btn-primary {
  background: #fff;
  color: var(--brand-800);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.lp-cta-final .btn-primary:hover { background: var(--brand-50); color: var(--brand-900); }

.lp-cta-final-inner {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
}

/* 7. Auth pages ========================================================= */
body.auth-page { background: var(--paper); }
body.auth-page .site-main { width: 100%; max-width: none; padding: 0; }

.auth-page-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: calc(100vh - var(--topbar-h) - 6rem);
}

.auth-page-aside {
  position: relative;
  background:
    linear-gradient(165deg, rgba(8, 45, 86, 0.9), rgba(21, 89, 167, 0.74)),
    url("../img/hero-campus.jpg") center/cover no-repeat,
    var(--brand-700);
  color: #fff;
  padding: clamp(2.5rem, 5vw, 4rem) clamp(1.75rem, 4vw, 3.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-page-aside .hero-eyebrow { align-self: flex-start; }
.auth-page-aside h1 {
  color: #fff;
  font-size: clamp(2rem, 1.3rem + 2.2vw, 2.9rem);
  max-width: 13ch;
  margin-bottom: 0.9rem;
  letter-spacing: -0.03em;
}
.auth-page-aside p {
  color: rgba(255, 255, 255, 0.85);
  max-width: 38ch;
  font-size: 1.03rem;
  line-height: 1.65;
}

.auth-page-form {
  display: grid;
  place-items: center;
  padding: clamp(2rem, 4vw, 3.5rem) 1.5rem;
  background: var(--paper);
}

.auth-card {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 2rem 1.9rem;
  box-shadow: var(--shadow-lg);
}
.auth-card h2 { font-size: 1.5rem; margin-bottom: 0.3rem; }
.auth-card-solo { width: min(420px, 100%); }
.auth-card-lead { color: var(--muted); margin: 0 0 1.5rem; font-size: 0.95rem; }
.auth-card .btn-block { margin-top: 0.4rem; padding-block: 0.72rem; }
.auth-note {
  margin: 1.25rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-2);
  text-align: center;
  font-size: 0.9rem;
}
.auth-shell { max-width: 440px; margin: 2rem auto; }

/* 8. Install wizard ===================================================== */
.install-check { display: flex; justify-content: space-between; padding: 0.6rem 0; border-bottom: 1px solid var(--line-2); }
.install-check:last-child { border-bottom: 0; }
.auth-shell h1 { margin-bottom: 0.25rem; }
.auth-shell > .muted { margin-bottom: 1.75rem; }

/* 8b. Learner reader (course + lesson) ================================== */

/* Course-scoped rail */
.rail-back {
  display: block;
  padding: 0.6rem 0.75rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.rail-back:hover { color: var(--brand-700); text-decoration: none; }

.app-nav-label + .rail-progress { margin-top: -0.25rem; }
.rail-progress { padding: 0 0.75rem 0.85rem; }
.rail-progress p { margin: 0.45rem 0 0; }

.progress {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--paper-2);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-500), var(--brand-600));
  transition: width 0.4s ease;
}

/* Lesson titles wrap rather than truncate — a learner has to recognise them */
.app-nav a:has(.rail-text) { align-items: flex-start; }
.app-nav a .rail-text {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}
.app-nav a:has(.rail-text) .dot,
.app-nav a .tick { margin-top: 0.42em; }
.app-nav a .tick {
  color: var(--ok);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.app-nav a.is-done:not(.is-active) .rail-text { color: var(--muted); }
.app-nav a.is-done .dot { background: var(--ok); opacity: 0.55; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 1.1rem;
}
.breadcrumb a { color: var(--muted); font-weight: 500; }
.breadcrumb a:hover { color: var(--brand-700); }
.breadcrumb .current { color: var(--ink-2); font-weight: 600; }

/* The reading column — the page's centre of gravity */
.reader {
  max-width: 900px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 2.5rem 2.75rem 2rem;
}

.reader-head {
  padding-bottom: 1.4rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--line-2);
}
.reader-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.55rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-600);
}
.reader-head h1 {
  font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.3rem);
  margin: 0;
}

.reader .lesson-content {
  max-width: 74ch;
  font-size: 1.06rem;
  line-height: 1.78;
}
/* Headings inside lesson prose need to outrank the body text they label */
.reader .lesson-content h2 { font-size: 1.45rem; margin-top: 2rem; }
.reader .lesson-content h3 { font-size: 1.18rem; margin-top: 1.75rem; }
.reader .lesson-content h4 { font-size: 1.04rem; margin-top: 1.5rem; }
.reader .lesson-content > :first-child { margin-top: 0; }

.reader-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2.25rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line-2);
}
.reader-actions form { margin: 0; }

.lesson-attendance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin: -0.35rem 0 1.6rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, var(--brand-50), #e6f7f4);
  border: 1px solid var(--brand-200);
  border-left: 4px solid var(--teal);
  border-radius: var(--r-md);
}
.lesson-attendance.is-recorded { background: var(--ok-bg); border-color: #b7e7cb; }
.lesson-attendance-label { display: block; color: var(--teal); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.lesson-attendance strong { display: block; color: var(--ink); margin-top: 0.1rem; }
.lesson-attendance p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.86rem; }

/* Persistent controls prevent long lessons from becoming a scrolling trap. */
.reading-toolbar {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--brand-200);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}
.reading-toolbar a,
.reading-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-height: 40px;
  padding: 0.45rem 0.72rem;
  border: 0;
  border-radius: var(--r-full);
  color: var(--brand-800);
  background: transparent;
  font: 600 0.78rem/1 var(--font);
  cursor: pointer;
}
.reading-toolbar a:hover,
.reading-toolbar button:hover {
  color: #fff;
  background: var(--brand-700);
  text-decoration: none;
}

/* Previous / next */
.lesson-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 900px;
  margin-top: 1.15rem;
}
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.95rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.pager-link:hover {
  text-decoration: none;
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.pager-next { text-align: right; }
.pager-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.pager-title {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Course tools, kept deliberately quiet below the reading column */
.course-tools {
  max-width: 900px;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.course-tools > h2 {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  font-family: var(--font);
  margin-bottom: 1.1rem;
}
.course-tools-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
}
.course-tools-row.course-tools-single { grid-template-columns: 1fr; }
.course-tools h3 { font-size: 0.98rem; margin-bottom: 0.5rem; }

/* Student unit access, profile images, and community ==================== */
.join-unit-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.8fr);
  gap: 2rem;
  align-items: end;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, var(--brand-50), #fff 72%);
  border-color: var(--brand-200);
}
.join-unit-panel h2 { color: var(--brand-900); }
.join-unit-form { display: flex; align-items: end; gap: 0.7rem; }
.join-unit-form .field { flex: 1; margin: 0; }
.join-unit-form input { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.section-title { margin: 0 0 1rem; }
.inline-form { display: inline; }
.link-button {
  border: 0;
  padding: 0;
  color: var(--brand-700);
  background: transparent;
  font: 600 0.78rem/1.4 var(--font);
  cursor: pointer;
}
.link-button:hover { color: var(--brand-500); text-decoration: underline; }

.profile-photo-field {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 1.2rem;
  align-items: center;
  padding: 1rem;
  margin-bottom: 1.25rem;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: var(--r-lg);
}
.profile-photo-field .field { margin: 0; }
.password-panel .grid-2 { gap: 0 1rem; }
.password-form { max-width: 640px; }

.profile-photo-preview,
.community-avatar {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-500), var(--teal));
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.profile-photo-preview { width: 96px; height: 96px; font-size: 1.7rem; }
.profile-photo-preview img,
.community-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.community-head { align-items: end; }
.community-search { display: flex; gap: 0.6rem; width: min(520px, 100%); }
.community-search input { flex: 1; min-width: 0; }
.community-results-head { display: flex; justify-content: space-between; align-items: baseline; margin: 1.75rem 0 0.8rem; }
.community-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.community-card { display: flex; gap: 1rem; align-items: flex-start; }
.community-card-copy { min-width: 0; }
.community-card h3 { margin-bottom: 0.25rem; }
.community-card p { color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.community-role { color: var(--brand-600); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.community-profile { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 2rem; align-items: start; margin-bottom: 1rem; }
.community-avatar-large { width: 150px; height: 150px; font-size: 2.5rem; }
.community-profile h2 { margin-top: 0.5rem; font-size: 1.8rem; }
.community-bio { max-width: 70ch; white-space: normal; }
/* Your own card in the community */
.community-card.is-you { border-color: var(--brand-200); }
/* Member profile page */
.member-breadcrumb { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1rem; color: var(--muted); font-size: 0.82rem; }
.member-breadcrumb a { color: var(--brand-600); font-weight: 600; }
.member-breadcrumb span[aria-hidden] { color: var(--faint); }

.member-page { margin-bottom: 1.5rem; }
.member-hero {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.member-hero-band { height: 104px; background: linear-gradient(125deg, var(--brand-900), var(--brand-700) 58%, var(--teal)); }
.member-hero-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0 1.35rem;
  align-items: end;
  padding: 0.4rem 1.6rem 1.35rem;
}
.member-avatar {
  display: grid;
  place-items: center;
  margin-top: -84px;
  width: 128px;
  height: 128px;
  overflow: hidden;
  color: var(--brand-800);
  background: var(--brand-50);
  border: 4px solid var(--surface);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  font-family: var(--display);
  font-size: 2.4rem;
  font-weight: 700;
}
.member-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.member-identity { padding-bottom: 0.35rem; min-width: 0; }
.member-role {
  margin: 0 0 0.15rem;
  color: var(--brand-600);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.member-identity h1 { margin: 0; font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem); line-height: 1.18; }
.member-since { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.85rem; }
.member-hero-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; padding-bottom: 0.5rem; }

.member-body { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 1.15rem; margin-top: 1.15rem; }
.member-about h2, .member-aside h2 { font-size: 0.98rem; }
.member-bio { color: var(--ink-2); font-size: 0.97rem; line-height: 1.72; max-width: 70ch; }
.member-facts { margin: 0; }
.member-facts > div { padding: 0.7rem 0; border-bottom: 1px solid var(--line-2); }
.member-facts > div:first-child { padding-top: 0; }
.member-facts > div:last-child { padding-bottom: 0; border-bottom: 0; }
.member-facts dt { color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.member-facts dd { margin: 0.22rem 0 0; color: var(--ink-2); font-size: 0.9rem; word-break: break-word; }
.member-facts dd a { color: var(--brand-600); font-weight: 600; }
.member-privacy-note { margin: 1rem 0 0; padding-top: 0.85rem; border-top: 1px solid var(--line-2); color: var(--faint); font-size: 0.76rem; line-height: 1.5; }
.member-back { margin: 0; }
.member-back a { color: var(--brand-600); font-weight: 600; font-size: 0.88rem; }

/* Community cards are whole-card links now */
a.community-card { color: inherit; text-decoration: none; transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease; }
a.community-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand-200); }
.community-card-cta { display: inline-block; margin-top: 0.5rem; color: var(--brand-600); font-size: 0.85rem; font-weight: 600; }
a.community-card:hover .community-card-cta { text-decoration: underline; }
.community-join-cta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.community-join-cta h2 { margin: 0 0 0.2rem; padding: 0; border-bottom: 0; }
.community-join-cta p { margin: 0; max-width: 52ch; font-size: 0.9rem; }

/* Public-profile opt-out */
.checkbox-field { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.7rem; align-items: start; cursor: pointer; }
.checkbox-field input { width: 18px; height: 18px; margin-top: 0.15rem; accent-color: var(--brand-600); }
.checkbox-field span { color: var(--muted); font-size: 0.83rem; line-height: 1.5; }
.checkbox-field strong { display: block; margin-bottom: 0.15rem; color: var(--ink-2); font-size: 0.9rem; }
.profile-visibility { padding: 0.9rem 1rem; margin-bottom: 1.2rem; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-md); }

.community-role .is-you-tag { color: var(--brand-700); }


.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { margin-bottom: 0.4rem; }
.plain-list li:last-child { margin-bottom: 0; }

/* 9. Utilities & responsive ============================================= */
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 1024px) {
  .app-layout { grid-template-columns: 1fr; gap: 1.25rem; }
  .app-sidebar { position: static; }
  .app-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.25rem; }
  .app-nav-label { display: none; }
  .app-nav a.is-active { box-shadow: none; }

  /* Reading pages put the lesson itself first; the contents list follows it. */
  .app-layout.is-reader { width: min(var(--shell-w), calc(100% - 2.5rem)); grid-template-columns: 1fr; }
  .app-layout.is-reader .app-main { grid-column: 1; grid-row: 1; order: 1; }
  .app-layout.is-reader .app-sidebar { grid-column: 1; grid-row: 2; order: 2; margin-top: 1.5rem; }
  .app-layout.is-reader .app-nav { max-height: none; overflow-y: visible; }
  .app-layout.is-reader .app-nav { grid-template-columns: 1fr; }
  .app-layout.is-reader .app-nav-label { display: block; }
  .app-layout.is-reader .app-nav a.is-active { box-shadow: inset 2px 0 0 var(--brand-600); }
  .reader, .lesson-pager, .course-tools { max-width: none; }
  .values-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --shell-w: 100%; }
  .founder-layout, .approach-row, .platform-row, .auth-page-grid, .values-layout,
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .values-intro { position: static; }
  .hero h1 { max-width: none; }
  .hero-inner { gap: 2rem; padding: 3.5rem 0; }
  .founder-photo-frame { min-height: 280px; }
  .founder-photo { max-width: 420px; }
  .founder-band-inner { grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1.45fr); gap: 2rem; }
  .auth-page-aside { min-height: 240px; }
  .lp-cta-final-inner { justify-content: flex-start; }
  .footer-inner { grid-template-columns: 1.2fr 0.8fr; }
  .footer-contact { grid-column: 1 / -1; }
  .join-unit-panel { grid-template-columns: 1fr; }
  .attendance-unit-grid { grid-template-columns: 1fr; }
  .course-create-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .course-create-form .field:nth-of-type(3) { grid-column: 1 / -1; max-width: 200px; }
  .course-admin-item { grid-template-columns: 1fr; gap: 0.7rem; }
  .course-admin-actions { justify-content: flex-start; }
  .attendance-unit-summary { align-items: flex-start; flex-direction: column; }
  .attendance-summary-metrics { width: 100%; }
  .attendance-summary-metrics div { flex: 1; }
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .header-inner { flex-wrap: wrap; }
  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: 0.6rem 0 0.85rem;
    border-top: 1px solid var(--line);
    margin-top: 0.5rem;
  }
  .nav.is-open { display: flex; }
  .nav > a:not(.btn) { padding: 0.6rem 0.7rem; border-radius: var(--r-md); }
  .nav .btn { justify-content: center; margin-top: 0.35rem; }
  .nav-user { align-self: flex-start; }
  .panel { padding: 1.15rem 1.1rem; }
  .page-head { gap: 0.75rem; }
  th, td { padding: 0.65rem 0.5rem; }
  .hero-stats { gap: 1.5rem; }
  .hero-bg {
    background:
      linear-gradient(90deg, rgba(249, 252, 255, 0.98), rgba(237, 247, 253, 0.86)),
      url("../img/hero-campus.jpg") center / cover no-repeat;
  }
  .values-grid { grid-template-columns: 1fr; }
  .value-card { min-height: 0; }
  .hero-inner, .founder-band-inner, .founder-impact, .founder-contributions, .scholar-evidence { grid-template-columns: 1fr; }
  .hero-proof { display: none; }
  .founder-portrait { max-width: 320px; }
  .citation-growth-chart { overflow-x: auto; }
  .citation-growth-chart svg { min-width: 600px; }
  .citation-growth-chart figcaption { align-items: flex-start; flex-direction: column; }
  .citation-growth-chart figcaption span { text-align: left; }
  .reader { padding: 1.5rem 1.35rem 1.35rem; }
  .reader .lesson-content { font-size: 1.02rem; }
  .lesson-attendance { align-items: flex-start; flex-direction: column; }
  .lesson-pager, .course-tools-row { grid-template-columns: 1fr; }
  .enrol-picker { grid-template-columns: 1fr; align-items: stretch; }
  .enrol-picker-action .btn { width: 100%; }
  .pager-next { text-align: left; }
  .reading-toolbar { right: 0.75rem; bottom: 0.75rem; }
  .reading-toolbar a, .reading-toolbar button { width: 42px; padding: 0; justify-content: center; font-size: 1rem; }
  .reading-toolbar span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .footer-inner { grid-template-columns: 1fr; gap: 1.75rem; }
  .footer-contact { grid-column: auto; }
  .footer-bottom { flex-direction: column; }
  .cookie-consent { align-items: stretch; flex-direction: column; gap: 0.9rem; bottom: 0.75rem; }
  .cookie-consent-actions { flex-direction: column-reverse; }
  .cookie-consent-actions .btn { width: 100%; }
  .join-unit-form, .community-search { align-items: stretch; flex-direction: column; }
  .member-hero-body { grid-template-columns: 1fr; gap: 0.8rem; padding-inline: 1.15rem; }
  .member-avatar { margin-top: -64px; }
  .member-avatar { width: 96px; height: 96px; font-size: 1.8rem; }
  .member-hero-actions { padding-bottom: 0; }
  .member-body { grid-template-columns: 1fr; }
  .community-grid { grid-template-columns: 1fr; }
  .community-profile { grid-template-columns: 1fr; }
  .community-avatar-large { width: 112px; height: 112px; }
  .profile-photo-field { grid-template-columns: 72px minmax(0, 1fr); }
  .profile-photo-preview { width: 72px; height: 72px; font-size: 1.25rem; }
  .admin-lessons-head, .lesson-panel-heading { align-items: flex-start; }
  .admin-head-actions { width: 100%; justify-content: space-between; }
  .lesson-panel-heading { flex-direction: column; }
  .lesson-list-heading > p { text-align: left; }
  .lesson-form-meta { grid-template-columns: 1fr; }
  .lesson-order-field { max-width: 120px; }
  .lesson-editor-actions { justify-content: stretch; }
  .lesson-editor-actions .btn { width: 100%; }
  .lesson-admin-item { grid-template-columns: 52px minmax(0, 1fr); gap: 0.85rem; padding: 1rem; }
  .lesson-sequence { width: 48px; height: 48px; }
  .lesson-attendance-admin, .lesson-admin-actions { grid-column: 1 / -1; }
  .lesson-admin-actions { justify-content: flex-start; padding-left: 0; }
  .course-create-panel, .course-list-panel { padding: 0; }
  .unit-join-form { align-items: stretch; flex-direction: column; }
  .course-filter-field { width: 100%; min-width: 0; }
  .course-create-panel > summary { padding: 0.9rem 1.1rem; }
  .course-create-form { grid-template-columns: 1fr; padding: 1.1rem; }
  .course-create-form .field:nth-of-type(3) { max-width: none; }
  .course-create-action { justify-content: stretch; }
  .course-create-action .btn { width: 100%; }
  .course-admin-item { padding: 1rem; }
  .course-admin-actions .btn { flex: 1 0 auto; }
  .roster-member { grid-template-columns: minmax(0, 1fr) auto; }
  .roster-date { grid-column: 1 / -1; order: 3; }
  .attendance-report-head, .student-performance-head, .attendance-table-toolbar { align-items: stretch; flex-direction: column; }
  .attendance-sort-form { align-items: stretch; flex-direction: column; width: 100%; }
  .attendance-sort-form select { width: 100%; }
  .attendance-summary-metrics { display: grid; grid-template-columns: 1fr; }
  .attendance-summary-metrics div { padding: 0.65rem 0; border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.22); }
  .attendance-summary-metrics div:first-child { border-top: 0; }
  .student-performance-metrics { grid-template-columns: 1fr; }
  .attendance-unit-card dl { grid-template-columns: 1fr; }
  .attendance-unit-card dl div { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .attendance-unit-card dl div:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn:hover, .approach-row > div:hover, .platform-row > div:hover, .unit-card:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .app-sidebar, .reading-toolbar, .cookie-consent, .ad-slot, .actions, .btn { display: none !important; }
  .app-layout { grid-template-columns: 1fr; }
  .panel { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}
