@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,500;8..60,600;8..60,700&display=swap");

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
img { max-width: 100%; }
.course-content :is(h1, h2, h3, h4, p, figure) { margin-block-start: 0; }
iframe { max-width: 100%; }

html:has(.course-header) {
  --course-header-clearance: 116px;
  scroll-padding-block-start: var(--course-header-clearance);
}

.course-header {
  --course-header-ink: #14213d;
  --course-header-gold: #97702b;
  --course-header-ease: cubic-bezier(.2, .75, .28, 1);
  --course-header-panel-shadow: 0 18px 36px #14213d23, 0 4px 10px #14213d0c;
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  padding: clamp(9px, 1vw, 16px) clamp(10px, 1.6vw, 28px) 12px;
  color: var(--course-header-ink);
  font: 400 16px/1.5 Inter, system-ui, sans-serif;
}
.course-header::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: radial-gradient(ellipse at 13% 0%, #e5ebf9, transparent 68%),
    radial-gradient(ellipse at 88% 0%, #f6ecdb, transparent 58%), #f5f7fb;
  pointer-events: none;
  content: "";
}
.course-header.is-scrolled::before { opacity: 0; }

.course-header-inner {
  position: relative;
  max-width: 1680px;
  margin-inline: auto;
  padding: 9px clamp(12px, 1.25vw, 24px);
  border: 1px solid #f8faff;
  border-radius: 24px;
  background: linear-gradient(120deg, #fffffff5 16%, #f9fbfff2 66%, #fffdf8f5);
  box-shadow: 0 1px 2px #14213d0a, 0 8px 24px #14213d14, inset 0 1px 0 #fff;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.course-header.is-scrolled .course-header-inner {
  box-shadow: 0 1px 4px #14213d10, 0 12px 30px #14213d24, inset 0 1px 0 #fff;
}
.course-brand-row { display: flex; gap: clamp(6px, 1.3vw, 12px); align-items: center; }
.course-nav-row { display: none; }
.course-nav-row.is-open {
  position: absolute;
  z-index: 2;
  inset: calc(100% + 8px) 0 auto;
  display: block;
  max-block-size: min(64vh, 32rem);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px;
  border: 1px solid #edf1f7;
  border-radius: 20px;
  background: #fbfcff;
  box-shadow: var(--course-header-panel-shadow);
}

.course-brand {
  grid-area: brand;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 3px;
  min-width: 0;
  padding-block: 4px;
  border-radius: 7px;
  color: var(--course-header-ink);
  text-decoration: none;
}
.course-brand-name {
  font: 700 clamp(17px, 1.5vw, 21px)/1.15 "Source Serif 4", Georgia, serif;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.course-brand-english {
  color: #495970;
  font: 600 11px/1.25 Inter, system-ui, sans-serif;
  overflow-wrap: anywhere;
}
.course-brand-row > .site-language-menu {
  grid-area: language;
  z-index: 3;
}
.course-brand-row > .site-language-menu > summary {
  min-block-size: 38px;
  padding: 6px 10px;
  border: 1px solid #e4e9f1;
  border-radius: 999px;
  background: #edf1f7;
  color: var(--course-header-ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}
.course-header .site-language-menu[open] > summary,
.course-header .site-language-menu > summary:hover { background: #e5ebf4; }
.course-header .site-language-options {
  inset-block-start: calc(100% + 7px);
  padding: 6px;
  border-color: #e8edf5;
  border-radius: 15px;
  background: #fbfcff;
  box-shadow: var(--course-header-panel-shadow);
}
.course-header .site-language-options a { border-radius: 9px; }
.course-header .site-language-options a[aria-current="true"] { background: #f6ead7; }

.course-nav {
  grid-area: navigation;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.course-nav > a, .course-nav-group > summary {
  display: flex;
  align-items: center;
  min-block-size: 42px;
  padding: 9px 13px;
  border-radius: 12px;
  color: var(--course-header-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
}
.course-nav > a:is(:hover, :focus-visible),
.course-nav-group > summary:is(:hover, :focus-visible),
.course-nav-group[open] > summary {
  background: #e7edf7;
  color: #0b1e3a;
}
.course-nav > a[aria-current="page"],
.course-nav-group:has(.course-nav-options a[aria-current="page"]):not([open]) > summary {
  background: #f6ebd8;
  color: #583e17;
  box-shadow: inset 0 0 0 1px #ded0af9c;
}
.course-nav-group { position: relative; }
.course-nav-group[open] { z-index: 2; }
.course-nav-group > summary { justify-content: space-between; gap: 5px; cursor: pointer; list-style: none; }
.course-nav-group > summary::-webkit-details-marker { display: none; }
.course-nav-chevron {
  flex: none;
  color: var(--course-header-gold);
  font-size: 10px;
}
.course-nav-group[open] > summary .course-nav-chevron { rotate: 180deg; }
.course-nav-options {
  padding: 4px 6px 7px;
  border-radius: 14px;
}
.course-nav-options a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--course-header-ink);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.course-nav-options a:is(:hover, :focus-visible) { background: #edf2f9; }
.course-nav-options a[aria-current="page"] { background: #f6ebd8; color: #583e17; }
.course-nav-options a:first-child { font-weight: 700; }
.course-booking {
  grid-area: booking;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-block-size: 44px;
  margin-top: 7px;
  padding: 8px clamp(12px, 1.25vw, 21px);
  border: 1px solid #0b1e3a;
  border-radius: 999px;
  background: linear-gradient(180deg, #284060, #0b1e3a 86%);
  box-shadow: inset 0 1px 0 #ffffff26, 0 3px 7px #14213d26;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.course-booking:hover, .course-booking:focus-visible {
  background: linear-gradient(180deg, #385372, #132946 86%);
  box-shadow: inset 0 1px 0 #ffffff3d, 0 5px 12px #14213d36;
}
.course-menu-toggle {
  display: block;
  min-block-size: 38px;
  padding: 6px 12px;
  border: 1px solid #0b1e3a;
  border-radius: 999px;
  background: #0b1e3a;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.course-menu-toggle:hover,
.course-menu-toggle[aria-expanded="true"] { background: #294464; }
.course-header :is(a, summary, button):focus-visible {
  outline: 2px solid var(--course-header-gold);
  outline-offset: 2px;
}

.course-nav-row.is-open .course-booking { display: flex; }
.course-content { color: #3a4256; font: 400 16px/1.6 Inter, system-ui, sans-serif; }
.course-content h1[style*="Source Serif"], .course-content h2[style*="Source Serif"] { font-variation-settings: "opsz" 22; }
.course-content iframe { border: 0; }
.course-original { padding: 0 24px; max-width: 860px; margin: 42px auto; }
.course-original a { color: #002147; font-weight: 600; }

.course-content > .course-hero-photo {
  --course-hero-shade: linear-gradient(105deg, #101a2ee8, #14213dbf);
  /* The original page's inline background shorthand supplies the fallback. */
  background: var(--course-hero-shade), var(--course-hero-image) center / cover no-repeat #14213d !important;
  background-blend-mode: multiply, normal;
}
.course-content > .course-hero-photo:has(img) {
  --course-hero-shade: linear-gradient(105deg, #101a2ee8 10%, #14213dca 53%, #14213dab);
}
@media (max-width: 780px) {
  .course-content > .course-hero-photo:has(img) {
    --course-hero-shade: linear-gradient(180deg, #101a2edb, #14213dba);
  }
}

@media (min-width: 1101px) {
  .course-header:not(.is-compact) .course-header-inner {
    --course-brand-width: clamp(158px, 13.5vw, 214px);
    --course-brand-font-size: clamp(17px, 1.38vw, 21px);
    --course-nav-font-size: clamp(13px, 1vw, 15px);
    --course-nav-gap: clamp(3px, .45vw, 8px);
    --course-nav-padding: clamp(7px, .8vw, 13px);
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) max-content max-content;
    grid-template-areas: "brand navigation language booking";
    align-items: center;
    gap: clamp(6px, .8vw, 14px);
    min-block-size: 66px;
    border-radius: 999px;
  }
  .course-header.is-tight:not(.is-compact) .course-header-inner {
    --course-brand-width: clamp(165px, 12.4vw, 181px);
    --course-brand-font-size: 16px;
    --course-nav-font-size: 13px;
    --course-nav-gap: 3px;
    --course-nav-padding: 5px;
  }
  .course-header:not(.is-compact) :is(.course-brand-row, .course-nav-row) { display: contents; }
  .course-header:not(.is-compact) .course-brand {
    max-width: var(--course-brand-width);
    padding-inline: 7px 11px;
    border-inline-end: 1px solid #d9e0ec;
    border-end-end-radius: 0;
    border-start-end-radius: 0;
  }
  .course-header:not(.is-compact) .course-brand:lang(zh) { max-width: none; }
  .course-header:not(.is-compact) .course-brand-name:lang(zh) { white-space: nowrap; }
  .course-header:not(.is-compact) .course-brand-name { font-size: var(--course-brand-font-size); }
  .course-header:not(.is-compact) .course-menu-toggle { display: none; }
  .course-header:not(.is-compact) .course-nav {
    flex-direction: row;
    align-items: center;
    gap: var(--course-nav-gap);
  }
  .course-header:not(.is-compact) .course-nav > * { flex: 1 0 auto; }
  .course-header:not(.is-compact) :is(.course-nav > a, .course-nav-group > summary) {
    justify-content: center;
    min-block-size: 38px;
    padding-inline: var(--course-nav-padding);
    border-radius: 999px;
    font-size: var(--course-nav-font-size);
    text-align: center;
    white-space: nowrap;
  }
  .course-header:not(.is-compact) .course-nav-options {
    position: absolute;
    inset-block-start: 100%;
    inset-inline-start: 0;
    inline-size: max-content;
    min-inline-size: 246px;
    max-inline-size: 332px;
    padding: 7px;
    border: 1px solid #e8edf5;
    background: #fbfcff;
    box-shadow: var(--course-header-panel-shadow);
  }
  .course-header:not(.is-compact) .course-nav-group:last-of-type .course-nav-options {
    inset-inline-start: auto;
    inset-inline-end: 0;
  }
  .course-header:not(.is-compact) .course-booking {
    margin-top: 0;
    font-size: var(--course-nav-font-size);
  }
}

@media (min-width: 1360px) {
  .course-header.is-tight:not(.is-compact) .course-nav > * {
    flex: 1 1 auto;
    min-inline-size: 0;
  }
  .course-header.is-tight:not(.is-compact) :is(.course-nav > a, .course-nav-group > summary) {
    min-block-size: 44px;
    line-height: 1.25;
    white-space: normal;
    text-wrap: balance;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 420px) {
  .course-brand { gap: 3px; }
  .course-brand-name { font-size: 16px; }
  .course-brand-english { font-size: 10px; }
}

@media (max-width: 360px) {
  html:has(.course-header) { --course-header-clearance: 132px; }
  .course-brand-row { flex-wrap: wrap; }
  .course-brand { flex: 1 0 100%; }
  .course-brand-row > .site-language-menu { margin-inline-start: auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .course-header::before { transition: opacity 220ms var(--course-header-ease); }
  .course-header-inner {
    animation: course-header-appear 420ms var(--course-header-ease) backwards;
    transition: box-shadow 220ms var(--course-header-ease);
  }
  .course-header :is(.course-nav > a, .course-nav-group > summary, .course-booking,
    .course-menu-toggle, .site-language-menu > summary, .course-nav-options a) {
    transition: background-color 170ms var(--course-header-ease), color 170ms var(--course-header-ease),
      box-shadow 170ms var(--course-header-ease);
  }
  .course-nav-chevron { transition: rotate 170ms var(--course-header-ease); }
  .course-nav-row.is-open,
  .course-nav-group[open] > .course-nav-options,
  .course-header .site-language-menu[open] > .site-language-options {
    animation: course-header-menu-appear 200ms var(--course-header-ease) backwards;
  }
  @keyframes course-header-appear {
    from { opacity: .65; translate: 0 -8px; }
    to { opacity: 1; translate: 0; }
  }
  @keyframes course-header-menu-appear {
    from { opacity: .4; translate: 0 -4px; }
    to { opacity: 1; translate: 0; }
  }
}

/* Reading hierarchy shared by the course, fee and parent pages. */
.course-content {
  --editorial-sans: Inter, system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  font-family: var(--editorial-sans) !important;
  line-height: 1.68 !important;
}
.course-content :is(h1, h2, h3) {
  font-family: var(--editorial-sans) !important;
  font-weight: 700 !important;
  line-height: 1.17 !important;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.course-content :is(h1, h2):not(:lang(zh), :lang(ja), :lang(ko)) { letter-spacing: -.035em; }
.course-content h1 { font-size: clamp(37px, 5vw, 74px) !important; }
.course-content h2[style*="font-size: 36px"],
.course-content h2[style*="font-size: 38px"] {
  font-size: clamp(30px, 3.25vw, 46px) !important;
}
.course-content :is(p, li, summary) { overflow-wrap: anywhere; }

.course-content > section:first-child > div > p:first-child {
  padding-block-end: 14px;
  border-block-end: 1px solid #c9d1e04d;
}
.course-content > section:first-child h1 + p {
  color: #edf1f7 !important;
  font-size: clamp(16px, 1.4vw, 20px) !important;
  line-height: 1.62 !important;
  text-wrap: pretty;
}
.course-content > section:first-child > div:has(> div > div > h1) h1 {
  font-size: clamp(35px, 4.1vw, 60px) !important;
}
.course-content > section:first-child > div:has(> div > div > h1) > div:last-child {
  gap: clamp(24px, 3.2vw, 46px) !important;
}
.course-content > section:first-child > div:has(> div > div > h1) > div:last-child img {
  height: clamp(210px, 32vw, 360px) !important;
}

.course-content > section:not(:first-child) > div > p:has(+ h2) {
  text-wrap: pretty;
}
.course-content > section:not(:first-child) > div > h2 + p {
  max-inline-size: 66ch;
  text-wrap: pretty;
}
.course-content > section > div > h2 + p[style*="font-size: 19px"],
.course-content > section > div > p:first-child[style*="font-size: 19px"],
.programme-english-lead > p:first-child {
  font-size: clamp(19px, 2vw, 24px) !important;
  line-height: 1.5 !important;
  text-wrap: pretty;
}

.course-content #courses > div > p {
  max-inline-size: 65ch;
  padding-block-end: 16px;
  border-block-end: 1px solid #dce3ed;
  text-wrap: pretty;
}
.course-content #courses > div > h2 {
  font-size: clamp(31px, 3.8vw, 49px) !important;
}
.course-content #courses a[data-course-link] > div > span[style*="Source Serif"] {
  font-family: var(--editorial-sans) !important;
  font-weight: 700 !important;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.course-content #courses a[data-course-link] > div > span:last-child {
  line-height: 1.4;
}
.english-plus-course-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
@media (min-width: 560px) {
  .english-plus-course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .english-plus-course-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.course-content details > summary { line-height: 1.45; }
.course-content td:last-child { font-variant-numeric: tabular-nums; }

@media (min-width: 820px) {
  .course-content > section:first-child > div:has(> h1 + p:last-child) {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    column-gap: clamp(28px, 5vw, 74px);
  }
  .course-content > section:first-child > div:has(> h1 + p:last-child) > p:first-child {
    grid-column: 1 / -1;
  }
  .course-content > section:first-child > div:has(> h1 + p:last-child) > div,
  .course-content > section:first-child > div:has(> h1 + p:last-child) > h1 {
    grid-column: 1;
  }
  .course-content > section:first-child > div > h1:has(+ p:last-child) {
    margin-bottom: 0 !important;
  }
  .course-content > section:first-child > div > h1 + p:last-child {
    grid-area: 3 / 2;
    align-self: end;
    padding-inline-start: clamp(16px, 2vw, 28px);
    border-inline-start: 1px solid #c9d1e073;
  }
}

@media (max-width: 780px) {
  .course-content > section:first-child > div {
    padding-block: 34px 40px !important;
  }
  .course-content > section > div[style*="padding: 88px 24px"],
  .course-content > section > div[style*="padding: 80px 24px"],
  .course-content > section > div[style*="padding: 72px 24px"] {
    padding-block: 42px !important;
  }
}

@media (max-width: 390px) {
  .course-content [style*="grid-template-columns: repeat(2, minmax(0, 1fr))"] {
    hyphens: auto;
    overflow-wrap: anywhere;
  }
  .course-content [style*="white-space: nowrap"]:not(table *) {
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
}
