/* ---------- tokens (palette and type from experimentempire.com) ---------- */
:root {
  --paper: #ede8df;
  --ink: #2a2520;
  --graphite: #7a7167;
  --rule: #d6cec1;

  --font: "Host Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --edge: clamp(16px, 4vw, 48px);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* the reel: the composition is measured off its width */
  --ar: 16 / 9;
  --reel-w: min(54vw, calc((100svh - 230px) * var(--ar)));

  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 4px; border-radius: 2px; }
::selection { background: var(--ink); color: var(--paper); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- wordmark: MOTION [PRO] ---------- */
/* letters are separate spans so the intro can raise them one by one;
   trimming to cap height lets the pill centre on the capitals, not the line box */
.word {
  display: inline-flex;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}
.word > span,
.badge > span {
  display: inline-block;
  text-box: trim-both cap alphabetic;
}
.badge {
  display: inline-flex;
  padding: 0.44em 0.66em;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.42em;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
  overflow: clip;
}

/* ---------- intro ---------- */
.intro { display: none; }
.is-intro .intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: clamp(12px, 1.5vw, 20px);
  pointer-events: none;
}
.intro__mark {
  display: flex;
  align-items: center;
  gap: 0.16em;
  font-size: clamp(40px, 6.8vw, 100px);
}
.split, .split__inner { display: flex; }
.split__inner { transform-origin: 0 0; }
/* the letters rise out of the baseline */
.intro .word { clip-path: inset(-0.3em -0.3em -0.03em -0.3em); }
.intro .word > span { transform: translateY(115%); }
.intro .badge { opacity: 0; }
.intro__name {
  margin: 0;
  font-size: clamp(17px, 1.8vw, 26px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  opacity: 0;
}

/* ---------- header and footer: the wordmark spread across the page ---------- */
.bar,
.foot {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
  padding: 0 var(--edge);
  transition: opacity 600ms ease;
}
.bar { top: 0; }
.foot { bottom: 0; font-size: 15px; }
.bar__motion { font-size: 22px; }
.bar__pro { font-size: 27px; }
.bar__motion, .bar__pro { display: flex; }

.foot__id {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
}
.foot__name { font-weight: 500; }
.foot__place {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--graphite);
}
.flag { width: 13px; height: 13px; fill: currentColor; }

.foot__social {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: -10px; /* hit areas overhang; glyphs line up with the edge */
}
.icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: color 160ms ease, transform 160ms var(--ease-out);
}
.icon svg { width: 18px; height: 18px; }
.icon--ig, .icon--mail { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.icon--ig .dot { fill: currentColor; stroke: none; }
.icon .icon--x { width: 15px; height: 15px; fill: currentColor; }
.icon:active { transform: scale(0.92); }
@media (hover: hover) and (pointer: fine) {
  .icon:hover { color: var(--graphite); }
}

/* email copied: anchored to the envelope, rises out of it */
.toast {
  position: absolute;
  right: 6px;
  bottom: calc(100% + 6px);
  display: flex;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  transform-origin: 100% 100%;
  opacity: 0;
  transform: translateY(4px) scale(0.97);
  pointer-events: none;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.toast.is-on { opacity: 1; transform: none; }
.toast__note { color: var(--rule); opacity: 0.7; }

/* ---------- stage ---------- */
.stage {
  position: relative;
  display: grid;
  place-items: center;
  height: 100svh;
  min-height: 540px;
  overflow: clip;
}
.scene {
  position: relative;
  width: var(--reel-w);
}

/* ---------- floating loops, behind the reel ---------- */
/* positions are fractions of the reel: x and width of its width, y of its height */
.loops {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  transition: opacity 800ms ease;
}
.float {
  position: absolute;
  left: calc(50% + var(--x));
  top: calc(50% + var(--y));
  width: var(--w);
  will-change: transform;
}
.loop {
  translate: -50% -50%;
  aspect-ratio: var(--ar);
  border-radius: 6px;
  overflow: hidden;
  background: var(--rule);
}
.loop video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.f1 { --x: -57%; --y: -42%; --w: 21%; --d: 0.8; }
.f2 { --x: -77%; --y: 10%;  --w: 25%; --d: 0.45; }
.f3 { --x: -55%; --y: 56%;  --w: 15%; --d: 1; }
.f4 { --x: -30%; --y: -66%; --w: 12%; --d: 0.3; }
.f5 { --x: 60%;  --y: -36%; --w: 24%; --d: 0.6; }
.f6 { --x: 77%;  --y: 30%;  --w: 15%; --d: 0.9; }
.f7 { --x: 44%;  --y: 60%;  --w: 15%; --d: 0.5; }
.f8 { --x: 24%;  --y: -64%; --w: 11%; --d: 0.35; }

/* ---------- the reel ---------- */
.reel {
  position: relative;
  z-index: 2;
  margin: 0;
  aspect-ratio: var(--ar);
  border-radius: 10px;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink);
  box-shadow:
    0 1px 2px rgba(42, 37, 32, 0.1),
    0 30px 70px -30px rgba(42, 37, 32, 0.45);
  cursor: pointer;
}
.reel__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* one control on the poster: a paper pill with an ink play disc, echoing the PRO badge */
.reel__play {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 20px 0 7px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
.reel__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--ink);
}
.reel__icon svg { width: 10px; height: 12px; margin-left: 2px; fill: var(--paper); }
.reel__time {
  color: var(--graphite);
  font-variant-numeric: tabular-nums;
}
.reel__time:empty { display: none; }

