/* Teaching page, programs: six programs on the left (a white plate glides to the one you point at),
   and a screen on the right that shows what that program looks like from the inside: the recording's
   title card, then three real frames from inside it, played through like a preview. Pointing across
   the screen scrubs the frames; the strip under it shows all four at rest. On a phone the screen
   sticks under the nav and the program you scroll to takes the screen. */
.pg {
  --pg-travel: cubic-bezier(0.28, 0.11, 0.32, 1);
  --pg-settle: cubic-bezier(0.32, 0.72, 0, 1);
}
.pg-run {
  display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start; margin-top: clamp(2rem, 4vw, 3rem);
}

/* ---------- the ledger of programs ---------- */
.pg-ledger { position: relative; isolation: isolate; min-width: 0; margin-inline: -1.1rem; }
.pg-plate {
  position: absolute; left: 0; top: 0; z-index: -1; width: 0; height: 0; border-radius: 18px;
  background: var(--paper); box-shadow: var(--shadow-1); opacity: 0;
  transition: transform 0.55s var(--pg-settle), width 0.55s var(--pg-settle), height 0.55s var(--pg-settle), opacity 0.3s var(--pg-travel);
}
.pg-ledger.is-set .pg-plate { opacity: 1; }
.pg-ledger.is-still .pg-plate { transition: none; }
.pg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pg-list li { position: relative; }
.pg-list li + li::before {
  content: ''; position: absolute; left: 1.1rem; right: 1.1rem; top: -1px; height: 1px; background: var(--line-2);
  transition: opacity 0.35s var(--pg-travel);
}
.pg-list li:has(> [aria-pressed="true"])::before, .pg-list li:has(> [aria-pressed="true"]) + li::before { opacity: 0; }
.pg-row {
  display: grid; grid-template-columns: 6.3rem minmax(0, 1fr); gap: 0.3rem 1.1rem; width: 100%;
  padding: 1.1rem 1.1rem 1.15rem; border: 0; border-radius: 18px; background: none; font: inherit; text-align: left;
  color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s var(--pg-travel), transform 0.35s var(--pg-settle);
}
.pg-row:hover:not([aria-pressed="true"]) { background: rgba(255, 255, 255, 0.5); }
.pg-row:active { transform: scale(0.99); }
.pg-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pg-when {
  font-family: var(--label); font-weight: 600; font-size: 0.92rem; color: var(--muted); padding-top: 0.28rem;
  font-variant-numeric: tabular-nums; transition: color 0.3s var(--pg-travel);
}
.pg-name {
  font-family: var(--display); font-weight: 600; font-size: clamp(1.2rem, 1.7vw, 1.45rem); line-height: 1.25;
  color: var(--ink-2); transition: color 0.3s var(--pg-travel);
}
.pg-what {
  grid-column: 2; max-width: 46ch; font-size: 0.97rem; line-height: 1.5; color: var(--muted);
  transition: color 0.3s var(--pg-travel);
}
.pg-row[aria-pressed="true"] .pg-when { color: var(--accent); }
.pg-row[aria-pressed="true"] .pg-name { color: var(--ink); }
.pg-row[aria-pressed="true"] .pg-what { color: var(--ink-2); }

