/* ==========================================================================
   course.css — the course information page (course.html?id=<courseId>)

   Page-scoped only. Every value resolves to a token from css/tokens.css and
   no component declared in css/components.css is redefined here; the rules
   below either lay out this page's own elements or nudge a component
   instance that this page owns.
   ========================================================================== */

/* The shared .stars mask token is declared on :root, so its var(--star-size)
   is substituted against :root — the size must exist there or the mask drops
   and the stars paint as a solid bar. Seed it at the component default. */
:root { --star-size: 0.95rem; }

/* --------------------------------------------------------------------------
   1. The hero band
   The hero and the purchase rail share one tinted band so the rail reads as
   part of the offer rather than as a floating widget.
   -------------------------------------------------------------------------- */
.course-top {
  position: relative;
  isolation: isolate;
  padding-block: var(--space-10) var(--space-16);
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, var(--bg-gradient-stop) 0%, var(--bg) 62%);
}

.course-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(58rem 26rem at 12% -6%, var(--primary-soft) 0%, transparent 62%),
    radial-gradient(42rem 22rem at 88% 4%, var(--accent-soft) 0%, transparent 60%),
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: auto, auto, 56px 56px, 56px 56px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, #000 34%, transparent 82%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, #000 34%, transparent 82%);
}

.course-notice:not(:empty) { margin-bottom: var(--space-6); }

/* Hero, rail and tabbed body are three items of the one shared aside grid.
   The rail spans both content rows so its sticky box has the full band to
   travel in; in source order it sits between them, so the single-column
   layout reads hero → purchase card → syllabus without any reordering. */
.course-shell {
  grid-template-rows: auto auto;
  gap: var(--space-10);
}
.course-hero { grid-column: 1; grid-row: 1; }
.course-rail { grid-column: 2; grid-row: 1 / span 2; }
.course-body { grid-column: 1; grid-row: 2; }

/* --------------------------------------------------------------------------
   2. Hero content
   -------------------------------------------------------------------------- */
.course-hero {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}
.course-hero[aria-busy="true"] { gap: var(--space-4); }
.course-hero .breadcrumb { margin-bottom: calc(var(--space-1) * -1); }

.course-flags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.course-title {
  font-size: var(--fs-5xl);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tighter);
  text-wrap: balance;
}

.course-subtitle {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--primary-soft-text);
  max-width: 46ch;
}

.course-blurb {
  font-size: var(--fs-lg);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
  max-width: 62ch;
}

/* Meta row ---------------------------------------------------------------- */
.course-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--fs-md);
  color: var(--text-muted);
}
.course-meta > li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h-sm);
}
.course-meta-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  color: var(--text-subtle);
}

/* Rating trigger + distribution popover ----------------------------------- */
.course-meta-rating { position: relative; }

.course-rating-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h-sm);
  padding: 0 var(--space-3) 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--fs-md);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard),
              background-color var(--dur-fast) var(--ease-standard);
}
.course-rating-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.course-rating-btn:focus-visible {
  outline: var(--ring-w) solid var(--focus-ring-color);
  outline-offset: 2px;
}
.course-rating-value {
  font-size: var(--fs-lg);
  font-weight: var(--fw-extrabold);
  color: var(--accent-soft-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
}
.course-rating-count { color: var(--text-muted); }
.course-rating-caret {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--text-subtle);
  transition: transform var(--dur-fast) var(--ease-standard);
}
.course-rating-btn[aria-expanded="true"] { border-color: var(--primary-border); background: var(--primary-soft); }
.course-rating-btn[aria-expanded="true"] .course-rating-caret { transform: rotate(180deg); }

#rating-pop { min-width: 20rem; }

.course-dist {
  display: grid;
  gap: var(--space-2);
}
.course-dist-row {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) 3.25rem;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-sm);
}
.course-dist-star {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.course-dist-glyph {
  width: 0.8rem;
  height: 0.8rem;
  fill: var(--accent);
}
.course-dist-track {
  position: relative;
  display: block;
  height: 0.5rem;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  overflow: hidden;
}
.course-dist-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--grad-accent);
  transition: width var(--dur-slow) var(--ease-out);
}
.course-dist-pct {
  text-align: right;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Instructor line --------------------------------------------------------- */
.course-teacher {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}
.course-teacher-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  margin-right: auto;
}
.course-teacher-name {
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  color: var(--text);
  letter-spacing: var(--tracking-tight);
}
.course-teacher-title { font-size: var(--fs-sm); color: var(--text-muted); }
.course-teacher-link { flex: 0 0 auto; }

/* --------------------------------------------------------------------------
   3. Tabbed body
   -------------------------------------------------------------------------- */
