/* ==========================================================================
   Adrian Ely – portfolio
   ========================================================================== */

:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --gutter: clamp(16px, 1.6vw, 28px);
  --line: color-mix(in srgb, var(--fg) 22%, transparent);
  --ease: cubic-bezier(.7, 0, .2, 1);
  --font: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --fs-label: 11px;
  --fs-body: clamp(15px, 1.05vw, 18px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.35;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .7s var(--ease), color .7s var(--ease);
}
body.is-loading { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--fg); color: var(--bg); }

.label {
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.2;
  margin: 0;
}
.label--square { display: inline-flex; align-items: center; gap: 8px; }
.label--square::before { content: ""; width: 9px; height: 9px; background: currentColor; }

/* SplitText masks: give descenders (y, g, p) room inside the clipping wrapper */
.hero__word > div, .contact__big .js-split > div, .case__title > div { padding-bottom: .16em; margin-bottom: -.16em; }

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100;
  background: #0a0a0a; color: #f4f4f0;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: var(--gutter);
}
.loader__count { font-size: clamp(80px, 18vw, 300px); font-weight: 500; line-height: .8; letter-spacing: -0.06em; }
.loader__label { font-size: var(--fs-label); text-transform: uppercase; font-weight: 500; }

/* ---------- Page transition ---------- */
.wipe {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background: #0a0a0a; color: #f4f4f0;
  display: flex; align-items: flex-end; padding: var(--gutter);
  clip-path: inset(100% 0 0 0);
}
.wipe__label {
  display: block; overflow: hidden;
  font-size: clamp(48px, 9vw, 170px); font-weight: 500; letter-spacing: -0.06em; line-height: 1; padding-bottom: .08em;
}
.wipe__label span { display: inline-block; }

