/* ==========================================================================
   StudySpace — marketing & catalogue pages
   Hero · category rail · batch cards · test cards · course detail · auth
   ========================================================================== */

/* ================================ HERO ================================= */
/* The banner of the reference: a navy panel, headline bottom-left, artwork
   bleeding off the right edge, violet bloom behind it. */
.masthead { padding-block: 0 var(--sp-2); }

.masthead-panel {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 268px;
  padding: clamp(20px, 2.6vw, 38px);
  border-radius: var(--r-2xl);
  border: 1px solid var(--border-strong);
  background: var(--grad-hero-panel);
  overflow: hidden;
  isolation: isolate;
}
.masthead-art {
  position: absolute;
  inset: 0 0 0 auto;
  width: 64%;
  z-index: -1;
}
.masthead-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.65) 26%, black 55%);
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.65) 26%, black 55%);
}
.masthead-copy { position: relative; z-index: 1; max-width: 56%; display: grid; gap: var(--sp-4); }
.masthead-copy h2 {
  font-size: clamp(1.5rem, 1.1rem + 2vw, 2.35rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--text-invert);
}
.masthead-copy p {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: rgba(232, 232, 242, 0.72);
  max-width: 34ch;
}
.masthead-copy .btn { justify-self: start; }

/* ============================== BATCH CARD ============================= */
.batch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }

.batch-card {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  position: relative;
}
.batch-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* Pastel header band carrying the mentor chips, exactly like the board. */
.batch-cover {
  position: relative;
  display: block;
  padding: 12px 14px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--band-ink);
  min-height: 86px;
}
.batch-cover .badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: rgba(12, 12, 24, 0.82);
  color: var(--text-invert);
}
.batch-cover .cover-tag {
  position: absolute;
  left: 14px;
  top: 12px;
  z-index: 2;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--band-ink-muted);
}
.cover-faces { display: flex; align-items: center; gap: 6px; margin-top: 26px; }
.cover-face {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--band-ink);
  background: var(--band-chip);
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 2px 6px rgba(12, 12, 24, 0.16);
  flex: 0 0 auto;
}
.cover-face:nth-child(2) { margin-left: -14px; }
.cover-face:nth-child(3) { margin-left: -14px; }
.cover-face:nth-child(4) { margin-left: -14px; }
.cover-face:nth-child(5) { margin-left: -14px; }
.cover-face:nth-child(6) { margin-left: -14px; }
.cover-more {
  margin-left: 2px;
  font-size: 11px;
  font-weight: 800;
  color: var(--band-ink-muted);
}
.cover-pill {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(12, 12, 24, 0.82);
  color: var(--text-invert);
  font-size: 10px;
  font-weight: 700;
}

/* One hue per subject. */
.thumb-physics { background: var(--band-physics); }
.thumb-chemistry { background: var(--band-chemistry); }
.thumb-maths { background: var(--band-maths); }
.thumb-biology { background: var(--band-biology); }
.thumb-reasoning { background: var(--band-reasoning); }
.thumb-english { background: var(--band-english); }
.thumb-computer { background: var(--band-computer); }
.thumb-default { background: var(--band-default); }

.batch-body { padding: var(--sp-4); display: flex; flex-direction: column; gap: 7px; flex: 1; }
.batch-title {
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.005em;
  color: var(--text-strong);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}
.batch-title a:hover { color: var(--violet-400); }
.batch-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: var(--text-xs);
  color: var(--text-subtle);
  line-height: 1.5;
}
.batch-meta span + span::before {
  content: "·";
  margin-right: 6px;
  color: var(--text-subtle);
}
.batch-start {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
.batch-start svg { width: 14px; height: 14px; }
.batch-foot {
  margin-top: auto;
  padding-top: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.batch-foot .btn { flex: 1 1 auto; }
.batch-cta {
  min-height: 38px;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
}
.batch-cta svg { width: 14px; height: 14px; }

/* ============================== TEST CARD ============================== */
.test-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); }
.test-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: var(--sp-5);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.test-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.test-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.test-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: rgba(91, 91, 246, 0.16);
  color: var(--violet-400);
  flex: 0 0 auto;
}
.test-icon svg { width: 20px; height: 20px; }
.test-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.test-title {
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--text-strong);
}

.test-meta { font-size: var(--text-xs); color: var(--text-subtle); }
.test-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--border); }

/* ============================== PANELS ================================ */
.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--sp-5);
  align-items: start;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: grid;
  gap: var(--sp-4);
  align-content: start;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.panel-title { font-size: var(--text-lg); font-weight: 700; }