.course-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* The tab strip parks under the site header, so a 12-module curriculum can be
   scrolled without losing the way back to Overview. It borrows the header's
   own frosted treatment so the two strips read as one surface. */
.course-tabbar {
  position: sticky;
  top: var(--header-h);
  z-index: var(--z-sticky);
  background: var(--surface-overlay);
  -webkit-backdrop-filter: saturate(180%) blur(var(--glass-blur));
  backdrop-filter: saturate(180%) blur(var(--glass-blur));
  margin-inline: calc(var(--space-3) * -1);
  padding-inline: var(--space-3);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .course-tabbar { background: var(--surface); }
}

/* Five tabs stop fitting at about 460px, so the strip scrolls. Tighter tab
   padding delays that; below the width where it still clips, a fade on the
   trailing edge says so — without it the FAQ tab is simply cut off with no
   sign that anything follows. The strip is already position:sticky, so it
   anchors the fade itself. */
@media (max-width: 560px) {
  .course-tabbar .tab { padding-inline: var(--space-3); }
}
@media (max-width: 460px) {
  .course-tabbar::after {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-end: 0;
    width: var(--space-8);
    pointer-events: none;
    background: linear-gradient(to left, var(--bg), transparent);
  }
}

.course-body .tab-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  padding-top: var(--space-8);
}

.course-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.course-section-title {
  font-size: var(--fs-2xl);
  letter-spacing: var(--tracking-tight);
}
.course-section-sub {
  font-size: var(--fs-md);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
  max-width: 68ch;
}

/* Overview: outcome grid -------------------------------------------------- */
.course-outcomes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: var(--space-4) var(--space-6);
  list-style: none;
  margin: 0;
  padding: 0;
}
.course-outcome {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
}
.course-outcome-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.05rem;
  border-radius: var(--radius-full);
  background: var(--success-soft);
  color: var(--success);
}
.course-outcome-mark > svg { width: 1rem; height: 1rem; }

/* Overview: prerequisites + audience ------------------------------------- */
.course-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--tile-gap);
  align-items: start;
}
.course-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  height: 100%;
}
.course-panel-title {
  font-size: var(--fs-lg);
  letter-spacing: var(--tracking-tight);
}
.course-panel-note {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
}

.course-bullets {
  display: grid;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}
.course-bullets > li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
}
.course-bullet-icon {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.28rem;
  color: var(--primary);
}

/* Overview: skills cloud -------------------------------------------------- */
.course-skills { gap: var(--space-2) var(--space-2); }
.course-skills .tag {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  white-space: normal;
}
.course-skills .tag { color: var(--text-muted); }
.course-skills .tag-brand { border-color: var(--primary-border); }

.course-cta-callout .callout-title { font-size: var(--fs-base); }

/* --------------------------------------------------------------------------
   4. Curriculum
   -------------------------------------------------------------------------- */
.course-curriculum-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.course-curriculum-summary {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.course-modules .accordion-panel { padding-top: var(--space-2); }

/* Runtime and lecture counts are read, not decoration. The shared components
   paint them in --text-subtle, which is 3.7:1 on the light card. */
.course-modules .accordion-meta,
.course-lectures .lecture-time { color: var(--text-muted); }

.course-module-summary {
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
  padding-inline: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px dashed var(--border-subtle);
  margin-bottom: var(--space-2);
  max-width: 78ch;
}

.course-lectures {
  display: grid;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* A lecture is only a link once the learner is enrolled; before that the same
   row renders as a static, non-interactive summary. */
.course-lectures .lecture-row.is-static { cursor: default; }
.course-lectures .lecture-row.is-static:hover { background: none; color: var(--text-muted); }

.course-lectures .lecture-row { gap: var(--space-3); }
.course-lectures .lecture-name { white-space: normal; overflow: visible; }

.course-lecture-tags {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  flex: 0 0 auto;
}
.course-lecture-kind {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
}
.course-preview-chip { letter-spacing: var(--tracking-wide); }

/* Icon plus one run of prose. The prose is wrapped in a span by course.js, so
   this stays a two-item flex row — never a row of loose sentence fragments. */
.course-curriculum-foot {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
}
.course-foot-icon {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.16rem;
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   5. Instructor
   -------------------------------------------------------------------------- */
.course-teacher-card .card-body { gap: var(--space-6); }

.course-teacher-head {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}
.course-teacher-heading {
  font-size: var(--fs-2xl);
  letter-spacing: var(--tracking-tight);
}
.course-teacher-role {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--primary-soft-text);
}
.course-teacher-course { font-size: var(--fs-sm); color: var(--text-muted); }
.course-teacher-bio {
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
  max-width: 72ch;
}
.course-teacher-stats { gap: var(--space-4); }
.course-teacher-stats .stat-hint { color: var(--text-muted); }

.course-faculty {
  display: grid;
  gap: var(--space-2);
}
.course-faculty-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-standard),
              background-color var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-out);
}
.course-faculty-row:hover {
  border-color: var(--primary-border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  transform: translateX(2px);
}
.course-faculty-row:focus-visible {
  outline: var(--ring-w) solid var(--focus-ring-color);
  outline-offset: 2px;
}
.course-faculty-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}
.course-faculty-name {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
}
.course-faculty-meta { font-size: var(--fs-sm); color: var(--text-muted); }
.course-faculty-go {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--text-subtle);
}
.course-faculty-go > svg { width: 1.15rem; height: 1.15rem; }
.course-faculty-row:hover .course-faculty-go { color: var(--primary); }

