/* Defines reusable design values so the palette and spacing can be changed from one place. */
:root {
  --ice: #e2f4ff; /* Keeps the user's original pale-blue preference as the principal canvas. */
  --ink: #090b0e; /* Supplies the near-black used for text, borders, and high-contrast panels. */
  --paper: #f7fbfd; /* Creates a cool near-white surface without introducing beige. */
  --amber: #f4b860; /* Borrows Rob FWA's restrained amber signal colour. */
  --orange: #ff4d1f; /* Adds one energetic editorial accent inspired by Love + Money. */
  --muted-ink: #53616d; /* Provides quieter readable text for explanations and metadata. */
  --line: rgb(9 11 14 / 18%); /* Creates subtle rules that remain related to the ink colour. */
  --shadow: 0 18px 60px rgb(9 11 14 / 10%); /* Gives interactive surfaces restrained depth. */
  --sans: "Space Grotesk", Arial, Helvetica, sans-serif; /* Sets the bold editorial type family. */
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace; /* Sets the technical label type family. */
  --page-pad: clamp(1.25rem, 4vw, 4.5rem); /* Scales page-edge spacing smoothly across screen sizes. */
  --section-space: clamp(5rem, 12vw, 11rem); /* Scales vertical section spacing without fixed breakpoints. */
  --max-width: 96rem; /* Prevents content becoming unreadably wide on large monitors. */
}

/* Makes every declared width include its padding and border. */
*,
/* Extends predictable sizing to generated decorative content. */
*::before,
/* Extends predictable sizing to generated decorative content. */
*::after {
  box-sizing: border-box; /* Uses the easier-to-reason-about border-box sizing model. */
}

/* Enables smooth anchor movement while preserving normal document scrolling. */
html {
  scroll-behavior: smooth; /* Animates in-page navigation without taking control of the scroll wheel. */
  background: var(--ink); /* Prevents a white flash around the page during overscroll. */
}

/* Establishes the global page appearance. */
body {
  min-width: 20rem; /* Avoids unsupported layouts below a practical mobile width. */
  margin: 0; /* Removes the browser's default outer margin. */
  overflow-x: hidden; /* Prevents the moving marquee from creating horizontal scrolling. */
  background: var(--ice); /* Applies the preferred blue across the complete page. */
  color: var(--ink); /* Sets the default readable foreground colour. */
  font-family: var(--sans); /* Applies the editorial sans serif to ordinary page copy. */
  font-size: 1rem; /* Uses the browser's accessible root font size as the default. */
  line-height: 1.5; /* Gives paragraphs comfortable vertical rhythm. */
}

/* Makes keyboard-only navigation visible when the link receives focus. */
.skip-link {
  position: fixed; /* Keeps the accessibility link relative to the viewport. */
  top: 0.75rem; /* Places it near the upper screen edge. */
  left: 0.75rem; /* Places it near the left screen edge. */
  z-index: 100; /* Ensures it appears over the sticky header. */
  padding: 0.75rem 1rem; /* Creates a comfortably clickable target. */
  transform: translateY(-180%); /* Hides it visually until keyboard focus arrives. */
  background: var(--ink); /* Gives the revealed link maximum contrast. */
  color: var(--paper); /* Makes its text readable on the dark surface. */
  font-family: var(--mono); /* Distinguishes utility navigation from editorial content. */
}

/* Reveals the skip link when a keyboard user tabs to it. */
.skip-link:focus {
  transform: translateY(0); /* Moves the link into the visible viewport. */
}

/* Creates the slim persistent navigation bar. */
.site-header {
  position: fixed; /* Keeps navigation visible during the full scrolling story. */
  inset: 0 0 auto; /* Pins the header to the top and both horizontal edges. */
  z-index: 50; /* Places it above panels, cards, and marquees. */
  display: flex; /* Arranges branding and navigation on one row. */
  align-items: center; /* Vertically centres the header contents. */
  justify-content: space-between; /* Pushes the wordmark and navigation to opposite sides. */
  min-height: 3.5rem; /* Keeps a compact but touchable header height. */
  padding-inline: var(--page-pad); /* Aligns header content with the page grid. */
  border-bottom: 1px solid rgb(226 244 255 / 22%); /* Adds a precise separator over dark backgrounds. */
  background: rgb(9 11 14 / 86%); /* Creates a translucent near-black navigation surface. */
  color: var(--paper); /* Makes header text readable on the dark surface. */
  backdrop-filter: blur(14px); /* Softens page content visible behind the translucent header. */
}

/* Styles the compact brand identifier. */
.wordmark {
  color: inherit; /* Uses the foreground colour of its current section. */
  font-family: var(--mono); /* Applies the reference-inspired technical type style. */
  font-size: 0.72rem; /* Keeps the wordmark deliberately compact. */
  font-weight: 600; /* Makes the small lettering remain legible. */
  letter-spacing: 0.22em; /* Creates the widely spaced Rob FWA-like labelling. */
  text-decoration: none; /* Removes the browser's standard underline. */
}

/* Arranges primary navigation links in a compact row. */
.site-nav {
  display: flex; /* Places navigation links beside each other. */
  align-items: center; /* Aligns all links vertically. */
  gap: clamp(0.8rem, 2.5vw, 2rem); /* Adjusts link spacing for the available width. */
}

/* Styles navigation as understated interface labels. */
.site-nav a {
  color: inherit; /* Uses the header's light foreground colour. */
  font-family: var(--mono); /* Matches navigation with the technical identity system. */
  font-size: 0.67rem; /* Keeps labels small enough for mobile headers. */
  letter-spacing: 0.12em; /* Adds clarity and character to the small text. */
  text-decoration: none; /* Removes default underlines. */
  text-transform: uppercase; /* Gives navigation a consistent visual rhythm. */
}

/* Signals interactive navigation on hover and keyboard focus. */
.site-nav a:hover,
/* Shares the same signal for keyboard users. */
.site-nav a:focus-visible {
  color: var(--amber); /* Uses amber as the navigation feedback colour. */
}

/* Styles the saved-course count as a compact live badge. */
.saved-nav-link span {
  display: inline-grid; /* Creates a reliable centred badge box. */
  place-items: center; /* Centres one- or two-digit counts. */
  min-width: 1.25rem; /* Preserves a circular shape for a single digit. */
  min-height: 1.25rem; /* Gives the count a consistent badge height. */
  margin-left: 0.25rem; /* Separates the badge from its label. */
  padding-inline: 0.25rem; /* Allows two-digit counts without crowding. */
  border-radius: 999px; /* Creates the pill shape. */
  background: var(--amber); /* Makes saved state discoverable in the dark header. */
  color: var(--ink); /* Keeps the number readable on amber. */
}

/* Defines the shared geometry of every major scrolling panel. */
.panel {
  position: relative; /* Creates a positioning context for decorative children. */
  min-height: 100svh; /* Makes each narrative stage at least one stable viewport tall. */
  padding: var(--section-space) var(--page-pad); /* Adds responsive space inside every stage. */
  overflow: clip; /* Clips moving decorative content without introducing a scrollbar. */
}

/* Creates the dark opening screen. */
.hero {
  display: grid; /* Creates controllable rows for the headline and marquee. */
  grid-template-rows: 1fr auto; /* Gives the headline flexible height and the marquee natural height. */
  padding-top: clamp(7rem, 14vh, 10rem); /* Clears the fixed header and adds dramatic breathing room. */
  padding-bottom: 0; /* Lets the moving message touch the bottom edge. */
  background: var(--ink); /* Uses near-black for a high-impact first impression. */
  color: var(--ice); /* Carries the preferred blue into the hero typography. */
}

/* Constrains the hero statement while keeping it visually dominant. */
.hero__content {
  align-self: center; /* Centres the statement vertically within available space. */
  width: min(100%, var(--max-width)); /* Limits extreme line lengths on large screens. */
  margin-inline: auto; /* Centres the content container. */
}

/* Styles small technical labels used throughout the site. */
.eyebrow {
  margin: 0 0 1.5rem; /* Separates the label from the heading below. */
  color: currentColor; /* Allows the label to work on both light and dark panels. */
  font-family: var(--mono); /* Applies the restrained technical font. */
  font-size: clamp(0.65rem, 1vw, 0.78rem); /* Keeps the label compact but responsive. */
  font-weight: 500; /* Improves legibility at the small size. */
  letter-spacing: 0.18em; /* Recreates the spacious reference-site label rhythm. */
  line-height: 1.4; /* Prevents wrapped labels from feeling cramped. */
  text-transform: uppercase; /* Standardises the label system. */
}

