:root {
  --paper: #fff;
  --ink: #111;
  --rule: #ebebeb;       /* ruler lines: light gray, not black */
  --rule-text: #b4b4b4;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Host Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--paper); color: var(--ink); }
body { font-family: var(--sans); overflow-x: hidden; -webkit-font-smoothing: antialiased; }
body.intro-on { overflow: hidden; }
::selection { background: var(--ink); color: #fff; }   /* selected text: white on black */
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }

/* a still film grain laid over everything */
.grain {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' seed='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); background-size: 100px 100px;
  opacity: .36; mix-blend-mode: multiply;
}
/* the same grain in white, so it also shows on the photos and anything dark */
.grain.lite { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' seed='5' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); opacity: .12; mix-blend-mode: screen; }

/* ---------- intro ---------- */
#intro {
  position: fixed; inset: 0; z-index: 20;
  background: #000;
  transition: background-color .6s ease;
}
#intro.paper { background: var(--paper); }
#intro.clear { background: transparent; pointer-events: none; }
#intro.gone { display: none; }

.stage {
  position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
  background: #000; overflow: hidden;
  transition: top .9s cubic-bezier(.7,0,.2,1), left .9s cubic-bezier(.7,0,.2,1),
              width .9s cubic-bezier(.7,0,.2,1), height .9s cubic-bezier(.7,0,.2,1),
              opacity .4s;
}
.stage.card {
  /* same 16:9 as the reel, so the shrink is a pure scale with no re-crop */
  --w: var(--card);
  width: var(--w); height: calc(var(--w) * 9 / 16);
  top: calc(50vh - var(--w) * 9 / 32); top: calc(50dvh - var(--w) * 9 / 32); left: calc(50vw - var(--w) / 2);
}
.stage.out { opacity: 0; }
.stage video { width: 100%; height: 100%; object-fit: cover; display: none; }
.stage video.on { display: block; }

.flicker { position: absolute; inset: 0; display: none; }
.flicker.on { display: block; }
.flicker > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

:root { --card: min(320px, 72vw); }

/* small index pinned to the card's top-left corner while the photos run (placed in main.js) */
.count {
  position: absolute; z-index: 3; white-space: nowrap;
  font-family: var(--mono); font-size: .65rem; letter-spacing: .2em; color: var(--rule-text);
  opacity: 0; transition: opacity .3s;
}
.count.on { opacity: 1; }

/* construction lines behind the card. each shape is one unit long (pathLength=1)
   and draws itself over 1.4s; main.js starts them in order as photos land */
