:root {
  --gutter: 10px;          /* page padding + gap between cards */
  --step: 10px;            /* how much each stacked card peeks out */
  --radius: 4px;
  --beige: #e9dfcf;
  --card-bg: #fffefd;
  --ink-faint: rgba(0, 0, 0, 0.15);
  --ink-soft: rgba(0, 0, 0, 0.4);
  --font: "Allo", "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: #fff;
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.3;
  color: var(--ink-soft);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ---------- Project tag (top-left) ---------- */
.tag {
  position: fixed;
  top: var(--gutter);
  left: var(--gutter);
  z-index: 100;
  padding: 8px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), opacity .25s ease;
}
/* hover: an 8px ↗ arrow slides in, 10px after the label */
.tag__arrow {
  display: block;
  width: 8px;
  height: 8px;
  max-width: 0;
  margin-left: 0;
  opacity: 0;
  transform: translate(-3px, 3px);
  overflow: visible;
  transition: max-width .3s cubic-bezier(.2,.7,.2,1), margin-left .3s cubic-bezier(.2,.7,.2,1),
              opacity .2s ease, transform .3s cubic-bezier(.2,.7,.2,1);
}
.tag:hover .tag__arrow,
.tag:focus-visible .tag__arrow,
a.card:hover .chip .tag__arrow,
a.card:focus-visible .chip .tag__arrow {
  max-width: 8px;
  margin-left: 10px;
  opacity: 1;
  transform: none;
}
.tag:focus-visible { outline: 1px solid #fff; outline-offset: 2px; }
/* hide on scroll down, show again on scroll up */
.tag.is-hidden {
  transform: translateY(calc(-100% - var(--gutter) - 4px));
  opacity: 0;
  pointer-events: none;
}
.tag.is-hidden:focus-visible { transform: none; opacity: 1; }

/* label chip on home-page cards (same look as the tag, sits inside the card) */
.chip {
  position: absolute;
  top: var(--gutter);
  left: var(--gutter);
  z-index: 2;
  padding: 8px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: #fff;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
/* password-locked preview label */
.lock {
  position: absolute;
  top: 20px;
  left: 10px;
  z-index: 2;
  color: #fff;
  line-height: 1.4;
}
.lock span { display: block; opacity: .4; }

/* ---------- Page layout ---------- */
.page { padding: 0 var(--gutter) 270px; }   /* 270px of space at the end of every page */
.page--outro { padding-bottom: 0; }

.intro {
  padding: 260px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.intro--home { padding: 20px 0 240px; }
.intro--short { gap: 0; }
.note { padding: 20px 0 20px; display: flex; flex-direction: column; gap: 40px; }
.block { max-width: 460px; display: flex; flex-direction: column; gap: 10px; }
.label { font-weight: 600; color: var(--ink-faint); }
.lead  { font-weight: 600; color: var(--ink-soft); }
.copy p:not(.label) { color: var(--ink-soft); }
.copy strong { font-weight: 600; }
.copy a { text-decoration: none; }
.copy a:hover { text-decoration: underline; }

.outro { padding: 20px 0 270px; max-width: 460px; }
.footer { padding: 10px 0 60px; max-width: 460px; }

/* ---------- Stacking sticky cards ---------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
}

.card {
  --top: calc(var(--gutter) + var(--i, 0) * var(--step));
  position: sticky;
  top: var(--top);
  display: flex;
  width: 100%;
  /* Figma frame is 1420 × 900; never taller than the viewport, so the whole card stays visible while pinned */
  height: min(calc((100vw - 2 * var(--gutter)) * 900 / 1420), calc(100svh - var(--gutter) * 2 - var(--n, 7) * var(--step)));
  border-radius: var(--radius);
  overflow: clip;
  background: var(--card-bg);
  text-decoration: none;
  color: inherit;
}

.panel {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  overflow: clip;
  background: var(--bg, var(--beige));
}
.panel img,
.panel video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
/* framed artwork: never crop, shrink to fit on the panel colour */
.panel--fit img { object-fit: contain; }

/* inset video (Figma "hero": 1124 × 712 centred in 1420 × 900) */
.panel--inset {
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
}
.panel--inset video {
  width: 79.155%;                       /* % not container units, so older Safari sizes it too */
  width: min(79.155cqw, 79.11cqh * 1124 / 712);
  height: auto;
  aspect-ratio: 1124 / 712;
  object-fit: contain;                  /* never trim the recording's edges (e.g. the i-D logo) */
}
/* recording framed over a photo (Atmos): box matches the recording, so no bars */
.panel__bg { position: absolute; inset: 0; }
.panel--inset:has(> .panel__bg) video,
.panel--inset:has(> picture > .panel__bg) video,
.panel--inset > .panel__inset {
  position: relative;
  width: calc(var(--vw) * 1%);
  width: min(calc(var(--vw) * 1cqw), calc(77cqh * var(--ar)));
  aspect-ratio: var(--ar);
  object-fit: cover;                    /* Figma crops the recording to its box */
  object-position: top center;
  border-radius: 4px;
}

/* a still image framed the same way (Atmos article pages) */
.panel--inset > .panel__inset { display: block; height: auto; overflow: hidden; }
.panel--inset > .panel__inset img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }

/* a 4:5 film in a wide card: centred at the same height as the framed recordings */
.panel--portrait { position: relative; }
.panel--portrait video { position: absolute; top: 10.445%; bottom: 10.445%; left: 50%; width: auto; height: 79.11%; aspect-ratio: 4 / 5; transform: translateX(-50%); object-fit: cover; }
@media (max-width: 767px) {
  .panel--portrait video { inset: 0; width: 100%; height: 100%; aspect-ratio: auto; transform: none; }   /* phone card is ~4:5 already */
}

/* ---------- Mobile: every image becomes its own sticky card ---------- */
@media (max-width: 767px) {
  .intro { padding-top: 200px; }
  .intro--home { padding: 20px 0 60px; }
  .outro { padding-bottom: 270px; }

  .tag__arrow {
    max-width: 8px;
    margin-left: 10px;
    opacity: 1;
    transform: none;
    transition: none;
  }

  /* dissolve the desktop row so each panel is a direct child of the stack */
  .card { display: contents; }
  .panel {
    --top: calc(var(--gutter) + var(--m, 0) * var(--step));
    position: sticky;
    top: var(--top);
    flex: none;
    width: 100%;
    /* mobile Figma card: 355 × 450 */
    height: min(calc((100vw - 2 * var(--gutter)) * 450 / 355), calc(100svh - var(--gutter) * 2 - var(--nm, 13) * var(--step)));
    border-radius: var(--radius);
  }
  .panel--inset video,
  .panel--inset:has(> .panel__bg) video,
  .panel--inset:has(> picture > .panel__bg) video,
  .panel--inset > .panel__inset { width: calc(100% - 20px); }   /* 10px all round, like the gutter */
}

@media (prefers-reduced-motion: reduce) {
  .tag, .tag__arrow { transition: opacity .2s linear; }
  .tag.is-hidden { transform: none; }
  .card, .panel { position: relative; top: auto; }
}

/* ---------- Project page header: Context | Credits | Links ---------- */
.meta {
  display: grid;
  /* three equal columns with a 10px gap; the gap lives inside the first two tracks so the label rule runs unbroken */
  grid-template-columns: calc((100% - 20px) / 3 + 10px) calc((100% - 20px) / 3 + 10px) minmax(0, 1fr);
  row-gap: 20px;
  padding: 20px 0 260px;
}
.meta__col { display: contents; }
.meta { position: relative; }
.meta__home {                        /* "Back to Home": label style, pinned to the far right of the label row */
  position: absolute;
  top: 20px;
  right: 0;                          /* the page already has its 10px gutter */
  line-height: 1;
  font-weight: 600;
  color: var(--ink-faint);
  text-decoration: none;
}
.meta__home:hover, .meta__home:focus-visible { color: var(--ink-soft); }
.meta .label {
  color: var(--ink-faint);
  grid-row: 1;
  line-height: 1;
  padding: 0 10px 5px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.meta__col:last-child .label { padding-right: 0; }
.meta__text { grid-row: 2; max-width: 480px; color: var(--ink-soft); }
.meta__text p { color: var(--ink-soft); }

/* "Live Site" button: same component as the tag / card labels
   (8px padding, 2px radius, 30% black + blur, white text; ↗ slides in on hover, always shown on touch) */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: #fff;
  line-height: 1;
  text-decoration: none;
}
.pill:hover .tag__arrow, .pill:focus-visible .tag__arrow { max-width: 8px; margin-left: 10px; opacity: 1; transform: none; }
.pill:focus-visible { outline: 1px solid #fff; outline-offset: 2px; }
.copy a.pill:hover { text-decoration: none; }

@media (max-width: 767px) {
  .meta { display: flex; flex-direction: column; gap: 10px; padding: 20px 0 60px; }
  .meta__col { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
  .meta .label, .meta__text { padding-right: 0; }
}

/* Back button sits top-right */
.tag--back { left: auto; right: var(--gutter); }

/* touch screens (no hover) of any width: arrows always visible */
@media (hover: none) {
  .tag__arrow { max-width: 8px; margin-left: 10px; opacity: 1; transform: none; transition: none; }
}

/* homepage on phones: one frame per project (the left one) */
@media (max-width: 767px) {
  .panel--desk { display: none; }
}

/* ---------- Release the whole stack together ----------
   A sticky card unpins when its margin box hits the end of the stack. Giving each card a bottom
   margin of (cards after it × step), and pulling the next card back up by the same amount, makes every
   card reach that point at the same scroll position, so the last card never slides over the earlier slivers. */
.card { margin-bottom: calc((var(--n) - 1 - var(--i)) * var(--step)); }
.card + .card { margin-top: calc(-1 * (var(--n) - var(--i)) * var(--step)); }
@media (max-width: 767px) {
  .panel {
    margin-bottom: calc(var(--mb, 0) * var(--step));
    margin-top: calc(var(--mt, 0) * var(--step));
  }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card + .card, .panel { margin: 0; }
}

/* Room after each stack so the last card can rise to its pinned spot under the slivers
   (needed whenever a card is shorter than the screen, e.g. on phones). */
.stack {
  --card-h: min(calc((100vw - 2 * var(--gutter)) * 900 / 1420), calc(100svh - var(--gutter) * 2 - var(--n, 7) * var(--step)));
  --pad: max(0px, calc(100svh - var(--gutter) - (var(--n, 7) - 1) * var(--step) - var(--card-h) - var(--gutter)));
  padding-bottom: var(--pad);
}
@media (max-width: 767px) {
  .stack {
    --card-h: min(calc((100vw - 2 * var(--gutter)) * 450 / 355), calc(100svh - var(--gutter) * 2 - var(--nm, 13) * var(--step)));
    --pad: max(0px, calc(100svh - var(--gutter) - (var(--nm, 13) - 1) * var(--step) - var(--card-h) - var(--gutter)));
  padding-bottom: var(--pad);
  }
}
@media (prefers-reduced-motion: reduce) { .stack { padding-bottom: 0; } }

/* ---------- Never crop, always full width ----------
   Cards keep Figma's exact proportions at full width. Each card pins at its sliver offset when it fits;
   if the window is too short, it pins lower so its bottom edge stays on screen (slivers tuck above). */
.stack { --card-h: calc((100vw - 2 * var(--gutter)) * 900 / 1420); }
.card {
  height: auto;
  aspect-ratio: 1420 / 900;
  min-height: 0;                 /* keep 1420:900 even when a tall video is inside */
  width: 100%;
  top: min(calc(var(--gutter) + var(--i, 0) * var(--step)), calc(100svh - var(--card-h) - var(--gutter)));
}
.stack {
  --last-top: min(calc(var(--gutter) + (var(--n, 7) - 1) * var(--step)), calc(100svh - var(--card-h) - var(--gutter)));
  --pad: max(0px, calc(100svh - var(--last-top) - var(--card-h) - var(--gutter) - var(--after, 270px)));
  padding-bottom: var(--pad);
}
@media (max-width: 767px) {
  .stack {
    --card-h: calc((100vw - 2 * var(--gutter)) * 450 / 355);
    --last-top: min(calc(var(--gutter) + (var(--nm, 13) - 1) * var(--step)), calc(100svh - var(--card-h) - var(--gutter)));
  }
  .card { width: 100%; aspect-ratio: auto; top: auto; }
  .panel {
    height: auto;
    aspect-ratio: 355 / 450;
    width: 100%;
    top: min(calc(var(--gutter) + var(--m, 0) * var(--step)), calc(100svh - var(--card-h) - var(--gutter)));
  }
}
@media (prefers-reduced-motion: reduce) { .stack { padding-bottom: 0; } }

/* Back button: arrow points back (up-left) */
.tag--back .tag__arrow { transform: scaleX(-1) translate(-3px, 3px); }
.tag--back:hover .tag__arrow, .tag--back:focus-visible .tag__arrow { transform: scaleX(-1); }
@media (max-width: 767px) { .tag--back .tag__arrow { transform: scaleX(-1); } }
@media (hover: none) { .tag--back .tag__arrow { transform: scaleX(-1); } }

/* ---------- Next project: the top of the next page sits below the last card ---------- */
.next { margin-top: 200px; min-height: 100svh; }
.next .meta, .next .intro { pointer-events: none; }
.stack--next { padding-bottom: 0 !important; }
.stack--next .card, .stack--next .panel { position: relative; top: auto !important; margin: 0 !important; }
.page:has(.next) { padding-bottom: 0; }



/* Footer (Figma 1811:46651): full-width #ebebeb band, 10px padding (397px tall at 1440px wide);
   two Semibold lines at 15% black along the top, a 108px image at the bottom left */
.footer {
  display: flex;
  flex-direction: column;
  margin: 10px calc(-1 * var(--gutter)) 0;   /* 10px below the last card, edge to edge */
  padding: var(--gutter);
  background: #ebebeb;
  max-width: none;
}
.footer__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.footer p { color: var(--ink-soft); font-weight: 400; line-height: 1; }
.footer strong { font-weight: 600; }
.footer__copy { white-space: nowrap; }
.footer a { color: inherit; text-decoration: none; }
.footer a:hover, .footer a:focus-visible { text-decoration: underline; }
.footer__avatar { display: block; align-self: flex-start; margin-top: clamp(60px, 18.06vw, 260px); padding: 0; border: 0; background: none; cursor: pointer; }   /* 260px at the 1440px Figma width, shrinks with the screen */
.footer__img { display: block; width: 108px; height: 108px; border-radius: 2px; object-fit: cover; }
.page:has(> .footer) { padding-bottom: 0; }
/* homepage intro: only Allo Regular (400) and Semibold (600) are used anywhere on the site */
.intro--home strong { font-weight: 600; }
.intro--home strong.semi, .intro--home span.semi { font-weight: 600; }   /* name + LinkedIn / E-mail */

/* space that already follows each stack (counts toward the last card's settling room) */
.page:has(> .footer) .stack { --after: calc(10px + 20px + 12px + clamp(60px, 18.06vw, 260px) + 108px); }   /* footer band */
.page--outro .stack { --after: 299px; }               /* "Full website coming soon." block */

/* Card labels: plain CSS sticky, built like the Figma component:
   a sticky wrapper with 10px padding on every side, holding the 8px-padded tag.
   It sticks to the top of the screen and stops at the bottom of its card. */
.chip-rail { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.chip-rail .chip {
  position: sticky;
  top: var(--gutter);             /* keeps 10px from the top of the screen when stuck */
  left: auto;
  margin: var(--gutter);          /* the 10px padding all over */
  pointer-events: auto;
}

/* "Enter Password" labels on the homepage: same sticky wrapper */
.chip-rail .lock { position: sticky; top: var(--gutter); left: auto; display: block; width: max-content; margin: var(--gutter); }

/* A tag that spans a whole stack (Misc: "Sentimental Value" across all three rows) */
.stack { position: relative; }
.chip-rail--stack { bottom: var(--pad, 0px); z-index: 3; }

/* separate portrait video cut for phones */
.only-mob { display: none !important; }
.only-mob-i { display: none; }
@media (max-width: 767px) {
  .only-desk { display: none !important; }
  .only-mob { display: block !important; }
}

/* ---------- Back / Next buttons (Figma: 43px circle, blur, white 8px arrow) ----------
   Hidden off the edge; they slide in only while swiping right (Back) or left (Next).
   Light while dragging, 30% black once letting go will follow them. */
.nav-btn {
  position: fixed;
  top: 50%;
  z-index: 300;
  width: 43px;
  height: 43px;
  margin-top: -21.5px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  -webkit-backdrop-filter: blur(50px);
  backdrop-filter: blur(50px);
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: background-color .15s ease;
  will-change: transform;
}
.nav-btn--back { left: var(--gutter); transform: translate3d(-53px, 0, 0); }
.nav-btn--next { right: var(--gutter); transform: translate3d(53px, 0, 0); }
.nav-btn svg { width: 8px; height: 8px; display: block; overflow: visible; }
.nav-btn--next svg { transform: scaleX(-1); }
.nav-btn.is-armed { background: rgba(0, 0, 0, 0.3); }
.is-settling .nav-btn { transition: transform .25s cubic-bezier(.2,.8,.2,1), opacity .25s ease, background-color .15s ease; }
/* keyboard users can still tab to them */
.nav-btn:focus-visible { transform: none !important; opacity: 1 !important; pointer-events: auto; background: rgba(0, 0, 0, 0.3); outline: 1px solid #000; outline-offset: 2px; }

/* ---------- Password wall (005 / 006) ---------- */
.lock { pointer-events: auto; }
.lock__label { font-style: normal; display: block; }
.lock__input {
  display: none;
  font: inherit;
  color: #fff;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  width: 160px;
  line-height: 1.4;
  outline: none;
  caret-color: #fff;
}
.lock__input::placeholder { color: #fff; opacity: 1; }
.lock.is-open .lock__label { display: none; }
.lock.is-open .lock__input { display: block; }
.lock.is-wrong { animation: lock-shake .35s ease; }
.lock.is-wrong .lock__input::placeholder { opacity: .4; }
@keyframes lock-shake { 25% { translate: -4px 0; } 50% { translate: 4px 0; } 75% { translate: -2px 0; } }
a[data-lock] { cursor: text; }

.gate { display: none; }
.is-locked .gate {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 250;
  background: #ddd center / cover no-repeat;
}
.is-locked .gate::before {           /* preview is already blurred; same 10% black tint as the homepage card */
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.1);
}
.lock--gate { position: absolute; top: 20px; left: var(--gutter); z-index: 1; }
.is-locked main { display: none; }

/* header with only a Context column (Misc): the label rule still runs full width */
.meta:not(:has(.meta__col + .meta__col)) .label { grid-column: 1 / -1; padding-right: 0; }
.meta:not(:has(.meta__col + .meta__col)) .meta__text { grid-column: 1; }

/* photos with a separate upright version for phones */
.panel picture { display: contents; }
@media (max-width: 767px) { .panel picture.has-mob img { object-position: 50% 15%; } }

/* phones: a full-bleed desktop video shown framed on its panel colour instead of cropped */
@media (max-width: 767px) {
  .panel--m-inset { display: flex; align-items: center; justify-content: center; }
  .panel--m-inset video { width: 100%; height: auto; object-fit: contain; }   /* the recording already has its black frame */
}

/* phones: wide graphics on a flat colour are shown whole, framed by that colour */
@media (max-width: 767px) {
  .panel--fit-m { display: flex; align-items: center; justify-content: center; }
  .panel--fit-m img, .panel--fit-m video { width: calc(100% - 20px); height: auto; object-fit: contain; }   /* 10px all round, same as the framed recordings */
}

/* phones: per-image focal point (e.g. keep a face in a portrait crop) */
@media (max-width: 767px) { .panel img { object-position: var(--pos, center); } }

/* phones: the words follow the stacked layout; each note sits close to the images it describes */
@media (max-width: 767px) {
  .only-desk-i { display: none; }
  .only-mob-i { display: inline; }
  .stack:has(+ .note) { padding-bottom: 0; }
  .note { padding: 20px 0 95px; }
  .note:last-child { padding-bottom: 0; }
}

/* homepage "LinkedIn, Email": semibold text links; Email copies the address and reads "Email Copied!" */
.home-links { margin-top: 4px; font-weight: 600; }
.home-links a, .home-links button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.home-links a:hover, .home-links button:hover { text-decoration: underline; }
.home-links button:focus-visible, .home-links a:focus-visible { outline: 1px solid currentColor; outline-offset: 2px; }

/* Misc tag that links out: arrow on hover, always on touch */
.chip-rail a.chip--link { pointer-events: auto; text-decoration: none; color: #fff; }
a.chip--link:hover .tag__arrow, a.chip--link:focus-visible .tag__arrow { max-width: 8px; margin-left: 10px; opacity: 1; transform: none; }

/* two stills that take turns, 1s each (CHUN menu: toasts / drinks) */
.panel--flip { position: relative; }
.panel--flip .flip-b { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: flip-b 2s steps(1, end) infinite; }
@keyframes flip-b { 0% { opacity: 0; } 50% { opacity: 1; } }

/* project pages: the footer band follows the last text block or card */
.page:has(> .footer) > .outro { padding-bottom: 20px; }
.page:has(> .footer) > .note:nth-last-child(2) { padding-bottom: 20px; }
/* phones: the two footer lines stack 10px apart in Figma terms (Figma trims text boxes to 9px, the browser keeps 12px) */
@media (max-width: 767px) { .footer__row { row-gap: 7px; } }
