/* =========================================================================
   Math.Visualised
   A black canvas, two Manim colours, and a lot of room to breathe.
   ========================================================================= */

:root {
  /* Canvas */
  --bg: #050605;
  --bg-alt: #080a09;
  --bg-raise: #0d100e;
  --ink: #eef1ee;
  --ink-2: #a9b1ac;
  --ink-3: #6c746f;
  --line: rgba(238, 241, 238, 0.08);
  --line-2: rgba(238, 241, 238, 0.16);

  /* Manim palette */
  --green: #00ff00;   /* PURE_GREEN */
  --blue: #58c4dd;    /* BLUE */
  --yellow: #ffff00;
  --orange: #ff862f;
  --violet: #a970ff;
  --grad: linear-gradient(90deg, var(--green), var(--blue));

  /* Type */
  /* Computer Modern, via KaTeX: the same face as every MathTex in the videos */
  --serif: KaTeX_Main, "Latin Modern Roman", "CMU Serif", Georgia, serif;
  --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Layout */
  --wrap: 1220px;
  --gutter: clamp(16px, 4vw, 44px);
  --section: clamp(76px, 9.5vw, 132px);
  --radius: 14px;
  --ease: cubic-bezier(.22, .7, .2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, canvas, video { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p, ol, ul, dl, dd, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }

::selection { background: rgba(0, 255, 0, 0.28); color: #fff; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: fixed; left: 16px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: 8px;
  background: var(--ink); color: var(--bg);
  font: 700 .9rem var(--sans); text-decoration: none;
  transition: top .2s;
}
.skip:focus { top: 16px; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* The signature: PURE_GREEN fading into BLUE */
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.fig-label {
  font: 500 .72rem/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  margin-right: .5em;
}

/* KaTeX sits a touch smaller inside running text */
.tex .katex { font-size: 1.04em; }

/* ------------------------------------------------------------------ Nav */

.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  transition: background-color .3s, border-color .3s, backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled,
.nav.is-open {
  background: rgba(5, 6, 5, 0.78);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line);
}
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}

.brand {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none;
}
/* The π logo is one traced path (#logo-pi), so it takes any fill. */
.brand__logo {
  width: 29px; aspect-ratio: 355 / 336;
  fill: var(--ink);
  transition: fill .3s;
}
.brand:hover .brand__logo { fill: var(--blue); }
.brand__name {
  font: 700 1rem/1 var(--sans);
  letter-spacing: -0.01em;
}

.nav__links { display: flex; gap: clamp(18px, 3vw, 40px); }
.nav__links a {
  position: relative;
  display: inline-flex; align-items: baseline; gap: 7px;
  font-size: .93rem; color: var(--ink-2);
  text-decoration: none;
  padding: 6px 0;
  transition: color .2s;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--grad);
  transform: scaleX(0); transform-origin: left;
  transition: transform .4s var(--ease);
}
.nav__links a:hover,
.nav__links a.is-active { color: var(--ink); }
.nav__links a:hover::after,
.nav__links a.is-active::after { transform: scaleX(1); }
.nav__num { font: 400 .68rem/1 var(--mono); color: var(--ink-3); }
.nav__toggle {
  display: none;
  width: 44px; height: 44px; margin-right: -10px;
  background: none; border: 0; color: var(--ink); cursor: pointer;
}
.nav__toggle-bars,
.nav__toggle-bars::before {
  display: block; width: 22px; height: 1.5px; margin: auto;
  background: currentColor; position: relative;
  transition: transform .3s var(--ease);
}
.nav__toggle-bars { transform: translateY(-4px); }
.nav__toggle-bars::before { content: ""; position: absolute; top: 8px; left: 0; }
.nav.is-open .nav__toggle-bars { transform: translateY(0) rotate(45deg); }
.nav.is-open .nav__toggle-bars::before { transform: translateY(-8px) rotate(-90deg); }