/* ---------- Cursor ---------- */
/* a small dot everywhere; over anything clickable-to-view it gives way to a sharp tag */
/* arrow cursor: follows with a slight spring and turns to face the direction of travel */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 97; pointer-events: none;
  width: 25px; height: 27px; margin: -13.5px 0 0 -12.5px;
  opacity: 0; transition: opacity .25s; will-change: transform;
}
.cursor svg { display: block; }
.cursor.is-ready { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  html, body, a, button, label, input, textarea, .yt__hit, .yt__poster, .fan__card { cursor: none; }
}
.cursor-tag {
  position: fixed; top: 0; left: 0; z-index: 96; pointer-events: none;
  margin: 20px 0 0 18px; /* clear of the arrow */
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 7px; background: #0a0a0a; color: #f4f4f0;
  font-size: var(--fs-label); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; line-height: 1;
  clip-path: inset(0 100% 0 0); transition: clip-path .45s var(--ease);
}
.cursor-tag.is-on { clip-path: inset(0 0 0 0); }
.cursor-tag__arrow { font-size: 12px; transform: translateY(-1px); }
/* pop-up preview on the work list: opens above-right of the pointer, tag sits on its bottom edge */
.peek {
  position: fixed; top: 0; left: 0; z-index: 94; pointer-events: none;
  width: clamp(220px, 21vw, 340px); aspect-ratio: 202 / 158;
  margin: calc(clamp(220px, 21vw, 340px) * -0.782 + 14px) 0 0 14px;
  transform-origin: 0 100%;
}
.peek__img { position: absolute; inset: 0; overflow: hidden; clip-path: inset(100% 0 0 0); background: #111; }
.peek__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (hover: none) { .cursor, .cursor-tag, .peek { display: none; } }

/* ---------- Header ---------- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: var(--gutter);
  color: #fff; mix-blend-mode: difference;
  pointer-events: none;
}
.header > * { pointer-events: auto; }
.header__logo { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.header__nav { display: flex; gap: clamp(20px, 4vw, 64px); }
.header__nav a { font-size: var(--fs-label); font-weight: 500; text-transform: uppercase; position: relative; overflow: hidden; display: inline-block; }
.header__nav a span { display: inline-block; transition: transform .5s var(--ease); }
.header__nav a::after {
  content: attr(data-nav); position: absolute; left: 0; top: 100%;
  text-transform: uppercase; transition: transform .5s var(--ease);
}
.header__nav a:hover span, .header__nav a:hover::after { transform: translateY(-100%); }
.header__nav a.is-current::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; }
.header__menu { display: none; width: 28px; height: 14px; position: relative; }
.header__menu span { position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; transition: transform .4s var(--ease), top .4s var(--ease); }
.header__menu span:first-child { top: 2px; }
.header__menu span:last-child { top: 10px; }
.menu-open .header__menu span:first-child { top: 6px; transform: rotate(45deg); }
.menu-open .header__menu span:last-child { top: 6px; transform: rotate(-45deg); }

.menu {
  position: fixed; inset: 0; z-index: 70; background: #0a0a0a; color: #f4f4f0;
  display: flex; flex-direction: column; justify-content: flex-end; padding: var(--gutter);
  clip-path: inset(0 0 100% 0); transition: clip-path .7s var(--ease);
}
.menu a { font-size: clamp(48px, 15vw, 96px); font-weight: 500; letter-spacing: -0.05em; line-height: .95; }
.menu-open .menu { clip-path: inset(0 0 0 0); }

@media (max-width: 760px) {
  .header__nav { display: none; }
  .header__menu { display: block; }
}

/* ---------- Hero ---------- */
/* intro top-left, rotating project card top-right, the name set full-width along the bottom */
.hero {
  position: relative; height: 100svh; min-height: 600px;
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto; column-gap: var(--gutter);
  padding: calc(var(--gutter) + 56px) var(--gutter) var(--gutter);
}
.hero__intro {
  grid-column: 1; grid-row: 1; margin: 0; max-width: 21em;
  font-size: clamp(20px, 1.9vw, 32px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1;
}
.hero__clock {
  grid-column: 1; grid-row: 2; align-self: end; margin: 0 0 2.4vw;
  display: flex; gap: 10px; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.hero__clock .label { opacity: .5; font-size: 13px; }
.hero__card { grid-column: 2; grid-row: 1 / span 2; align-self: start; width: clamp(240px, 30vw, 520px); display: flex; flex-direction: column; gap: 10px; }
.hero__window { position: relative; display: block; aspect-ratio: 1040 / 597; overflow: hidden; background: #0a0a0a; }
.hero__window-inner { position: absolute; inset: 0; }
.hero__window-inner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero__now { display: flex; justify-content: space-between; gap: var(--gutter); align-items: baseline; }
.hero__now .label { opacity: .5; }
.hero__now-title { font-size: 13px; font-weight: 500; text-align: right; }
.hero__title {
  grid-column: 1 / -1; grid-row: 3; margin: 0 -0.02em -0.12em;
  /* full width, but never taller than the space a short window leaves */
  font-size: min(34.4vw, 48svh); font-weight: 500; letter-spacing: -0.075em; line-height: .78; white-space: nowrap;
  padding-bottom: .1em;
}
.hero__word { display: inline-block; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto auto; row-gap: 20px; }
  .hero__card { grid-column: 1; grid-row: 2; width: 100%; }
  .hero__clock { grid-row: 4; margin: 0; }
  .hero__title { grid-row: 5; }
}

/* ---------- Manifesto ---------- */
/* one statement; each word fills in from pale to solid as you scroll through it */
.manifesto { position: relative; padding: 22vh var(--gutter) 24vh; }
.manifesto__text {
  margin: 0; max-width: 12.6em; text-wrap: balance; /* even lines, no single word left on the last one */
  font-size: clamp(40px, 7.6vw, 150px); font-weight: 500; letter-spacing: -0.055em; line-height: .96;
}
.manifesto__text .w { opacity: .14; }

/* ---------- Marquee ---------- */
.marquee { overflow: hidden; padding: 28px 0; border-bottom: 1px solid var(--line); }
.marquee__track { display: flex; width: max-content; }
.marquee__item { display: inline-flex; align-items: center; gap: 28px; padding-right: 28px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .01em; white-space: nowrap; }
.marquee__item::after { content: "✦"; font-size: 10px; }

/* ---------- Reel ---------- */
.reel { position: relative; overflow: hidden; }
.reel__grid { display: grid; grid-template-columns: repeat(5, 1fr); }
.reel__tile { display: block; aspect-ratio: 202/158; overflow: hidden; background: #111; }
.reel__tile img { width: 100%; height: 100%; object-fit: cover; transition: filter .4s; }
.reel__tile:hover img { filter: brightness(1.12); }
@media (max-width: 760px) { .reel__grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Section heads ---------- */
section { position: relative; }
.work, .about, .awards, .contact { padding: 120px var(--gutter) 140px; }
.section-head {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); align-items: start;
  margin-bottom: clamp(60px, 10vw, 160px);
}
.section-head--compact { margin-bottom: 40px; }
.section-head__intro { margin: 0; font-size: clamp(22px, 2.2vw, 36px); font-weight: 500; letter-spacing: -0.035em; line-height: 1.05; max-width: 16em; }
@media (max-width: 760px) { .section-head { grid-template-columns: 1fr; } }

/* ---------- Work ---------- */
.work__bar { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--fg); }
.work__toggle { display: flex; gap: 4px; }
.work__toggle button { font-size: var(--fs-label); font-weight: 500; text-transform: uppercase; padding: 6px 12px; border: 1px solid var(--fg); border-radius: 99px; transition: background .3s, color .3s; }
.work__toggle button.is-active { background: var(--fg); color: var(--bg); }

.work__index { list-style: none; margin: 0; padding: 0; }
.work__row { border-bottom: 1px solid var(--line); }
.work__row a {
  display: grid; grid-template-columns: 60px 1fr 220px 200px 20px; gap: var(--gutter); align-items: center;
  padding: 18px 0; position: relative;
}
.work__row a::before {
  content: ""; position: absolute; inset: 0; background: var(--fg);
  transform: scaleY(0); transform-origin: bottom; transition: transform .5s var(--ease); z-index: 0;
}
.work__row a > * { position: relative; z-index: 1; transition: color .3s, transform .5s var(--ease); }
.work__row a:hover::before, .work__row a:focus-visible::before { transform: scaleY(1); transform-origin: top; }
.work__row a:hover > *, .work__row a:focus-visible > * { color: var(--bg); }
.work__row a:hover .work__title { transform: translateX(14px); }
.work__num { font-size: var(--fs-label); font-weight: 500; padding-left: 4px; }
.work__title { font-size: clamp(26px, 3.6vw, 62px); font-weight: 500; letter-spacing: -0.045em; line-height: 1; }
.work__client, .work__disc { font-size: 13px; font-weight: 500; }
.work__disc { opacity: .6; }
.work__arrow { font-size: 18px; }
.work__thumb { display: none; }
@media (max-width: 900px) {
  .work__row a { grid-template-columns: 90px 1fr; row-gap: 4px; }
  .work__thumb { display: block; grid-row: span 2; width: 90px; aspect-ratio: 202/158; object-fit: cover; }
  .work__num, .work__disc, .work__arrow { display: none; }
  .work__client { grid-column: 2; }
}


/* only one view shows at a time (display rules would otherwise override [hidden]) */
.work__grid[hidden], .work__index[hidden] { display: none; }
.work__grid { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px var(--gutter); }
.work__card a { display: block; }
.work__card-media { overflow: hidden; aspect-ratio: 202/158; background: color-mix(in srgb, var(--fg) 8%, transparent); }
.work__card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease); }
.work__card a:hover img { transform: scale(1.06); }
.work__card-meta { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; }
.work__card-title { font-size: 20px; font-weight: 500; letter-spacing: -0.03em; }
.work__card-client { font-size: 13px; font-weight: 500; opacity: .6; }
.work__card:nth-child(3n+2) { transform: translateY(80px); }
@media (max-width: 900px) { .work__grid { grid-template-columns: 1fr 1fr; } .work__card:nth-child(3n+2) { transform: none; } }
@media (max-width: 560px) { .work__grid { grid-template-columns: 1fr; } }

/* ---------- About ---------- */
.about__grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); margin-bottom: 140px; }
.about__portrait { margin: 0; position: relative; aspect-ratio: 4/5; overflow: hidden; max-width: 360px; }
.about__portrait img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); transform: scale(1.12); }
.about__portrait-blocks { position: absolute; inset: 0; display: grid; }
.about__portrait-blocks i { background: var(--bg); }
.about__copy { display: flex; flex-direction: column; gap: 1.2em; max-width: 34em; }
.about__copy p { margin: 0; }
.about__lead { font-size: clamp(26px, 2.6vw, 44px); font-weight: 500; letter-spacing: -0.04em; line-height: 1.02; }
@media (max-width: 760px) { .about__grid { grid-template-columns: 1fr; margin-bottom: 80px; } }

