:root {
  --bg: #fcfcfc;
  --text: #6e6e73;
  --strong: #1d1d1f;
  --faint: #b4b4b9;
  --column: 22em;
  --fade: 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Pro Text", "SF Pro", -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Water-ripple light, drawn by ripple.js behind everything else. */
.ripple {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Layout ---------- */

.page {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 96px 24px 120px;
}

.intro {
  width: 100%;
  max-width: var(--column);
}

.name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 30px;
  font-size: inherit;
  font-weight: 600;
  color: var(--strong);
}

.mark {
  width: 20px;
  height: 20px;
  flex: none;
  stroke-width: 2.25;
}

p { margin: 0 0 30px; }
p:last-child { margin-bottom: 0; }

.discipline,
.handle {
  font-weight: 500;
  color: var(--strong);
}

/* Keep each category on one line ("spatial / design" never splits). */
.discipline { white-space: nowrap; }

.handle { text-decoration: none; }

/* The last line links to Calendly. It matches the body text and darkens on
   hover, with the arrow nudging right. */
.cta {
  color: var(--text);
  text-decoration: none;
}

.cta svg {
  width: 16px;
  height: 16px;
  margin-left: 2px;
  vertical-align: -3px;
  transition: translate 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cta:hover,
.cta:focus-visible {
  color: var(--strong);
  outline: none;
}

.cta:hover svg,
.cta:focus-visible svg { translate: 3px 0; }
/* Underline under the name only (not the @), sitting just below the
   baseline so the browser breaks it around the tails of the p's.
   It fades in on hover/focus. */
.handle-name {
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-skip-ink: auto;
  text-decoration-color: transparent;
  transition: text-decoration-color 180ms ease;
}

.handle:hover .handle-name,
.handle:focus-visible .handle-name {
  text-decoration-color: currentColor;
}

.handle:focus-visible { outline: none; }

.footer {
  position: fixed;
  left: 50%;
  bottom: 48px;
  width: calc(100% - 48px);
  max-width: var(--column);
  transform: translateX(-50%);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  color: var(--faint);
}

.social {
  display: flex;
  gap: 14px;
}

.social a {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-weight: 500;
  color: var(--faint);
  text-decoration: none;
  transition: color 180ms ease;
}

.social a:hover,
.social a:focus-visible {
  color: var(--strong);
  outline: none;
}

.social-arrow {
  width: 16px;
  height: 16px;
}

/* ---------- Page-load intro (played by intro.js) ---------- */

.mark .star {
  transform-box: fill-box;
  transform-origin: center;
}

/* Before the intro plays, only the (still hidden) stars exist. */
html.is-intro .mark .star,
html.is-intro .name-text,
html.is-intro .intro > p,
html.is-intro .footer,
html.is-intro .reel {
  opacity: 0;
}

html.is-intro .intro,
html.intro-playing .intro { pointer-events: none; }

/* ---------- Hover state: everything but the hovered word fades away ---------- */

.intro,
.intro .name,
.intro .discipline,
.intro .handle,
.intro .cta {
  transition: color var(--fade);
}

/* Invisible padding around each previewable word so the cursor has room to roam. */
.discipline.has-preview { position: relative; }
.discipline.has-preview::after {
  content: "";
  position: absolute;
  inset: -10px -12px;
}

.discipline:focus-visible { outline: none; text-decoration: underline; text-underline-offset: 3px; }

body.is-previewing .intro,
body.is-previewing .intro .name,
body.is-previewing .intro .discipline,
body.is-previewing .intro .handle,
body.is-previewing .intro .cta {
  color: transparent;
}

/* The hovered word sits above the preview and inverts against whatever is behind it. */
.discipline.is-active {
  position: relative;
  z-index: 2;
  color: #fff !important;
  mix-blend-mode: difference;
  transition: none;
}

/* ---------- Preview card ---------- */

.preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  width: var(--w, 640px);
  height: var(--h, 360px);
  pointer-events: none;
  opacity: 0;
  filter: blur(10px);
  scale: 0.96;
  will-change: transform, opacity, filter;
  transition:
    opacity 280ms ease,
    filter 360ms ease,
    scale 420ms cubic-bezier(0.22, 1, 0.36, 1),
    width 420ms cubic-bezier(0.22, 1, 0.36, 1),
    height 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.preview.is-visible {
  opacity: 1;
  filter: blur(0);
  scale: 1;
}

/* Ambient light: a tiny copy of the media, blown up and blurred behind the card. */
.preview-glow {
  position: absolute;
  inset: -7%;
  width: 114%;
  height: 114%;
  filter: blur(40px) saturate(1.4);
  opacity: 0.8;
}

.preview-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 6px;
  background: #e9e9ec;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.35);
}

.preview-frame > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 400ms ease;
}

