/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 6.5rem; }
body {
  margin: 0;
  background: var(--white);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.12; margin: 0; color: var(--navy); letter-spacing: -0.015em; }
h2 { text-wrap: balance; }
h1 { font-size: var(--h1); line-height: 1.03; letter-spacing: -0.025em; }
h2 { font-size: var(--h2); }
h3 { font-size: var(--h3); line-height: 1.2; }
h4 { font-size: var(--h4); line-height: 1.25; }
p { margin: 0; }
p + p { margin-top: var(--s-4); }
ul, ol { margin: 0; padding: 0; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; transition: color var(--ease); }
a:hover { color: var(--crimson); }
sup, sub { font-size: 0.72em; line-height: 0; }
main:focus { outline: none; }

:focus-visible { outline: 3px solid var(--crimson); outline-offset: 2px; border-radius: 3px; }
.on-navy :focus-visible, .site-footer :focus-visible { outline-color: var(--white); }

.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 100;
  background: var(--navy); color: var(--white); padding: var(--s-3) var(--s-4); border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--s-3); color: var(--white); }

.wrap { width: min(100% - 2 * var(--gutter), var(--page)); margin-inline: auto; }
.section { padding-block: var(--s-9); }
.section--tight { padding-block: var(--s-8); }
.section + .section:not(.on-navy):not(.after-navy) { border-top: 1px solid var(--line); }
.on-navy { background: var(--navy); color: var(--text-on-navy); }
.on-navy h1, .on-navy h2, .on-navy h3, .on-navy h4 { color: var(--text-on-navy); }
.on-navy a:hover { color: var(--text-on-navy); text-decoration-thickness: 2px; }

.lede { font-size: var(--text-lg); line-height: 1.5; color: var(--text-muted); max-width: 38em; }
.muted { color: var(--text-muted); }
.on-navy .lede, .on-navy .muted { color: var(--text-on-navy-muted); }
.small { font-size: var(--text-sm); }
.measure > * { max-width: 42rem; }
.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-5); }

/* Section marker: the small triangle comes from the crimson detail in the logo. */
.eyebrow {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--text-sm); font-weight: 600; color: var(--navy); margin-bottom: var(--s-4);
}
.eyebrow::before {
  content: ""; width: 12px; height: 10px; flex: none; background: var(--crimson);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.on-navy .eyebrow { color: var(--text-on-navy); }

.section-head { max-width: 44em; margin-bottom: var(--s-7); }
.section-head .lede { margin-top: var(--s-4); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0.7rem 1.4rem; border-radius: var(--radius-sm); border: 1.5px solid transparent;
  font: 600 1rem/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease);
}
.btn--primary { background: var(--crimson); color: var(--white); }
.btn--primary:hover { background: var(--navy); color: var(--white); }
.on-navy .btn--primary:hover { background: var(--white); color: var(--navy); }
.btn--secondary { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn--secondary:hover { background: var(--navy); color: var(--white); }
.on-navy .btn--secondary { color: var(--white); border-color: var(--white); }
.on-navy .btn--secondary:hover { background: var(--white); color: var(--navy); }
.btn--small { min-height: 42px; padding: 0.5rem 1rem; font-size: var(--text-sm); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }

.text-link { font-weight: 600; text-decoration: underline; }

/* ---------- Header ---------- */
.site-header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); min-height: 84px; }
.logo { display: block; flex: none; padding-block: var(--s-3); }
.logo img { height: 50px; width: auto; }
.nav-toggle {
  display: none; min-height: 44px; padding: 0.5rem 0.9rem; background: transparent; color: var(--navy);
  border: 1.5px solid var(--navy); border-radius: var(--radius-sm); font: 600 var(--text-sm) var(--font-body); cursor: pointer;
}
.site-nav { display: flex; align-items: center; gap: var(--s-5); }
.site-nav ul { display: flex; gap: var(--s-5); list-style: none; }
.site-nav li a { display: block; padding: var(--s-2) 0; font-size: var(--text-sm); font-weight: 500; text-decoration: none; border-bottom: 2px solid transparent; }
.site-nav li a:hover { color: var(--navy); border-bottom-color: var(--grey); }
.site-nav li a[aria-current="page"] { font-weight: 600; border-bottom-color: var(--crimson); }