@media (hover: hover) and (pointer: fine) {
  .reel:hover .reel__play { transform: scale(1.04); }
}
.reel:active .reel__play { transform: scale(0.97); transition-duration: 120ms; }

.reel.is-playing .reel__play {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}
.reel.is-playing .reel__play:focus-visible { opacity: 1; }
.reel.is-playing:not(.is-active) { cursor: none; }

/* playback chrome: a hairline you can scrub, and full screen. Only while the reel is out */
.reel__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  height: 20px;
  cursor: pointer;
  touch-action: none;
}
.reel__track {
  width: 100%;
  height: 3px;
  background: rgba(237, 232, 223, 0.28);
  transition: height 160ms var(--ease-out);
}
.reel__fill {
  height: 100%;
  background: var(--paper);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
@media (hover: hover) and (pointer: fine) {
  .reel__bar:hover .reel__track { height: 5px; }
}
.reel__fs {
  position: absolute;
  right: 12px;
  bottom: 16px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
}
.reel__fs svg { width: 12px; height: 12px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.reel__bar,
.reel__fs {
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}
.reel.is-started.is-active .reel__bar,
.reel.is-started:not(.is-playing) .reel__bar,
.reel.is-started.is-active .reel__fs,
.reel.is-started:not(.is-playing) .reel__fs,
.reel__fs:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.reel:fullscreen { border-radius: 0; background: #000; }
.reel:fullscreen .reel__video { object-fit: contain; }

/* ---------- watching: everything around the reel steps back ---------- */
.is-watching .loops { opacity: 0.12; }
.is-watching .bar,
.is-watching .foot { opacity: 0.35; }
@media (hover: hover) and (pointer: fine) {
  .is-watching .bar:hover,
  .is-watching .foot:hover { opacity: 1; }
}

/* ---------- intro start states (main.js animates from here) ---------- */
.is-intro .bar,
.is-intro .foot,
.is-intro .reel,
.is-intro .loop { opacity: 0; }

/* ---------- phones: the reel goes full width, loops sit above and below it ---------- */
@media (max-width: 720px) {
  :root { --reel-w: calc(100vw - 2 * var(--edge)); }
  .bar, .foot { height: 60px; }
  .foot { font-size: 14px; }
  .foot__id { gap: 12px; }
  .bar__motion { font-size: 19px; }
  .bar__pro { font-size: 23px; }
  .reel { border-radius: 8px; }

  .f1 { --x: -27%; --y: -96%;  --w: 29%; }
  .f5 { --x: 24%;  --y: -112%; --w: 34%; }
  .f8 { --x: 42%;  --y: -66%;  --w: 14%; }
  .f3 { --x: -26%; --y: 104%;  --w: 22%; }
  .f7 { --x: 26%;  --y: 86%;   --w: 26%; }
  .f2, .f4, .f6 { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .intro .word > span { transform: none; }
  .intro .badge { opacity: 1; }
  .intro__mark { opacity: 0; }
  .reel:hover .reel__play,
  .reel:active .reel__play { transform: none; }
}