/* Styles the oversized opening headline. */
.hero h1 {
  margin: 0; /* Removes browser heading margins. */
  font-size: clamp(4rem, 13vw, 12rem); /* Scales dramatically from phones to wide desktops. */
  font-weight: 600; /* Creates a bold silhouette without the heaviest available weight. */
  letter-spacing: -0.075em; /* Tightens large display lettering into an editorial word shape. */
  line-height: 0.78; /* Compresses the two headline lines for visual impact. */
  text-transform: uppercase; /* Echoes the assertive Love + Money typography. */
}

/* Forces each half of the product name onto its own line. */
.hero h1 span {
  display: block; /* Makes each span occupy a separate row. */
}

/* Offsets the second headline line to create motion even while static. */
.hero h1 span:last-child {
  margin-left: clamp(0rem, 8vw, 8rem); /* Adds a responsive horizontal step. */
  color: var(--amber); /* Uses amber as the hero's single focal accent. */
}

/* Styles the short product explanation below the headline. */
.hero__summary {
  max-width: 38rem; /* Keeps the summary easy to scan. */
  margin: clamp(2rem, 5vw, 4rem) 0 1.5rem auto; /* Positions it beneath and toward the right of the headline. */
  font-size: clamp(1.15rem, 2.2vw, 1.8rem); /* Makes the summary feel substantial but secondary. */
  line-height: 1.25; /* Creates a compact editorial paragraph. */
}

/* Styles important textual calls to action. */
.text-link {
  display: inline-flex; /* Keeps the words and arrow aligned. */
  align-items: center; /* Vertically centres the call-to-action contents. */
  gap: 0.75rem; /* Separates the label from its directional symbol. */
  padding-bottom: 0.3rem; /* Creates room above the custom underline. */
  border-bottom: 1px solid currentColor; /* Replaces a default underline with a clean rule. */
  color: inherit; /* Uses the current panel foreground colour. */
  font-family: var(--mono); /* Gives calls to action an interface-like character. */
  font-size: 0.76rem; /* Keeps the link precise and understated. */
  letter-spacing: 0.12em; /* Matches the technical typographic system. */
  text-decoration: none; /* Removes the browser underline. */
  text-transform: uppercase; /* Creates consistent interface labelling. */
}

/* Provides visible interaction feedback. */
.text-link:hover,
/* Shares the feedback with keyboard navigation. */
.text-link:focus-visible {
  color: var(--amber); /* Highlights the action with the signal colour. */
}

/* Creates the clipped band for continuously moving type. */
.marquee {
  width: calc(100% + (var(--page-pad) * 2)); /* Extends the band across the panel padding. */
  margin-left: calc(var(--page-pad) * -1); /* Pulls the band back to the left viewport edge. */
  overflow: hidden; /* Hides text outside the moving band. */
  border-top: 1px solid rgb(226 244 255 / 25%); /* Separates the band from the hero statement. */
  background: var(--orange); /* Adds a controlled burst of editorial energy. */
  color: var(--ink); /* Keeps the oversized moving words highly legible. */
}

/* Holds two copies of the moving statement on one uninterrupted row. */
.marquee__track {
  display: flex; /* Places every phrase in a continuous horizontal row. */
  width: max-content; /* Allows the row to become as wide as its content requires. */
  animation: marquee 28s linear infinite; /* Moves at a constant calm speed and loops forever. */
}

/* Styles each repeated phrase in the moving band. */
.marquee__track span {
  display: inline-block; /* Makes spacing and borders apply predictably. */
  padding: 0.75rem 2.5rem; /* Gives each phrase breathing room. */
  border-right: 1px solid rgb(9 11 14 / 30%); /* Separates adjacent phrases with a fine rule. */
  font-size: clamp(1.4rem, 4vw, 3.5rem); /* Scales the moving message with the viewport. */
  font-weight: 600; /* Keeps moving text readable at speed. */
  letter-spacing: -0.04em; /* Tightens the display lettering. */
  line-height: 1; /* Keeps the band compact. */
  white-space: nowrap; /* Prevents phrases wrapping during the animation. */
}

/* Defines the continuous leftward movement of the repeated marquee track. */
@keyframes marquee {
  from { transform: translateX(0); } /* Begins with the first sequence in its natural position. */
  to { transform: translateX(-50%); } /* Ends after one duplicated sequence has crossed the viewport. */
}

/* Creates the pale narrative section. */
.problem {
  background: var(--ice); /* Returns to the user's preferred blue canvas. */
  color: var(--ink); /* Uses near-black for strong editorial contrast. */
}

/* Establishes the shared two-column introduction layout. */
.section-intro {
  display: grid; /* Enables deliberate alignment between label, heading, and explanation. */
  grid-template-columns: minmax(9rem, 0.55fr) minmax(0, 1.8fr); /* Gives the main message substantially more width. */
  gap: clamp(2rem, 6vw, 7rem); /* Separates the technical label from the narrative. */
  width: min(100%, var(--max-width)); /* Keeps the introduction aligned to the central content grid. */
  margin-inline: auto; /* Centres the introduction on large screens. */
}

/* Places the section label in the narrow first column. */
.section-intro > .eyebrow {
  grid-column: 1; /* Keeps the technical marker on the left. */
}

/* Places the main section heading in the wider column. */
.section-intro > h2 {
  grid-column: 2; /* Aligns the headline with the narrative column. */
  margin: 0; /* Removes the default heading margin. */
  font-size: clamp(2.8rem, 7vw, 7rem); /* Makes narrative headings a major visual event. */
  font-weight: 500; /* Keeps the large type confident rather than heavy. */
  letter-spacing: -0.065em; /* Tightens the large heading for an editorial texture. */
  line-height: 0.95; /* Compresses multiline display type. */
}

/* Places the explanatory lead under the large section heading. */
.section-intro > .lede {
  grid-column: 2; /* Aligns supporting copy with the headline above. */
  max-width: 48rem; /* Limits line length for comfortable reading. */
  margin: 1.5rem 0 0; /* Adds controlled separation from the heading. */
  color: var(--muted-ink); /* Reduces emphasis relative to the headline. */
  font-size: clamp(1.15rem, 2vw, 1.55rem); /* Keeps lead copy visibly distinct from body copy. */
  line-height: 1.4; /* Gives the larger paragraph adequate breathing room. */
}

/* Creates a denser introduction suitable for the interactive matcher. */
.section-intro--compact > h2 {
  font-size: clamp(2.5rem, 5.8vw, 5.8rem); /* Reduces the heading slightly to make room for controls. */
}

/* Arranges headline statistics as equal editorial cards. */
.stat-grid {
  display: grid; /* Places statistic cards in responsive columns. */
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* Creates three equal evidence columns. */
  width: min(100%, var(--max-width)); /* Aligns statistics with the main page grid. */
  margin: clamp(4rem, 9vw, 8rem) auto; /* Separates statistics from surrounding narrative. */
  border-top: 1px solid var(--ink); /* Defines the top of the statistical strip. */
  border-bottom: 1px solid var(--ink); /* Defines the bottom of the statistical strip. */
}

/* Styles one statistic within the strip. */
.stat-card {
  min-width: 0; /* Allows long labels to wrap instead of widening the grid. */
  padding: clamp(1.5rem, 3vw, 3rem); /* Adds responsive internal space. */
  border-right: 1px solid var(--ink); /* Separates neighbouring statistics. */
}

/* Removes the final unnecessary vertical separator. */
.stat-card:last-child {
  border-right: 0; /* Leaves the outer strip edge visually clean. */
}

/* Styles the large placeholder statistic. */
.stat-card strong {
  display: block; /* Places the value above its explanation. */
  margin-bottom: 1rem; /* Separates the value from its label. */
  color: var(--orange); /* Marks provisional evidence with the energetic accent. */
  font-size: clamp(3rem, 7vw, 7rem); /* Makes each statistic immediately scannable. */
  font-weight: 600; /* Gives values strong visual weight. */
  letter-spacing: -0.07em; /* Tightens the large numerals. */
  line-height: 0.85; /* Keeps the value visually compact. */
}

/* Styles the statistic explanation. */
.stat-card p {
  margin: 0; /* Removes default paragraph margins. */
  font-size: clamp(1rem, 1.5vw, 1.2rem); /* Keeps the description readable across widths. */
  line-height: 1.35; /* Balances compact cards with readable copy. */
}

/* Styles the placeholder source warning. */
.stat-card small {
  display: block; /* Places the warning beneath the statistic label. */
  margin-top: 1rem; /* Separates source information from the claim. */
  color: var(--muted-ink); /* Keeps source metadata secondary. */
  font-family: var(--mono); /* Distinguishes evidence metadata from prose. */
  font-size: 0.65rem; /* Keeps the warning compact. */
  letter-spacing: 0.08em; /* Improves small mono text legibility. */
  text-transform: uppercase; /* Gives source metadata a consistent shape. */
}