.table { border-top: 1px solid var(--fg); }
.table__row {
  display: grid; grid-template-columns: 120px 1.2fr 1fr 2fr; gap: var(--gutter);
  padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 500;
  position: relative;
}
.table__row--head { font-size: var(--fs-label); text-transform: uppercase; opacity: .7; }
.table__row strong { font-weight: 600; }
@media (max-width: 760px) {
  .table__row { grid-template-columns: 80px 1fr; }
  .table__row > :nth-child(3) { display: none; }
  .table__row > :nth-child(4) { grid-column: 2; opacity: .7; }
}

/* ---------- Awards ---------- */
.awards__hero { display: grid; grid-template-columns: auto 1fr; gap: var(--gutter); align-items: end; margin-bottom: 100px; }
.awards__big { font-size: clamp(120px, 30vw, 520px); font-weight: 500; letter-spacing: -0.07em; line-height: .75; font-variant-numeric: tabular-nums; }
.awards__caption { margin: 0 0 .6em; max-width: none; font-size: clamp(18px, 1.6vw, 26px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; }
@media (max-width: 760px) { .awards__hero { grid-template-columns: 1fr; } .awards__caption .br-wide { display: none; } }

.awards__stats { display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid var(--fg); margin-bottom: 100px; }
.awards__stat { padding: 16px 12px 22px 0; border-right: 1px solid var(--line); }
.awards__stat:last-child { border-right: 0; }
.awards__stat-n { display: block; font-size: clamp(44px, 6vw, 110px); font-weight: 500; letter-spacing: -0.06em; line-height: 1; margin-top: 30px; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .awards__stats { grid-template-columns: repeat(3, 1fr); } .awards__stat:nth-child(3) { border-right: 0; } .awards__stat:nth-child(n+4) { border-top: 1px solid var(--line); } }

.awards__list { border-top: 1px solid var(--fg); }
.acc { border-bottom: 1px solid var(--line); }
.acc__btn {
  width: 100%; display: grid; grid-template-columns: 1fr auto 30px; gap: var(--gutter); align-items: center;
  padding: 16px 0; text-align: left;
}
.acc__name { font-size: clamp(20px, 2vw, 32px); font-weight: 500; letter-spacing: -0.035em; transition: transform .5s var(--ease); }
.acc__btn:hover .acc__name { transform: translateX(10px); }
.acc__count { font-size: 13px; font-weight: 500; opacity: .6; font-variant-numeric: tabular-nums; }
.acc__icon { width: 14px; height: 14px; position: relative; justify-self: end; }
.acc__icon::before, .acc__icon::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1.5px; background: currentColor; transition: transform .5s var(--ease); }
.acc__icon::after { transform: rotate(90deg); }
.acc.is-open .acc__icon::after { transform: rotate(0); }
.acc__panel { height: 0; overflow: hidden; }
.acc__items { list-style: none; margin: 0; padding: 0 0 24px; columns: 2; column-gap: var(--gutter); }
.acc__items li { font-size: 13px; font-weight: 500; padding: 5px 0; break-inside: avoid; display: flex; gap: 10px; }
.acc__items li span:first-child { min-width: 92px; opacity: .55; }
@media (max-width: 760px) { .acc__items { columns: 1; } }

