/* ==========================================================================
   Course hub — MAT1023
   ========================================================================== */

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: min(100svh, 920px);
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h) + 48px) 0 96px;
  overflow: hidden;
  isolation: isolate;
}
.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}
.hero-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7,10,20,0.92) 0%, rgba(7,10,20,0.7) 38%, rgba(7,10,20,0.1) 70%),
    linear-gradient(0deg, var(--ink-0) 0%, transparent 22%);
}
.hero-inner { position: relative; }

.crumbs {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--faint);
  margin-bottom: 26px;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--gold); }
.crumbs [aria-current] { color: var(--gold); font-family: var(--font-mono); font-size: 12px; }

.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }

.hero-title {
  font-size: clamp(40px, 7.2vw, 92px);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -0.01em;
  max-width: 17ch;
  font-variation-settings: "opsz" 144;
}
.hero-title em {
  font-style: italic;
  color: var(--gold);
  font-weight: 300;
}

.hero-lede {
  max-width: 54ch;
  color: var(--muted);
  font-size: clamp(16px, 1.6vw, 19px);
  margin: 26px 0 34px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(5, auto);
  justify-content: start;
  gap: 0;
  margin: 54px 0 0;
  border-top: 1px solid var(--line);
  max-width: 760px;
}
.hero-stats > div {
  padding: 18px 28px 0 0;
  margin-right: 28px;
  border-right: 1px solid var(--line);
}
.hero-stats > div:last-child { border-right: 0; margin-right: 0; }
.hero-stats dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.hero-stats dd {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--cream);
  font-weight: 300;
}
.hero-stats dd.mono { font-family: var(--font-mono); font-size: 20px; padding-top: 7px; color: var(--gold); }

.hero-caption {
  position: absolute;
  right: var(--gutter);
  bottom: 28px;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--faint);
  font-size: 13px;
  opacity: 0.85;
}
.hero-caption-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hero-caption .katex { color: var(--muted); font-size: 1.05em; }

@media (max-width: 860px) {
  .hero-stats { grid-template-columns: repeat(3, auto); row-gap: 18px; }
  .hero-stats > div:nth-child(3) { border-right: 0; }
  .hero-veil {
    background:
      linear-gradient(180deg, rgba(7,10,20,0.55) 0%, rgba(7,10,20,0.85) 60%, var(--ink-0) 100%);
  }
}
@media (max-width: 520px) {
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .hero-stats > div { border-right: 0; margin-right: 0; padding-right: 12px; }
  .hero-stats dd { font-size: 24px; }
  .hero-caption { display: none; }
}

/* ---------- Sticky course tabs ---------- */

.course-tabs {
  position: sticky;
  top: var(--nav-h);
  z-index: 40;
  background: rgba(7, 10, 20, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.course-tabs .container { position: relative; }
.course-tabs ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.course-tabs ul::-webkit-scrollbar { display: none; }
.course-tabs a {
  display: block;
  padding: 14px 14px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  position: relative;
  transition: color 0.2s;
}
.course-tabs a:hover { color: var(--cream); }
.course-tabs a.is-active { color: var(--gold); }
.course-tabs a.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}
.tabs-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  pointer-events: none;
}
.tabs-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, transparent, var(--gold-dim));
}

/* ---------- Sections ---------- */

.section { padding: clamp(72px, 10vw, 128px) 0 0; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.sub-title {
  font-size: 24px;
  font-weight: 400;
}
.sub-lede {
  color: var(--muted);
  margin: 6px 0 0;
  font-size: 15px;
}

/* ---------- Overview ---------- */

.overview-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}
@media (max-width: 900px) { .overview-grid { grid-template-columns: 1fr; } }

.objectives {
  list-style: none;
  padding: 0;
  margin: 36px 0 0;
  display: grid;
  gap: 18px;
}
.objectives li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
}
.objectives p { margin: 0; color: var(--text); }
.obj-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  color: var(--gold);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  line-height: 1;
}

.outcomes {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  display: grid;
  gap: 10px;
}
.outcome {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 24, 48, 0.45);
  transition: border-color 0.25s, transform 0.25s var(--ease), background 0.25s;
}
.outcome:hover { border-color: var(--line-strong); transform: translateX(4px); background: rgba(24,33,61,0.6); }
.outcome-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gold);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 3px 8px;
}
.outcome p { margin: 0; font-size: 15px; line-height: 1.5; }
.outcome a {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
}
.outcome a:hover { color: var(--gold); }