/* Arranges the cost and response narratives side by side. */
.problem__story {
  display: grid; /* Creates equal narrative columns. */
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* Gives each narrative equal visual status. */
  gap: clamp(3rem, 10vw, 12rem); /* Creates a generous editorial divide. */
  width: min(100%, var(--max-width)); /* Aligns the stories to the central page grid. */
  margin-inline: auto; /* Centres the story container. */
}

/* Styles narrative subheadings. */
.problem__story h3 {
  margin: 0 0 1.2rem; /* Separates each heading from its paragraph. */
  font-size: clamp(1.8rem, 3vw, 3rem); /* Establishes a clear subsection hierarchy. */
  font-weight: 500; /* Keeps subheadings visually calm. */
  letter-spacing: -0.045em; /* Tightens display type. */
  line-height: 1; /* Keeps short headings compact. */
}

/* Styles the narrative body copy. */
.problem__story article > p:last-child {
  max-width: 37rem; /* Keeps prose at a readable measure. */
  margin: 0; /* Removes default paragraph margins. */
  color: var(--muted-ink); /* Lowers contrast slightly for long reading. */
  font-size: 1.08rem; /* Makes the explanation comfortable without competing with headings. */
}

/* Creates a full-width transition link into the matcher. */
.section-jump {
  display: flex; /* Places the label and arrow on one row. */
  align-items: center; /* Vertically centres both pieces. */
  justify-content: space-between; /* Pushes the arrow to the opposite edge. */
  width: min(100%, var(--max-width)); /* Aligns the transition with the page grid. */
  margin: clamp(4rem, 9vw, 8rem) auto 0; /* Gives the transition generous separation. */
  padding: 1.25rem 0; /* Enlarges the interactive area. */
  border-top: 1px solid var(--ink); /* Frames the transition with precise rules. */
  border-bottom: 1px solid var(--ink); /* Frames the transition with precise rules. */
  color: var(--ink); /* Keeps the action strong on the blue panel. */
  font-size: clamp(1.15rem, 2.5vw, 2rem); /* Makes the section transition prominent. */
  text-decoration: none; /* Removes the browser underline. */
}

/* Adds motion to the directional arrow on interaction. */
.section-jump:hover span:last-child,
/* Includes keyboard interaction in the same animation. */
.section-jump:focus-visible span:last-child {
  transform: translateY(0.35rem); /* Nudges the arrow in its promised direction. */
}

/* Animates the arrow smoothly rather than snapping. */
.section-jump span:last-child {
  transition: transform 180ms ease; /* Defines a brief responsive movement. */
}

/* Creates the dark interactive matching stage. */
.matcher {
  background: var(--ink); /* Separates the input task from the explanatory narrative. */
  color: var(--paper); /* Makes form text readable on the dark panel. */
}

/* Adjusts muted lead text for a dark background. */
.matcher .lede {
  color: rgb(247 251 253 / 66%); /* Provides softer supporting copy on near-black. */
}

/* Arranges qualifications and interests in an asymmetric two-column interface. */
.matcher-form {
  display: grid; /* Enables the requested left and larger right columns. */
  grid-template-columns: minmax(17rem, 0.78fr) minmax(0, 1.55fr); /* Makes the search-term side visibly larger. */
  gap: clamp(1rem, 3vw, 2.5rem); /* Separates the two functional groups. */
  width: min(100%, var(--max-width)); /* Aligns the interface with the rest of the site. */
  margin: clamp(3rem, 7vw, 6rem) auto 0; /* Separates controls from their introduction. */
}

/* Removes default fieldset decoration and creates intentional panels. */
.filter-panel {
  min-width: 0; /* Allows controls to shrink within the grid. */
  margin: 0; /* Removes browser fieldset margins. */
  padding: clamp(1.5rem, 3vw, 3rem); /* Gives controls generous responsive spacing. */
  border: 1px solid rgb(226 244 255 / 23%); /* Adds a precise low-contrast panel boundary. */
  border-radius: 0; /* Keeps the interface sharp and editorial rather than app-template-like. */
  background: rgb(226 244 255 / 4%); /* Slightly lifts the panel from the dark canvas. */
}

/* Gives the wider interest panel a subtle focal treatment. */
.filter-panel--interests {
  background: var(--ice); /* Uses the brand blue to emphasise the search controls. */
  color: var(--ink); /* Restores dark readable text on the blue surface. */
}

/* Styles fieldset legends as section identifiers. */
.filter-panel legend {
  float: left; /* Turns the legend into a stable panel header instead of a border interruption. */
  width: 100%; /* Prevents the label colliding with or overlaying the first input. */
  margin: 0 0 0.5rem; /* Separates the group heading from its fields. */
  padding: 0 0 1rem; /* Gives the heading a deliberate lower edge. */
  border-bottom: 1px solid currentColor; /* Frames the heading without text crossing a border. */
  color: inherit; /* Adapts the label to either panel background. */
  font-family: var(--mono); /* Applies the technical identity. */
  font-size: 0.72rem; /* Keeps group labels restrained. */
  letter-spacing: 0.14em; /* Improves small uppercase text. */
  text-transform: uppercase; /* Creates consistent control-group labels. */
}

/* Clears the floated legend so the first field always starts underneath it. */
.filter-panel > label:first-of-type {
  clear: both; /* Prevents the Academic interests heading from overlaying the first label. */
}

/* Styles individual field labels. */
.filter-panel label {
  display: block; /* Places each label on its own line. */
  margin: 1.35rem 0 0.55rem; /* Separates controls into readable vertical groups. */
  font-size: 0.92rem; /* Keeps labels clear but secondary. */
  font-weight: 600; /* Provides enough contrast against entered values. */
}

/* Gives text inputs and selects one coherent visual language. */
.filter-panel input,
/* Shares input styling with the generated grade menu. */
.filter-panel select {
  width: 100%; /* Makes controls fill their assigned column. */
  min-height: 3.65rem; /* Creates accessible touch targets. */
  padding: 0.85rem 1rem; /* Gives values comfortable internal spacing. */
  border: 1px solid currentColor; /* Uses the panel foreground to define the control. */
  border-radius: 0; /* Maintains the sharp editorial geometry. */
  outline: 0; /* Removes the default outline so a deliberate focus style can replace it. */
  background: transparent; /* Lets controls inherit the character of their panel. */
  color: inherit; /* Keeps values readable in both light and dark panels. */
  font: 500 1rem/1.2 var(--sans); /* Applies consistent control typography. */
}

/* Makes options readable even when the select sits on a dark panel. */
.filter-panel option {
  background: var(--paper); /* Gives native menu options a light surface. */
  color: var(--ink); /* Gives native menu options dark text. */
}

/* Creates an unmistakable but restrained keyboard focus state. */
.filter-panel input:focus,
/* Shares the focus state with the grade select. */
.filter-panel select:focus {
  box-shadow: 0 0 0 4px rgb(244 184 96 / 35%); /* Surrounds the active field with translucent amber. */
}

/* Styles explanatory copy attached to fields. */
.field-help {
  margin: 0.55rem 0 0; /* Keeps help close to the control it describes. */
  color: currentColor; /* Adapts to the current panel. */
  font-family: var(--mono); /* Distinguishes help from entered content. */
  font-size: 0.68rem; /* Keeps help unobtrusive. */
  letter-spacing: 0.04em; /* Improves mono text legibility. */
  opacity: 0.62; /* Lowers its visual priority. */
}

/* Explains how every active filter contributes to the overall match percentage. */
.score-help {
  margin: 1.5rem 0 0; /* Separates the weighting note from field-specific help. */
  padding-top: 1rem; /* Creates room beneath its framing rule. */
  border-top: 1px solid rgb(9 11 14 / 28%); /* Distinguishes scoring logic from input instructions. */
  color: var(--ink); /* Keeps the transparent scoring explanation readable. */
  font-family: var(--mono); /* Gives the weighting formula an analytical voice. */
  font-size: 0.68rem; /* Keeps the explanation secondary to the fields. */
  line-height: 1.55; /* Preserves readability when the formula wraps. */
}

/* Styles the principal action inside the matcher. */
.match-button {
  display: flex; /* Places the button label and arrow on one row. */
  align-items: center; /* Vertically centres the contents. */
  justify-content: space-between; /* Sends the arrow to the button's far edge. */
  width: 100%; /* Gives the action full prominence in the wider panel. */
  min-height: 4.5rem; /* Creates a generous accessible target. */
  margin-top: 2rem; /* Separates the action from the final field. */
  padding: 1rem 1.25rem; /* Gives the action balanced internal spacing. */
  border: 1px solid var(--ink); /* Defines the button against the blue panel. */
  border-radius: 0; /* Matches the rest of the sharp interface. */
  background: var(--ink); /* Creates maximum visual contrast. */
  color: var(--paper); /* Keeps the action label readable. */
  font: 600 0.86rem/1 var(--mono); /* Uses a strong technical label style. */
  letter-spacing: 0.1em; /* Gives the action an intentional identity. */
  text-transform: uppercase; /* Matches other interface labels. */
  cursor: pointer; /* Signals that the element can be activated. */
  transition: background 180ms ease, color 180ms ease, transform 180ms ease; /* Animates interaction feedback smoothly. */
}