/* ---------- Contact ---------- */
.contact { padding-bottom: 80px; }
.contact__big { margin: 0 0 80px; font-size: clamp(72px, 17vw, 330px); font-weight: 500; letter-spacing: -0.07em; line-height: .82; }
.contact__big > span { display: inline-block; }
.contact__form { display: grid; grid-template-columns: 1fr 1fr 2fr 1fr; border: 1px solid var(--fg); }
.field { display: flex; flex-direction: column; justify-content: space-between; gap: 30px; padding: 14px; border-right: 1px solid var(--fg); min-height: 120px; }
.field:last-child { border-right: 0; }
.field input, .field textarea {
  font: inherit; font-size: 18px; font-weight: 500; letter-spacing: -0.02em; color: inherit;
  background: none; border: 0; border-bottom: 1px solid transparent; padding: 0; outline: none; resize: none; width: 100%;
}
.field input:focus, .field textarea:focus { border-bottom-color: currentColor; }
.field--submit { flex-direction: row; align-items: flex-end; justify-content: space-between; font-size: 18px; font-weight: 500; transition: background .35s, color .35s; }
.field--submit:hover { background: var(--fg); color: var(--bg); }
.field--submit .arrow { transition: transform .5s var(--ease); }
.field--submit:hover .arrow { transform: translateX(6px); }
.contact__thanks { margin-top: 16px; }
@media (max-width: 900px) {
  .contact__form { grid-template-columns: 1fr 1fr; }
  .field:nth-child(4) { border-right: 0; }
  .field--wide, .field--submit { grid-column: 1 / -1; border-right: 0; border-top: 1px solid var(--fg); }
}

/* ---------- Footer ---------- */
.footer { padding: 0 var(--gutter); overflow: hidden; }
.footer__meta { display: flex; justify-content: space-between; padding: 20px 0; border-top: 1px solid var(--fg); }
.footer__giant { font-size: 35vw; font-weight: 500; letter-spacing: -0.075em; line-height: .78; white-space: nowrap; margin: 0 -0.02em; padding-bottom: .1em; }
.footer__giant span { display: inline-block; }

/* ==========================================================================
   Case study
   ========================================================================== */
.case { position: relative; min-height: 100vh; background: var(--bg); color: var(--fg); padding: 0 var(--gutter); }
.case-open #main { display: none; }