/* --------------------------------------------------------------------------
   6. Reviews
   -------------------------------------------------------------------------- */
.course-review-summary {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  align-items: center;
  gap: var(--space-6) var(--space-10);
  padding: var(--card-pad);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-2);
}
.course-review-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
}
.course-score-value {
  font-family: var(--font-display);
  font-size: var(--fs-5xl);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-none);
  letter-spacing: var(--tracking-tighter);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
/* The shared mask token resolves --star-size on :root, so a larger tile has to
   be declared alongside the size on the element that wants it. */
.course-score-stars {
  --star-size: 1.5rem;
  --bi-star-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 1.6l2.47 5.28 5.53.72-4.06 3.94 1.03 5.66L10 14.5l-4.97 2.7 1.03-5.66L2 7.6l5.53-.72z'/%3E%3C/svg%3E")
    left center / var(--star-size) var(--star-size) repeat-x;
}
.course-score-count {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-wrap: balance;
}
.course-review-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.course-review-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(21rem, 1fr));
  gap: var(--tile-gap);
}
.course-review .card-body { gap: var(--space-3); }
.course-review-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.course-review-id {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}
.course-review-name {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
}
.course-review-meta { font-size: var(--fs-xs); color: var(--text-muted); }
.course-review-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
}
.course-review-body {
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
}
.course-review-helpful {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.course-review-thumb {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   7. FAQ
   -------------------------------------------------------------------------- */
.course-faq .accordion-panel p {
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
  max-width: 76ch;
}
.course-faq .accordion-title { white-space: normal; }

/* --------------------------------------------------------------------------
   8. The sticky purchase rail
   -------------------------------------------------------------------------- */
/* The rail keeps the shared sticky offset; the padding is only there so a
   focus ring on the card is not shaved by the grid edge. */
.course-rail {
  padding: var(--space-1);
  margin: calc(var(--space-1) * -1);
}

.course-buy {
  box-shadow: var(--shadow-xl);
  border-color: var(--border-strong);
}

.course-buy-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--card-pad);
}
.course-buy-skeleton .skeleton-block { height: 9rem; }

/* Preview plate ----------------------------------------------------------- */
.course-preview {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5) var(--card-pad);
  color: var(--text-on-brand);
  background: linear-gradient(140deg, var(--course-a, var(--a-400)) 0%, var(--course-b, var(--a-600)) 100%);
}
.course-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(12rem 9rem at 88% 8%, rgba(255, 255, 255, 0.26) 0%, transparent 70%),
    radial-gradient(14rem 10rem at 6% 104%, rgba(10, 12, 24, 0.28) 0%, transparent 72%);
}
.course-preview-glyph {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  margin-bottom: var(--space-1);
}
.course-preview-glyph > svg { width: 1.6rem; height: 1.6rem; }
.course-preview-eyebrow {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  opacity: 0.88;
}
.course-preview-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
}
.course-preview-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  list-style: none;
  margin: var(--space-1) 0 0;
  padding: 0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.course-preview-facts > li + li::before {
  content: "·";
  margin-right: var(--space-3);
  opacity: 0.7;
}

/* Body -------------------------------------------------------------------- */
.course-buy-body { gap: var(--space-5); }

.course-buy-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--text-muted);
}