.fgrid { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fgrid > * {
  fill: none; stroke: var(--rule); stroke-width: 1;
  stroke-dasharray: 1 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 1s cubic-bezier(.65, 0, .35, 1);
}
.stage { z-index: 2; }  /* the photo sits over the construction lines */
.stage.card.out { opacity: 0; transform: scale(.97); transition: opacity .9s ease, transform .9s ease; }

/* the title being made, over the ruler lines: for each letter a hairline (.o) draws
   the outline, the ink (.f) fades in behind it, then the hairline lifts */
.ink { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 31; pointer-events: none; overflow: visible; }
.ink .f { fill: var(--ink); stroke: none; fill-opacity: 0; animation: ink-fill .4s cubic-bezier(.42, 0, 1, 1) calc(var(--n) + .8s) forwards; }
.ink .o {
  fill: none; stroke: var(--ink); stroke-width: .6px; stroke-opacity: .2; stroke-linejoin: round;
  stroke-dasharray: var(--len); stroke-dashoffset: var(--len);
  /* the dash is far longer than the outline, so the line itself is done in about 0.6s */
  animation: ink-draw 1.56s cubic-bezier(.42, 0, .58, 1) var(--n) forwards, ink-line .2s linear calc(var(--n) + 1.6s) forwards;
}
/* construction marks: plain paths, one unit long (pathLength=1) */
.ink .c {
  fill: none; stroke: var(--ink); stroke-width: .6px; stroke-opacity: .2; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: ink-draw .7s cubic-bezier(.42, 0, .58, 1) var(--n) forwards, ink-line .25s linear calc(var(--n) + 1.6s) forwards;
}
@keyframes ink-draw { to { stroke-dashoffset: 0; } }
@keyframes ink-fill { to { fill-opacity: 1; } }
@keyframes ink-line { to { stroke-opacity: 0; } }

.guides { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transition: opacity .6s; }
.guides line { stroke: var(--rule); stroke-width: 1; transition: stroke-dashoffset 1.4s cubic-bezier(.65,0,.35,1); }
.guides text { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; fill: var(--rule-text); opacity: 0; transition: opacity .4s; }
.guides.drawn text { opacity: .8; }
.guides.out { opacity: 0; }

.skip {
  position: absolute; right: 1.4rem; bottom: 1.2rem; z-index: 6;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
  color: #fff; opacity: .45; transition: opacity .2s;
}
#intro.paper .skip { color: var(--ink); }

/* the tag that rides beside the cursor while the film plays and says whether the
   sound is on. it is placed by main.js, and only shows while the cursor is moving. */
.tag {
  position: fixed; left: 0; top: 0; z-index: 7; pointer-events: none;
  padding: .55em .85em .5em;
  background: var(--ink); color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .3);
  font-family: var(--mono); font-size: .64rem; letter-spacing: .2em; text-transform: uppercase; white-space: nowrap;
  opacity: 0; transition: opacity .35s, background-color .2s, color .2s;
}
.tag.on { opacity: 1; }
.tag.rest { left: 50%; top: auto; bottom: 13vh; transform: translateX(-50%); }   /* touch screens */
.tag.off { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); }
#intro { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* ---------- name ---------- */
/* Source Serif 4 at its display optical size, like bharadwhat, a touch heavier and looser.
   font-size is fitted to the screen width in main.js. */
.name {
  font-family: var(--serif); font-weight: 480; font-optical-sizing: auto;
  font-size: 12vw; line-height: .92; letter-spacing: -.012em;
  white-space: nowrap; text-align: center; margin: 0;
  /* rests half cut at the top of the page, above the clear intro layer */
  position: absolute; left: 0; right: 0; top: 0; z-index: 30;
  transform: translateY(-.24em);
  transition: transform 1.25s cubic-bezier(.62, 0, .18, 1);
  pointer-events: none;
}
/* during the intro it is a title card in the middle of the screen */
.name.card { transform: translateY(calc(50svh - 50%)); }
.name.still { transition: none; }
/* a letter of the title. it stays unseen while the intro draws and inks a copy of it
   (see .ink), and is simply there once that is done. */
.ch { position: relative; display: inline-block; }
.ch .b { opacity: 0; }
.name.set .ch .b { opacity: 1; }
/* on the page, each letter of the title changes to another typeface under the cursor */
/* (only over the letter itself: the box of a letter hangs well below its baseline) */
.ch .hit { position: absolute; left: 0; right: 0; top: 0; bottom: var(--drop, 24%); }
body.live .name .ch .hit { pointer-events: auto; cursor: default; }
@media (hover: hover) and (pointer: fine) and (min-width: 701px) {
  .name.set .ch:hover .b { opacity: 0; }
  .name.set .ch:hover .a { opacity: 1; }
}
.ch .a {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  opacity: 0; pointer-events: none; line-height: 1;
}
.sp { display: inline-block; width: .26em; }
.probe { display: inline-block; width: 0; height: 0; }

.f-ital   { font-family: var(--serif); font-style: italic; font-weight: 300; }
.f-black  { font-family: var(--serif); font-weight: 900; }
.f-script { font-family: "Style Script", cursive; }
.f-story  { font-family: "Story Script", cursive; }
.f-bench  { font-family: "Workbench", monospace; font-size: .8em; }
.f-pixel  { font-family: "Silkscreen", monospace; font-size: .62em; }