/* Hours budget */
.budget {
  margin-top: 64px;
  padding: clamp(22px, 3vw, 34px);
}
.budget-head { margin-bottom: 22px; }
.budget-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: center;
  margin-top: 14px;
}
.budget-label { font-size: 14px; color: var(--muted); }
.budget-label b { color: var(--cream); font-weight: 500; margin-left: 4px; }
.budget-bar {
  display: flex;
  height: 44px;
  gap: 3px;
}
.budget-seg {
  position: relative;
  border-radius: 8px;
  background: var(--seg, var(--gold-mid));
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-0);
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  transform-origin: left;
  transition: filter 0.2s, transform 0.2s;
  cursor: default;
}
.budget-seg:hover { filter: brightness(1.12); }
.budget-seg.is-dark { color: var(--cream); }
.budget-seg span { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .budget-row { grid-template-columns: 1fr; gap: 8px; }
  .budget-seg { padding: 0 6px; font-size: 10.5px; }
}

/* ---------- Progress card ---------- */

.progress-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 24, 48, 0.45);
  min-width: 260px;
}
.progress-ring { width: 56px; height: 56px; flex: none; transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-width: 4; }
.progress-ring .track { stroke: var(--line); }
.progress-ring .val { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
.progress-text b { display: block; font-family: var(--font-display); font-size: 22px; color: var(--cream); font-weight: 400; }
.progress-text span { font-size: 13px; color: var(--muted); }
.progress-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- Status badges ---------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--faint);
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status--published { color: var(--gold); border-color: var(--line-strong); background: var(--gold-glow); }
.status--in-progress { color: var(--cream); border-color: var(--line-strong); }
.status--in-progress::before { animation: pulse 1.8s ease-in-out infinite; background: var(--gold); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(227,194,122,0.6); }
  50% { box-shadow: 0 0 0 5px rgba(227,194,122,0); }
}

/* ---------- Module list ---------- */

.module-list { display: grid; gap: 14px; }

.module {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(24,33,61,0.5), rgba(11,16,32,0.5));
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.4s var(--ease);
}
.module:hover { border-color: var(--line-strong); }
.module.is-open {
  border-color: var(--line-strong);
  box-shadow: 0 30px 80px -40px rgba(227,194,122,0.25);
}

.module-head {
  width: 100%;
  display: grid;
  grid-template-columns: 76px 1fr auto 132px 36px;
  align-items: center;
  gap: 22px;
  padding: 20px 24px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.module-num {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 300;
  color: var(--gold);
  line-height: 1;
  font-variation-settings: "opsz" 144;
}
.module-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.2vw, 26px);
  color: var(--cream);
  line-height: 1.2;
}
.module-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  color: var(--faint);
  font-size: 13px;
  flex-wrap: wrap;
}
.module-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.module-thumb {
  width: 132px;
  height: 76px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(7,10,20,0.6);
}
.module-chevron {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--gold);
  transition: transform 0.4s var(--ease), background 0.3s;
}
.module-chevron svg { width: 14px; height: 14px; }
.module.is-open .module-chevron { transform: rotate(180deg); background: var(--gold-glow); }

.module-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.55s var(--ease);
}
.module.is-open .module-body { grid-template-rows: 1fr; }
.module-body-inner { overflow: hidden; }
.module-content {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 28px 40px;
  padding: 6px 24px 28px 122px;
}

.block-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 12px;
}