.course-tier-pick {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.course-tier-picker .segmented-option { padding-inline: var(--space-2); }
.course-tier-flag {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.course-tier-hint {
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}

.course-price .price-main { font-size: var(--fs-4xl); }
.course-price .price-total,
.course-plan .price-total { color: var(--text-muted); }

.course-incart {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.course-buy-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.course-refund {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}
.course-refund-icon {
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.08rem;
  color: var(--success);
}

.course-includes { font-size: var(--fs-md); gap: var(--space-2); }

.course-buy-foot {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-align: center;
}

/* Enrolled state ---------------------------------------------------------- */
.course-enrolled-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.course-next {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
}
.course-next-label {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--primary-soft-text);
}
.course-next-name {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--text);
}
.course-next-meta { font-size: var(--fs-sm); color: var(--text-muted); }

/* --------------------------------------------------------------------------
   9. Plans band
   -------------------------------------------------------------------------- */
.course-plans { background: var(--surface-2); border-block: 1px solid var(--border-subtle); }

.course-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--tile-gap);
  align-items: start;
}
.course-plan .card-body { gap: var(--space-5); }
.course-plan-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.course-plan-name {
  font-size: var(--fs-2xl);
  letter-spacing: var(--tracking-tight);
}
.course-plan-tagline {
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
  max-width: 44ch;
}
.course-plan-bridge {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: calc(var(--space-2) * -1);
}
.course-plan-features { font-size: var(--fs-md); }

/* Centred prose carrying an inline link. It must stay a block: as a flex row
   the sentence broke into separate items and read out of order. */
.course-plan-note {
  display: block;
  max-width: 72ch;
  margin: var(--space-8) auto 0;
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
  text-align: center;
  text-wrap: pretty;
}
.course-plan-note a { color: var(--primary); }

/* --------------------------------------------------------------------------
   10. Related courses
   -------------------------------------------------------------------------- */
.course-related { height: 100%; }
.course-related .card-body { gap: var(--space-4); }
.course-related-tile {
  background: linear-gradient(135deg, var(--course-a, var(--a-400)), var(--course-b, var(--a-600)));
}
.course-related-title {
  font-size: var(--fs-lg);
  letter-spacing: var(--tracking-tight);
}
.course-related-link { color: inherit; text-decoration: none; }
.course-related-link:hover { color: var(--primary); text-decoration: none; }
.course-related-link:focus-visible {
  outline: var(--ring-w) solid var(--focus-ring-color);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}
.course-related-sub {
  font-size: var(--fs-md);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}
.course-related-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.course-related-price {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.course-related-gst {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
}
.course-related-foot .rating-count { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   11. Unknown course id
   -------------------------------------------------------------------------- */
.course-notfound .empty-state h1 {
  font-size: var(--fs-3xl);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}
.course-notfound .empty-state-art {
  width: 8.5rem;
  max-width: 100%;
  color: var(--primary);
}
.course-notfound .empty-state-art svg { width: 100%; height: auto; }

/* --------------------------------------------------------------------------
   12. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .course-title { font-size: var(--fs-4xl); }
  .course-review-summary { grid-template-columns: minmax(0, 1fr); }
  .course-review-score { flex-direction: row; flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 960px) {
  .course-top { padding-bottom: var(--space-12); }
  .course-shell { grid-template-rows: none; gap: var(--space-8); }
  .course-hero,
  .course-rail,
  .course-body { grid-column: auto; grid-row: auto; }
}

@media (max-width: 780px) {
  .course-split { grid-template-columns: minmax(0, 1fr); }
  .course-plan-grid { grid-template-columns: minmax(0, 1fr); }
  .course-tabbar { margin-inline: calc(var(--container-pad) * -1); padding-inline: var(--container-pad); }
}

@media (max-width: 560px) {
  .course-title { font-size: var(--fs-3xl); }
  .course-subtitle { font-size: var(--fs-lg); }
  .course-blurb { font-size: var(--fs-base); }
  .course-meta { gap: var(--space-2) var(--space-4); font-size: var(--fs-sm); }
  #rating-pop { min-width: 0; }
  .course-dist-row { grid-template-columns: 2.5rem minmax(0, 1fr) 3rem; gap: var(--space-2); }
  .course-outcomes { grid-template-columns: minmax(0, 1fr); }
  .course-review-list { grid-template-columns: minmax(0, 1fr); }
  /* Title and runtime keep the first line; the chips drop underneath,
     indented to line up with the title rather than the kind icon. */
  .course-lectures .lecture-row { flex-wrap: wrap; row-gap: var(--space-2); }
  .course-lectures .lecture-state { order: 1; }
  .course-lectures .lecture-name { order: 2; flex: 1 1 8rem; }
  .course-lectures .lecture-time { order: 3; }
  .course-lecture-tags {
    order: 4;
    flex: 1 1 100%;
    justify-content: flex-start;
    padding-left: calc(1.25rem + var(--space-3));
  }
  .course-teacher-head { gap: var(--space-4); }
  .course-score-stars { --star-size: 1.25rem; }
}

/* The rail is a purchase panel, not a print artefact. */
@media print {
  .course-rail,
  .course-tabbar { display: none; }
}
