/* Hersi Maths — stylesheet
   Ground is graphite rather than white: large bright fields are what tire the
   eye, so the page sits dark and the type is a warm off-white rather than pure
   white, which keeps contrast high without the glare. One blue carries links,
   buttons and the surfaces in the hero; one warm tone marks the moving point.
   Nothing else is coloured. */

:root {
  --bg: #161a20;
  --surface: #1d222a;
  --raised: #232932;
  --line: #2c333d;
  --text: #e4e3de;
  --muted: #99a1ac;
  --accent: #7cb0ee;
  --accent-strong: #9cc4f5;

  --measure: 38rem;
  --shell: 64rem;

  /* one spacing scale, used everywhere */
  --s1: 0.5rem;
  --s2: 1rem;
  --s3: 1.75rem;
  --s4: 3rem;
  --s5: 4.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: #cfd2d6;
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: Newsreader, Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-optical-sizing: auto;
  color: var(--text);
  line-height: 1.12;
  letter-spacing: -0.012em;
  margin: 0 0 0.55em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.2rem, 5.2vw, 3.25rem); }
h2 { font-size: clamp(1.55rem, 3vw, 2.05rem); margin-top: 0; }
h3 { font-size: 1.2rem; margin-top: var(--s3); }

p, li { max-width: var(--measure); }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color 140ms ease; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 1.5rem; }
.lede { font-size: 1.2rem; line-height: 1.55; color: #d7dade; }
.quiet { color: var(--muted); font-size: 0.95rem; margin-top: 1.4rem; }

/* --- header ------------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--line);
  background: rgba(22, 26, 32, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.masthead .shell {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 0.6rem 1.8rem; padding-top: 0.8rem; padding-bottom: 0.8rem;
}
.wordmark {
  font-family: Newsreader, Georgia, serif; font-size: 1.3rem;
  color: var(--text); text-decoration: none; margin-right: auto;
}
.wordmark span { color: var(--muted); }
.masthead nav { display: flex; gap: 1.4rem; font-size: 0.94rem; }
.masthead nav a { color: var(--muted); text-decoration: none; }
.masthead nav a:hover { color: var(--accent); }
.masthead .call { font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }

@media(max-width:480px) {
  .masthead .shell { display:grid; grid-template-columns:1fr auto; gap:0 12px; padding:4px 16px; align-items:center; }
  .masthead .wordmark { grid-column:1; grid-row:1; margin:0; display:flex; align-items:center; gap:4px; min-height:40px; }
  .masthead .call { grid-column:2; grid-row:1; display:flex; align-items:center; min-height:40px; font-size:.85rem; }
  .masthead nav { grid-column:1/-1; grid-row:2; gap:24px; font-size:.85rem; }
  .masthead nav a { display:flex; align-items:center; min-height:36px; }
}

/* --- hero --------------------------------------------------------------- */

.hero { padding: 3.4rem 0 3.2rem; }
.hero .shell { position: relative; }
.hero h1 { margin-bottom: 0.4em; }
.hero-head, .hero-foot { position: relative; z-index: 1; }

/* the surfaces are drawn on the page itself — no panel, no frame */
.stage-wrap { margin: 0.4rem -1.5rem 1.6rem; height: 340px; position: relative; pointer-events: none; }
#stage { display: block; width: 100%; height: 100%; }
.stage-caption {
  position: absolute; left: 1.5rem; bottom: -0.2rem;
  font-size: 0.86rem; color: var(--muted); margin: 0;
}

@media (min-width: 62rem) {
  .hero { padding: 5rem 0 4.4rem; }
  .hero-head, .hero-foot { max-width: 33rem; }
  .stage-wrap {
    position: absolute; margin: 0;
    top: 50%; transform: translateY(-50%);
    right: -9%; width: 58%; height: 30rem; z-index: 0;
  }
  .stage-caption { left: auto; right: 11%; bottom: 1.2rem; text-align: right; }
}

.byline {
  display: flex; align-items: center; gap: 0.9rem;
  margin: 1.6rem 0 0; padding-top: 1.2rem;
  border-top: 1px solid var(--line); max-width: var(--measure);
}
.byname { margin: 0; font-weight: 600; }
.bycreds { margin: 0; font-size: 0.92rem; color: var(--muted); line-height: 1.45; }

.portrait { display: block; object-fit: cover; background: var(--raised); }
.portrait-small { width: 60px; height: 60px; border-radius: 50%; flex: none; }
.portrait-large { width: 100%; max-width: 260px; height: auto; aspect-ratio: 4 / 5; border-radius: 4px; }
.message-card { padding:28px; background:var(--surface); border:1px solid var(--line); border-radius:6px; min-width:0; }
.message-card h2 { margin-top:0; }
.contact-number { font-size:1.15rem; color:var(--text); font-variant-numeric:tabular-nums; }
.contact-email { overflow-wrap:anywhere; }
@media(max-width:400px) { .message-card { padding:18px; } .message-card .btn { padding:12px; font-size:.9rem; } }

/* --- buttons ------------------------------------------------------------ */

.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.7rem; }
.btn {
  display: inline-block; padding: 0.72rem 1.35rem;
  transition: background 140ms ease, border-color 140ms ease;
  background: var(--accent); color: #12161c;
  border-radius: 3px; text-decoration: none; font-weight: 600;
}
.btn:hover { background: var(--accent-strong); color: #12161c; }
.btn-quiet { background: transparent; color: var(--accent); border: 1px solid var(--line); font-weight: 500; }
.btn-quiet:hover { background: var(--surface); color: var(--accent-strong); }

/* --- sections ----------------------------------------------------------- */

section { padding: var(--s4) 0; scroll-margin-top: 4.5rem; }
@media (min-width: 62rem) { section { padding: var(--s5) 0; } }
section h2 + p { margin-top: 0; }
section p + h2, section ul + h2, section div + h2 { margin-top: var(--s4); }
section.lead { padding-bottom: 1.4rem; }
section + section:not(.band) { border-top: 1px solid var(--line); }
.band { background: var(--surface); border-top: 1px solid var(--line); }

.rate { border-left: 2px solid var(--accent); padding: 0.1rem 0 0.1rem 1.15rem; margin: 1.5rem 0; }
.rate p { margin: 0; color: var(--muted); }
.rate strong { color: var(--text); font-weight: 600; }

/* --- videos ------------------------------------------------------------- */

.vgrid { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin-top: 1.8rem; }
.vcard { display: block; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.vcard.empty { cursor: default; }
.thumb {
  position: relative; aspect-ratio: 16 / 9;
  transition: border-color 140ms ease;
  background: var(--raised) center / cover no-repeat;
  border: 1px solid var(--line); border-radius: 4px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.thumb iframe { width: 100%; height: 100%; border: 0; }
.play {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(18, 22, 28, 0.72); border: 1px solid rgba(228, 227, 222, 0.4); position: relative;
}
.play::after {
  content: ""; position: absolute; top: 50%; left: 54%;
  transform: translate(-50%, -50%);
  border-left: 13px solid var(--text);
  border-top: 8px solid transparent; border-bottom: 8px solid transparent;
}
.vcard:hover .play { background: var(--accent); }
.vcard:hover .play::after { border-left-color: #12161c; }
.dur {
  position: absolute; right: 7px; bottom: 7px;
  background: rgba(18, 22, 28, 0.88); color: var(--text);
  font-size: 0.76rem; padding: 0.1rem 0.35rem; border-radius: 2px;
}
.soon { color: var(--muted); font-size: 0.82rem; padding: 0 1rem; text-align: center; }
.vtitle { display: block; margin-top: 0.6rem; font-weight: 500; line-height: 1.4; }
.vcard:hover .vtitle { color: var(--accent); }
.vcard:hover .thumb { border-color: #3d4655; }

/* --- credential strip --------------------------------------------------- */

.strip { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.creds {
  list-style: none; margin: 0; padding: 0.9rem 0;
  display: flex; flex-wrap: wrap; gap: 0.4rem 2.2rem;
  font-size: 0.9rem; color: var(--muted);
}
.creds li { max-width: none; position: relative; }
@media (min-width: 48rem) {
  .creds li + li::before {
    content: ""; position: absolute; left: -1.1rem; top: 0.55em;
    width: 3px; height: 3px; border-radius: 50%; background: #4a535f;
  }
}

/* --- quotes -------------------------------------------------------------- */

.quotes { display: grid; gap: 1.6rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); margin-top: var(--s3); }
.quote { margin: 0; border-left: 2px solid var(--line); padding-left: 1.3rem; }
.quote blockquote { margin: 0; font-family: Newsreader, Georgia, serif; font-size: 1.17rem; line-height: 1.5; color: var(--text); }
.quote figcaption { margin-top: 0.7rem; font-size: 0.88rem; color: var(--muted); }
.quote figcaption span { display: block; color: #6f7885; }

/* --- contact form -------------------------------------------------------- */

.contact-grid { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 56rem) { .contact-grid { grid-template-columns: 1.15fr 0.85fr; gap: var(--s5); } }
.form { display: grid; gap: 1.1rem; max-width: 34rem; }
.form label { display: grid; gap: 0.35rem; font-size: 0.95rem; color: var(--text); max-width: none; }
.form label span { color: var(--muted); font-size: 0.85rem; }
.form input, .form textarea {
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 3px;
  padding: 0.65rem 0.8rem; width: 100%;
  transition: border-color 140ms ease;
}
.form input:focus, .form textarea:focus { outline: none; border-color: var(--accent); }
.form textarea { resize: vertical; }
.form .btn { justify-self: start; border: 0; cursor: pointer; }
.form .hp { position: absolute; left: -9999px; }
.form-notice { border-left: 3px solid var(--accent); padding: 0.7rem 1rem; background: var(--surface); }
.form [hidden] { display: none !important; }
.form input:focus-visible, .form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.contact-grid aside h2 { font-size: 1.25rem; }
.contact-grid aside p { max-width: none; }

/* --- listings ----------------------------------------------------------- */

.listing { list-style: none; padding: 0; margin: 1.4rem 0 0; }
.listing li { max-width: none; border-top: 1px solid var(--line); }
.listing li:last-child { border-bottom: 1px solid var(--line); }
.listing a { display: block; padding: 1.05rem 0.75rem; margin: 0 -0.75rem; text-decoration: none; color: var(--text); border-radius: 3px; transition: background 140ms ease, color 140ms ease; }
.listing a:hover { background: var(--surface); }
.listing a:hover { color: var(--accent); }
.listing .spec { display: block; font-size: 0.88rem; color: var(--muted); margin-top: 0.15rem; }

.area-columns { display: grid; gap: 2rem 3rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 23rem), 1fr)); margin-bottom: 2.4rem; }
.area-group { min-width: 0; }
.area-group h3 { margin: 0 0 1rem; }
.area-columns ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 1.6rem; }
.area-columns li { margin-bottom: 0.3rem; break-inside: avoid; }

.covers { padding-left: 1.15rem; }
.covers li { margin-bottom: 0.3rem; }

/* --- topic pages -------------------------------------------------------- */

.spec-ref { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.8rem; }
.slot {
  border: 1px dashed var(--line); background: var(--surface);
  padding: 2.6rem 1.5rem; text-align: center; color: var(--muted);
  margin: 1.5rem 0; border-radius: 4px;
}
.slot p { max-width: none; margin: 0; }
.embed { position: relative; padding-bottom: 56.25%; height: 0; margin: 0 0 1.8rem; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 4px; }

.about-grid { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 52rem) { .about-grid { grid-template-columns: 1fr auto; gap: 3rem; } }

.breadcrumb { font-size: 0.9rem; color: var(--muted); padding-top: 1.6rem; }
.breadcrumb a { color: var(--muted); }

/* --- footer ------------------------------------------------------------- */

footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 2.6rem 0; font-size: 0.94rem; }
footer a { color: #b9c6d6; }
footer a:hover { color: var(--accent-strong); }
footer .foot-grid { display: grid; gap: 1.6rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
footer p { margin: 0.2rem 0; }

/* Keyboard access to the main content on every page. */
.skip-link { position:fixed; top:8px; left:8px; padding:12px 18px; background:var(--accent); color:#12161c; z-index:100; transform:translateY(-180%); }
.skip-link:focus { transform:translateY(0); }
#main { scroll-margin-top:90px; }

.course-directory { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:32px; }
.course-directory article { border-top:1px solid var(--line); padding-top:20px; }
.course-directory h2 { font-size:1.8rem; }
.course-directory h2 a { color:var(--text); text-decoration:none; }
.course-directory h2 a:hover { color:var(--accent); }
.course-directory p { font-size:.96rem; }
.course-directory .course-year { color:var(--muted); text-transform:uppercase; font-size:.72rem; letter-spacing:.07em; margin:0 0 12px; }
@media(max-width:700px) { .course-directory { grid-template-columns:1fr; gap:30px; } }