.panel-lead { font-size: var(--text-sm); line-height: 1.65; color: var(--text-muted); }

.notice-list { display: grid; gap: var(--sp-3); }
.notice-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.notice-item:first-child { border-top: 0; padding-top: 0; }
.notice-icon {
  width: 36px; height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--surface-raised);
  color: var(--violet-400);
}
.notice-icon svg { width: 18px; height: 18px; }
.notice-item strong { display: block; font-size: var(--text-sm); color: var(--text-strong); margin-bottom: 3px; }
.notice-item p { font-size: var(--text-xs); line-height: 1.6; color: var(--text-subtle); }

.feature-list { display: grid; gap: 10px; }
.feature-list li { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--text-muted); }
.feature-list svg { width: 18px; height: 18px; color: var(--violet-400); flex: 0 0 auto; }
.panel .btn { justify-self: start; }

/* ============================== PAGE HEAD ============================== */
.page-head {
  background: var(--grad-page-head);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-block: var(--sp-8) var(--sp-7);
}
.page-head h1 {
  color: var(--text-strong);
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, var(--text-3xl));
  margin-bottom: var(--sp-2);
}
.page-head p { color: var(--text-muted); max-width: 62ch; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-xs);
  color: var(--text-subtle);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.breadcrumb a:hover { color: var(--text-strong); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb svg { width: 13px; height: 13px; opacity: 0.5; }
.breadcrumb .current { color: var(--text-muted); font-weight: 500; }

/* ============================== CATALOG ================================ */
.catalog-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: var(--sp-6); align-items: start; }

.filter-panel {
  position: sticky;
  top: calc(var(--topbar-h) + var(--sp-4));
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: grid;
  gap: var(--sp-5);
}
.filter-group { display: grid; gap: 10px; }
.filter-group + .filter-group { padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.filter-group h2 {
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin: 0;
}
.filter-list { display: grid; gap: 2px; }
.filter-list label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.filter-list label:hover { background: var(--slate-50); color: var(--text-strong); }
/* Hidden from the eye, not from the keyboard: `display: none` would take the
   checkbox out of the tab order and leave the panel mouse-only. */
.filter-list { position: relative; }
.filter-list label { position: relative; }
.filter-list input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.filter-list label:has(input:checked) { background: rgba(91, 91, 246, 0.16); color: var(--violet-400); font-weight: 700; }
.filter-list label:has(input:focus-visible) { outline: 2px solid var(--violet-600); outline-offset: 2px; }
.filter-count { font-size: 11px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.filter-option-end { display: flex; align-items: center; gap: 8px; }

/* The Filters button exists only where the panel is collapsed (mobile). */
.filter-toggle { display: none; align-items: center; gap: 6px; }
.filter-toggle svg { width: 15px; height: 15px; }
.filter-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--violet-600);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.filter-badge[hidden] { display: none; }

/* The active filters, above the grid: what is on, and how to take it off. */
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--sp-4); }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.filter-chip:hover { border-color: var(--violet-600); color: var(--violet-600); }
.filter-chip svg { width: 12px; height: 12px; }
.filter-chip--clear { border-style: dashed; }

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.catalog-toolbar .result-count { font-size: var(--text-sm); color: var(--text-muted); }
.catalog-toolbar .result-count strong { color: var(--text-strong); }
.toolbar-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.toolbar-actions .input,
.toolbar-actions .select { min-width: 0; }
@media (max-width: 720px) {
  .toolbar-actions { width: 100%; }
  .toolbar-actions .input,
  .toolbar-actions .select { flex: 1 1 100%; width: 100%; }
}
.mobile-filter-btn { display: none; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: var(--sp-7); }
.page-btn {
  min-width: 40px; height: 40px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
  display: grid;
  place-items: center;
  transition: all var(--dur-fast) var(--ease);
}
.page-btn:hover:not([disabled]) { border-color: var(--violet-400); color: var(--violet-600); }
.page-btn[aria-current="page"] { background: var(--ink-900); border-color: var(--ink-900); color: var(--text-invert); }
.page-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ============================== COURSE DETAIL ========================== */
.course-hero-lead { color: var(--text-muted); font-size: var(--text-md); max-width: 62ch; }

.purchase-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
.purchase-note svg { width: 14px; height: 14px; }

.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-6); align-items: start; }

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: var(--sp-5);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  min-height: 40px;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--text-strong); background: var(--surface-raised); }
.tab[aria-selected="true"] { color: var(--text-invert); font-weight: 700; background: var(--violet-600); }

