/* LaunchLab
   Navy and sky come from the LaunchLab slide decks. Everything else stays neutral
   so the photos and slides carry the page.

   The image `sizes` attributes in index.html are worked out from --wrap, --gutter,
   the 12-column grid and the 860px / 640px / 560px breakpoints below. Change one, check the other. */

/* Arvo and Libre Franklin (SIL Open Font License), self-hosted Latin subsets */
@font-face {
  font-family: "Arvo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/arvo-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Arvo";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/arvo-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Arvo";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/arvo-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Libre Franklin";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/libre-franklin-400-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Libre Franklin";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/libre-franklin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Local fallbacks sized to match the web fonts, so text doesn't reflow when they arrive */
@font-face {
  font-family: "Arvo Fallback";
  src: local("Georgia");
  size-adjust: 109.9%;
}

@font-face {
  font-family: "Libre Franklin Fallback";
  src: local("Arial");
  size-adjust: 103.7%;
}

:root {
  --paper: #ffffff;
  --wash: #eef3f8;
  --ink: #092241;
  --text: #26344b;
  --muted: #5d6879;
  --rule: #dde1e7;
  --sky: #38bdf8;
  --focus: #0369a1;

  --heading: "Arvo", "Arvo Fallback", Georgia, serif;
  --body: "Libre Franklin", "Libre Franklin Fallback", Arial, sans-serif;

  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

figure {
  margin: 0;
}

p {
  margin: 0 0 1em;
}

p,
li,
dd,
td,
figcaption {
  text-wrap: pretty;
}

a {
  color: var(--ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--heading);
  font-weight: 400;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.15rem, 4.4vw, 3.5rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.65rem, 2.6vw, 2.1rem);
  line-height: 1.2;
}

h3 {
  font-size: clamp(1.45rem, 2.2vw, 1.8rem);
  line-height: 1.25;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
}

.skip:focus {
  top: 12px;
}

figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Header */

.site-head {
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}

.site-head .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 32px;
}

.wordmark {
  color: var(--ink);
  font-family: var(--heading);
  font-size: 1.3rem;
  font-weight: 700;
  text-decoration: none;
}

.wordmark span {
  margin-left: 0.2em;
  color: var(--muted);
  font-family: var(--body);
  font-size: 0.9rem;
  font-weight: 400;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 26px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.site-nav a {
  text-decoration-line: none;
}

.site-nav a:hover {
  text-decoration-line: underline;
}

@media (max-width: 480px) {
  .site-nav ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, max-content));
    column-gap: 24px;
  }
}

/* Opening */

.intro {
  padding: clamp(48px, 7vw, 96px) 0 clamp(64px, 9vw, 112px);
}

.intro h1 {
  grid-column: 1 / span 8;
}

.intro-aside {
  grid-column: 9 / span 4;
  align-self: end;
  font-size: 1rem;
}

.intro-aside p:last-child {
  margin-bottom: 0;
}

/* The two lectures, listed like a course catalogue */

.catalogue {
  margin: clamp(36px, 5vw, 56px) 0 0;
  padding: 0 24px;
  background: var(--wash);
  list-style: none;
}

.catalogue li + li {
  border-top: 1px solid var(--rule);
}

.catalogue a {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr) minmax(0, 18rem);
  align-items: baseline;
  gap: 4px 24px;
  padding: 20px 0;
  color: var(--text);
  text-decoration: none;
}

.catalogue .code {
  color: var(--ink);
  font-family: var(--heading);
  font-size: 1.5rem;
  font-weight: 700;
  white-space: nowrap;
}