.case__top {
  position: fixed; left: 0; right: 0; top: 0; z-index: 81; pointer-events: none;
  display: grid; grid-template-columns: 1fr auto 1fr; padding: calc(var(--gutter) + 26px) var(--gutter) 0;
  color: #fff; mix-blend-mode: difference;
}
.case__top > * { pointer-events: auto; }
.case__top a:last-child { justify-self: end; }
.case__head { padding-top: 26vh; }
.case__client { display: flex; gap: 20px; margin-bottom: 18px; }
.case__title { margin: 0; font-size: clamp(54px, 10.5vw, 200px); font-weight: 500; letter-spacing: -0.065em; line-height: .86; max-width: 12ch; }
.case__meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gutter); border-top: 1px solid var(--fg); margin-top: 60px; padding-top: 14px; }
.case__meta div { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 500; }
.case__meta .label { opacity: .55; }
.case__hero { margin: 60px calc(var(--gutter) * -1) 0; height: 92vh; overflow: hidden; position: relative; }
.case__hero img { width: 100%; height: 120%; object-fit: cover; }
/* heroRatio: show the header image whole at its own shape (no crop, no parallax) */
.case__hero.is-natural { height: auto; }
.case__hero.is-natural img { height: 100%; }
.case__body { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); padding: 120px 0; }
.case__headline { margin: 0; font-size: clamp(28px, 3vw, 52px); font-weight: 500; letter-spacing: -0.04em; line-height: 1.02; max-width: 14em; }
.case__text { display: flex; flex-direction: column; gap: 1em; max-width: 36em; }
.case__text p { margin: 0; }
.case__videos { display: grid; gap: var(--gutter); }
.case__videos.is-multi { grid-template-columns: 1fr 1fr; }
.case__video { position: relative; aspect-ratio: 16/9; background: #111; overflow: hidden; }
.case__video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* 9:16 films (set videoShape: "vertical" in data.js) sit in a single row on desktop */
.case__videos.is-vertical { grid-template-columns: repeat(var(--n), 1fr); }
.case__videos.is-vertical .case__video { aspect-ratio: 9 / 16; }
/* videoShape: "stack" – films one above the other, each full width */
.case__videos.is-stack { grid-template-columns: 1fr; }
/* videoCopy: a line of copy sitting between two films */
.case__video-copy { margin: 60px 0 16px; }
/* videoShape: "square" – 1:1 films in one column, capped so each fits on screen */
.case__videos.is-square { grid-template-columns: 1fr; justify-items: center; }
.case__videos.is-square .case__video { aspect-ratio: 1 / 1; width: min(100%, 80vh); }
.case__gallery { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gutter); padding: 120px 0; }
.case__gallery figure { margin: 0; overflow: hidden; background: color-mix(in srgb, var(--fg) 6%, transparent); }
.case__gallery img { width: 100%; height: auto; }
.case__gallery figure:nth-child(4n+1) { grid-column: 1 / -1; }
/* pairs sit side by side at identical size */
.case__gallery figure:nth-child(4n+2) { grid-column: 1 / span 6; }
.case__gallery figure:nth-child(4n+3) { grid-column: 7 / span 6; }
.case__gallery figure:nth-child(4n+2), .case__gallery figure:nth-child(4n+3) { aspect-ratio: 3 / 2; }
.case__gallery figure:nth-child(4n+2) img, .case__gallery figure:nth-child(4n+3) img { width: 100%; height: 100%; object-fit: cover; }
/* an image left without a partner (e.g. a closing GIF) is centred at its natural shape */
.case__gallery figure:nth-child(4n+2):last-child { grid-column: 4 / span 6; aspect-ratio: auto; }
.case__gallery figure:nth-child(4n+2):last-child img { height: auto; object-fit: initial; }
/* grid layout (galleryLayout: "grid" in data.js): even 2-up grid, a leftover odd image runs full width */
.case__gallery.is-grid figure:nth-child(n) { grid-column: span 6; aspect-ratio: auto; align-self: start; }
.case__gallery.is-grid figure:nth-child(n) img { width: 100%; height: auto; object-fit: initial; }
.case__gallery.is-grid figure:nth-child(odd):last-child { grid-column: 1 / -1; }
/* galleryEndFull: the closing image runs full width like the opening one */
.case__gallery.end-full figure:last-child:nth-child(n) { grid-column: 1 / -1; aspect-ratio: auto; }
.case__gallery.end-full figure:last-child:nth-child(n) img { height: auto; object-fit: initial; }
/* galleryPairs: "natural" shows paired images at their own shape (e.g. portrait ads), uncropped */
.case__gallery.pairs-natural figure:nth-child(4n+2), .case__gallery.pairs-natural figure:nth-child(4n+3) { aspect-ratio: auto; align-self: start; }
.case__gallery.pairs-natural figure:nth-child(4n+2) img, .case__gallery.pairs-natural figure:nth-child(4n+3) img { height: auto; object-fit: initial; }
/* galleryGapless: images stack flush, with no gaps between them */
.case__gallery.gapless { gap: 0; }
/* galleryWide: [n, …] makes those gallery images (1-based) run full width, uncropped */
.case__gallery figure.is-wide.is-wide:nth-child(n) { grid-column: 1 / -1; aspect-ratio: auto; }
.case__gallery figure.is-wide.is-wide:nth-child(n) img { height: auto; object-fit: initial; }
/* galleryBar: {index, color} runs that image's background colour edge to edge like a bar */
.case__gallery figure.is-bar.is-bar:nth-child(n) {
  grid-column: 1 / -1; aspect-ratio: auto; margin: 0 calc(var(--gutter) * -1);
  background: var(--bar); display: flex; justify-content: center;
}
.case__gallery figure.is-bar.is-bar:nth-child(n) img { width: min(100% - var(--gutter) * 2, 1712px); height: auto; object-fit: initial; }
/* preVideos: full-width images shown between the body copy and the films */
.case__gallery.is-pre-videos { padding: 0 0 var(--gutter); }
/* fanLead: full-width images shown just before a carousel */
.case__gallery.is-fan-lead { padding: 100px 0 0; }
/* galleryFlush: [n, …] – those images butt up against the one above (no gap) */
.case__gallery figure.is-flush { margin-top: calc(var(--gutter) * -1); }
/* galleryMarquee: n – that image (e.g. a logo strip) scrolls endlessly */
.case__gallery figure.is-marquee.is-marquee:nth-child(n) { grid-column: 1 / -1; aspect-ratio: auto; background: #000; overflow: hidden; }
.marquee-strip { display: flex; width: max-content; animation: marquee-strip 28s linear infinite; }
.case__gallery figure.is-marquee .marquee-strip img { width: clamp(900px, 100vw, 1820px); height: auto; max-width: none; object-fit: initial; flex: none; }
.case__gallery figure.is-marquee:hover .marquee-strip { animation-play-state: paused; }
@keyframes marquee-strip { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee-strip { animation: none; } }
/* a gallery straight after the films sits one gutter below them, like the gaps inside it */
.case__videos + .case__gallery { padding-top: var(--gutter); }
/* full layout (galleryLayout: "full"): every image runs the full width, uncropped */
.case__gallery.is-full figure:nth-child(n) { grid-column: 1 / -1; aspect-ratio: auto; }
.case__gallery.is-full figure:nth-child(n) img { width: 100%; height: auto; object-fit: initial; }
/* tiles layout (galleryLayout: "tiles"): two columns of identical 16:9 crops;
   galleryLead: true keeps the first image full width and uncropped as an intro */
.case__gallery.is-tiles figure:nth-child(n) { grid-column: span 6; aspect-ratio: 16 / 9; align-self: start; }
.case__gallery.is-tiles figure:nth-child(n) img { width: 100%; height: 100%; object-fit: cover; }
.case__gallery.is-tiles.has-lead figure:first-child { grid-column: 1 / -1; aspect-ratio: auto; }
.case__gallery.is-tiles.has-lead figure:first-child img { height: auto; object-fit: initial; }
/* HTML embeds in a gallery (e.g. an animated widget) run full width at a fixed height */
.case__gallery figure.is-embed:nth-child(n) { grid-column: 1 / -1; background: none; aspect-ratio: auto; }
.case__gallery figure.is-embed iframe { display: block; width: 100%; height: 100%; border: 0; background: transparent; }
.case__gallery figure:nth-child(4n+4) { grid-column: 3 / span 8; }
/* blockTitles: a subhead over the films / poster carousel / gallery */
.case__block-head { margin: 0 0 32px; }
.case__block-head + .case__gallery { padding-top: 0; }
.case__fan + .case__block-head, .case__videos + .case__block-head { margin-top: 0; }

/* feelings (e.g. Feel NSW): intro copy, then a subhead over each film, two per row */
.case__feelings { padding-top: 100px; }
.case__feelings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 60px var(--gutter); }
.case__feelings-grid:not(.has-lead) .case__feeling:last-child:nth-child(odd) { grid-column: 1 / -1; }
/* lead: the first (best) film runs full width, the rest two per row */
.case__feelings-grid.has-lead .case__feeling:first-child { grid-column: 1 / -1; }
.case__feeling .case__subhead { margin-bottom: 20px; }
@media (max-width: 760px) { .case__feelings-grid { grid-template-columns: 1fr; } }

