/* The course syllabus that compiles on scroll. Colours in :root (the Playground palette): one accent, tangerine, for
   the week in focus, the rail and the lesson bars; everything else is a warm neutral. GSAP moves .frame, the CSS styles
   .card inside it; GSAP moves .wk (opacity, scale) and its parts, the CSS styles .wk__face. The rail is filled by the
   --p variable (0 to 1) that the script writes on .rail. */
:root {
  --page: #f2efe9;          /* the page */
  --page-lift: #faf8f4;     /* the soft lift of the page behind the card */
  --card: #ffffff;          /* the card */
  --side: #fbfaf7;          /* the left column */
  --ink: #18171b;           /* the words */
  --muted: #8d8992;         /* the small words */
  --line: #ebe8e2;          /* hairlines and skeletons */
  --accent: #ff5a2c;        /* the week in focus, the rail, the lesson bars */
  --button: #18171b;        /* the enroll button */
  --button-ink: #ffffff;    /* the words on the button */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--page); }
html, body { overflow-x: clip; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
ol, ul { list-style: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.course { position: relative; height: 520vh; }
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2.6vh, 40px) clamp(8px, 2.4vw, 32px);
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(120% 90% at 50% 38%, var(--page-lift), var(--page) 72%);
}
@supports (height: 100lvh) {
  .stage { height: 100lvh; }
}

/* one warm light behind the card, low on the right; it drifts up with the weeks */
.light {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: min(80vw, 80vh, 620px);
  height: min(80vw, 80vh, 620px);
  margin: calc(min(80vw, 80vh, 620px) / -2) 0 0 calc(min(80vw, 80vh, 620px) / -2);
  border-radius: 50%;
  pointer-events: none;
  filter: blur(46px);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 24%, transparent), color-mix(in srgb, var(--accent) 6%, transparent) 62%, transparent);
}
.grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

.frame { width: min(980px, 100%); }
.card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  height: min(560px, calc(100vh - 2 * clamp(8px, 2.6vh, 40px)));
  border-radius: clamp(16px, 2.6vh, 24px);
  background: var(--card);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(24, 23, 27, 0.06),
    0 1px 1px rgba(24, 23, 27, 0.04),
    0 8px 18px -8px rgba(24, 23, 27, 0.12),
    0 40px 80px -30px rgba(70, 40, 20, 0.22);
}
@supports (height: 100lvh) {
  .card { height: min(560px, calc(100lvh - 2 * clamp(8px, 2.6vh, 40px))); }
}
/* the light inside the card that follows the pointer */
.card__glow {
  position: absolute;
  z-index: 3;
  left: 0;
  top: 0;
  width: 360px;
  height: 360px;
  margin: -180px 0 0 -180px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: multiply;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 9%, transparent), transparent);
}