/* Inverts the primary action on hover. */
.match-button:hover,
/* Includes keyboard users in the same interaction state. */
.match-button:focus-visible {
  background: var(--amber); /* Introduces the signal colour at the moment of action. */
  color: var(--ink); /* Maintains readable contrast on amber. */
  transform: translateY(-2px); /* Gives the control a small responsive lift. */
}

/* Styles live loading and success information. */
.form-status {
  min-height: 1.2em; /* Prevents layout movement when the status text changes. */
  margin: 1rem 0 0; /* Places status directly beneath the primary action. */
  color: currentColor; /* Adapts to the light panel. */
  font-family: var(--mono); /* Makes system feedback visually distinct. */
  font-size: 0.68rem; /* Keeps feedback compact. */
  opacity: 0.68; /* Prevents status text competing with the action. */
}

/* Creates the light results stage. */
.results {
  background: var(--paper); /* Separates analytical results from the blue narrative areas. */
  color: var(--ink); /* Uses high-contrast text on the cool white surface. */
}

/* Constrains the result heading to the shared page grid. */
.results__header {
  width: min(100%, var(--max-width)); /* Aligns the result introduction with both result views. */
  margin-inline: auto; /* Centres the result introduction. */
}

/* Styles the result heading as a major editorial statement. */
.results__header h2 {
  max-width: 64rem; /* Keeps the title from becoming too wide. */
  margin: 0; /* Removes default heading spacing. */
  font-size: clamp(3rem, 8vw, 8rem); /* Makes the result reveal feel consequential. */
  font-weight: 500; /* Balances scale with restraint. */
  letter-spacing: -0.07em; /* Tightens large display type. */
  line-height: 0.9; /* Creates a compact visual block. */
}

/* Styles the dynamic result summary. */
.results__header .lede {
  max-width: 48rem; /* Maintains a comfortable reading measure. */
  margin: 1.5rem 0 0; /* Separates the summary from the title. */
  color: var(--muted-ink); /* Makes the summary secondary to the title. */
  font-size: clamp(1.05rem, 2vw, 1.45rem); /* Gives the changing status enough presence. */
}

/* Frames each requested result mode. */
.result-view {
  width: min(100%, var(--max-width)); /* Aligns views with the page's central grid. */
  margin: clamp(4rem, 9vw, 8rem) auto 0; /* Separates views from the heading and each other. */
  padding-top: 1.5rem; /* Creates space beneath the framing rule. */
  border-top: 1px solid var(--ink); /* Defines the start of each analytical view. */
}

/* Arranges a result-view heading and explanation. */
.view-heading {
  display: grid; /* Gives the title and explanation deliberate columns. */
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.7fr); /* Gives the title slightly more visual weight. */
  gap: 2rem; /* Separates the view label from its explanation. */
  align-items: start; /* Aligns both text blocks at the top. */
  margin-bottom: 2rem; /* Separates the heading from its data display. */
}

/* Aligns the paginated result count to the right. */
.view-heading--row {
  grid-template-columns: 1fr auto; /* Gives the title remaining width and the count natural width. */
  align-items: end; /* Aligns the count to the title baseline area. */
}

/* Styles titles for each result mode. */
.view-heading h3 {
  margin: 0; /* Removes browser heading margins. */
  font-size: clamp(1.6rem, 3vw, 2.7rem); /* Establishes a clear analytical hierarchy. */
  font-weight: 500; /* Keeps view labels refined. */
  letter-spacing: -0.045em; /* Tightens the heading. */
  line-height: 1; /* Keeps the label compact. */
}

/* Styles result-view explanations and counts. */
.view-heading p {
  margin: 0; /* Removes default paragraph spacing. */
  color: var(--muted-ink); /* Keeps explanatory text secondary. */
  font-family: var(--mono); /* Gives analytical metadata a technical character. */
  font-size: 0.72rem; /* Keeps metadata compact. */
  letter-spacing: 0.05em; /* Improves mono text legibility. */
}

/* Presents the exact, overmatch, and undermatch definitions before the university cells. */
.mismatch-key {
  display: grid; /* Aligns all three definitions in a scannable row. */
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* Gives every status equal space. */
  gap: 1px; /* Creates fine separators using the parent background. */
  margin-bottom: 1rem; /* Keeps the key attached to the heatmap. */
  background: var(--ink); /* Supplies the separator colour. */
  border: 1px solid var(--ink); /* Frames the complete key. */
}

/* Styles each mismatch definition as a compact explanatory cell. */
.mismatch-key p {
  display: grid; /* Places the status above its meaning. */
  gap: 0.35rem; /* Separates label and explanation. */
  margin: 0; /* Removes browser paragraph margins. */
  padding: 0.9rem; /* Gives the compact key comfortable space. */
  background: var(--paper); /* Restores a readable light surface. */
  font-size: 0.75rem; /* Keeps the key secondary to results. */
}

/* Gives mismatch-key labels the technical interface voice. */
.mismatch-key strong {
  font-family: var(--mono); /* Matches status labels elsewhere. */
  font-size: 0.66rem; /* Keeps labels compact. */
  letter-spacing: 0.06em; /* Improves small uppercase readability. */
  text-transform: uppercase; /* Standardises the three terms. */
}

/* Softens the longer mismatch explanations. */
.mismatch-key span {
  color: var(--muted-ink); /* Establishes a secondary text level. */
}

/* Creates the dense heatmap-like grid. */
.heatmap {
  display: grid; /* Arranges department cells in a compact matrix. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); /* Fits as many readable cells per row as space permits. */
  gap: 2px; /* Creates fine dark channels between cells. */
  background: var(--ink); /* Supplies the channel colour between heatmap cells. */
  border: 2px solid var(--ink); /* Frames the complete matrix. */
}

/* Styles one best-match heatmap cell. */
.heat-cell {
  display: flex; /* Creates a vertical content stack. */
  flex-direction: column; /* Places metadata above the course title and score. */
  min-height: 11rem; /* Gives cells a consistent substantial shape. */
  padding: 1rem; /* Creates space around dense analytical content. */
  border: 0; /* Removes default button borders. */
  background: hsl(calc(202deg - (var(--score) * 1.62deg)) 88% calc(93% - (var(--score) * 0.34%))); /* Maps low scores from blue toward warm orange as scores rise. */
  color: var(--ink); /* Keeps every heat colour paired with readable dark text. */
  font-family: inherit; /* Preserves the site's typography inside the button. */
  text-align: left; /* Makes dense labels easy to scan. */
  cursor: pointer; /* Signals that clicking can locate the related course. */
  transition: filter 160ms ease, transform 160ms ease; /* Animates heatmap interaction without distraction. */
}

/* Highlights a heat cell on interaction. */
.heat-cell:hover,
/* Gives keyboard users the same feedback. */
.heat-cell:focus-visible {
  z-index: 1; /* Keeps the enlarged cell above its neighbours. */
  filter: saturate(1.25); /* Strengthens the current heat colour. */
  transform: scale(1.025); /* Makes the active cell lift from the matrix. */
}

/* Styles the department label in a heat cell. */
.heat-cell__group {
  margin-bottom: auto; /* Pushes the course information toward the bottom. */
  font-family: var(--mono); /* Uses the analytical label face. */
  font-size: 0.62rem; /* Fits longer department names. */
  letter-spacing: 0.07em; /* Improves compact mono text. */
  text-transform: uppercase; /* Standardises group labels. */
}

/* Styles the best course title in a heat cell. */
.heat-cell__course {
  margin-top: 1.5rem; /* Separates the course from the department label. */
  font-size: 1rem; /* Keeps the course readable in a dense matrix. */
  font-weight: 600; /* Gives the best match suitable emphasis. */
  line-height: 1.15; /* Keeps multiline titles compact. */
}

/* Displays the published entry grades prominently inside each university cell. */
.heat-cell__grade {
  margin-top: 0.85rem; /* Separates the grade fact from the course name. */
  font-family: var(--mono); /* Treats entry grades as structured metadata. */
  font-size: 0.7rem; /* Keeps the factual line compact. */
  font-weight: 600; /* Makes the requested grade value easy to scan. */
}