/* headed sections (e.g. Christmas / Easter / Mother's Day): one large image, then equal pairs */
.case__section { padding-top: 100px; }
.case__section + .case__section { padding-top: 120px; }
.case__gallery + .case__section { padding-top: 0; }
.case__subhead { margin: 0 0 32px; padding-top: 14px; border-top: 1px solid var(--fg); font-size: clamp(28px, 3vw, 52px); font-weight: 500; letter-spacing: -0.04em; line-height: 1; }
.case__section-copy { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); margin-bottom: 40px; }
.case__section-copy p { grid-column: 2; margin: 0; max-width: 36em; }
.case__section-copy p + p { margin-top: 1em; }
@media (max-width: 760px) { .case__section-copy { grid-template-columns: 1fr; } .case__section-copy p { grid-column: 1; } }
.case__section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); }
.case__section-grid figure { margin: 0; overflow: hidden; aspect-ratio: 16 / 9; background: color-mix(in srgb, var(--fg) 6%, transparent); }
.case__section-grid figure img { width: 100%; height: 100%; object-fit: cover; }
.case__section-grid figure.is-large { grid-column: 1 / -1; aspect-ratio: auto; }
.case__section-grid figure.is-large img { height: auto; }
/* phones: section images one per row, full width and uncropped */
@media (max-width: 760px) {
  .case__section-grid { grid-template-columns: 1fr; gap: 12px; }
  .case__section-grid figure { aspect-ratio: auto; }
  .case__section-grid figure img { height: auto; }
  .case__section.is-small .case__section-grid figure.is-large { width: 100%; }
}
/* size: "small" – the section's image sits centred at half width */
.case__section.is-small .case__section-grid figure.is-large { width: 50%; justify-self: center; }
@media (max-width: 760px) { .case__section.is-small .case__section-grid figure.is-large { width: 100%; } }
/* "after" images butt straight up against the image above */
.case__section-grid figure.is-after { margin-top: calc(var(--gutter) * -1); }
.case__next { display: block; border-top: 1px solid var(--fg); padding: 20px 0 60px; position: relative; overflow: hidden; }
.case__next-title { display: block; font-size: clamp(54px, 11vw, 210px); font-weight: 500; letter-spacing: -0.065em; line-height: .9; margin-top: 40px; transition: transform .7s var(--ease); }
.case__next:hover .case__next-title { transform: translateX(3vw); }
/* sized to the strip so it never gets clipped at the top */
.case__next-img { position: absolute; right: 0; top: 20px; bottom: 60px; height: calc(100% - 80px); width: auto; max-width: 40vw; aspect-ratio: 202/158; object-fit: cover; clip-path: inset(100% 0 0 0); transition: clip-path .8s var(--ease); }
.case__next:hover .case__next-img { clip-path: inset(0 0 0 0); }
@media (max-width: 760px) {
  .case__meta { grid-template-columns: 1fr 1fr; row-gap: 20px; }
  .case__body { grid-template-columns: 1fr; padding: 80px 0; }
  .case__videos.is-multi { grid-template-columns: 1fr; }
  .case__videos.is-vertical { grid-template-columns: 1fr 1fr; }
  .case__gallery { display: flex; flex-direction: column; padding: 80px 0; }
  .case__videos + .case__gallery { padding-top: var(--gutter); }
  .case__gallery.is-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .case__gallery.is-tiles figure:nth-child(n) { grid-column: auto; }
  .case__gallery.is-tiles.has-lead figure:first-child { grid-column: 1 / -1; }
  /* phones: show header images whole at their own shape rather than a tall cropped frame */
  .case__hero, .case__hero.is-natural { height: auto; aspect-ratio: auto !important; }
  .case__hero img { height: auto; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Print-series card fan ---------- */
.case__fan { padding: 40px 0 120px; overflow-x: clip; }
.case__fan-head--titled { align-items: flex-end; }
.case__fan-head--titled .case__subhead { margin: 0; padding: 0; border: 0; }
.case__fan-note { display: block; margin-top: 10px; opacity: .6; }
.case__section-note { margin: -18px 0 32px; opacity: .6; }
.case__fan-head { display: flex; justify-content: space-between; gap: var(--gutter); border-top: 1px solid var(--fg); padding-top: 14px; margin-bottom: 40px; }
.fan { --card-w: clamp(130px, 17vw, 272px); }
.fan.fan--landscape { --card-w: clamp(160px, 20vw, 340px); }
/* size: "large" – bigger cards for small landscape sets */
.fan.fan--landscape.fan--large { --card-w: clamp(220px, 30vw, 520px); }
/* (stage height and card position are set by fan.js to fit each fan; this is the pre-JS fallback) */
.fan--landscape .fan__stage { height: calc(var(--card-w) / var(--fan-ratio, 2) + var(--card-w) * .6); }
.fan__stage { position: relative; height: calc(var(--card-w) / var(--fan-ratio, .7) * 1.35); touch-action: pan-y; }
.fan__card {
  position: absolute; left: 50%; top: 46%;
  width: var(--card-w); aspect-ratio: var(--fan-ratio, .7);
  background: color-mix(in srgb, var(--fg) 10%, transparent); overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22), 0 2px 6px rgba(0, 0, 0, .12);
  will-change: transform;
}
.fan__card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }
.fan__card:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; }
.fan__nav { display: flex; justify-content: center; align-items: center; gap: 24px; margin-top: 28px; }
.fan__count { font-variant-numeric: tabular-nums; min-width: 60px; text-align: center; }
.fan__arrow { width: 48px; height: 48px; border: 1px solid var(--fg); border-radius: 50%; font-size: 18px; transition: background .3s, color .3s; }
.fan__arrow:hover { background: var(--fg); color: var(--bg); }