@media (max-width: 760px) {
  .nav__toggle { display: block; }
  .nav__links {
    position: absolute; top: 72px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    padding: 8px var(--gutter) 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .25s, transform .3s var(--ease), visibility 0s .3s;
  }
  .nav.is-open .nav__links {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity .25s, transform .3s var(--ease);
  }
  .nav__links a {
    font: 400 1.6rem/1.2 var(--serif); color: var(--ink);
    padding: 14px 0; border-bottom: 1px solid var(--line);
  }
  .nav__links a::after { display: none; }
}

/* ------------------------------------------------------------------ Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border-radius: 999px;
  font: 700 .95rem/1 var(--sans);
  text-decoration: none;
  transition: background-color .25s, color .25s, border-color .25s, transform .25s var(--ease);
}
.btn--primary {
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--ink); color: #041004;
}
.btn--primary::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--grad);
  opacity: 0; transition: opacity .35s;
}
.btn--primary:hover::before { opacity: 1; }
.btn--ghost {
  border: 1px solid var(--line-2); color: var(--ink);
}
.btn--ghost:hover { border-color: var(--blue); }
.btn:active { transform: translateY(1px); }


/* ------------------------------------------------------------------ Hero */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex; align-items: center;
  padding: 112px 0 96px;
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
  align-items: center;
  gap: clamp(40px, 6vw, 96px);
}

.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font: 400 .8rem/1.4 var(--mono);
  color: var(--ink-2);
  margin-bottom: 30px;
}
.kicker__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--grad);
  flex: none;
}

.hero__title {
  font: 400 clamp(3rem, 6.4vw, 6rem)/1 var(--serif);
  letter-spacing: -0.012em;
  max-width: 11ch;
}
.hero__title em {
  font-style: italic;
  padding-right: .08em; /* keep the italic overhang inside the clip */
}

.hero__lede {
  margin-top: 30px;
  max-width: 34rem;
  font-size: clamp(1.06rem, 1.3vw, 1.18rem);
  color: var(--ink-2);
}
.hero__lede em { font-family: var(--serif); font-size: 1.08em; line-height: 1; color: var(--ink); }

.hero__actions {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 38px;
}


.hero__figure { position: relative; }

.plot {
  position: relative;
  aspect-ratio: 1;
  border-radius: 20px;
  border: 1px solid var(--line);
  overflow: hidden;
  touch-action: pan-y;
  cursor: crosshair;
  background:
    radial-gradient(closest-side, rgba(88, 196, 221, 0.06), transparent 75%),
    var(--bg-sunk, #020302);
}
/* A faint Manim-style NumberPlane underneath */
.plot::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(88, 196, 221, 0.075) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(88, 196, 221, 0.075) 1px, transparent 1px);
  background-size: 10% 10%;
  background-position: center;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
}
.plot::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(rgba(238, 241, 238, 0.13), rgba(238, 241, 238, 0.13)) center / 100% 1px no-repeat,
    linear-gradient(rgba(238, 241, 238, 0.13), rgba(238, 241, 238, 0.13)) center / 1px 100% no-repeat;
  -webkit-mask-image: radial-gradient(closest-side, #000 40%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 40%, transparent 100%);
  pointer-events: none;
}
.plot canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
}
.plot__axis {
  position: absolute; z-index: 2;
  font: italic 400 .9rem/1 var(--serif);
  color: var(--ink-3);
}
.plot__axis--re { right: 16px; top: calc(50% + 8px); }
.plot__axis--im { left: calc(50% + 10px); top: 14px; }