/* ---------- the screen ---------- */
.pg-watch { position: sticky; top: calc(var(--nav-h) + 1.5rem); min-width: 0; }
.pg-screen {
  padding: clamp(0.7rem, 1.2vw, 1rem); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow-2);
}
.pg-media { position: relative; }
.pg-stage {
  position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden;
  background: var(--mist-2); isolation: isolate; cursor: pointer;
}
.pg-shot {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; filter: blur(10px); transform: translate3d(0, var(--pg-rise, 12px), 0) scale(1.04);
  transition: opacity 0.5s var(--pg-travel), filter 0.55s var(--pg-travel), transform 0.75s var(--pg-settle);
}
.pg-shot.is-on { opacity: 1; filter: blur(0); transform: none; }
/* while the preview holds a frame it drifts closer, slowly, the way the recording would move */
.pg-shot.is-on.is-drift { transform: scale(1.04); transition: opacity 0.5s var(--pg-travel), filter 0.55s var(--pg-travel), transform 2.4s var(--pg-travel); }
.pg-shot.is-off { opacity: 0; filter: blur(0); transform: none; transition: opacity 0.45s var(--pg-travel) 0.08s; z-index: -1; }
.pg-screen.is-veiled .pg-shot.is-on, .pg-screen.is-veiled .pg-shot.is-off { filter: blur(16px) saturate(0.5); transform: scale(1.12); }
.pg-play {
  position: absolute; left: 50%; top: 50%; z-index: 2; width: 58px; height: 58px; margin: -29px 0 0 -29px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(255, 255, 255, 0.95); box-shadow: 0 6px 18px rgba(10, 13, 18, 0.28);
  opacity: 0; transform: scale(0.8); transition: opacity 0.3s var(--pg-travel), transform 0.45s var(--pg-settle);
}
.pg-play::before { content: ''; margin-left: 4px; border-left: 15px solid var(--ink); border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.pg-stage:hover .pg-play { opacity: 1; transform: scale(1); }
.pg-screen.is-veiled .pg-play { display: none; }
.pg-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pg-veil {
  position: absolute; left: 50%; top: 50%; z-index: 3; translate: -50% -50%; padding: 0.75rem 1.15rem; border: 0; border-radius: 10px;
  background: rgba(255, 255, 255, 0.95); box-shadow: 0 8px 24px rgba(10, 13, 18, 0.22); color: var(--ink);
  font-family: var(--label); font-weight: 600; font-size: 0.98rem; white-space: nowrap; cursor: pointer;
  transition: transform 0.35s var(--pg-settle), box-shadow 0.35s var(--pg-travel);
}
.pg-veil:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(10, 13, 18, 0.26); }
.pg-veil:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pg-veil[hidden] { display: none; }

/* four frames under the screen: title card, then three from inside the recording */
.pg-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.55rem; }
.pg-frame {
  position: relative; display: block; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: 8px; overflow: hidden;
  background: var(--mist-2); cursor: pointer; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 0 0 var(--accent); transition: box-shadow 0.35s var(--pg-settle), transform 0.35s var(--pg-settle);
}
.pg-frame img {
  display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0.7;
  transition: opacity 0.35s var(--pg-travel) calc(var(--pg-i, 0) * 35ms), filter 0.35s var(--pg-travel) calc(var(--pg-i, 0) * 35ms), transform 0.5s var(--pg-settle);
}
.pg-frame:nth-child(2) { --pg-i: 1; }
.pg-frame:nth-child(3) { --pg-i: 2; }
.pg-frame:nth-child(4) { --pg-i: 3; }
.pg-frame:hover img, .pg-frame.is-on img { opacity: 1; }
.pg-frame.is-on { box-shadow: 0 0 0 2px var(--accent); }
.pg-frame:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pg-strip.is-swap .pg-frame img { opacity: 0; filter: blur(4px); transition-duration: 0.16s; transition-delay: 0s; }
.pg-screen.is-veiled .pg-frame img { filter: blur(7px) saturate(0.5); transform: scale(1.18); }
.pg-frame i {
  position: absolute; left: 6px; right: 6px; bottom: 5px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 3px rgba(10, 13, 18, 0.35); transform: scaleX(0); transform-origin: 0 50%; opacity: 0;
  transition: opacity 0.2s var(--pg-travel), transform 0.2s var(--pg-travel);
}
.pg-frame i.is-run { opacity: 1; transform: scaleX(1); transition: opacity 0.2s var(--pg-travel), transform var(--pg-hold, 1.5s) linear; }

/* the caption: a fixed two line title box so the list never jumps */
.pg-cap { display: grid; align-content: start; gap: 0.35rem; margin: 0.95rem 0.3rem 0.35rem; }
.pg-t, .pg-m { transition: opacity 0.4s var(--pg-travel), transform 0.5s var(--pg-settle), filter 0.4s var(--pg-travel); }
.pg-t {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0;
  font-family: var(--display); font-weight: 600; font-size: 1.22rem; font-variant-numeric: lining-nums; line-height: 1.3; color: var(--ink);
}
.pg-line { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 0; }
.pg-m { font-family: var(--label); font-weight: 500; font-size: 0.95rem; color: var(--muted); transition-delay: 0.04s; }
.pg-go {
  flex: none; font-family: var(--label); font-weight: 600; font-size: 0.95rem; color: var(--accent); text-decoration: none;
  border-radius: 4px; transition: color 0.3s var(--pg-travel);
}
.pg-go span { display: inline-block; margin-left: 0.3em; transition: translate 0.4s var(--pg-settle); }
.pg-go:hover { color: var(--accent-deep); }
.pg-go:hover span, .pg-media:has(.pg-stage:hover) ~ .pg-cap .pg-go span { translate: 3px 0; }
.pg-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pg-cap.is-out .pg-t, .pg-cap.is-out .pg-m {
  opacity: 0; filter: blur(3px); transform: translateY(calc(var(--pg-dir, 1) * -6px)); transition-duration: 0.16s; transition-delay: 0s;
}
.pg-cap.is-in .pg-t, .pg-cap.is-in .pg-m { opacity: 0; filter: blur(3px); transform: translateY(calc(var(--pg-dir, 1) * 8px)); transition: none; }