/* Creates the shared grade-relationship badge. */
.mismatch-badge {
  width: max-content; /* Keeps the badge fitted to its label. */
  max-width: 100%; /* Prevents long unavailable labels overflowing a narrow cell. */
  margin-top: 0.6rem; /* Separates the badge from the grade fact. */
  padding: 0.3rem 0.5rem; /* Gives the status a compact pill-like surface. */
  border: 1px solid currentColor; /* Reinforces the status without relying on colour alone. */
  font-family: var(--mono); /* Gives all statuses a consistent analytical voice. */
  font-size: 0.62rem; /* Fits status wording within dense cells. */
  font-weight: 600; /* Keeps small text readable. */
  letter-spacing: 0.05em; /* Improves compact label clarity. */
  text-transform: uppercase; /* Makes classifications visually consistent. */
}

/* Uses green for exact grade matches. */
.mismatch-badge--exact {
  background: #d9f8df; /* Creates a calm positive fill. */
  color: #164b24; /* Preserves readable contrast. */
}

/* Uses blue for student attainment above the course requirement. */
.mismatch-badge--overmatch {
  background: #dceeff; /* Keeps overmatch related to the site's blue palette. */
  color: #123f67; /* Preserves readable contrast. */
}

/* Uses warm orange for a course requirement above the student's pattern. */
.mismatch-badge--undermatch {
  background: #ffe3d5; /* Makes the caution visible without implying failure. */
  color: #7b250f; /* Preserves readable contrast. */
}

/* Uses a neutral surface when published grades cannot be compared. */
.mismatch-badge--unavailable {
  background: #edf0f2; /* Signals missing data without a success or warning colour. */
  color: #424d56; /* Keeps the fallback text readable. */
}

/* Explains the grade relationship beneath each university-cell badge. */
.heat-cell__note {
  margin-top: 0.55rem; /* Keeps the note attached to its status. */
  color: rgb(9 11 14 / 72%); /* Makes the explanation secondary to the course title. */
  font-size: 0.7rem; /* Fits complete explanations inside the matrix. */
  line-height: 1.35; /* Preserves readability when the note wraps. */
}

/* Styles the match percentage in a heat cell. */
.heat-cell__score {
  margin-top: 0.75rem; /* Separates the score from the course title. */
  font-family: var(--mono); /* Gives the number an analytical character. */
  font-size: 0.72rem; /* Keeps it subordinate to the course title. */
}

/* Creates a three-column course-card grid. */
.course-grid {
  display: grid; /* Arranges course results into columns. */
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* Creates the requested three-column desktop view. */
  gap: 1rem; /* Separates cards while retaining a dense results surface. */
}

/* Styles a ranked course result. */
.course-card {
  display: flex; /* Enables a card footer that stays at the bottom. */
  flex-direction: column; /* Stacks course information vertically. */
  min-width: 0; /* Prevents long course names from expanding the grid. */
  min-height: 14rem; /* Gives the simplified programme cards a compact consistent shape. */
  gap: 1rem; /* Separates rank, programme, status, and actions cleanly. */
  padding: 1.4rem; /* Adds compact but comfortable internal spacing. */
  border: 1px solid var(--line); /* Defines each result without a heavy outline. */
  background: var(--ice); /* Returns the brand blue inside the white results area. */
  box-shadow: 0 1px 0 rgb(9 11 14 / 4%); /* Adds a barely perceptible physical edge. */
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease; /* Creates restrained card feedback. */
}

/* Keeps the simplified card's mismatch label attached to its programme. */
.course-card > .mismatch-badge {
  margin-top: 0; /* Uses the card's grid gap instead of legacy badge spacing. */
}

/* Lifts a course card when explored. */
.course-card:hover {
  border-color: var(--ink); /* Makes the active card boundary decisive. */
  box-shadow: var(--shadow); /* Adds depth only during interaction. */
  transform: translateY(-4px); /* Moves the card slightly toward the visitor. */
}

/* Arranges the rank and match percentage. */
.course-card__meta {
  display: flex; /* Places both compact values on one row. */
  justify-content: space-between; /* Sends the score to the opposite edge. */
  gap: 1rem; /* Prevents the labels colliding. */
  margin-bottom: 1.5rem; /* Separates metadata from the title. */
  font-family: var(--mono); /* Uses the analytical type family. */
  font-size: 0.66rem; /* Keeps ranking metadata compact. */
  letter-spacing: 0.07em; /* Improves small mono text. */
  text-transform: uppercase; /* Standardises card metadata. */
}

/* Styles each course title. */
.course-card h4 {
  margin: 0; /* Removes browser heading spacing. */
  font-size: clamp(1.35rem, 2vw, 1.8rem); /* Makes course names the card's dominant content. */
  font-weight: 600; /* Creates strong but not overwhelming hierarchy. */
  letter-spacing: -0.04em; /* Tightens the title. */
  line-height: 1.05; /* Keeps long titles compact. */
}

/* Styles the department beneath the course title. */
.course-card__department {
  margin: 0.8rem 0 0; /* Separates department from title. */
  color: var(--muted-ink); /* Reduces department emphasis. */
  font-family: var(--mono); /* Treats the department as metadata. */
  font-size: 0.68rem; /* Keeps metadata compact. */
  line-height: 1.4; /* Allows long department names to wrap neatly. */
}

/* Holds short factual course information. */
.course-card__facts {
  display: grid; /* Stacks factual rows evenly. */
  gap: 0.5rem; /* Separates each factual row. */
  margin: 1.4rem 0; /* Creates space around the facts. */
  padding: 1rem 0; /* Creates internal breathing room between horizontal rules. */
  border-top: 1px solid var(--line); /* Defines the factual block. */
  border-bottom: 1px solid var(--line); /* Completes the factual block. */
}

/* Styles individual facts. */
.course-card__facts p {
  display: flex; /* Places each label and value on one line where possible. */
  justify-content: space-between; /* Aligns values to the opposite edge. */
  gap: 1rem; /* Prevents labels and values touching. */
  margin: 0; /* Removes default paragraph margins. */
  font-size: 0.82rem; /* Keeps facts compact. */
}

/* Styles fact labels. */
.course-card__facts strong {
  font-family: var(--mono); /* Gives labels a technical voice. */
  font-size: 0.65rem; /* Keeps labels secondary to their values. */
  font-weight: 500; /* Avoids overly heavy small text. */
  letter-spacing: 0.05em; /* Improves mono label clarity. */
  text-transform: uppercase; /* Standardises factual labels. */
}

/* Limits course descriptions to a consistent preview. */
.course-card__description {
  display: -webkit-box; /* Enables multi-line clamping in current browsers. */
  overflow: hidden; /* Hides description text beyond the preview. */
  margin: 0 0 1.5rem; /* Separates the preview from the card footer. */
  color: var(--muted-ink); /* Keeps long copy secondary. */
  font-size: 0.88rem; /* Fits useful detail without making cards too tall. */
  line-height: 1.5; /* Preserves readability in the smaller type. */
  -webkit-box-orient: vertical; /* Tells the clamp to count vertical text lines. */
  -webkit-line-clamp: 4; /* Shows no more than four description lines. */
}

/* Frames the complete grade relationship explanation inside each result card. */
.course-card__mismatch {
  margin: 0 0 1.1rem; /* Separates the note from facts above and description below. */
  padding: 0.7rem; /* Gives the explanation a compact callout surface. */
  border-left: 3px solid currentColor; /* Reinforces status without relying on background colour. */
  background: rgb(255 255 255 / 42%); /* Lifts the note gently from the pale-blue card. */
  font-size: 0.75rem; /* Keeps the explanation concise. */
  line-height: 1.4; /* Supports wrapped grade wording. */
}

/* Colours exact-match notes positively. */
.course-card__mismatch--exact {
  color: #164b24; /* Matches the exact badge's dark green. */
}

/* Colours overmatch notes in the analytical blue family. */
.course-card__mismatch--overmatch {
  color: #123f67; /* Matches the overmatch badge. */
}

/* Colours undermatch notes as a warm caution. */
.course-card__mismatch--undermatch {
  color: #7b250f; /* Matches the undermatch badge. */
}

/* Colours unavailable notes neutrally. */
.course-card__mismatch--unavailable {
  color: #424d56; /* Matches the unavailable badge. */
}

/* Holds the explanation and external course link at the card bottom. */
.course-card__footer {
  display: flex; /* Places explanation and link in one row. */
  align-items: end; /* Aligns both items to their lower edge. */
  justify-content: space-between; /* Pushes the external link to the right. */
  gap: 1rem; /* Prevents footer contents colliding. */
  margin-top: auto; /* Pushes the footer to the bottom of every equal-height card. */
}