@media (max-width: 900px) {
  .header-inner { min-height: 72px; flex-wrap: wrap; }
  .logo img { height: 42px; }
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: var(--s-4); padding-bottom: var(--s-5); }
  .site-nav.is-open { display: flex; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav li a { padding: var(--s-3) 0; font-size: 1rem; border-bottom: 1px solid var(--line); }
  .site-nav li a[aria-current="page"] { border-bottom: 2px solid var(--crimson); }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: var(--text-on-navy); padding-block: var(--s-8) var(--s-6); font-size: var(--text-sm); }
.on-navy + .site-footer, main:has(> .on-navy:last-child) + .site-footer { box-shadow: inset 0 1px 0 var(--line-on-navy); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: var(--s-7); }
.footer-logo { height: 58px; width: auto; margin-bottom: var(--s-5); }
.footer-tag { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 500; line-height: 1.35; }
.footer-col h2 { font: 600 var(--text-sm) var(--font-body); color: var(--white); margin-bottom: var(--s-3); letter-spacing: 0; }
.footer-col ul { list-style: none; }
.footer-col li + li { margin-top: var(--s-2); }
.footer-col a { color: var(--text-on-navy-muted); text-decoration: none; }
.footer-col a:hover { color: var(--white); text-decoration: underline; }
.footer-legal { margin-top: var(--s-7); padding-top: var(--s-5); border-top: 1px solid var(--line-on-navy); color: var(--text-on-navy-muted); }
.footer-legal p + p { margin-top: var(--s-2); }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--s-6); } .footer-brand { grid-column: 1 / -1; } }

/* ---------- Badges and placeholders ---------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--s-2); padding: 0.2rem 0.6rem; border: 1px solid var(--line-strong);
  border-radius: 999px; font-size: 0.875rem; font-weight: 500; line-height: 1.4; color: var(--navy); background: transparent;
}
.badge--solid { background: var(--navy); border-color: var(--navy); color: var(--white); }
.tag-example { font-size: 0.8125rem; font-weight: 600; color: var(--navy); border: 1px solid var(--navy); border-radius: var(--radius-sm); padding: 0.05rem 0.4rem; white-space: nowrap; }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: var(--s-5); }
.card-symbol { width: 40px; height: auto; margin-bottom: var(--s-4); }

.course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); }
.course-card { display: flex; flex-direction: column; gap: var(--s-4); padding: var(--s-6); transition: border-color var(--ease); }
.course-card:hover { border-color: var(--navy); }
.course-card__top { display: flex; justify-content: space-between; gap: var(--s-4); align-items: flex-start; }
.course-card__top img { width: 44px; height: auto; flex: none; }
.course-card h3 a { text-decoration: none; }
.course-card h3 a:hover { color: var(--navy); text-decoration: underline; text-decoration-thickness: 2px; }
.course-card .btn-row { margin-top: auto; padding-top: var(--s-3); }
.course-card--dev { border-style: dashed; }
.badge-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
@media (max-width: 720px) { .course-grid { grid-template-columns: 1fr; } .course-card { padding: var(--s-5); } }

/* ---------- Progress ---------- */
.progress { height: 8px; background: rgba(160, 167, 176, 0.35); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--crimson); border-radius: 999px; }

.next-card { background: var(--white); color: var(--navy); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: var(--s-4) var(--s-5); }
.next-card__head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); margin-bottom: var(--s-2); }
.next-card__label { font-size: var(--text-sm); font-weight: 600; }
.next-card__title { font-family: var(--font-display); font-weight: 700; font-size: var(--h4); line-height: 1.25; margin-bottom: var(--s-3); }
.next-card__meta { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--s-2); }