.topics { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.topics li {
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  color: var(--text);
}

.key-results { display: grid; gap: 10px; }
.key {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(7,10,20,0.5);
}
.key-name {
  font-size: 12px;
  color: var(--gold);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.key .katex-display { margin: 8px 0 2px; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
.key .katex { color: var(--cream); font-size: 1.08em; }

.resources { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.res {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
a.res:hover { color: var(--cream); border-color: var(--gold); background: var(--gold-glow); transform: translateX(3px); }
.res-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(227,194,122,0.08);
  color: var(--gold);
}
.res-icon svg { width: 16px; height: 16px; }
.res-name { font-size: 14.5px; }
.res-tag { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.res.is-soon { opacity: 0.55; }
.res.is-soon .res-icon { color: var(--faint); background: rgba(255,255,255,0.03); }

.lab-links { display: flex; flex-wrap: wrap; gap: 8px; }
.lab-links a {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}
.lab-links a:hover { color: var(--gold); border-style: solid; }

.module-co {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: baseline;
}

@media (max-width: 900px) {
  .module-head { grid-template-columns: 54px 1fr 36px; gap: 14px; padding: 18px 16px; }
  .module-head .status,
  .module-thumb { display: none; }
  .module-num { font-size: 34px; }
  .module-content { grid-template-columns: 1fr; padding: 4px 16px 22px; }
  .module-mobile-status { display: inline-flex !important; }
}
.module-mobile-status { display: none !important; }

/* ---------- Demos ---------- */

.demo { margin-top: 40px; overflow: hidden; }
.demo-tabs {
  display: flex;
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.demo-tabs button {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14.5px;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  gap: 10px;
  align-items: center;
}
.demo-tabs button .mono { font-size: 11px; color: var(--faint); }
.demo-tabs button:hover { color: var(--cream); }
.demo-tabs button[aria-selected="true"] { background: var(--gold-glow); color: var(--gold); }
.demo-tabs button[aria-selected="true"] .mono { color: var(--gold-mid); }

.demo-panel {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
}
.demo-panel[hidden] { display: none; }
.demo-stage {
  position: relative;
  min-height: 380px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(227,194,122,0.05), transparent 70%),
    rgba(7,10,20,0.5);
}
.demo-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.demo-controls {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.seg {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(7,10,20,0.5);
  align-self: flex-start;
}
.seg button {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.seg button[aria-checked="true"] { background: var(--gold); color: var(--ink-0); font-weight: 500; }

.slider { display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
.slider > span { display: flex; justify-content: space-between; align-items: baseline; }
.slider i { font-family: var(--font-display); color: var(--cream); }
.slider b { font-family: var(--font-mono); font-weight: 500; color: var(--gold); font-size: 13px; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--gold) var(--fill, 50%), var(--ink-3) var(--fill, 50%));
  outline-offset: 6px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cream);
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(227,194,122,0.15);
  cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cream);
  border: 3px solid var(--gold);
  cursor: grab;
}

.btn-small { padding: 8px 14px; font-size: 13.5px; align-self: flex-start; }

.readout {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(7,10,20,0.5);
}
.readout-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.readout-value { font-family: var(--font-display); font-size: 26px; color: var(--cream); line-height: 1.2; }
.readout-sub { font-size: 13px; color: var(--muted); }
.readout-sub .katex { font-size: 1em; }
.meter { height: 4px; border-radius: 4px; background: var(--ink-3); margin-top: 6px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dim), var(--gold-strong)); transition: width 0.4s var(--ease); }

.demo-formula { color: var(--cream); overflow-x: auto; overflow-y: hidden; }
.demo-formula .katex-display { margin: 0; }
.demo-note { margin: 0; font-size: 13.5px; color: var(--muted); }
.demo-note em { color: var(--gold); font-style: normal; }

@media (max-width: 900px) {
  .demo-panel { grid-template-columns: 1fr; }
  .demo-stage { min-height: 300px; border-right: 0; border-bottom: 1px solid var(--line); }
  .demo-controls { padding: 18px 16px 22px; }
}

/* ---------- Lab list ---------- */

.lab-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  counter-reset: lab;
}
.lab-item {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17,24,48,0.4);
  transition: border-color 0.25s, background 0.25s;
  scroll-margin-top: calc(var(--nav-h) + 80px);
}
.lab-item:hover, .lab-item.is-flash { border-color: var(--line-strong); background: rgba(24,33,61,0.6); }
.lab-item.is-flash { box-shadow: 0 0 0 1px var(--gold) inset; }
.lab-n {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gold);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
}
.lab-title { font-size: 15px; color: var(--text); line-height: 1.4; }
.lab-mod { font-family: var(--font-mono); font-size: 11px; color: var(--faint); margin-top: 3px; }
.lab-hours {
  display: flex;
  gap: 3px;
  align-items: center;
}
.lab-hours i {
  width: 6px;
  height: 18px;
  border-radius: 2px;
  background: var(--gold-mid);
  opacity: 0.85;
}
.lab-hours b { font-family: var(--font-mono); font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 8px; }
@media (max-width: 800px) { .lab-list { grid-template-columns: 1fr; } }

/* ---------- Assessment ---------- */

.assess-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 40px;
}
@media (max-width: 800px) { .assess-grid { grid-template-columns: 1fr; } }
.assess-card { padding: clamp(22px, 3vw, 32px); }

.donut-wrap {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 28px;
  align-items: center;
  margin-top: 22px;
}
@media (max-width: 440px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } }
.donut { width: 180px; height: 180px; }
.donut circle { fill: none; transition: stroke-dasharray 1.2s var(--ease), opacity 0.2s; }
.donut-center-big { font-family: var(--font-display); font-size: 34px; fill: var(--cream); font-weight: 300; }
.donut-center-small { font-family: var(--font-mono); font-size: 10px; fill: var(--faint); letter-spacing: 0.12em; }
.donut-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; width: 100%; }
.donut-legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 14.5px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: default;
  transition: background 0.2s;
}
.donut-legend li:hover, .donut-legend li.is-hot { background: rgba(255,255,255,0.04); }
.donut-legend i { width: 12px; height: 12px; border-radius: 3px; }
.donut-legend b { font-family: var(--font-mono); font-weight: 500; color: var(--cream); font-size: 13.5px; }