/* ---------- hero: the title half cut at the top, the fountain under it ---------- */
#site {
  position: relative; height: 100vh; height: 100svh; min-height: 560px; display: flex; flex-direction: column;
  padding-top: calc(var(--title, 12vw) * .7);   /* the part of the title that shows */
}
/* these arrive once the title has moved up to the top (straight away if there was no intro) */
.under, .garden, .quote, .bio, .foot { opacity: 0; transition: opacity 1.1s ease 1.2s; }
body.snap .under, body.snap .garden, body.snap .quote, body.snap .bio, body.snap .foot { transition-delay: 0s; }
body.live .under, body.live .garden, body.live .quote, body.live .bio, body.live .foot { opacity: 1; }

.under {
  display: flex; justify-content: flex-end; align-items: baseline; gap: 2rem;
  padding: 0 3vw; font-size: 14px; letter-spacing: .02em;
}
.under a { font-weight: 600; color: inherit; text-decoration: none; }
/* the title's letter boxes reach down over this line, so it sits above them */
body.live .under { position: relative; z-index: 31; }

/* the fountain takes everything that is left */
.garden { flex: 1 1 0; min-height: 0; position: relative; margin: .6rem 0 3.4rem; }
.garden svg, .garden canvas { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.garden canvas { pointer-events: none; }

.quote {
  position: absolute; left: 3vw; top: 46%; width: min(17rem, 21vw); margin: 0;
  font-family: var(--serif); font-size: clamp(17px, 1.45vw, 22px); line-height: 1.3; letter-spacing: -.005em;
}
.quote p { font-style: italic; }
.quote .hl { display: block; white-space: normal; cursor: default; }   /* the sweep, over a block that wraps */
.quote cite {
  display: block; margin-top: .9rem; font-style: normal;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #8a8a8a;
}
.quote cite::before { content: "\2014\00a0"; }

/* three lines and a button, on the right, a little lower than the quote */
/* set in Erode (Fontshare), a chiselled reading serif */
.bio { position: absolute; right: 3vw; top: 54%; font-family: "Erode", var(--serif); font-size: 16px; line-height: 1.75; letter-spacing: .005em; }
.bio p span { display: block; white-space: nowrap; }   /* one line each */
.bio b, .bio p a { font-weight: 600; color: inherit; text-decoration: none; }
.bio b { cursor: default; }
.btn {
  display: inline-flex; align-items: center; gap: .3em; margin-top: .9rem; padding: 2px 10px;
  background: #f0f0f0; color: var(--ink); font-weight: 500; text-decoration: none;
}

/* the one hover effect on the page: on About and the bold names, a band of colour
   crosses the word from left to right. nothing grows or moves. */
.hl { position: relative; display: inline-block; white-space: nowrap; vertical-align: top; }
.hl-grad {
  position: absolute; inset: 0; opacity: 0; pointer-events: none; user-select: none;
  color: transparent; -webkit-text-fill-color: transparent;
  background-image: linear-gradient(90deg, transparent 0%, transparent 33.33%,
    #c99bc6 40%, #ee6f58 45%, #e6b950 50%, #b6c8e8 55%, #5c8ee0 60%, transparent 66.67%, transparent 100%);
  background-image: linear-gradient(90deg, transparent 0%, transparent 33.33%,
    lab(69 21.6 -14.7) 40%, lab(62.6 48 36.3) 45%, lab(78.8 12.4 59.6) 50%, lab(80.3 -0.3 -17.8) 55%, lab(58.7 1.8 -46.8) 60%, transparent 66.67%, transparent 100%);
  background-size: 300% 100%; background-position: 100% 0; background-repeat: no-repeat;
  -webkit-background-clip: text; background-clip: text;
}
@media (hover: hover) and (pointer: fine) {
  a:hover .hl-grad, .hl:hover .hl-grad, .quote:hover .hl-grad { opacity: .94; animation: sweep .85s cubic-bezier(.4, 0, .2, 1) both; }
}
@keyframes sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { a:hover .hl-grad, .hl:hover .hl-grad, .quote:hover .hl-grad { animation: none; } }

/* foot links: hairline icons drawn like the rest of the page */
.foot {
  position: absolute; bottom: 1.2rem; display: inline-flex; align-items: center; gap: .55em;
  font-size: 12px; letter-spacing: .02em; color: #8a8a8a; text-decoration: none;
}
.foot svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.x { left: 3vw; }
.replay { right: 3vw; }

/* the caption at the foot of the screen while the photos run */
.cap {
  position: absolute; left: 0; right: 0; bottom: 6.5vh; z-index: 3; text-align: center; padding: 0 1.5rem;
  font-family: var(--mono); font-size: clamp(9px, .82vw, 11.5px); line-height: 1.75; letter-spacing: .12em; text-transform: uppercase;
  color: #8f8f8f; opacity: 0; transition: opacity .6s;
}
.cap.on { opacity: 1; }
.cap span { display: block; }

/* fountain: pencil drawing (svg) with live water over it (canvas).
   a still noise mask breaks the lines up like graphite on paper. */
.garden {
  -webkit-mask-image: var(--graphite); mask-image: var(--graphite);
  -webkit-mask-size: 260px; mask-size: 260px;
  --graphite: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -2.6 2.15'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  touch-action: pan-y;
}
#fountain path {
  fill: none; stroke: #232323; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 1s cubic-bezier(.6, 0, .3, 1);
}
#fountain .f-line   { stroke-width: .8; }
#fountain .f-detail { stroke-width: .5; }
#fountain .f-shade  { stroke-width: .42; stroke: #4a4a4a; }

/* ---------- work: pinned stage on a tall scroll track ---------- */
.work { position: relative; height: 420svh; --blank: #f1f1ef; }   /* work.js sets the real height */
.work-rails { position: absolute; inset: 0 3vw; pointer-events: none; }
.work-rails::before, .work-rails::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px;
  background: repeating-linear-gradient(#e0e0e0 0 6px, transparent 6px 12px);
}
.work-rails::before { left: 0; } .work-rails::after { right: 0; }
.work-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.work-space { position: absolute; top: 50%; left: 50%; width: 0; height: 0; }
.work-card {
  position: absolute; top: 0; left: 0; translate: -50% -50%; display: block;
  background: var(--blank); opacity: 0; will-change: transform, opacity; text-decoration: none;
}
.work-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* caption under a card once it has landed, if it has a title */
.work-cap {
  position: absolute; left: 0; top: calc(100% + 8px); white-space: nowrap;
  font-family: var(--mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: #1f1f1f;
  opacity: 0; transition: opacity .4s;
}
.work-card.open .work-cap { opacity: 1; }
.work-word {
  position: absolute; top: 50%; left: 50%; margin: 0; white-space: nowrap; pointer-events: none; z-index: 400;
  font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 5vw, 76px); line-height: 1; letter-spacing: -.02em;
  color: #1f1f1f; transform-origin: 0 50%;
}
.work-word:first-of-type { transform-origin: 100% 50%; }
/* reduced motion: a plain grid */
.work.still { height: auto; padding: 12vh 6vw; }
.work.still .work-stage { position: static; height: auto; overflow: visible; }
.work.still .work-word { position: static; display: inline; font-size: clamp(28px, 4vw, 56px); }
.work.still .work-space { position: static; width: auto; height: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 3rem 1.5rem; margin-top: 3rem; }
.work.still .work-card { position: relative; translate: none; opacity: 1; width: auto; aspect-ratio: 16 / 9; }
.work.still .work-cap { opacity: 1; }

/* ---------- footer ---------- */
.end {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 4vh 3vw 0; overflow: hidden;
}
/* the two words are almost the colour of the page. a hard light edge up and to the left
   and a hard dark edge down and to the right make them read as pressed out of the paper. */
.end-big {
  --lift: -.0032em -.0048em 0 #fff; --drop: .0032em .0048em 0 rgba(112, 112, 108, .62);
  margin: 0 -3vw; padding-bottom: .2em; text-align: center; white-space: nowrap;
  font-family: var(--serif); font-weight: 480; font-size: 15vw; line-height: 1.02; letter-spacing: -.02em;
  color: #e7e7e5; text-shadow: var(--lift), var(--drop);
}
.end-line { display: inline-flex; align-items: baseline; gap: .1em; }
.end-big i { display: inline-block; font-style: normal; }
.end-icon {
  width: .78em; height: .78em; flex: none; overflow: visible; fill: currentColor;
  filter: drop-shadow(-.0032em -.0048em 0 #fff) drop-shadow(.0032em .0048em 0 rgba(112, 112, 108, .62));
}
.end-icon .jet { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
/* the whole line rises from under the bottom edge when the footer scrolls into view */
.end-big i, .end-icon { opacity: 0; transform: translateY(1.1em); transition: opacity .5s ease, transform 1.2s cubic-bezier(.16, .84, .24, 1); }
.end-big.in i, .end-big.in .end-icon { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .end-big i, .end-icon { opacity: 1; transform: none; transition: none; } }

/* narrower screens: the quote and the lines move under the fountain */
@media (max-width: 1080px) {
  #site { height: auto; min-height: 100svh; padding-bottom: 4.5rem; }
  .under { padding: 0 6vw; font-size: 12px; }
  .garden { flex: 0 0 auto; height: min(92vw, 62svh); margin: 1.5rem 0 0; }
  .quote { position: static; width: auto; padding: 0 12vw; margin: 1.6rem 0 0; text-align: center; }
  .bio { position: static; padding: 0 8vw; margin: 2rem 0 0; text-align: center; }
  .bio p span { white-space: normal; }
  .x { left: 6vw; } .replay { right: 6vw; }
  .end { padding: 7vh 6vw 0; }
    .end-big { margin: 0 -6vw; }
}


/* phones: the title is set large and tight on two lines with the first cut at the top,
   then the three lines and the button, then the fountain, small and centred. no quote,
   and the title letters do not change face. */
@media (max-width: 700px) {
  .name { white-space: normal; text-align: left; padding: 0 2.5vw; line-height: .76; transform: translateY(-.3em); }
  .name .sp { display: block; width: 0; height: 0; }
  body.live .name .ch .hit { pointer-events: none; }
  /* the first screen holds everything: the fountain takes the room that is left */
  #site { height: auto; min-height: 100svh; padding-top: calc(var(--title, 28vw) * 1.36); padding-bottom: 0; }
  .under { order: 1; justify-content: flex-start; padding: 0 7.5vw; font-size: 13px; }
  .quote { display: none; }
  /* one line each: main.js shrinks the type until the longest line fits */
  .bio { order: 2; padding: 0 7.5vw; margin: 1.5rem 0 0; text-align: left; font-size: 17px; line-height: 1.8; }
  .bio p span { display: table; white-space: nowrap; }
  .btn { margin-top: 1.1rem; padding: 5px 13px; font-size: 17px; }
  .garden { order: 3; flex: 1 1 0; width: auto; height: auto; min-height: 210px; margin: 1.2rem 5vw 3.4rem; }
  .guides text { font-size: 7px; }
  /* the two phrases sit above and below the stack (placed in work.js) */
  .work-word { font-size: 34px; transform-origin: 50% 50%; }
  .work-word:first-of-type { transform-origin: 50% 50%; }
}

/* an upright screen: the film keeps its own wide shape, as a band across the middle,
   so nothing is cut off and the shrink to the card is a plain scale */
@media (orientation: portrait) {
  .stage:not(.card) { height: 56.25vw; top: calc(50vh - 28.125vw); top: calc(50dvh - 28.125vw); }
}