.map-list { list-style: none; display: grid; gap: 0; }
.map-list li { display: grid; grid-template-columns: 26px 1fr auto; gap: var(--s-3); align-items: center; padding: var(--s-3) 0; border-top: 1px solid var(--line); }
.map-list li:first-child { border-top: 0; }
.map-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--grey); display: grid; place-items: center; }
.map-list .is-done .map-dot { background: var(--navy); border-color: var(--navy); }
.map-list .is-done .map-dot::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--white); border-bottom: 2px solid var(--white); transform: rotate(-45deg) translate(1px, -1px); }
.map-list .is-next .map-dot { border-color: var(--crimson); }
.map-list .is-next .map-dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--crimson); }
.map-list .is-next { font-weight: 600; }
.map-state { font-size: var(--text-sm); color: var(--text-muted); font-weight: 400; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(2.5rem, 1.5rem + 4vw, 5.5rem) var(--s-9); }
.hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(2rem, 1rem + 3vw, 4rem); align-items: center; }
.hero h1 { margin-bottom: var(--s-5); font-size: clamp(2.5rem, 1.6rem + 3vw, 4rem); text-wrap: balance; }
.h1-line { display: inline-block; }
.hero .lede { margin-bottom: var(--s-6); }
.hero-support { margin-top: var(--s-5); font-weight: 600; }
.hero-media { position: relative; padding-bottom: var(--s-7); }
.hero-media > img { width: 100%; max-width: 640px; margin-left: auto; aspect-ratio: 5 / 4; object-fit: cover; border-radius: var(--radius-lg); }
.hero-media .next-card { position: absolute; left: calc(-1 * var(--s-5)); bottom: 0; width: min(330px, 88%); }
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-media > img { max-width: none; }
  .hero-media .next-card { left: var(--s-4); }
}
@media (max-width: 520px) {
  .hero-media { padding-bottom: 0; }
  .hero-media .next-card { position: static; width: auto; margin-top: var(--s-4); }
}

.page-hero { padding-block: var(--s-8); }
.page-hero h1 { font-size: clamp(2.25rem, 1.6rem + 2.8vw, 3.75rem); margin-bottom: var(--s-4); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 1rem + 4vw, 5rem); align-items: center; }
.split--top { align-items: start; }
.split img.photo { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius-lg); }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ---------- Journey ---------- */
.journey { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-6); list-style: none; counter-reset: none; }
.journey-step { position: relative; background: var(--white); color: var(--navy); border-radius: var(--radius); padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.journey-step h3 { color: var(--navy); font-size: 1.75rem; }
.journey-step .muted { color: var(--text-muted); }
.journey-step :focus-visible { outline-color: var(--crimson); }
.journey-step:not(:last-child)::after {
  content: ""; position: absolute; top: 2.15rem; right: calc(-1 * var(--s-6) + 7px); width: 18px; height: 18px; background: var(--crimson);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.journey-diagram { width: 100%; max-width: 270px; margin-inline: auto; }
.maths { font-family: var(--font-body); font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.maths-block { padding: var(--s-3) var(--s-4); background: var(--tint); border-left: 3px solid var(--navy); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-variant-numeric: tabular-nums; }
.maths-block p + p { margin-top: var(--s-1); }
.reveal summary { cursor: pointer; font-weight: 600; font-size: var(--text-sm); text-decoration: underline; text-underline-offset: 0.18em; }
.reveal[open] summary { margin-bottom: var(--s-3); }
.next-line { margin-top: auto; padding-top: var(--s-3); border-top: 1px solid var(--line); font-size: var(--text-sm); font-weight: 600; }
@media (max-width: 900px) {
  .journey { grid-template-columns: 1fr; gap: var(--s-6); }
  .journey-step:not(:last-child)::after { top: auto; bottom: -1.65rem; right: 50%; transform: translateX(50%) rotate(90deg); }
}

/* ---------- Lists and steps ---------- */
.benefit-list { list-style: none; }
.benefit-list li { padding-block: var(--s-5); border-top: 1px solid var(--line-strong); }
.benefit-list li:last-child { border-bottom: 1px solid var(--line-strong); }
.benefit-list h3 { font-size: var(--h4); margin-bottom: var(--s-2); }
.split-sticky { position: sticky; top: 7rem; }
@media (max-width: 860px) { .split-sticky { position: static; } }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-5); list-style: none; counter-reset: step; }
.steps li { counter-increment: step; padding-top: var(--s-4); border-top: 2px solid var(--navy); }
.steps li::before { content: counter(step); display: block; font: 700 1.75rem/1 var(--font-display); margin-bottom: var(--s-3); }
.steps h3 { font-size: var(--h4); margin-bottom: var(--s-2); }
@media (max-width: 860px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

.check-list { list-style: none; display: grid; gap: var(--s-3); }
.check-list li { position: relative; padding-left: 1.6rem; }
.check-list li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 12px; height: 10px; background: var(--navy); clip-path: polygon(50% 0, 100% 100%, 0 100%); }

.three-up { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); }
.three-up h3 { font-size: var(--h4); margin-bottom: var(--s-2); }
@media (max-width: 860px) { .three-up { grid-template-columns: 1fr; } }