/* How much sits behind each tab — lessons, notes, papers, teachers. The badge
   is written by `renderCounts` and stays hidden at zero, so an empty tab reads
   "Notes" rather than "Notes 0". `display` has to be restated for `[hidden]`,
   because an explicit display beats the attribute's `display: none`. */
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 7px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: var(--text-2xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  vertical-align: 1px;
}
.tab[aria-selected="true"] .tab-count {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.22);
  color: var(--text-invert);
}
.tab-count[hidden] { display: none; }

.tab-panel[hidden] { display: none; }

/* A tab strip is a primary control, so on a phone its labels wrap inside the
   row instead of being clipped. These rules sit *after* the base `.tab` rules
   on purpose: an equal-specificity override placed earlier loses to `nowrap`,
   which is exactly how "Announcements" got cut off. */
@media (max-width: 640px) {
  .tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
    gap: 4px;
    overflow-x: visible;
    border-radius: var(--r-lg);
    padding: 5px;
  }

  /* 11px keeps a whole word like "Announcements" inside a third of a 390px
     strip; at 12px it broke mid-word ("Announcemen/ts"), which reads as a bug. */
  .tab {
    padding: 8px 4px;
    text-align: center;
    white-space: normal;
    overflow-wrap: break-word;
    font-size: var(--text-2xs);
    line-height: 1.25;
    min-height: 40px;
  }

  /* Five tabs share a phone's strip, so the count shrinks rather than pushing
     its label onto a second line. */
  .tab-count {
    min-width: 18px;
    height: 18px;
    margin-left: 4px;
    padding: 0 5px;
  }
}

/* Five labels do not divide evenly into four columns: at an auto-fit width the
   fifth drops alone onto its own line. Three and two reads as a strip. */
@media (max-width: 420px) {
  #batch-tabs.tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.prose { font-size: var(--text-base); line-height: 1.75; color: var(--text-muted); }
.prose h3 { font-size: var(--text-lg); color: var(--text-strong); margin-block: var(--sp-5) var(--sp-2); }
.prose p + p { margin-top: var(--sp-3); }
.prose ul { display: grid; gap: 8px; margin-top: var(--sp-3); }
.prose ul li { display: flex; gap: 9px; align-items: flex-start; }
.prose ul svg { width: 16px; height: 16px; color: var(--success-500); flex: 0 0 auto; margin-top: 4px; }

/* Accordion (curriculum + FAQ) */
.accordion { display: grid; gap: 10px; }
.acc-item {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--paper);
  overflow: hidden;
}
.acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 56px;
  padding: 12px var(--sp-4);
  text-align: left;
}
.acc-head:hover { background: var(--surface-raised); }
.acc-head:hover .acc-title { color: var(--violet-400); }
.acc-num {
  width: 24px; height: 24px;
  border-radius: var(--r-xs);
  background: var(--slate-50);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-size: var(--text-2xs);
  font-weight: 600;
  flex: 0 0 auto;
}
.acc-title { flex: 1 1 auto; font-size: var(--text-base); font-weight: 600; color: var(--text-strong); }
.acc-count { font-size: var(--text-xs); color: var(--text-subtle); }
.acc-chevron { width: 18px; height: 18px; color: var(--text-subtle); transition: transform var(--dur) var(--ease); }
.acc-head[aria-expanded="true"] .acc-chevron { transform: rotate(180deg); }
.acc-panel { display: none; }
.acc-text {
  padding: 0 var(--sp-4) var(--sp-4);
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--text-muted);
  max-width: 70ch;
}
.acc-head[aria-expanded="true"] + .acc-panel { display: block; }
.lesson-row {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 11px var(--sp-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.lesson-row:last-child { border-bottom: 0; }
.lesson-row svg { width: 16px; height: 16px; color: var(--text-subtle); flex: 0 0 auto; }
.lesson-row .lr-title { flex: 1 1 auto; min-width: 0; }
.lesson-row .lr-dur { font-size: var(--text-xs); color: var(--text-subtle); }
.lesson-row .lr-lock { color: var(--amber-500); }
.lesson-row.is-free .lr-title::after {
  content: "FREE";
  margin-left: 8px;
  font-size: 9px;
  font-weight: 800;
  color: var(--success-600);
  background: var(--success-100);
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: 1px;
}

/* Faculty list */
.faculty-list { display: grid; gap: var(--sp-3); }
.faculty-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--paper);
}
.faculty-row h4 { font-size: var(--text-sm); margin-bottom: 2px; }
.faculty-row p { font-size: var(--text-xs); color: var(--text-muted); }