.preview-frame > .is-shown { opacity: 1; }

/* Blur crossfade: the outgoing layer blurs and fades as the incoming one
   sharpens in. Videos use 900ms (keep in step with LOOP_CROSSFADE in
   main.js); images take their time from "crossfade" in MEDIA. */
.preview-frame > video,
.preview-frame > img {
  filter: blur(14px);
  scale: 1.04;
  transition: opacity 900ms ease, filter 900ms ease, scale 900ms ease;
}

.preview-frame > video.is-shown,
.preview-frame > img.is-shown {
  filter: blur(0);
  scale: 1;
}

/* ---------- Touch screens: the reel ---------- */

/* Instead of hover previews, a card above the text cycles through every
   preview (main.js). The category playing gets an underline that fills
   left to right like a progress bar. */
.reel { display: none; }
html.is-touch .preview { display: none; }

/* The reel sits at the top of the screen, as wide as the text column. The
   text sits centred in the space below it, with the links at the bottom. */
html.is-touch {
  overflow-x: clip; /* the glow spills past the screen edges; don't let it scroll */
}

html.is-touch .page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px calc(32px + env(safe-area-inset-bottom));
}

html.is-touch .reel {
  display: block;
  position: relative;
  width: 100%;
  max-width: var(--column);
  aspect-ratio: 16 / 9;
}

/* Same glow as the desktop card, fitted to a phone. Nothing can draw past
   the screen edge, and the card sits closer to the edges than the glow
   spreads, so the glow would end in a hard line there. Instead its box stops
   at the screen edges (assuming the 24px page padding) and a mask fades it
   out just before them, leaving most of the glow below the card. The padding
   keeps the blur inside the canvas's own box, since Safari crops a filter at
   an element's edges. */
html.is-touch .reel .preview-glow {
  inset: auto;
  top: -24px;
  left: -24px;
  width: calc(100% + 48px);
  height: calc(100% + 24px + 96px);
  padding: 24px 24px 96px;
  filter: blur(28px) saturate(1.4);
  --fade-x: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
  --fade-y: linear-gradient(to bottom, transparent, #000 40px, #000 calc(100% - 72px), transparent);
  -webkit-mask-image: var(--fade-x), var(--fade-y);
  -webkit-mask-composite: source-in;
  mask-image: var(--fade-x), var(--fade-y);
  mask-composite: intersect;
}

html.is-touch .intro { margin: auto 0; padding: 48px 0; }

html.is-touch .footer {
  position: static;
  transform: none;
  width: 100%;
}

@property --reel-a {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

/* Two 1px lines at the bottom of the word: a faint track, and the fill
   whose width is --reel-p (0..1, set every frame). --reel-a fades both in
   and out as the reel moves between categories. */
html.is-touch .intro .discipline {
  --reel-p: 0;
  background:
    linear-gradient(color-mix(in srgb, currentColor calc(var(--reel-a) * 100%), transparent) 0 0)
      0 100% / calc(var(--reel-p) * 100%) 1px no-repeat,
    linear-gradient(color-mix(in srgb, currentColor calc(var(--reel-a) * 15%), transparent) 0 0)
      0 100% / 100% 1px no-repeat;
  transition: color var(--fade), --reel-a 300ms ease;
  -webkit-tap-highlight-color: transparent;
}

html.is-touch .intro .discipline.is-playing { --reel-a: 1; }

/* ---------- Small screens & accessibility ---------- */

@media (max-width: 520px) {
  .page { place-items: start center; padding-top: 22vh; }
  .footer { bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .preview { filter: none; scale: 1; transition: opacity 200ms ease; }
}