/* ---------- Subject cards and filters ---------- */
.subject-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); }
.subject-card { display: grid; grid-template-columns: 1fr 150px; gap: var(--s-5); padding: var(--s-6); align-items: center; }
.subject-card h2 { font-size: var(--h3); margin-bottom: var(--s-3); }
@media (max-width: 960px) { .subject-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .subject-card { grid-template-columns: 1fr; padding: var(--s-5); } .subject-card img { max-width: 180px; } }

.filters { display: flex; flex-wrap: wrap; gap: var(--s-5); margin-bottom: var(--s-5); }
.filter-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.filter-group legend { font-size: var(--text-sm); font-weight: 600; padding: 0; margin-bottom: var(--s-2); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip {
  min-height: 44px; padding: 0.4rem 1rem; border-radius: var(--radius-sm); border: 1.5px solid var(--grey); background: transparent; color: var(--navy);
  font: 500 var(--text-sm) var(--font-body); cursor: pointer; transition: border-color var(--ease), background-color var(--ease), color var(--ease);
}
.chip:hover { border-color: var(--navy); }
.chip[aria-pressed="true"] { background: var(--crimson); border-color: var(--crimson); color: var(--white); font-weight: 600; }
.result-count { margin-bottom: var(--s-5); font-size: var(--text-sm); color: var(--text-muted); }

/* ---------- States ---------- */
.state { border: 1px dashed var(--navy); border-radius: var(--radius); padding: var(--s-6); text-align: center; }
.state h2, .state h3 { font-size: var(--h3); margin-bottom: var(--s-2); }
.state .btn { margin-top: var(--s-4); }
.state--loading { border-style: solid; border-color: var(--line); color: var(--text-muted); }

/* ---------- Course detail ---------- */
.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(2rem, 1rem + 4vw, 5rem); align-items: start; }
.course-aside { display: grid; gap: var(--s-4); }
@media (min-height: 860px) and (min-width: 961px) { .course-aside { position: sticky; top: 7rem; } }
.course-section + .course-section { margin-top: var(--s-7); padding-top: var(--s-7); border-top: 1px solid var(--line); }
.course-section h2 { font-size: var(--h3); margin-bottom: var(--s-4); }
.fact-list { display: grid; gap: var(--s-3); margin: 0; }
.fact-list div { display: grid; gap: var(--s-1); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.fact-list div:first-child { border-top: 0; padding-top: 0; }
.fact-list dt { font-size: var(--text-sm); font-weight: 600; }
.fact-list dd { margin: 0; }
.topic-group { margin-top: var(--s-6); }
.topic-group h3 { font-size: var(--h4); margin-bottom: var(--s-3); }
.topic-group h4 { font: 600 var(--text-sm)/1.4 var(--font-body); letter-spacing: 0; margin: var(--s-4) 0 var(--s-2); }
.topic-group .check-list { gap: var(--s-2); }
.journey-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); list-style: none; }
.journey-mini li { padding-top: var(--s-3); border-top: 2px solid var(--navy); }
.journey-mini strong { display: block; font: 700 var(--h4)/1.25 var(--font-display); margin-bottom: var(--s-1); }
@media (max-width: 960px) { .course-layout { grid-template-columns: 1fr; } .course-aside { position: static; } }
@media (max-width: 600px) { .journey-mini { grid-template-columns: 1fr; } }

/* ---------- FAQ ---------- */
.faq { border-top: 1px solid var(--line-strong); }
.faq details { border-bottom: 1px solid var(--line-strong); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: var(--s-4); align-items: center;
  padding-block: var(--s-4); font-family: var(--font-display); font-weight: 500; font-size: var(--text-lg); line-height: 1.3;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font: 500 1.6rem/1 var(--font-body); color: var(--navy); width: 1.2em; text-align: center; }
.faq details[open] summary::after { content: "−"; color: var(--crimson); }
.faq summary:hover { color: var(--crimson); }
.faq-body { padding-bottom: var(--s-5); max-width: 44em; color: var(--text-muted); }
.faq-group + .faq-group { margin-top: var(--s-7); }
.faq-group h2 { font-size: var(--h3); margin-bottom: var(--s-4); }

/* ---------- Dialog ---------- */
dialog.modal { width: min(92vw, 520px); border: 0; border-radius: var(--radius-lg); padding: var(--s-6); background: var(--white); color: var(--navy); }
dialog.modal::backdrop { background: rgba(20, 43, 74, 0.6); }
dialog.modal h2 { font-size: var(--h3); margin-bottom: var(--s-3); }
dialog.modal .btn-row { margin-top: var(--s-5); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