/* ============================== AUTH =================================== */
.auth-shell { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

/* Left column: a lit gradient panel, not a marketing billboard */
.auth-brand {
  position: relative;
  overflow: hidden;
  background: var(--grad-auth);
  color: var(--text);
  border-right: 1px solid var(--border);
  padding: clamp(28px, 4vw, 64px);
  display: flex;
  flex-direction: column;
  gap: var(--sp-7);
}
.auth-brand::after {
  content: "";
  position: absolute;
  right: -140px;
  bottom: -160px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(124, 124, 255, 0.32), transparent 72%);
  pointer-events: none;
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand .brand { color: var(--text-strong); }
.auth-brand .brand-mark { background: var(--grad-brand); border-color: transparent; }
.auth-brand .brand-mark svg { color: var(--text-invert); }
.auth-brand .brand-text small { color: var(--text-subtle); }
.auth-brand-copy { max-width: 34ch; margin-top: auto; }
.auth-brand h2 {
  color: var(--text-strong);
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, var(--text-2xl));
  line-height: 1.2;
  margin-bottom: var(--sp-3);
}
.auth-brand p { color: var(--text-muted); font-size: var(--text-md); line-height: 1.7; }
.auth-brand-foot {
  margin-top: auto;
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
.auth-brand-foot a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; }
.auth-brand-foot a:hover { color: var(--text-strong); }

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 4vw, 56px) var(--sp-6);
  background: var(--canvas);
}
.auth-form-wrap { width: 100%; max-width: 400px; }
.auth-form-wrap h1 { font-size: var(--text-2xl); margin-bottom: var(--sp-2); }
.auth-form-wrap > p { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--sp-6); }
.auth-tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  margin-bottom: var(--sp-6);
}
.auth-tabs button {
  position: relative;
  flex: 1 1 0;
  min-height: 40px;
  border-radius: var(--r-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.auth-tabs button:hover { color: var(--text-strong); }
.auth-tabs button[aria-selected="true"] { color: var(--text-invert); font-weight: 700; background: var(--violet-600); }
.auth-form { display: grid; gap: var(--sp-4); }
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--text-subtle);
  margin-block: var(--sp-5);
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Signed-in account panel ---------------------------------------- */
.account-panel { display: grid; gap: var(--sp-5); }
.account-panel[hidden] { display: none; }

.account-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-soft);
}

.account-facts dt {
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 4px;
}

.account-facts dd {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

.account-note {
  padding: 10px 12px;
  border: 1px solid var(--amber-200);
  border-radius: var(--r-md);
  background: var(--amber-100);
  color: var(--amber-800);
  font-size: var(--text-xs);
  line-height: 1.55;
}

.account-actions { display: grid; gap: 10px; }

.account-password {
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}

@media (max-width: 560px) {
  .account-facts { grid-template-columns: minmax(0, 1fr); }
}

/* ============================== RESPONSIVE ============================= */
@media (max-width: 860px) {
  .masthead-panel { min-height: 0; padding-bottom: 150px; }
  .masthead-art { width: 100%; inset: auto 0 0 0; height: 62%; }
  .masthead-art img {
    object-position: right bottom;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 55%);
    mask-image: linear-gradient(180deg, transparent 0%, black 55%);
  }
  .masthead-copy { max-width: 100%; }
}
@media (max-width: 1080px) {
  .batch-grid, .test-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course-layout { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 900px) {
  .course-layout { grid-template-columns: minmax(0, 1fr); }
  .catalog-layout { grid-template-columns: minmax(0, 1fr); }
  .filter-panel { position: static; display: none; }
  .filter-panel.is-open { display: grid; }
  .filter-toggle { display: inline-flex; }
  .mobile-filter-btn { display: inline-flex; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}
@media (max-width: 900px) {
  .split-grid { grid-template-columns: minmax(0, 1fr); }
  .legal-layout { grid-template-columns: minmax(0, 1fr); }
  /* `.legal-nav` is un-stuck in the legal block below, next to its base rule. */
}

@media (max-width: 720px) {
  .batch-grid, .test-grid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: var(--sp-4); }
}

/* ------------------------------------------------------------------ */
/* Legal / policy page                                                */
/* ------------------------------------------------------------------ */

.legal-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: var(--sp-7);
  align-items: start;
}

.legal-nav {
  position: sticky;
  top: calc(var(--header-h) + 18px);
  display: grid;
  gap: 10px;
  padding: 18px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.legal-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 2px;
}

.legal-nav a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
}

.legal-nav a:hover {
  background: var(--violet-50);
  color: var(--violet-700);
}