.dial {
  position: absolute; z-index: 2;
  left: 18px; bottom: 18px;
  width: 58px; height: 58px;
  overflow: visible;
}
.dial__axis { stroke: rgba(238, 241, 238, 0.2); stroke-width: .04; }
.dial__ring { fill: none; stroke: #bbbbbb; stroke-width: .06; }
.dial__hand { stroke: var(--green); stroke-width: .07; }
.dial__dot { fill: var(--green); }

.readout {
  position: absolute; z-index: 2;
  right: 18px; bottom: 20px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  font: 400 .8rem/1 var(--mono);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.readout sup { font-size: .72em; vertical-align: .55em; }
.readout__label {
  font: italic 400 .95rem/1 var(--serif);
  color: var(--green);
}

.hero__figure figcaption {
  margin-top: 16px;
  font-size: .9rem; line-height: 1.6;
  color: var(--ink-2);
  max-width: 36rem;
}
.hero__figure .hint { color: var(--ink-3); }
.hero__figure .hint i { font-family: var(--serif); font-size: 1.1em; }

.hero__scroll {
  position: absolute; left: 50%; bottom: 22px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font: 400 .66rem/1 var(--mono);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); text-decoration: none;
  transition: color .2s;
}
.hero__scroll:hover { color: var(--ink); }
.hero__scroll svg {
  width: 10px; height: 34px;
  fill: none; stroke: currentColor; stroke-width: 1.2;
}

@media (max-width: 960px) {
  .hero { min-height: 0; padding-top: 128px; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__title { max-width: 12ch; }
  .hero__figure { max-width: 620px; }
  .hero__scroll { display: none; }
}
@media (max-width: 520px) {
  .dial { width: 46px; height: 46px; left: 12px; bottom: 12px; }
  .readout { right: 12px; bottom: 14px; font-size: .72rem; }
}

/* ------------------------------------------------------------------ Sections */

.section {
  padding-block: var(--section);
  border-top: 1px solid var(--line);
}
.section--alt { background: var(--bg-alt); }

.section__head {
  display: grid;
  grid-template-columns: minmax(120px, 2fr) 10fr;
  gap: 24px;
  margin-bottom: clamp(40px, 5vw, 68px);
}
.section__head--stacked { grid-template-columns: 1fr; gap: 18px; }
.section__num {
  font: 400 .8rem/1 var(--mono);
  color: var(--ink-3);
  padding-top: .9em;
}
.section__head h2 {
  font: 400 clamp(2.7rem, 6vw, 4.9rem)/1 var(--serif);
  letter-spacing: -0.01em;
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px;
}
.section__lede {
  margin-top: 22px;
  max-width: 40rem;
  font-size: 1.1rem;
  color: var(--ink-2);
}
.section__lede strong { color: var(--ink); font-weight: 700; }

@media (max-width: 760px) {
  .section__head { grid-template-columns: 1fr; gap: 14px; }
  .section__num { padding-top: 0; }
}

/* ------------------------------------------------------------------ Reel */

.reel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(20px, 2.4vw, 32px);
  counter-reset: reel;
}
.reel__item:nth-child(even) { margin-top: 56px; }

.clip__frame {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  transition: border-color .4s, transform .5s var(--ease), box-shadow .5s;
}
/* Dashed inner rule: this frame is an empty slot, not a finished video */
.clip__frame::after {
  content: ""; position: absolute; inset: 8px;
  border: 1px dashed rgba(238, 241, 238, 0.14);
  border-radius: 10px;
  pointer-events: none;
}
.clip:hover .clip__frame {
  border-color: rgba(88, 196, 221, 0.45);
  transform: translateY(-4px);
  box-shadow: 0 30px 60px -30px rgba(0, 255, 0, 0.16);
}
.clip__frame.has-video::after { display: none; }
.clip__frame video { width: 100%; height: 100%; object-fit: cover; }

.thumb { width: 100%; height: 100%; }
.thumb text { text-anchor: middle; }
.thumb__title { font: 700 7.2px var(--sans); }
.thumb__title--long { font-size: 6.1px; }
.thumb__title--sm { font-size: 5.6px; }
.thumb__math { font: 400 6.6px var(--serif); fill: #fff; }
.thumb__math--big { font-size: 9px; }
.thumb__var { font: italic 400 6px var(--serif); }
.thumb__bf { font-style: normal; font-weight: 700; } /* \mathbf, as in the render */
.thumb__label { font: italic 400 3.8px var(--serif); text-anchor: start !important; }
.thumb__num { font: 700 5.6px var(--sans); fill: #fff; }
.thumb__caption { font: 400 3.4px var(--sans); fill: #bbbbbb; }
.thumb__op { font: 400 4.6px var(--serif); fill: var(--yellow); }
.thumb__cells text { font: 400 5.2px var(--serif); fill: #fff; }
.thumb__faint { fill: none; stroke: rgba(255, 255, 255, 0.14); stroke-width: .3; }

.clip__tag,
.clip__soon {
  position: absolute; z-index: 2;
  font: 500 .64rem/1 var(--mono);
  letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap;
}
.clip__tag {
  top: 16px; left: 16px;
  color: var(--ink-2);
}
.clip__soon {
  left: 50%; bottom: 16px; transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(5, 6, 5, 0.82);
  border: 1px solid var(--line-2);
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.clip__soon::before {
  content: ""; width: 0; height: 0;
  border-left: 6px solid var(--green);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.clip__meta { padding: 22px 4px 0; }
.clip__num { font: 400 .74rem/1 var(--mono); color: var(--ink-3); }
.clip__meta h3 {
  margin-top: 10px;
  font: 400 1.6rem/1.1 var(--serif);
  letter-spacing: -0.01em;
}
.clip__meta p:not([class]) {
  margin-top: 10px;
  font-size: .94rem; line-height: 1.6;
  color: var(--ink-2);
}
.clip__topic {
  margin-top: 16px;
  display: inline-flex; align-items: center; gap: 8px;
  font: 400 .72rem/1 var(--mono);
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}
.clip__topic::before {
  content: ""; width: 14px; height: 1px; background: var(--grad);
}

.reel__note {
  margin-top: clamp(40px, 5vw, 64px);
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: .95rem;
}
.reel__note a {
  color: var(--ink);
  text-decoration: none;
  background: var(--grad) left bottom / 100% 1px no-repeat;
  padding-bottom: 2px;
}

@media (max-width: 1060px) {
  .reel { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 64px; }
  .reel__item:nth-child(even) { margin-top: 48px; }
}
@media (max-width: 560px) {
  .reel {
    display: flex; overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    padding-bottom: 8px;
    scrollbar-width: none;
  }
  .reel::-webkit-scrollbar { display: none; }
  .reel__item { flex: 0 0 76%; scroll-snap-align: center; }
  .reel__item:nth-child(even) { margin-top: 0; }
}

/* ------------------------------------------------------------------ Playground */

/* Cards: a square live preview with the title under it */
.pg-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(36px, 4vw, 52px) clamp(16px, 2.2vw, 28px);
}
.pg-card {
  position: relative; z-index: 0;
  display: block; width: 100%;
  padding: 0; border: 0; background: none;
  color: inherit; font: inherit; text-align: left;
  cursor: pointer;
}
.pg-card:hover, .pg-card:focus-visible { z-index: 1; outline: none; }
.pg-card__frame {
  position: relative; display: block;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  transition: transform .45s var(--ease), border-color .35s, box-shadow .45s var(--ease);
}
.pg-card__frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pg-card:hover .pg-card__frame,
.pg-card:focus-visible .pg-card__frame {
  transform: scale(1.07);
  border-color: rgba(88, 196, 221, 0.5);
  box-shadow: 0 30px 60px -34px rgba(0, 0, 0, 0.9);
}

/* Light under the card, centred on the cursor (--mx/--my are set from playground.js).
   Registered so the light glides rather than jumps between positions. */
@property --mx { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
@property --my { syntax: "<percentage>"; inherits: true; initial-value: 60%; }
.pg-card { transition: --mx .35s var(--ease), --my .35s var(--ease); }
.pg-card__glow {
  position: absolute; z-index: -1;
  top: 0; left: 0;
  width: 100%; aspect-ratio: 1;
  border-radius: 24px;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 60%),
    rgba(0, 255, 0, 0.55), rgba(88, 196, 221, 0.32) 30%, transparent 62%);
  filter: blur(26px);
  opacity: 0;
  transform: scale(1.12);
  transition: opacity .45s var(--ease);
  pointer-events: none;
}
.pg-card:hover .pg-card__glow,
.pg-card:focus-visible .pg-card__glow { opacity: .85; }
.pg-card:focus-visible .pg-card__frame { outline: 2px solid var(--blue); outline-offset: 3px; }
.pg-card__title {
  display: block;
  margin-top: 16px;
  font: 400 1.2rem/1.25 var(--serif);
  transition: transform .45s var(--ease);
}
.pg-card:hover .pg-card__title { transform: translateY(6px); }

@media (max-width: 900px) {
  .pg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .pg-card__title { font-size: 1.05rem; margin-top: 12px; }
}

/* The dialog: the card's square flies here and becomes the live graph */
html.pg-lock { overflow: hidden; }

.pg-modal {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  max-width: none; max-height: none;
  margin: 0;
  padding: clamp(12px, 3vw, 32px);
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
}
.pg-modal[open] { display: flex; }
.pg-modal::backdrop {
  background: rgba(2, 3, 2, 0.8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.pg-modal__panel {
  --stage: min(640px, calc(100vh - 2 * clamp(12px, 3vw, 32px) - 48px), calc(100vw - 480px));
  position: relative; isolation: isolate;
  margin: auto;
  display: grid;
  grid-template-columns: var(--stage) minmax(280px, 340px);
  gap: 28px;
  padding: 24px;
}
.pg-modal__bg {
  position: absolute; inset: 0; z-index: -1;
  border-radius: 24px;
  background: var(--bg-raise);
  border: 1px solid var(--line-2);
  box-shadow: 0 50px 120px -40px rgba(0, 0, 0, 0.9);
}
.pg-modal__stage {
  position: relative;
  width: var(--stage); aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  transform-origin: top left;
}
.pg-modal__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
.pg-modal__stage.is-draggable canvas { touch-action: none; }
.pg-modal__stage.is-clickable canvas { cursor: pointer; }
.pg-modal__stage.is-over-handle canvas { cursor: grab; }
.pg-modal__stage.is-dragging canvas { cursor: grabbing; }

.pg-modal__side {
  display: flex; flex-direction: column; gap: 20px;
  min-width: 0;
  max-height: var(--stage);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 4px 4px 0;
}
.pg-modal__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.pg-modal__title { font: 400 2rem/1.05 var(--serif); }
.pg-modal__close {
  flex: none;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: none; color: var(--ink);
  cursor: pointer;
  transition: border-color .25s, color .25s;
}
.pg-modal__close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.pg-modal__close:hover { border-color: var(--blue); color: var(--blue); }
.pg-modal__desc { color: var(--ink-2); font-size: .95rem; line-height: 1.6; }
.pg-modal__tex {
  min-height: 64px;
  display: flex; align-items: center;
  padding: 4px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.4);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.pg-modal__tex .katex-display { margin: 10px 0; }
.pg-modal__tex .katex { font-size: 1.08em; }

.pg-controls { display: grid; gap: 14px; }
.pg-ctl {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center; gap: 12px;
}
.pg-ctl__k { font: 400 1.05rem/1.2 var(--serif); color: var(--ink); }
.pg-ctl__k b { font-weight: 700; }
.pg-ctl__v {
  font: 400 .8rem/1 var(--mono);
  color: var(--ink-2);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pg-range {
  --fill: 50%;
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.pg-range::-webkit-slider-runnable-track {
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--green), var(--blue)) 0 0 / var(--fill) 100% no-repeat, var(--line-2);
}
.pg-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; margin-top: -7px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--blue);
  transition: transform .2s var(--ease);
}
.pg-range:active::-webkit-slider-thumb { transform: scale(1.2); }
.pg-range::-moz-range-track { height: 2px; border-radius: 2px; background: var(--line-2); }
.pg-range::-moz-range-progress { height: 2px; border-radius: 2px; background: var(--grad); }
.pg-range::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--blue);
}
.pg-range:focus-visible { outline: none; }
.pg-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(88, 196, 221, 0.3); }
.pg-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px rgba(88, 196, 221, 0.3); }

.pg-seg {
  grid-column: span 2;
  display: inline-flex; flex-wrap: wrap; justify-self: start;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
}
.pg-seg button {
  padding: 7px 11px;
  white-space: nowrap;
  border: 0; border-radius: 999px;
  background: none; color: var(--ink-2);
  font: italic 400 .98rem/1 var(--serif);
  cursor: pointer;
  transition: background-color .25s, color .25s;
}
.pg-seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.pg-readout {
  display: grid; gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: .88rem;
}
.pg-readout div { display: flex; justify-content: space-between; gap: 16px; }
.pg-readout dt { color: var(--ink-3); }
.pg-readout dd { font-family: var(--mono); font-size: .82rem; text-align: right; font-variant-numeric: tabular-nums; }

.pg-modal__reset {
  align-self: flex-start;
  margin-top: auto;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: none; color: var(--ink-2);
  font: 700 .82rem/1 var(--sans);
  cursor: pointer;
  transition: border-color .25s, color .25s;
}
.pg-modal__reset:hover { border-color: var(--blue); color: var(--ink); }

@media (max-width: 900px) {
  .pg-modal__panel {
    --stage: min(100%, calc(100vh - 220px));
    grid-template-columns: minmax(0, 1fr);
    width: min(100%, 560px);
    padding: 16px;
    gap: 20px;
  }
  .pg-modal__stage { width: 100%; justify-self: center; max-width: calc(100vh - 220px); }
  .pg-modal__side { max-height: none; overflow: visible; }
  .pg-modal__title { font-size: 1.6rem; }
}

/* ------------------------------------------------------------------ About */

.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(48px, 7vw, 112px);
  align-items: center;
}