/* Groups save and external-link actions at the card's lower edge. */
.course-card__actions {
  flex: 0 0 auto; /* Protects the actions from shrinking beside long explanations. */
  display: flex; /* Places both actions on one row. */
  gap: 0.45rem; /* Separates the save control from the external link. */
  align-items: stretch; /* Gives both actions the same visible height. */
  margin-top: auto; /* Keeps essential actions aligned at the bottom of simple cards. */
}

/* Styles the persistent save-course control. */
.course-card__save {
  min-height: 2.5rem; /* Matches the adjacent square external action. */
  padding: 0.55rem 0.7rem; /* Creates a comfortable compact target. */
  border: 1px solid var(--ink); /* Keeps the action clear on pale-blue cards. */
  background: transparent; /* Treats saving as a secondary action. */
  color: var(--ink); /* Uses the primary card foreground. */
  font: 600 0.62rem/1 var(--mono); /* Gives the control an interface label style. */
  letter-spacing: 0.04em; /* Improves compact text. */
  cursor: pointer; /* Signals that saved state can be toggled. */
}

/* Highlights courses already included in the comparison. */
.course-card__save[aria-pressed="true"] {
  background: var(--amber); /* Makes saved state visible without relying on the label alone. */
}

/* Adds immediate feedback to the save action. */
.course-card__save:hover,
/* Gives keyboard users the same interaction feedback. */
.course-card__save:focus-visible {
  background: var(--ink); /* Inverts the secondary action during interaction. */
  color: var(--paper); /* Keeps the label readable on ink. */
}

/* Styles the short reason a course ranked well. */
.course-card__reason {
  margin: 0; /* Removes default paragraph margins. */
  color: var(--muted-ink); /* Keeps the reason supportive rather than dominant. */
  font-family: var(--mono); /* Distinguishes algorithmic explanation from course content. */
  font-size: 0.62rem; /* Fits a short explanation in the card footer. */
  line-height: 1.4; /* Allows wrapping without crowding. */
}

/* Styles the external course link as a compact square action. */
.course-card__link {
  flex: 0 0 auto; /* Prevents the link shrinking beside long explanation text. */
  display: grid; /* Enables effortless centring of the arrow. */
  place-items: center; /* Centres the arrow horizontally and vertically. */
  width: 2.5rem; /* Creates a compact consistent action size. */
  height: 2.5rem; /* Makes the action square. */
  border: 1px solid var(--ink); /* Clearly defines the external action. */
  background: var(--ink); /* Gives the action decisive contrast. */
  color: var(--paper); /* Makes the arrow visible. */
  text-decoration: none; /* Removes default link decoration. */
}

/* Inverts the course link on interaction. */
.course-card__link:hover,
/* Includes keyboard interaction. */
.course-card__link:focus-visible {
  background: var(--amber); /* Uses the signal colour. */
  color: var(--ink); /* Preserves contrast on amber. */
}

/* Arranges pagination controls under the card grid. */
.pagination {
  display: grid; /* Provides stable alignment for previous, status, and next. */
  grid-template-columns: 1fr auto 1fr; /* Centres the page number while buttons occupy both sides. */
  align-items: center; /* Vertically aligns pagination content. */
  gap: 1rem; /* Separates all three items. */
  margin-top: 2rem; /* Moves pagination away from the final card row. */
  padding-top: 1rem; /* Creates space beneath the framing rule. */
  border-top: 1px solid var(--ink); /* Visually closes the result grid. */
}

/* Styles pagination actions as text-led controls. */
.pagination button {
  width: max-content; /* Keeps each button only as wide as its label. */
  padding: 0.75rem 0; /* Creates vertical target area without a button box. */
  border: 0; /* Removes native button chrome. */
  background: transparent; /* Keeps the editorial text-link treatment. */
  color: var(--ink); /* Uses the primary foreground colour. */
  font: 500 0.72rem/1 var(--mono); /* Applies consistent pagination typography. */
  letter-spacing: 0.06em; /* Improves small interface text. */
  cursor: pointer; /* Signals pagination interaction. */
}

/* Aligns the next-page action to the right edge. */
.pagination button:last-child {
  justify-self: end; /* Places the next action at the grid's far edge. */
}

/* Visually de-emphasises unavailable pagination actions. */
.pagination button:disabled {
  opacity: 0.28; /* Indicates that the action is unavailable. */
  cursor: not-allowed; /* Reinforces the disabled state. */
}

/* Styles the central page counter. */
.pagination span {
  font-family: var(--mono); /* Uses the analytical font. */
  font-size: 0.68rem; /* Keeps pagination status compact. */
  letter-spacing: 0.06em; /* Improves legibility. */
}

/* Hides supporting text visually while keeping it available to assistive technology. */
.visually-hidden {
  position: absolute; /* Removes the element from visible document flow. */
  width: 1px; /* Reduces the element to an imperceptible width. */
  height: 1px; /* Reduces the element to an imperceptible height. */
  padding: 0; /* Prevents padding from increasing its visible footprint. */
  margin: -1px; /* Pulls the final pixel outside normal layout. */
  overflow: hidden; /* Clips any remaining visible content. */
  clip: rect(0 0 0 0); /* Supports older browsers' clipping behaviour. */
  white-space: nowrap; /* Prevents hidden text wrapping into extra pixels. */
  border: 0; /* Removes any browser border. */
}

/* Gives the separate saved page a cool near-white canvas. */
.saved-page {
  background: var(--paper); /* Distinguishes comparison from the blue narrative panels. */
}

/* Creates the primary saved-course workspace beneath the fixed header. */
.saved-main {
  min-height: calc(100svh - 10rem); /* Keeps the footer low when only an empty state is present. */
  padding: clamp(7rem, 12vw, 10rem) var(--page-pad) var(--section-space); /* Clears the header and creates generous page edges. */
  background: var(--paper); /* Maintains the analytical results surface. */
}

/* Constrains and aligns the saved-page introduction. */
.saved-intro {
  width: min(100%, var(--max-width)); /* Uses the same central grid as the main site. */
  margin-inline: auto; /* Centres the introduction. */
}

/* Creates the large saved-page title. */
.saved-intro h1 {
  max-width: 70rem; /* Protects the headline's readable shape. */
  margin: 0; /* Removes browser heading margins. */
  font-size: clamp(3.2rem, 9vw, 8rem); /* Gives the comparison page equal visual importance. */
  font-weight: 500; /* Keeps large display type refined. */
  letter-spacing: -0.07em; /* Creates the established tight editorial setting. */
  line-height: 0.9; /* Keeps the headline compact. */
}

/* Limits the saved-page explanation to a readable measure. */
.saved-intro .lede {
  max-width: 52rem; /* Prevents an overly long line. */
  margin: 1.5rem 0 0; /* Separates supporting copy from the title. */
  color: var(--muted-ink); /* Keeps the headline visually dominant. */
  font-size: clamp(1rem, 2vw, 1.35rem); /* Scales the explanation gently. */
}

/* Reserves space for saved-course feedback without shifting the table. */
.saved-status {
  min-height: 1.3rem; /* Prevents movement when feedback changes. */
  margin: 1.25rem 0 0; /* Places feedback beneath the introduction. */
  color: var(--muted-ink); /* Keeps system feedback secondary. */
  font-family: var(--mono); /* Distinguishes status text from editorial copy. */
  font-size: 0.7rem; /* Keeps feedback compact. */
}

/* Creates one shared module-year switch for every course column. */
.module-switch {
  display: flex; /* Places the legend and year choices in one responsive row. */
  flex-wrap: wrap; /* Allows controls to wrap cleanly on narrow screens. */
  gap: 0.5rem; /* Separates each year choice. */
  align-items: center; /* Vertically aligns the label and buttons. */
  width: min(100%, var(--max-width)); /* Aligns the control with the comparison table. */
  margin: clamp(2rem, 5vw, 4rem) auto 0; /* Separates the switch from the introduction. */
  padding: 0; /* Removes default fieldset padding. */
  border: 0; /* Removes default fieldset borders. */
}

/* Styles the module-switch legend as a fixed interface label. */
.module-switch legend {
  float: left; /* Lets the legend participate in the flex-like horizontal control row. */
  margin: 0.6rem 1rem 0.6rem 0; /* Separates the label from the first choice. */
  color: var(--muted-ink); /* Keeps the label secondary to the selected year. */
  font-family: var(--mono); /* Matches other analytical interface labels. */
  font-size: 0.68rem; /* Keeps the label compact. */
  letter-spacing: 0.06em; /* Improves small uppercase readability. */
  text-transform: uppercase; /* Standardises the control label. */
}