.lightbox {
  position: fixed; inset: 0; z-index: 92; background: rgba(10, 10, 10, .94); color: #f4f4f0;
  display: flex; align-items: center; justify-content: center; padding: 70px 70px;
}
.lightbox[hidden] { display: none; }
.lightbox__img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.lightbox__btn { position: absolute; color: inherit; padding: 12px; }
.lightbox__close { top: calc(var(--gutter) - 12px); right: calc(var(--gutter) - 12px); }
.lightbox__prev, .lightbox__next { top: 50%; transform: translateY(-50%); font-size: 22px; }
.lightbox__prev { left: calc(var(--gutter) - 12px); }
.lightbox__next { right: calc(var(--gutter) - 12px); }
.lightbox__count { position: absolute; bottom: var(--gutter); left: 50%; transform: translateX(-50%); }
@media (max-width: 760px) { .lightbox { padding: 60px 16px; } .lightbox__prev, .lightbox__next { top: auto; bottom: calc(var(--gutter) - 12px); transform: none; } }

/* ---------- Clean YouTube player (assets/yt.js) ---------- */
.yt { position: absolute; inset: 0; background: #000; overflow: hidden; }
/* YouTube's title bar and logo sit at the top and bottom edges of its player. The player is made
   taller than the frame: YouTube letterboxes the film inside it, so the film fills the frame exactly
   while the title and logo land in the hidden bands above and below */
.yt iframe { position: absolute; left: 0; width: 100%; top: -100px; height: calc(100% + 200px); border: 0; }
.yt__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; cursor: pointer; transition: opacity .35s var(--ease); }
.yt.is-playing .yt__poster { opacity: 0; pointer-events: none; }
.yt__hit { position: absolute; inset: 0; z-index: 3; cursor: pointer; }
.yt__play {
  position: absolute; left: 50%; top: 50%; z-index: 4; transform: translate(-50%, -50%);
  width: clamp(56px, 7vw, 88px); aspect-ratio: 1; border-radius: 50%;
  background: rgba(10, 10, 10, .55); color: #fff; display: grid; place-items: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: transform .4s var(--ease), background .3s, opacity .3s;
}
.yt__play svg { width: 40%; fill: currentColor; margin-left: 6%; }
.yt__play:hover { transform: translate(-50%, -50%) scale(1.08); background: rgba(10, 10, 10, .75); }
.yt.is-playing .yt__play, .yt.is-loading .yt__play { opacity: 0; pointer-events: none; }
.yt.is-loading .yt__poster { filter: brightness(.8); }
.yt__bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; padding: 14px 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .45)); opacity: 0; transition: opacity .35s;
  pointer-events: none;
}
.yt.is-awake .yt__bar, .yt:not(.is-playing):not(.is-loading) .yt__bar { opacity: 1; pointer-events: auto; }
.yt:not(.is-playing) .yt__bar .yt__toggle { visibility: hidden; } /* the big button handles play */
.yt__btn { width: 36px; height: 36px; display: grid; place-items: center; color: #fff; border-radius: 50%; transition: background .25s; }
.yt__btn:hover { background: rgba(255, 255, 255, .16); }
.yt__btn svg { width: 22px; fill: currentColor; }
/* touch: until the first tap has started the film, taps pass through poster, button and
   our layer to the video itself (phones only let a tap on the video start it with sound) */
.yt.is-touch:not(.has-started) .yt__poster,
.yt.is-touch:not(.has-started) .yt__play,
.yt.is-touch:not(.has-started) .yt__hit { pointer-events: none; }
.yt.is-touch:not(.has-started) .yt__bar { display: none; }
.yt:fullscreen, .yt:-webkit-full-screen { width: 100%; height: 100%; }
.yt:fullscreen .yt__poster { object-fit: contain; }

/* Netlify's "Powered by Netlify" badge (injected by the host, not part of the site) */
#nl-badge-frame { display: none !important; }

/* looping clips (converted GIFs) sit exactly like the images around them */
.case figure video { display: block; width: 100%; height: auto; }

/* the work-list preview never shows over a case study */
body.case-open .peek { visibility: hidden; }

/* copy placed inside a gallery, just before a given image */
.case__gallery > .case__gallery-copy { grid-column: 1 / -1; margin: 50px 0 10px; }
.case__videos > .case__video-copy { grid-column: 1 / -1; }