.outro {
  aspect-ratio: 4 / 5;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(18px, 3vw, 30px);
}
.outro__logo {
  width: clamp(6rem, 13vw, 10rem); aspect-ratio: 355 / 336;
  fill: #fff;
}
.outro__handle {
  font: 700 clamp(1.05rem, 2vw, 1.5rem)/1 var(--sans);
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, var(--blue), var(--green));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.about__card figcaption {
  margin-top: 14px;
  font-size: .9rem; color: var(--ink-2);
}

.pull {
  font: 400 clamp(2rem, 3.8vw, 3.2rem)/1.1 var(--serif);
  letter-spacing: -0.01em;
  margin-bottom: 40px;
  max-width: 18ch;
}
.pull em { font-style: italic; padding-right: .05em; }

.about__text > p {
  max-width: 38rem;
  color: var(--ink-2);
  font-size: 1.08rem;
}
.about__text > p + p { margin-top: 1.1em; }
.about__text strong { color: var(--ink); font-weight: 700; }

@media (max-width: 960px) {
  .about { grid-template-columns: 1fr; }
  .about__card { max-width: 380px; }
}

/* ------------------------------------------------------------------ Socials */

.socials { border-top: 1px solid var(--line-2); }
.social {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center; gap: 24px;
  padding: 34px 4px;
  border-bottom: 1px solid var(--line-2);
  text-decoration: none;
  transition: padding .4s var(--ease);
}
/* Each platform wears its own colours: --brand (solid), --brand-icon (icon paint), --brand-grad (underline). */
.social[data-social="instagram"] {
  --brand: #e1306c;
  --brand-icon: url(#g-instagram);
  --brand-grad: linear-gradient(90deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5);
}
.social[data-social="youtube"] {
  --brand: #ff0000;
  --brand-icon: #ff0000;
  --brand-grad: linear-gradient(90deg, #ff0000, #ff0000);
}
.social[data-social="tiktok"] {
  --brand: #fe2c55;
  --brand-icon: #ffffff;
  --brand-grad: linear-gradient(90deg, #25f4ee, #fe2c55);
}

.social::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 100%;
  background: var(--brand-grad, var(--grad));
  transform: scaleX(0); transform-origin: left;
  transition: transform .6s var(--ease);
}
.social__icon {
  width: 30px; height: 30px;
  fill: none; stroke: var(--brand-icon, var(--ink-2)); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .4s var(--ease), opacity .3s;
}
.social__icon .fill { fill: var(--brand-icon, var(--ink-2)); stroke: none; }
/* YouTube: the red rounded rectangle with a white play button */
.social[data-social="youtube"] .social__icon rect { fill: var(--brand); }
.social[data-social="youtube"] .social__icon .fill { fill: #fff; }
/* TikTok: white note with its cyan and pink offset edges */
.social[data-social="tiktok"] .social__icon {
  stroke-width: 2;
  filter: drop-shadow(-1.3px -1px 0 #25f4ee) drop-shadow(1.3px 1px 0 #fe2c55);
}
.social__name {
  font: 400 clamp(2rem, 4.6vw, 3.4rem)/1 var(--serif);
  letter-spacing: -0.01em;
}
.social__handle { color: var(--ink-3); font-size: .95rem; }
.social__status {
  justify-self: end;
  display: inline-flex; align-items: center; gap: 10px;
  font: 400 .74rem/1 var(--mono);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

.social[aria-disabled="true"] { cursor: default; }
.social[aria-disabled="true"] .social__name { color: var(--ink-2); }
.social[aria-disabled="true"] .social__icon { opacity: .6; }
.social[aria-disabled="true"] .social__status::before {
  content: ""; width: 18px; height: 1px;
  background: repeating-linear-gradient(90deg, var(--ink-3) 0 3px, transparent 3px 6px);
}

.social.is-live .social__status { color: var(--ink); transition: color .3s; }
.social.is-live .social__status::after {
  content: "→"; font-family: var(--sans); font-size: 1rem;
  transition: transform .4s var(--ease);
}
.social.is-live:hover { padding-left: 18px; }
.social.is-live:hover::after { transform: scaleX(1); }
.social.is-live:hover .social__icon { transform: scale(1.12); }
.social.is-live:hover .social__status { color: var(--brand); }
.social.is-live:hover .social__status::after { transform: translateX(6px); }

@media (max-width: 760px) {
  .social {
    grid-template-columns: 36px 1fr;
    grid-template-areas: "icon name" ". handle" ". status";
    gap: 6px 16px;
    padding: 26px 0;
  }
  .social__icon { grid-area: icon; width: 26px; height: 26px; }
  .social__name { grid-area: name; }
  .social__handle { grid-area: handle; }
  .social__status { grid-area: status; justify-self: start; margin-top: 10px; }
  .social.is-live:hover { padding-left: 0; }
}

/* ------------------------------------------------------------------ Footer */

.footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 48px;
}
.footer__inner {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center; gap: 32px 56px;
}
.footer__brand { display: flex; align-items: center; gap: 18px; }
.footer__logo { width: 40px; aspect-ratio: 355 / 336; flex: none; fill: var(--ink); }
.footer__handle { font: 700 1.05rem/1.2 var(--sans); display: inline-block; }
.footer__tag { margin-top: 4px; font-size: .88rem; color: var(--ink-3); }
.footer__nav { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.footer__nav a { color: var(--ink-2); text-decoration: none; font-size: .9rem; transition: color .2s; }
.footer__nav a:hover { color: var(--ink); }
.footer__copy { font: 400 .74rem/1 var(--mono); color: var(--ink-3); }

@media (max-width: 860px) {
  .footer__inner { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ Reveal */

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}
.js .reveal.is-in { opacity: 1; transform: none; }
.js .reel .reveal:nth-child(2) { transition-delay: .08s; }
.js .reel .reveal:nth-child(3) { transition-delay: .16s; }
.js .reel .reveal:nth-child(4) { transition-delay: .24s; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