/* ---- the left column: the course stays still ---- */
.side {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.6vh, 14px);
  padding: clamp(14px, 4vh, 36px) clamp(14px, 3vw, 34px);
  background: var(--side);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.side__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 560;
  letter-spacing: 0.01em;
  color: var(--muted);
}
.side__mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 5px -2px rgba(24, 23, 27, 0.5);
}
.side__mark svg { width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side__title {
  font-size: clamp(24px, min(4.4vw, 6.4vh), 44px);
  line-height: 0.98;
  font-weight: 720;
  font-stretch: 112%;
  letter-spacing: -0.025em;
}
.side__lede {
  font-size: clamp(12px, 1.9vh, 14px);
  line-height: 1.45;
  color: var(--muted);
  max-width: 26ch;
}
.side__week {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
  margin-top: clamp(2px, 1vh, 10px);
  font-size: clamp(13px, 2.2vh, 16px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.side__weekword { color: var(--ink); }
.side__of { color: var(--muted); font-weight: 480; }
.roll {
  display: inline-block;
  height: 1.15em;
  width: 0.72em;
  overflow: hidden;
  vertical-align: bottom;
  text-align: center;
  color: var(--accent);
  font-weight: 720;
  position: relative;
  top: 0.12em;
}
.roll__strip { display: block; }
.roll__strip b { display: block; height: 1.15em; line-height: 1.15; font-weight: inherit; }

/* the rail: a hairline with six stops, filled by --p */
.rail {
  --p: 0;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding-left: 18px;
}
.rail__track, .rail__fill {
  position: absolute;
  left: 4px;
  top: 4px;
  bottom: 4px;
  width: 1.5px;
  border-radius: 2px;
}
.rail__track { background: var(--line); }
.rail__fill {
  background: var(--accent);
  transform-origin: 50% 0;
  transform: scaleY(var(--p));
}
.rail__stops {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stop {
  position: relative;
  display: flex;
  align-items: center;
  height: 8px;
  font-size: clamp(11px, 1.8vh, 13px);
  font-weight: 460;
  color: var(--muted);
  white-space: nowrap;
}
.stop__notch {
  position: absolute;
  left: -18px;
  top: 0;
  width: 9.5px;
  height: 8px;
  display: grid;
  place-items: center;
}
.stop__notch i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--card);
  box-shadow: 0 0 0 1.5px var(--line);
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}
.stop.is-done .stop__notch i { box-shadow: 0 0 0 1.5px var(--accent); }
.stop.is-on .stop__notch i { background: var(--accent); box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.stop__name { display: inline-block; transition: color 0.4s ease, font-weight 0.4s ease, transform 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
.stop.is-done .stop__name { color: var(--ink); opacity: 0.7; }
.stop.is-on .stop__name { color: var(--ink); opacity: 1; font-weight: 640; transform: translateX(2px); }

.side__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: clamp(8px, 1.6vh, 14px);
  border-top: 1px solid var(--line);
}
.side__meta { white-space: nowrap; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side__sep { display: inline-block; width: 3px; height: 3px; margin: 0 4px 2px; border-radius: 1px; background: currentColor; opacity: 0.5; }
.enroll {
  position: relative;
  flex: none;
  height: clamp(34px, 6vh, 42px);
  padding: 0 14px 0 16px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  font: inherit;
  color: var(--button-ink);
  background: var(--button);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 6px 14px -6px rgba(24, 23, 27, 0.55);
  transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.enroll__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.enroll__face { position: relative; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 620; }
.enroll__price {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.14);
}
.enroll:active { transform: scale(0.97); }
.enroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---- the right column: the weeks rise one at a time ---- */
.weeks {
  --wh: 400px;
  position: relative;
  min-height: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
}
.weeks__track {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2vh, 16px);
  padding: 0 clamp(12px, 3vw, 36px);
}

.wk { height: var(--wh); transform-origin: 50% 50%; }
.wk__face {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.5vh, 12px);
  padding: clamp(12px, 3vh, 22px) clamp(12px, 2.4vw, 22px);
  border-radius: clamp(12px, 2vh, 16px);
  background: var(--card);
  box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow 0.45s ease;
}
.wk.is-on .wk__face {
  box-shadow:
    0 0 0 1px rgba(24, 23, 27, 0.07),
    0 2px 4px -2px rgba(24, 23, 27, 0.08),
    0 18px 36px -18px rgba(70, 40, 20, 0.24);
}
.wk__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: clamp(11px, 1.8vh, 12.5px);
  font-variant-numeric: tabular-nums;
}
.wk__label { font-weight: 640; color: var(--muted); transition: color 0.4s ease; }
.wk.is-on .wk__label { color: var(--accent); }
.wk__sum { color: var(--muted); }
.wk__title {
  font-size: clamp(16px, min(2.5vw, 4vh), 25px);
  line-height: 1.1;
  font-weight: 640;
  letter-spacing: -0.015em;
}
.w { display: inline-block; will-change: filter, opacity; }

.wk__lessons { display: flex; flex-direction: column; }
.ls {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) clamp(30px, 6vw, 56px) 3.6em;
  align-items: center;
  gap: clamp(7px, 1.2vw, 12px);
  height: clamp(26px, 5.4vh, 38px);
  padding: 0 6px;
  margin: 0 -6px;
  border-radius: 9px;
  font-size: clamp(12px, 2vh, 14px);
  cursor: default;
}
.ls + .ls::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 0;
  height: 1px;
  background: var(--line);
}
.ls__play {
  display: grid;
  place-items: center;
  width: clamp(18px, 3.6vh, 22px);
  height: clamp(18px, 3.6vh, 22px);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  transition: background-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}