/* ---------- Rod ---------- */
.pg-foot { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: clamp(2rem, 5vw, 4.5rem); margin-top: 1.75rem; }
.pg-with {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.4rem 1.4rem;
  padding: 1.1rem 1.35rem; border-radius: 18px; background: var(--paper); color: var(--ink); text-decoration: none;
  box-shadow: 0 0 0 1px var(--line), 0 10px 26px -16px rgba(10, 13, 18, 0.28);
  transition: translate 0.45s var(--pg-settle), box-shadow 0.45s var(--pg-travel);
}
.pg-with-mark { display: block; width: auto; height: 2.3rem; }
.pg-with-t { font-size: 0.95rem; line-height: 1.5; color: var(--ink-2); }
.pg-with-go { font-family: var(--label); font-weight: 600; font-size: 0.95rem; color: var(--accent); white-space: nowrap; }
.pg-with-go span { display: inline-block; transition: translate 0.4s var(--pg-settle); }
.pg-with:hover { translate: 0 -2px; box-shadow: 0 0 0 1px var(--line-2), 0 18px 34px -18px rgba(10, 13, 18, 0.35); }
.pg-with:hover .pg-with-go span { translate: 2px -2px; }
.pg-with:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- tablet and phone: the screen sticks under the nav, the list slides beneath it ---------- */
@media (max-width: 960px) {
  .pg-run, .pg-foot { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
  .pg-watch { order: -1; top: var(--nav-h); z-index: 3; padding-block: 0.5rem 0.9rem; }
  /* the mist behind the stuck screen reaches the screen edges, and fades out below it */
  .pg-watch::before, .pg-watch::after {
    content: ''; position: absolute; left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter)); pointer-events: none; z-index: -1;
  }
  .pg-watch::before { top: 0; bottom: 0; background: var(--mist); }
  .pg-watch::after { top: 100%; height: 1rem; background: linear-gradient(var(--mist), rgba(242, 244, 247, 0)); }
  .pg-screen { max-width: 40rem; }
  .pg-t { min-height: 2.6em; }
  .pg-ledger { margin-inline: -0.6rem; }
  .pg-row { padding-inline: 0.6rem; }
  .pg-list li + li::before { left: 0.6rem; right: 0.6rem; }
}
@media (max-width: 640px) {
  .pg-with { grid-template-columns: minmax(0, 1fr); justify-items: start; }
}
@media (max-width: 560px) {
  .pg-row { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; padding-block: 0.95rem 1rem; }
  .pg-what { grid-column: 1; }
  .pg-when { padding-top: 0; }
  .pg-screen { padding: 0.5rem; border-radius: 16px; }
  .pg-stage { border-radius: 10px; }
  .pg-strip { gap: 0.35rem; margin-top: 0.4rem; }
  .pg-frame { border-radius: 6px; }
  .pg-veil { padding: 0.6rem 0.9rem; font-size: 0.9rem; }
  .pg-cap { margin: 0.6rem 0.2rem 0.15rem; gap: 0.15rem; }
  .pg-t { font-size: 1.05rem; }
  .pg-m, .pg-go { font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pg-plate, .pg-row, .pg-shot, .pg-go span, .pg-shot.is-off, .pg-play, .pg-frame, .pg-frame img, .pg-frame i, .pg-t, .pg-m, .pg-with, .pg-with-go span,
  .pg-list li + li::before, .pg-veil { transition: none !important; }
  .pg-shot { transform: none; filter: none; }
}

/* page pass: from the fellowship to the fellows it trained */
.pg-fellows {
  display: inline-flex; gap: 0.35rem; margin: -0.35rem 0 0.9rem calc(6.3rem + 1.1rem + 0.95rem);
  font-family: var(--label); font-weight: 600; font-size: 0.9rem; color: var(--accent-deep); text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat;
  transition: background-size 0.4s cubic-bezier(0.28, 0.11, 0.32, 1);
}
.pg-fellows:hover, .pg-fellows:focus-visible { background-size: 100% 1.5px; }
@media (max-width: 960px) { .pg-fellows { margin-left: 0; } }