.legal-nav a.is-active {
  background: var(--violet-50);
  color: var(--violet-700);
  font-weight: 600;
}

.legal-body {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
}

.legal-card {
  display: grid;
  gap: 12px;
  scroll-margin-top: calc(var(--header-h) + 18px);
}

.legal-card h2 {
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
  margin: 0;
}

.legal-card h3 {
  font-size: var(--text-md);
  margin: 6px 0 0;
}

.legal-card p,
.legal-card li {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.75;
}

.legal-card p {
  margin: 0;
}

.legal-card ul,
.legal-card ol {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.legal-card a {
  color: var(--violet-600);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-card code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--slate-100);
  padding: 1px 5px;
  border-radius: 5px;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  min-width: 480px;
}

/* The wrapper scrolls, the page must not: without this the 480px table pushed
   the whole document sideways on a phone. */
.table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table thead th {
  background: var(--slate-50);
  color: var(--text-strong);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
}

.contact-grid .eyebrow {
  margin-bottom: 4px;
}

@media (max-width: 1024px) {
  .legal-layout { grid-template-columns: minmax(0, 1fr); }
  .legal-nav { position: static; }
  .legal-nav ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .legal-nav ul { grid-template-columns: minmax(0, 1fr); }
  .contact-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------------ */
/* Editorial sections (home)                                          */
/* ------------------------------------------------------------------ */

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.section-head .section-title { margin-top: 2px; }

.section-head .link { flex: 0 0 auto; padding-bottom: 3px; }

@media (max-width: 720px) {
  .section-head { flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
}

/* Plain four-column assurance strip (tests page) */
.assurance {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-6);
  padding-block: var(--sp-6);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.assurance strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 6px;
}
.assurance span { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.6; }

@media (max-width: 1024px) { .assurance { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .assurance { grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); } }

/* ========================== ACCOUNT FORMS ============================== */

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.link-button {
  font: inherit;
  font-size: var(--text-sm);
  color: var(--violet-700);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-align: left;
}

.link-button:hover { color: var(--ink-900); }

.auth-form { display: grid; gap: var(--sp-4); }

.auth-lead {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text-muted);
}

.auth-alt {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
}

.auth-demo-note { text-align: center; }

.form-alert {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--danger-200);
  border-left: 3px solid var(--danger-600);
  background: var(--danger-100);
  color: var(--danger-800);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.auth-facts {
  display: grid;
  gap: 12px;
  margin-top: var(--sp-6);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.auth-facts li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.6; }
.auth-facts svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 3px; color: var(--violet-600); }

.auth-session {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--slate-50);
  font-size: var(--text-sm);
  color: var(--text-muted);
}



.auth-done {
  display: grid;
  gap: var(--sp-3);
  justify-items: start;
  padding: var(--sp-6);
  border: 1px solid var(--border);
  background: var(--paper);
}

.auth-done h2 { font-size: var(--text-xl); }
.auth-done p { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.7; }

.auth-done-icon {
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--success-100);
  color: var(--success-600);
}

.auth-done-icon svg { width: 22px; height: 22px; }

/* Password strength hint */
#signup-strength[data-strength="1"] { color: var(--danger-600); }
#signup-strength[data-strength="2"] { color: var(--amber-600); }
#signup-strength[data-strength="3"],
#signup-strength[data-strength="4"] { color: var(--success-600); }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { border-right: 0; border-bottom: 1px solid var(--border); }
  .auth-brand-copy { margin-top: var(--sp-6); }
  .auth-facts { display: none; }
  .auth-brand-foot { margin-top: var(--sp-5); }
}

/* A greeting icon sits inline with the heading, baseline-aligned and never on
   a line of its own. */
#welcome-title {
  display: flex;
  align-items: center;
  gap: 0.35em;
  flex-wrap: wrap;
}

#welcome-title svg {
  width: 0.8em;
  height: 0.8em;
  flex: none;
  color: var(--violet-500);
}

/* A batch may carry a cover image (an https URL pasted in the admin). It sits
   behind the badge and the subject tag, and the whole cover keeps a sane
   height whether or not one is set. */
.batch-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.batch-cover:has(.batch-cover-img) {
  min-height: 150px;
}
.batch-cover:has(.batch-cover-img)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(6, 8, 16, 0.55), rgba(6, 8, 16, 0.2));
}
.batch-cover .cover-tag,
.batch-cover .badge,
.batch-cover .cover-faces {
  position: relative;
  z-index: 2;
}
.batch-cover .badge {
  position: absolute;
}
.batch-cover-lg:has(.batch-cover-img) {
  min-height: 260px;
}