.ls__play svg { width: 8px; height: 8px; fill: currentColor; transition: transform 0.35s cubic-bezier(0.3, 1.8, 0.5, 1); }
.ls__cell { position: relative; min-width: 0; }
.ls__name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ls__sk {
  position: absolute;
  left: 0;
  top: 50%;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 4px;
  background: var(--line);
  transform-origin: 0 50%;
}
.ls__bar {
  position: relative;
  height: 3px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.ls__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.ls__dur {
  text-align: right;
  color: var(--muted);
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (hover: hover) {
  .wk.is-on .ls { cursor: pointer; }
  .wk.is-on .ls:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
  .wk.is-on .ls:hover::before, .wk.is-on .ls:hover + .ls::before { opacity: 0; }
  .wk.is-on .ls:hover .ls__play { background: var(--accent); color: #fff; box-shadow: inset 0 0 0 1px var(--accent), 0 3px 8px -3px color-mix(in srgb, var(--accent) 70%, transparent); }
  .wk.is-on .ls:hover .ls__play svg { transform: translateX(0.5px) scale(1.12); }
  .wk.is-on .ls:hover .ls__dur { color: var(--ink); }
  .enroll:hover { transform: translateY(-1px); }
}

/* the week's project: a small card inside the week */
.wk__projwrap { position: relative; margin-top: auto; }
.wk__projsk {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  border: 1px dashed var(--line);
}
.pj {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: clamp(7px, 1.6vh, 11px) 12px;
  border-radius: 11px;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdfb, #fbf8f4);
  box-shadow: 0 0 0 1px var(--line), 0 6px 14px -10px rgba(70, 40, 20, 0.35);
}
.pj__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(24px, 4.6vh, 30px);
  height: clamp(24px, 4.6vh, 30px);
  border-radius: 8px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.pj__icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pj__text { min-width: 0; flex: 1; }
.pj__kicker { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.pj__name { display: block; font-size: clamp(12px, 2vh, 14px); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj__time { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pj__sheen {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.85) 50%, transparent);
  opacity: 0;
}

/* ---- narrow: the course on top, the rail lies down ---- */
@media (max-width: 640px) {
  .card { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 6px 10px;
    padding: 12px 14px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side__brand { grid-column: 1; font-size: 11px; }
  .side__mark { width: 18px; height: 18px; border-radius: 6px; }
  .side__mark svg { width: 11px; height: 11px; }
  .side__title { grid-column: 1; font-size: clamp(20px, 6.4vw, 28px); }
  .side__week { grid-column: 2; grid-row: 2; margin: 0; font-size: 13px; }
  .side__lede, .side__foot { display: none; }
  .rail { grid-column: 1 / -1; height: 10px; flex: none; padding: 0; margin-top: 4px; }
  .rail__track, .rail__fill { left: 4px; right: 4px; top: 4.25px; bottom: auto; width: auto; height: 1.5px; }
  .rail__fill { transform-origin: 0 50%; transform: scaleX(var(--p)); }
  .rail__stops { flex-direction: row; height: 10px; align-items: center; }
  .stop { height: 10px; width: 9.5px; }
  .stop__notch { left: 0; top: 1px; }
  .stop__name { display: none; }
  .weeks__track { padding: 0 12px; }
  .ls { grid-template-columns: auto minmax(0, 1fr) 26px 3.4em; }
}