/* Styles each module-year option as a compact segmented control. */
.module-switch button {
  min-height: 2.5rem; /* Creates an accessible pointer and touch target. */
  padding: 0.65rem 0.9rem; /* Gives short year labels balanced space. */
  border: 1px solid var(--ink); /* Defines each independent year choice. */
  background: transparent; /* Keeps inactive choices quiet. */
  color: var(--ink); /* Preserves readable labels. */
  font: 600 0.66rem/1 var(--mono); /* Applies the technical interface voice. */
  letter-spacing: 0.04em; /* Improves compact text. */
  text-transform: uppercase; /* Makes all year choices consistent. */
  cursor: pointer; /* Signals that the module list can change. */
}

/* Highlights the one active module-year choice. */
.module-switch button[aria-pressed="true"] {
  background: var(--ink); /* Creates decisive selected-state contrast. */
  color: var(--paper); /* Keeps the active label readable. */
}

/* Gives pointer and keyboard interaction immediate feedback. */
.module-switch button:hover,
/* Includes visible keyboard focus in the same treatment. */
.module-switch button:focus-visible {
  background: var(--amber); /* Uses the established signal colour. */
  color: var(--ink); /* Preserves contrast on amber. */
}

/* Aligns the saved comparison with the shared central page grid. */
.comparison-shell {
  width: min(100%, var(--max-width)); /* Limits the visible comparison workspace. */
  margin: clamp(3rem, 7vw, 6rem) auto 0; /* Separates the table from its introduction. */
  padding-top: 1rem; /* Creates space beneath the framing rule. */
  border-top: 1px solid var(--ink); /* Defines the start of the comparison surface. */
}

/* Creates a keyboard-focusable viewport for wide side-by-side comparisons. */
.comparison-scroller {
  max-height: 72svh; /* Keeps row labels and course headings useful during large comparisons. */
  overflow: auto; /* Enables horizontal and vertical movement for up to twenty-four courses. */
  border: 1px solid var(--ink); /* Frames the complete analytical surface. */
  background: var(--paper); /* Prevents sticky cells revealing content beneath them. */
}

/* Makes keyboard focus on the scrollable comparison unmistakable. */
.comparison-scroller:focus-visible {
  outline: 4px solid rgb(244 184 96 / 55%); /* Uses the amber signal colour around the viewport. */
  outline-offset: 3px; /* Separates the focus ring from the table border. */
}

/* Creates the side-by-side comparison table. */
.comparison-table {
  width: max-content; /* Lets every saved course keep a readable column width. */
  min-width: 100%; /* Fills the viewport when only one course is saved. */
  border-collapse: separate; /* Allows sticky cells to retain their own backgrounds and borders. */
  border-spacing: 0; /* Removes gaps between analytical cells. */
  table-layout: fixed; /* Gives comparable columns predictable widths. */
}

/* Applies shared table-cell geometry. */
.comparison-table th,
/* Includes ordinary comparison values in the same geometry. */
.comparison-table td {
  width: 16rem; /* Gives every course enough room for meaningful text. */
  min-width: 16rem; /* Prevents wide comparisons compressing columns. */
  padding: 1rem; /* Gives dense facts comfortable internal spacing. */
  border-right: 1px solid var(--line); /* Separates course columns. */
  border-bottom: 1px solid var(--line); /* Separates comparison criteria. */
  vertical-align: top; /* Aligns values consistently at their top edge. */
  text-align: left; /* Keeps longer comparison text readable. */
}

/* Keeps the course headings visible while scrolling through comparison rows. */
.comparison-table thead th {
  position: sticky; /* Pins headings inside the scrollable viewport. */
  top: 0; /* Attaches headings to the viewport's upper edge. */
  z-index: 3; /* Keeps headings above body values and sticky row labels. */
  min-height: 8rem; /* Gives long course titles consistent room. */
  background: var(--ink); /* Creates a decisive comparison header. */
  color: var(--paper); /* Makes course names readable on ink. */
}

/* Styles linked course titles inside comparison headings. */
.comparison-table thead a {
  display: block; /* Places the course title above its removal action. */
  color: inherit; /* Uses the light header foreground. */
  font-size: 1.05rem; /* Makes each course name the column's primary label. */
  font-weight: 600; /* Gives the linked title suitable emphasis. */
  line-height: 1.15; /* Keeps multiline course names compact. */
  text-decoration-thickness: 1px; /* Uses a restrained but visible external-link underline. */
  text-underline-offset: 0.2em; /* Separates the underline from letterforms. */
}

/* Keeps every comparison criterion visible during horizontal scrolling. */
.comparison-table tr > th:first-child {
  position: sticky; /* Pins the criterion column inside the horizontal viewport. */
  left: 0; /* Attaches it to the viewport's left edge. */
  z-index: 2; /* Keeps criterion labels above course values. */
  width: 10rem; /* Makes the label column narrower than course columns. */
  min-width: 10rem; /* Prevents label compression. */
  background: var(--ice); /* Distinguishes row labels from saved values. */
  color: var(--ink); /* Keeps criterion labels readable. */
  font-family: var(--mono); /* Gives row headings an analytical voice. */
  font-size: 0.68rem; /* Keeps criterion labels compact. */
  letter-spacing: 0.05em; /* Improves small mono readability. */
  text-transform: uppercase; /* Standardises comparison criteria. */
}

/* Keeps the top-left corner above both sticky directions. */
.comparison-table thead tr > th:first-child {
  z-index: 4; /* Places the corner above headers and row labels. */
  background: var(--amber); /* Creates a clear origin point for the table. */
}

/* Styles ordinary comparison values. */
.comparison-table td {
  background: var(--paper); /* Preserves a clean factual surface. */
  color: var(--ink); /* Uses the primary readable foreground. */
  font-size: 0.86rem; /* Fits useful information across many columns. */
  line-height: 1.45; /* Preserves readability for mismatch notes. */
}

/* Removes unnecessary badge spacing inside table cells. */
.comparison-table .mismatch-badge {
  display: inline-block; /* Lets the badge retain its compact fitted shape. */
  margin-top: 0; /* Aligns it with other row values. */
}

/* Removes default list styling from subject requirement signals. */
.subject-check-list {
  display: grid; /* Stacks all three grade-aligned subject checks. */
  gap: 0.55rem; /* Separates each transparent signal. */
  margin: 0; /* Removes browser list margins. */
  padding: 0; /* Removes browser list indentation. */
  list-style: none; /* Replaces bullets with explicit yes-or-no wording. */
}

/* Styles each subject requirement signal. */
.subject-check {
  padding-left: 0.65rem; /* Creates room after the status-coloured rule. */
  border-left: 3px solid currentColor; /* Makes positive and absent mentions scannable. */
  font-size: 0.76rem; /* Fits three checks within comparison columns. */
  line-height: 1.4; /* Preserves readability across wrapped subject names. */
}

/* Colours a subject accepted or mentioned in requirements positively. */
.subject-check--yes {
  color: #164b24; /* Matches the site's positive exact-match green. */
}

/* Colours a subject not mentioned as neutral evidence rather than an admissions failure. */
.subject-check--no {
  color: var(--muted-ink); /* Avoids implying that absence automatically means ineligibility. */
}

/* Gives the module comparison row sufficient vertical room for full lists. */
.comparison-modules {
  min-height: 18rem; /* Keeps short columns visually aligned with longer module lists. */
}

/* Creates a compact unbulleted module list within each course column. */
.module-list {
  display: grid; /* Stacks modules consistently. */
  gap: 0.65rem; /* Separates module cards without wasting space. */
  margin: 0; /* Removes browser list margins. */
  padding: 0; /* Removes browser list indentation. */
  list-style: none; /* Uses bordered items instead of bullets. */
}

/* Styles one saved-course module record. */
.module-item {
  display: grid; /* Places the module name above year and type. */
  gap: 0.3rem; /* Keeps metadata closely associated with its title. */
  padding: 0.65rem; /* Gives every module a readable contained surface. */
  border: 1px solid var(--line); /* Separates adjacent modules clearly. */
  background: var(--ice); /* Keeps the module list within the blue brand system. */
}

/* Highlights modules that contributed to the visitor's module-search score. */
.module-item--matched {
  border-color: var(--ink); /* Strengthens the boundary of a supporting module. */
  box-shadow: inset 4px 0 0 var(--amber); /* Adds a visible search-match signal. */
}

/* Styles module names whether they are links or plain text. */
.module-item a,
/* Applies identical typography to modules without catalogue links. */
.module-item span {
  color: var(--ink); /* Keeps module names readable. */
  font-size: 0.78rem; /* Fits long module names inside comparison columns. */
  font-weight: 600; /* Makes titles distinct from their metadata. */
  line-height: 1.3; /* Supports compact wrapping. */
}