.matrix-card { margin-top: 16px; padding: clamp(22px, 3vw, 32px); }
.matrix-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-end; }
.matrix-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.matrix-legend span { display: inline-flex; gap: 8px; align-items: center; }
.lv { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.lv1 { background: rgba(227,194,122,0.22); }
.lv2 { background: rgba(227,194,122,0.55); }
.lv3 { background: var(--gold); }

.matrix-scroll { overflow-x: auto; margin-top: 22px; }
.matrix { border-collapse: separate; border-spacing: 6px; min-width: 420px; }
.matrix th {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 6px;
  text-align: center;
}
.matrix th[scope="row"] { text-align: left; color: var(--gold); padding-right: 14px; }
.matrix td {
  width: 64px;
  height: 44px;
  border-radius: 9px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-0);
  font-weight: 500;
  transition: transform 0.2s var(--ease);
}
.matrix td:hover { transform: scale(1.08); }
.matrix td.v1 { background: rgba(227,194,122,0.22); color: var(--cream); }
.matrix td.v2 { background: rgba(227,194,122,0.55); }
.matrix td.v3 { background: var(--gold); }

/* ---------- Books ---------- */

.shelf {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 40px;
}
@media (max-width: 980px) { .shelf { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .shelf { grid-template-columns: 1fr; } }

.book {
  position: relative;
  padding: 22px 22px 22px 34px;
  border-radius: 6px 16px 16px 6px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(24,33,61,0.9), rgba(11,16,32,0.9));
  min-height: 230px;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.3s;
  overflow: hidden;
}
.book::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 12px;
  background: linear-gradient(90deg, var(--spine, var(--gold-mid)), rgba(0,0,0,0.25));
}
.book:hover { transform: translateY(-6px) rotate(-0.4deg); box-shadow: 0 24px 50px -24px rgba(0,0,0,0.8); border-color: var(--line-strong); }
.book-kind { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.book-title { font-family: var(--font-display); font-size: 21px; color: var(--cream); margin: 12px 0 10px; line-height: 1.2; }
.book-author { color: var(--muted); font-size: 14px; }
.book-pub { margin-top: auto; padding-top: 18px; font-size: 12.5px; color: var(--faint); font-family: var(--font-mono); }

/* ---------- Lesson call-to-action in module cards ---------- */

.lesson-cta {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(135deg, rgba(227,194,122,.16), rgba(227,194,122,.04));
  color: var(--cream);
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
a.lesson-cta:hover { color: var(--cream); border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 16px 40px -20px rgba(227,194,122,.5); }
.lesson-cta .res-icon { width: 38px; height: 38px; background: var(--gold); color: var(--ink-0); }
.lesson-cta b { display: block; font-weight: 500; font-size: 15.5px; }
.lesson-cta small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.lesson-cta.is-soon { border-style: dashed; border-color: var(--line); background: none; opacity: .65; }
.lesson-cta.is-soon .res-icon { background: rgba(255,255,255,.04); color: var(--faint); }

.lesson-jump {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.lesson-jump a {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13.5px;
}
.lesson-jump a:hover { color: var(--gold); background: rgba(255,255,255,.03); }
.lesson-jump span { font-family: var(--font-mono); font-size: 11px; color: var(--faint); min-width: 22px; }
@media (max-width: 520px) { .lesson-jump { grid-template-columns: 1fr; } }

/* ---------- Textbook reading ---------- */

.reading-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.reading-list li {
  display: grid;
  grid-template-columns: 74px auto 1fr;
  gap: 10px;
  align-items: baseline;
  font-size: 13.5px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.reading-list b { color: var(--gold); font-weight: 500; font-size: 12.5px; }
.reading-list span { font-family: var(--font-mono); font-size: 12.5px; color: var(--cream); white-space: nowrap; }
.reading-list em { font-style: normal; color: var(--muted); }
@media (max-width: 520px) { .reading-list li { grid-template-columns: auto 1fr; } .reading-list em { grid-column: 1 / -1; } }

.guide-card { margin-top: 18px; padding: clamp(22px, 3vw, 32px); }
table.guide { width: 100%; border-collapse: collapse; margin-top: 16px; min-width: 520px; font-size: 14.5px; }
table.guide th, table.guide td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.guide thead th { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; color: var(--faint); letter-spacing: .06em; }
table.guide tbody th { font-weight: 400; color: var(--cream); }
table.guide tbody th .mono { color: var(--gold); font-size: 12px; margin-right: 6px; }
table.guide td { font-family: var(--font-mono); font-size: 13px; color: var(--text); }
table.guide .muted { color: var(--faint); }