.catalogue .cat-title {
  color: var(--ink);
  font-family: var(--heading);
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
  line-height: 1.3;
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.catalogue a:hover .cat-title {
  text-decoration-color: currentColor;
}

.catalogue .cat-meta {
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 860px) {
  .catalogue a {
    grid-template-columns: 5.5rem minmax(0, 1fr);
  }

  .catalogue .cat-meta {
    grid-column: 2;
  }
}

@media (max-width: 480px) {
  .catalogue {
    padding: 0 16px;
  }

  .catalogue a {
    grid-template-columns: minmax(0, 1fr);
  }

  .catalogue .cat-meta {
    grid-column: 1;
  }
}

.opening {
  margin-top: clamp(36px, 5vw, 56px);
}

.opening img {
  width: 100%;
}

@media (max-width: 1100px) {
  .intro h1 {
    grid-column: 1 / span 7;
  }

  .intro-aside {
    grid-column: 8 / span 5;
  }
}

@media (max-width: 860px) {
  .intro h1,
  .intro-aside {
    grid-column: 1 / -1;
  }

  .intro-aside {
    max-width: 36rem;
    margin-top: 24px;
  }
}

/* Sections */

.section {
  padding: clamp(64px, 9vw, 112px) 0;
  border-top: 1px solid var(--rule);
}

.section-head {
  grid-column: 1 / span 4;
}

.section-body {
  grid-column: 5 / span 7;
}

.section-body > p {
  max-width: 36rem;
}

@media (max-width: 860px) {
  .section-head,
  .section-body {
    grid-column: 1 / -1;
  }

  .section-head {
    margin-bottom: 20px;
  }
}

/* Lectures */

.lecture {
  margin-top: clamp(56px, 7vw, 88px);
  padding-top: 28px;
  border-top: 1px solid var(--ink);
}

.lecture-head {
  grid-column: 1 / -1;
  margin-bottom: 32px;
}

.lecture-num {
  display: block;
  margin-bottom: 4px;
  font-size: clamp(2.6rem, 5.5vw, 4.25rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* The hour, drawn to scale: one fr per minute */

.hour {
  grid-column: 1 / -1;
  margin-bottom: clamp(40px, 5vw, 56px);
}

.hour-bar {
  display: grid;
  gap: 2px;
}

.hour-l1 .hour-bar {
  grid-template-columns: 5fr 20fr 17fr 10fr 8fr;
}

.hour-l2 .hour-bar {
  grid-template-columns: 5fr 15fr 15fr 17fr 8fr;
}

.seg {
  min-height: 76px;
  padding: 10px 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.875rem;
  line-height: 1.35;
}

.seg b {
  display: block;
  font-weight: 600;
}

.seg-edge {
  padding: 10px 8px;
  background: var(--sky);
  color: var(--ink);
  font-weight: 600;
}

.hour-ticks {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  position: relative;
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.hour-ticks span,
.hour-ticks::after {
  padding: 8px 0 0 5px;
  border-left: 1px solid var(--muted);
}

.hour-ticks::after {
  content: "60";
  position: absolute;
  top: 0;
  right: 0;
  padding: 8px 5px 0 0;
  border-left: 0;
  border-right: 1px solid var(--muted);
}

.hour figcaption {
  margin-top: 6px;
}

@media (max-width: 640px) {
  /* Too narrow for names inside the segments; the running order below carries them */
  .seg {
    min-height: 28px;
    padding: 0;
    font-size: 0;
  }

  .hour-ticks span:not(:nth-child(3n + 1)) {
    visibility: hidden;
  }
}

.facts {
  grid-column: 1 / span 4;
  margin: 0;
}

.facts div {
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}

.facts div:first-child {
  padding-top: 0;
  border-top: 0;
}

.facts dt {
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
}

.facts dd {
  margin: 2px 0 0;
  font-size: 0.975rem;
}

.lecture-body {
  grid-column: 5 / span 8;
}

.lecture-body > p {
  max-width: 36rem;
}

.timetable {
  width: 100%;
  margin-top: 28px;
  border-collapse: collapse;
  font-size: 0.975rem;
  line-height: 1.5;
}

.timetable caption {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
}

.timetable thead th {
  padding: 0 16px 8px 0;
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
}

.timetable tbody th,
.timetable td {
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.timetable tbody th {
  width: 3.5rem;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.timetable td:first-of-type {
  width: 32%;
  color: var(--ink);
  font-weight: 600;
}

.prompt {
  max-width: 36rem;
  margin: 32px 0 0;
}

.prompt figcaption {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.prompt blockquote {
  margin: 0;
  padding: 14px 20px;
  border-left: 3px solid var(--sky);
  background: var(--wash);
  font-style: italic;
}

.prompt blockquote p {
  margin: 0;
}

.slides-note {
  grid-column: 1 / -1;
  margin: 48px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.slides {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px 16px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.slides a,
.wide-slide a {
  display: block;
}

.slides img,
.wide-slide img {
  width: 100%;
  border: 1px solid var(--rule);
}

.wide-slide {
  grid-column: 1 / -1;
  margin-top: 48px;
}

@media (max-width: 860px) {
  .facts,
  .lecture-body {
    grid-column: 1 / -1;
  }

  .facts {
    margin-bottom: 8px;
  }
}

@media (max-width: 640px) {
  /* Stack each row; keep the header row for screen readers but hide it visually.
     The explicit ARIA roles in index.html keep the table semantics once rows become grids. */
  .timetable thead tr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .timetable tbody tr {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr);
    padding: 12px 0;
    border-bottom: 1px solid var(--rule);
  }

  .timetable tbody th,
  .timetable td,
  .timetable td:first-of-type {
    width: auto;
    padding: 0;
    border: 0;
  }

  .timetable tbody th {
    grid-row: 1 / span 2;
  }

  .timetable td:last-of-type {
    grid-column: 2;
    margin-top: 2px;
  }

  .slides {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* How it started */

.pull {
  margin: 36px 0;
}

.pull blockquote {
  margin: 0;
  color: var(--ink);
  font-family: var(--heading);
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-style: italic;
  line-height: 1.2;
}

.pull blockquote p {
  margin: 0;
  text-indent: -0.4em;
}

.pull figcaption {
  margin-top: 12px;
  font-size: 0.9rem;
}

.story-photos {
  margin-top: clamp(48px, 6vw, 72px);
  align-items: start;
}

.story-photos figure:first-child {
  grid-column: 1 / span 7;
}

.story-photos figure:last-child {
  grid-column: 9 / span 4;
  margin-top: clamp(40px, 8vw, 96px);
}

@media (max-width: 860px) {
  .story-photos figure:last-child {
    grid-column: 8 / span 5;
    margin-top: 0;
  }
}

@media (max-width: 560px) {
  .story-photos figure:first-child,
  .story-photos figure:last-child {
    grid-column: 1 / -1;
  }

  .story-photos figure:last-child {
    width: min(100%, 420px);
    margin-top: 28px;
  }
}

/* For lecturers */

.spec {
  margin: 0;
}

.spec div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 4px 24px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}

.spec div:last-child {
  border-bottom: 1px solid var(--rule);
}

.spec dt {
  color: var(--ink);
  font-weight: 600;
}

.spec dd {
  margin: 0;
}

@media (max-width: 560px) {
  .spec div {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Contact */

.contact .grid {
  align-items: start;
}

.contact figure {
  grid-column: 1 / span 6;
}

.contact-text {
  grid-column: 8 / span 5;
}

.contact-text h2 {
  margin-bottom: 20px;
}

.email {
  font-family: var(--heading);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  overflow-wrap: anywhere;
}

.contact-text ul {
  margin: 0 0 1em;
  padding-left: 1.1em;
}

.contact-text li {
  margin: 0.2em 0;
}

@media (max-width: 860px) {
  .contact figure,
  .contact-text {
    grid-column: 1 / -1;
  }

  .contact-text {
    max-width: 38rem;
    margin-top: 32px;
  }
}

/* Footer */

.site-foot {
  padding: 28px 0 44px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-foot .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

.site-foot p {
  margin: 0;
}

/* Testimonials */

.quotes { columns: 2; column-gap: 48px; margin: clamp(32px, 4vw, 48px) 0 0; padding: 0; list-style: none; }
.quotes li { break-inside: avoid; padding: 20px 0 28px; border-top: 1px solid var(--rule); }
.quotes blockquote { margin: 0; color: var(--ink); }
.quotes blockquote p { margin: 0 0 0.6em; }
.quotes figcaption { margin-top: 6px; }
.quotes figcaption b { display: block; color: var(--ink); font-weight: 600; }
@media (max-width: 760px) { .quotes { columns: 1; } }

/* Student websites */

.sites { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 24px; margin: clamp(32px, 4vw, 48px) 0 0; padding: 0; list-style: none; }
.sites a { display: block; text-decoration: none; }
.sites img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); }
.sites .site-name { display: block; margin-top: 16px; font-family: var(--heading); font-size: 1.25rem; color: var(--ink); }
.sites a:hover .site-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.sites .site-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 0.875rem; line-height: 1.5; }
@media (max-width: 640px) { .sites { grid-template-columns: minmax(0, 1fr); } }

.site-nav a[aria-current="page"] {
  text-decoration-line: underline;
}