/* Styles year and module-type metadata. */
.module-item small {
  color: var(--muted-ink); /* Reduces metadata emphasis. */
  font-family: var(--mono); /* Distinguishes structured facts from module titles. */
  font-size: 0.6rem; /* Keeps metadata compact. */
  line-height: 1.35; /* Allows the search-match note to wrap. */
  text-transform: capitalize; /* Tidies lowercase source values such as compulsory. */
}

/* Styles course removal as a restrained secondary action. */
.comparison-remove {
  margin-top: 1rem; /* Separates removal from the linked title. */
  padding: 0.45rem 0; /* Creates a useful vertical target without a button box. */
  border: 0; /* Removes native button chrome. */
  border-bottom: 1px solid currentColor; /* Preserves clear action affordance. */
  background: transparent; /* Keeps attention on the course title. */
  color: var(--amber); /* Uses the established action signal on the dark header. */
  font: 500 0.64rem/1 var(--mono); /* Applies compact interface typography. */
  cursor: pointer; /* Signals that the saved column can be removed. */
}

/* Highlights the removal action during pointer and keyboard interaction. */
.comparison-remove:hover,
/* Includes keyboard focus in the same response. */
.comparison-remove:focus-visible {
  color: var(--paper); /* Brightens the action against the dark header. */
}

/* Gives the saved empty state more conversational spacing. */
.saved-empty-state {
  display: grid; /* Stacks the empty-state message and action. */
  gap: 0.8rem; /* Separates each piece without excess space. */
  justify-items: start; /* Aligns the content to the reading edge. */
  padding: clamp(2rem, 7vw, 5rem); /* Creates a deliberate empty workspace. */
  text-align: left; /* Matches the saved-page editorial alignment. */
}

/* Styles the saved empty-state heading. */
.saved-empty-state h3 {
  margin: 0; /* Removes browser heading margins. */
  color: var(--ink); /* Restores primary emphasis inside the muted state. */
  font-size: clamp(1.6rem, 4vw, 3rem); /* Makes the empty state intentional rather than broken. */
}

/* Removes default spacing from saved empty-state copy. */
.saved-empty-state p {
  margin: 0; /* Keeps the grid gap responsible for all spacing. */
}

/* Simplifies the saved-page footer to its three available columns. */
.saved-footer {
  grid-template-columns: auto minmax(14rem, 1fr) auto; /* Balances branding, caveat, and return action. */
}

/* Styles initial and error states that replace data displays. */
.empty-state {
  grid-column: 1 / -1; /* Makes the message span every grid column. */
  margin: 0; /* Removes default paragraph margins. */
  padding: 3rem 1rem; /* Gives an empty display intentional presence. */
  background: var(--ice); /* Keeps empty states within the brand system. */
  color: var(--muted-ink); /* Makes instructional text calm. */
  font-family: var(--mono); /* Signals a system state. */
  font-size: 0.72rem; /* Keeps the message compact. */
  text-align: center; /* Centres the instruction in the available area. */
}

/* Creates the closing dark information strip. */
.site-footer {
  display: grid; /* Arranges footer information in distinct columns. */
  grid-template-columns: auto minmax(14rem, 1fr) minmax(16rem, 1fr) auto; /* Balances branding, caveats, sources, and navigation. */
  gap: clamp(1.5rem, 4vw, 4rem); /* Separates footer content responsively. */
  align-items: start; /* Aligns all footer columns at the top. */
  padding: clamp(2rem, 5vw, 4rem) var(--page-pad); /* Gives the footer substantial breathing room. */
  background: var(--ink); /* Returns to the opening near-black palette. */
  color: var(--paper); /* Makes footer content readable. */
}

/* Styles footer paragraphs. */
.site-footer p {
  margin: 0; /* Removes default paragraph margins. */
  color: rgb(247 251 253 / 62%); /* Reduces the priority of supporting information. */
  font-size: 0.78rem; /* Keeps caveats compact. */
}

/* Keeps the footer wordmark fully visible. */
.site-footer .wordmark {
  color: var(--paper); /* Overrides the muted paragraph colour. */
}

/* Styles source links within the footer. */
.site-footer p a {
  color: var(--amber); /* Makes attribution links discoverable. */
}

/* Prepares reveal elements without hiding content when JavaScript is unavailable. */
.reveal--ready {
  opacity: 0; /* Hides only elements that JavaScript has registered for observation. */
  transform: translateY(2rem); /* Places prepared elements slightly below their final position. */
  transition: opacity 700ms ease, transform 900ms cubic-bezier(0.16, 1, 0.3, 1); /* Creates a smooth but restrained entrance. */
}

/* Restores observed content to its natural position. */
.reveal--ready.is-visible {
  opacity: 1; /* Fades the content fully into view. */
  transform: translateY(0); /* Moves the content to its intended position. */
}

/* Adapts the layout for tablets and small laptops. */
@media (max-width: 64rem) {
  .section-intro { grid-template-columns: 1fr; gap: 1rem; } /* Stacks narrative labels and headings when two columns become cramped. */
  .section-intro > .eyebrow { grid-column: 1; } /* Keeps the label in the single available column. */
  .section-intro > h2 { grid-column: 1; } /* Moves the heading into the single available column. */
  .section-intro > .lede { grid-column: 1; } /* Moves the lead copy into the single available column. */
  .matcher-form { grid-template-columns: 1fr; } /* Stacks qualifications above search controls. */
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* Reduces ranked results to two columns. */
  .site-footer { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* Wraps the footer into two balanced rows. */
}

/* Adapts the interface for phones. */
@media (max-width: 42rem) {
  .site-header { min-height: 3.25rem; } /* Slightly reduces the fixed header height. */
  .site-nav a:first-child { display: none; } /* Removes one optional link to protect limited header space. */
  .panel { min-height: auto; padding-top: clamp(5.5rem, 18vw, 7rem); padding-bottom: clamp(5rem, 18vw, 7rem); } /* Uses content-led sections on small screens. */
  .hero { min-height: 100svh; padding-bottom: 0; } /* Preserves a full-height opening experience. */
  .hero h1 { font-size: clamp(3.4rem, 19vw, 6rem); line-height: 0.82; } /* Keeps the product name dramatic without overflowing. */
  .hero h1 span:last-child { margin-left: 0; } /* Removes the large-screen headline offset. */
  .hero__summary { margin-left: 0; } /* Returns the summary to the natural reading edge. */
  .stat-grid { grid-template-columns: 1fr; } /* Stacks evidence cards vertically. */
  .stat-card { border-right: 0; border-bottom: 1px solid var(--ink); } /* Replaces vertical separators with horizontal ones. */
  .stat-card:last-child { border-bottom: 0; } /* Removes the final redundant separator. */
  .problem__story { grid-template-columns: 1fr; gap: 3.5rem; } /* Stacks problem narratives. */
  .filter-panel { padding: 1.25rem; } /* Preserves mobile input width. */
  .view-heading { grid-template-columns: 1fr; gap: 0.75rem; } /* Stacks result-view titles and explanations. */
  .view-heading--row { grid-template-columns: 1fr; } /* Stacks the page range under its title. */
  .mismatch-key { grid-template-columns: 1fr; } /* Stacks grade definitions on narrow screens. */
  .course-grid { grid-template-columns: 1fr; } /* Shows one course card per row. */
  .course-card { min-height: 0; } /* Lets mobile cards use their natural content height. */
  .course-card__footer { align-items: start; flex-direction: column; } /* Prevents save actions crowding match reasons on narrow cards. */
  .saved-main { padding-top: 6rem; } /* Clears the compact fixed header on the comparison page. */
  .saved-intro h1 { font-size: clamp(3rem, 17vw, 5rem); } /* Keeps the saved-page title inside narrow screens. */
  .comparison-table th, .comparison-table td { width: 14rem; min-width: 14rem; } /* Slightly narrows course columns on phones. */
  .comparison-table tr > th:first-child { width: 8rem; min-width: 8rem; } /* Preserves more space for course values on phones. */
  .pagination { grid-template-columns: 1fr 1fr; } /* Gives pagination buttons two columns. */
  .pagination span { grid-column: 1 / -1; grid-row: 1; text-align: center; } /* Places page status above both buttons. */
  .site-footer { grid-template-columns: 1fr; } /* Stacks all footer content for comfortable reading. */
  .saved-footer { grid-template-columns: 1fr; } /* Stacks the simplified comparison footer too. */
}

/* Respects visitors who request less animation at operating-system level. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; } /* Removes animated anchor scrolling. */
  .marquee__track { animation-play-state: paused; } /* Stops continuous decorative motion. */
  .reveal--ready { opacity: 1; transform: none; transition: none; } /* Shows all content immediately. */
  *, *::before, *::after { transition-duration: 0.01ms !important; } /* Minimises remaining interface transitions. */
}
