/* Education: a punt journey from Southampton to King's College, Cambridge. */
.education { position: relative; overflow: clip; padding-bottom: clamp(4rem, 7vw, 6.5rem); background: linear-gradient(180deg, var(--abyss), #071029 55%, var(--abyss)); border-top: 1px solid var(--line); }
.education .section-head { margin-bottom: clamp(1.6rem, 3vw, 2.6rem); }

.river {
  position: relative; height: clamp(24rem, 66vh, 42rem); overflow: hidden; touch-action: pan-y;
  background: linear-gradient(180deg, #162c46, #263b47 55%, #111f2a 56%, #09131e);
  border-block: 1px solid #1f2d57;
}
.river canvas, .river-poster { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.river-poster { object-fit: cover; object-position: 55% center; }
.river canvas { opacity: 0; transition: opacity .35s ease; }
.river[data-river="live"] canvas { opacity: 1; }
.river[data-river="static"] .river-caption { display: none; }
.river::before, .river::after { position: absolute; inset: 0; z-index: 1; pointer-events: none; content: ""; }
.river::before { background: linear-gradient(0deg, #050c19e8, #050c1900 27%); }
.river::after { background: #060d17; opacity: var(--river-shade, 0); }
.river-tip {
  position: absolute; z-index: 3; left: 0; top: 0; max-width: 16rem; padding: .5rem .72rem; pointer-events: none;
  transform: translate(-50%, 1.5rem); transition: opacity .25s;
  color: #fff1dc; background: #0b1724d9; border: 1px solid #ffc46b45; border-radius: .35rem; box-shadow: 0 .35rem 1.4rem #0005;
  font-size: .86rem; font-weight: 560; line-height: 1.35; text-align: center;
}

.river-tip.is-above { transform: translate(-50%, calc(-100% - 1.4rem)); }
.river-tip[data-kind="paper"] { color: #eef3ff; border-color: #b9c9ff8c; box-shadow: 0 0 1.4rem #8fa8ff33; }

/* Where the punt has stopped, named like a title card. */
.river-caption {
  position: absolute; z-index: 2; left: clamp(1rem, 3vw, 2.4rem); top: clamp(1rem, 3vw, 2.2rem); display: grid; gap: .35rem;
  max-width: min(24rem, calc(100% - 2rem)); margin: 0; padding-left: .9rem; border-left: 2px solid #ffc46b; pointer-events: none;
  opacity: 0; translate: 0 .35rem; transition: opacity .6s var(--ease), translate .6s var(--ease);
}
.river-caption.is-shown { opacity: 1; translate: 0 0; transition-delay: .12s; }
.rcap-place { color: #fff6e6; font: 700 clamp(1.45rem, 2.5vw, 2.2rem)/1 var(--display); font-stretch: condensed; text-shadow: 0 2px 18px #050c22d9; }
.rcap-near { color: #d6def4; font-size: .9rem; font-weight: 600; line-height: 1.3; text-shadow: 0 1px 10px #050c22, 0 0 3px #050c22; }

.river-controls {
  position: absolute; z-index: 2; top: clamp(1rem, 3vw, 2.2rem); right: clamp(1rem, 3vw, 2.4rem);
  display: flex; gap: .45rem;
}
.river-controls .button {
  gap: .55rem; min-height: 2.75rem; padding: .54rem .82rem; border-color: #d9e7ef59;
  background: #0b1725b8; color: #f5ead9; border-radius: .35rem; font-size: .9rem;
}
.river-controls .button:disabled { opacity: .55; cursor: default; }
.river-play::before {
  display: block; width: .64rem; height: .73rem; background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%); content: "";
}
.river-play[aria-pressed="true"]::before { clip-path: polygon(0 0, 39% 0, 39% 100%, 0 100%, 0 0, 61% 0, 100% 0, 100% 100%, 61% 100%, 61% 0); }

/* The chapter rail: four stops along a line of river, lit up to where you are. */
.river-rail {
  position: absolute; z-index: 2; left: 50%; bottom: clamp(.8rem, 2.2vw, 1.5rem); translate: -50% 0;
  width: min(calc(100% - 2 * var(--gutter)), 52rem); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
}
.river-rail::before, .river-rail::after { content: ""; position: absolute; left: 12.5%; top: calc(.45rem + 1px); height: 2px; }
.river-rail::before { right: 12.5%; background: #ffffff2e; }
.river-rail::after { width: calc(75% * var(--progress, 0)); background: linear-gradient(90deg, #f6bc9d, #ffb23e); box-shadow: 0 0 .8rem #ffb23e88; transition: width 1.8s var(--ease); }
.river-rail button {
  position: relative; z-index: 1; display: grid; justify-items: center; gap: .3rem; min-height: 4.4rem; padding: 0 .25rem .2rem;
  border: 0; color: #d8e0f6; background: none; text-align: center;
}
.river-rail button::before {
  content: ""; width: .95rem; height: .95rem; border-radius: 50%; border: 2px solid #ffffff73; background: #0a1434;
  transition: background .3s, border-color .3s, box-shadow .3s, transform .3s var(--ease);
}
.river-rail button:hover::before { border-color: #ffd9a0; transform: scale(1.15); }
.river-rail button[aria-pressed="true"]::before { background: #ffc46b; border-color: #ffe3b4; box-shadow: 0 0 1.1rem #ffb23e; }
.river-rail button:focus-visible { outline-offset: 2px; }
.rr-year { color: #fff; font: 700 1.2rem/1 var(--display); font-stretch: condensed; text-shadow: 0 1px 10px #050c22; }
.rr-name { color: #cfd8f0; font-size: .84rem; font-weight: 600; line-height: 1.2; text-shadow: 0 1px 10px #050c22, 0 0 3px #050c22; }
.river-rail button[aria-pressed="true"] .rr-name { color: #ffe2b0; }

/* Chapters: one at a time with scripting, all four as a list without. */
.river-chapters { list-style: none; padding: 0; margin: clamp(1.6rem, 3vw, 2.4rem) 0 0; }
.river-chapter {
  display: grid; grid-template-columns: minmax(11rem, .75fr) minmax(0, 1.65fr) minmax(14rem, 1fr);
  gap: clamp(1.2rem, 3vw, 3rem); align-items: start; padding-block: 1.4rem; border-top: 1px solid var(--line);
}
.education.is-ready .river-chapter:not([hidden]) { animation: quiet-rise .6s var(--ease) both; }
.rc-when { color: #ffc46b; font: 700 clamp(2rem, 3.4vw, 3rem)/.9 var(--display); font-stretch: condensed; }
.rc-where { margin-top: .55rem; color: var(--muted); font-weight: 600; line-height: 1.35; }
.rc-main h3 { font: 700 clamp(2.2rem, 3.8vw, 3.6rem)/.92 var(--display); font-stretch: condensed; text-wrap: balance; }
.rc-mark { display: inline-block; margin: .75rem 0 .85rem; padding: .28rem .62rem; border: 1px solid #ffc46b66; color: #ffe2b0; font-size: .9rem; font-weight: 600; }
.rc-main > p:not(.rc-mark) { max-width: 38rem; color: #cdd6ee; line-height: 1.55; }
.rc-honours { list-style: none; display: grid; gap: .5rem; margin-top: 1rem; padding: 0; }
.rc-honours li { display: flex; align-items: baseline; gap: .65rem; color: #eef2ff; line-height: 1.4; }
.rc-honours li::before { content: ""; flex: none; width: .5rem; height: .68rem; border-radius: 45%; background: #ffc46b; box-shadow: 0 0 .7rem #ffb23e; translate: 0 .05rem; }
.rc-papers li::before { background: #e8eeff; box-shadow: 0 0 .7rem #9fb6ff; }
.rc-today { padding: 1rem 1.1rem; border-left: 2px solid #ffc46b; background: #0b1534; color: #cdd6ee; line-height: 1.5; }
.rc-today strong { display: block; margin-bottom: .35rem; color: #fff; }
.river-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .4rem; }
.education:not(.is-ready) .river-rail, .education:not(.is-ready) .river-actions { display: none; }

@media (max-width: 970px) {
  .river-chapter { grid-template-columns: minmax(9rem, .6fr) minmax(0, 1.6fr); }
  .rc-today { grid-column: 2; }
}
@media (max-width: 740px) {
  .river { height: clamp(22rem, 62vh, 30rem); }
  .river-controls { top: auto; bottom: 5.8rem; }
  .river-rail { width: calc(100% - 1.2rem); }
  .rr-year { font-size: 1rem; }
  .rr-name { font-size: .8rem; }
  .river-chapter { grid-template-columns: 1fr; gap: .9rem; }
  .rc-today { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .river canvas, .river-caption, .river-rail::after { transition: none; }
  .education.is-ready .river-chapter:not([hidden]) { animation: none; }
}
@media print { .education { display: none; } }
