/* ════════════════════════════════════════════════════════════════════════
   CASE STUDY — shared stylesheet
   New design (Figma: Portfolio_case_study_page). Used by all case studies.
   ════════════════════════════════════════════════════════════════════════ */

/* ── FONT ───────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'PPNeueMachina';
  src: url('../fonts/PPNeueMachina-InktrapRegular.woff2') format('woff2'),
       url('../fonts/PPNeueMachina-InktrapRegular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  --blue:        #0066ff;
  --blue-60:     color-mix(in srgb, var(--blue) 60%, transparent);
  --blue-40:     color-mix(in srgb, var(--blue) 40%, transparent);
  --bg:          #f9f9f9;
  --edge:        48px;
  /* 12-column grid, matching the homepage. Grid lines are drawn every 2 cols. */
  --col-step:    calc((100vw - 96px) / 12);
  --img-radius:  8px;
  --tile-radius: 16px;
  --font:        'PPNeueMachina', sans-serif;
}

/* ── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: hidden; }

html, body {
  width: 100%;
  background: var(--bg);
  color: var(--blue);
  font-family: var(--font);
  overscroll-behavior-y: none;
}

img { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

/* Reusable bouncing ↓ arrow */
.t-arrow {
  display: inline-block;
  animation: arrow-bounce 1.8s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
@keyframes arrow-bounce {
  0%, 100% { transform: translateY(0);   }
  50%      { transform: translateY(6px); }
}

/* ── PAGE LAYOUT ────────────────────────────────────────────────────────── */
/* Opaque + above the fixed footer (z-index:1) so it scrolls over it. */
/* Opaque + above the fixed footer (z-index:1) so it scrolls over it. */
.cs-page {
  position: relative;
  z-index: 2;
  width: 100%;
  background: var(--bg);
}

/* Column grid overlay — same 1px blue lines as the homepage, every 2 columns,
   starting at the --edge gutter. Painted over the page bg, beneath content. */
.cs-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(
    to right,
    color-mix(in srgb, var(--blue) 10%, transparent) 0px,
    color-mix(in srgb, var(--blue) 10%, transparent) 1px,
    transparent 1px,
    transparent 100%
  );
  background-size: calc(var(--col-step) * 2) 100%;
  background-position: var(--edge) 0;
  background-repeat: repeat-x;
}

/* Everything content sits above the grid overlay. */
.cs-hero,
.cs-intro,
.cs-accordion,
.cs-image,
.cs-caption,
.cs-reflections,
.cs-pair,
.cs-next,
.cs-works { position: relative; z-index: 1; }

/* Hero + body images sit one grid column in from the edge — i.e. their edges
   fall halfway across the outermost grid column on each side. */
.cs-row,
.cs-hero,
.cs-image {
  margin-left: calc(var(--edge) + var(--col-step));
  margin-right: calc(var(--edge) + var(--col-step));
}

/* Full-bleed variant: images align with the nav text at var(--edge) on each side.
   Aspect ratio is adjusted so the rendered height stays the same as the inset layout
   (container is 2 col-steps wider = 10/12 → 12/12, so ratio scales by 12/10). */
.cs-wide .cs-hero,
.cs-wide .cs-image {
  margin-left: var(--edge);
  margin-right: var(--edge);
}

.cs-wide .cs-hero__img {
  aspect-ratio: 2106 / 875;
}
.cs-wide .cs-image__img {
  /* wide aspect height (2106/875) + 60px */
  height: calc(100cqw * 875 / 2106 + 60px);
}

.cs-wide .cs-pair {
  margin-left: var(--edge);
  margin-right: var(--edge);
}

.cs-wide .cs-caption {
  margin-left: var(--edge);
}

/* Reading column — 8 columns, centred (offset 2 cols, aligned to grid lines). */
.cs-col {
  margin-left: calc(var(--edge) + 2 * var(--col-step));
  width: calc(8 * var(--col-step));
}

/* Narrow caption column — 6 columns, left-aligned to the edge gutter. */
.cs-col--narrow {
  margin-left: var(--edge);
  width: calc(6 * var(--col-step));
}

/* ── HEADER — fixed like homepage chrome, always visible ────────────────── */
.cs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 48px var(--edge) 0;
  font-size: 22px;
  color: var(--blue);
  background: transparent;
  transition: opacity 0.3s ease;
}
body.footer-visible .cs-header {
  opacity: 0;
}

/* Home link — a back arrow slides + fades in to the left of the name on hover. */
.cs-header__home {
  display: inline-flex;
  align-items: baseline;
  color: var(--blue);
  pointer-events: auto;
}
.cs-header__home-arrow {
  display: inline-block;
  overflow: hidden;
  max-width: 0;
  margin-right: 0;
  opacity: 0;
  transform: translateX(6px);
  transition: max-width 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              margin-right 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.28s ease,
              transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.cs-header__home:hover .cs-header__home-arrow,
.cs-header__home:focus-visible .cs-header__home-arrow {
  max-width: 1.4em;
  margin-right: 0.3em;
  opacity: 1;
  transform: translateX(0);
}

/* ── HERO ───────────────────────────────────────────────────────────────── */
.cs-hero {
  position: relative;
  margin-top: 120px;
}
.cs-hero__img {
  width: 100%;
  aspect-ratio: 1404 / 700;
  object-fit: cover;
  border-radius: 0;
  background: #e9e9ee;
}

/* ── INTRO ──────────────────────────────────────────────────────────────── */
.cs-intro {
  margin-top: 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.cs-intro__header {
  font-size: 26px;
  line-height: 1.1;
}
.cs-intro__body {
  font-size: 31px;
  line-height: 1.39;
}
.cs-intro__meta {
  font-size: 20px;
  line-height: 1.3;
}
.cs-intro__meta p { margin-bottom: 24px; }
.cs-intro__meta p:last-child { margin-bottom: 0; }
.cs-intro__meta-label { color: var(--blue-60); }

/* ── ACCORDION ──────────────────────────────────────────────────────────── */
.cs-accordion { margin-top: 64px; }
.cs-accordion__group { display: flex; flex-direction: column; }

.cs-accordion__item {
  border-top: 0.5px solid var(--blue);
}
.cs-accordion__item:last-child {
  border-bottom: 0.5px solid var(--blue);
}

.cs-accordion__header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 64px;
  min-height: 108px;
  padding: 40px 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 26px;
  color: var(--blue);
  text-align: left;
}
.cs-accordion__label { flex: 1 0 0; min-width: 0; }
.cs-accordion__icon {
  flex-shrink: 0;
  font-size: 26px;
  line-height: 1;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.cs-accordion__item.is-open .cs-accordion__icon { transform: rotate(180deg); }

/* Collapsible body — grid-rows trick for smooth height animation */
.cs-accordion__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.cs-accordion__item.is-open .cs-accordion__body { grid-template-rows: 1fr; }
.cs-accordion__body-inner {
  overflow: hidden;
  border-top: 0.5px solid var(--blue-40);
  /* border only visible once open: collapse border with row height */
}
.cs-accordion__item:not(.is-open) .cs-accordion__body-inner { border-top-color: transparent; }
.cs-accordion__content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 40px 0;
  font-size: 20px;
  line-height: 1.39;
}
.cs-accordion__content b { font-weight: normal; color: var(--blue); }

/* ── IMAGE SECTIONS ─────────────────────────────────────────────────────── */
.cs-image { margin-top: 80px; position: relative; container-type: inline-size; }
.cs-image__img {
  width: 100%;
  /* width-driven aspect height (1404/700) + 60px; 100cqw = the container width */
  height: calc(100cqw * 700 / 1404 + 60px);
  object-fit: cover;
  border-radius: 0;
  background: #e9e9ee;
}

/* ── IMAGE PAIR (two images side by side) ───────────────────────────────── */
.cs-pair {
  margin-top: 80px;
  margin-left: calc(var(--edge) + var(--col-step));
  margin-right: calc(var(--edge) + var(--col-step));
  display: flex;
  gap: 24px;
}
.cs-pair__item { flex: 1 1 0; min-width: 0; position: relative; }
.cs-pair__img {
  display: block;
  width: 100%;
  height: 450px;
  object-fit: cover;
  border-radius: 0;
  background: #e9e9ee;
}

/* ── PICTURE FRAME ────────────────────────────────────────────────────────
   Same style as the Work-section images: a 0.5px stroke at 60% of the chosen
   colour (tracks the nav colour swap via color-mix on --blue) plus 1.2px / 8px
   L-shaped corner brackets in each corner. Drawn on the image containers (an
   <img> can't carry pseudo-elements). */
.cs-hero::before,
.cs-image::before,
.cs-pair__item::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  border: 0.5px solid color-mix(in srgb, var(--blue) 60%, transparent);
}
.cs-hero::after,
.cs-image::after,
.cs-pair__item::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background-image:
    linear-gradient(var(--blue), var(--blue)), linear-gradient(var(--blue), var(--blue)),   /* top-left   */
    linear-gradient(var(--blue), var(--blue)), linear-gradient(var(--blue), var(--blue)),   /* top-right  */
    linear-gradient(var(--blue), var(--blue)), linear-gradient(var(--blue), var(--blue)),   /* bot-left   */
    linear-gradient(var(--blue), var(--blue)), linear-gradient(var(--blue), var(--blue));   /* bot-right  */
  background-size:
    8px 1.2px, 1.2px 8px,
    8px 1.2px, 1.2px 8px,
    8px 1.2px, 1.2px 8px,
    8px 1.2px, 1.2px 8px;
  background-repeat: no-repeat;
  background-position:
    left top, left top,
    right top, right top,
    left bottom, left bottom,
    right bottom, right bottom;
}

/* ── CAPTION (narrow left-aligned detail copy) ──────────────────────────── */
.cs-caption {
  margin-top: 32px;
  margin-left: calc(var(--edge) + var(--col-step));
  width: calc(8 * var(--col-step));   /* 4 displayed grid columns (2 col-steps each) */
}
.cs-caption__text {
  font-size: 16px;
  line-height: 1.39;
}
/* Space stacked caption paragraphs (e.g. multi-part experiment notes). */
.cs-caption__text + .cs-caption__text { margin-top: 20px; }

/* ── REFLECTIONS ────────────────────────────────────────────────────────── */
.cs-reflections {
  margin-top: 120px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.cs-reflections__label { font-size: 26px; line-height: 1.1; }
.cs-reflections__body  { font-size: 24px; line-height: 1.4; }

/* ── NEXT PROJECT ───────────────────────────────────────────────────────── */
.cs-next {
  margin-top: 64px;
}
.cs-next__link {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: 26px;
  color: var(--blue);
  text-decoration: underline;
  text-decoration-skip-ink: none;
  text-underline-position: from-font;
  text-underline-offset: 3px;
}
.cs-next__link:hover { opacity: 0.7; }

/* ── SELECTED WORKS (physics scatter) ───────────────────────────────────── */
.cs-works {
  position: relative;
  margin: 120px 0 0;
  border-top: 0.5px solid var(--blue);
}
.cs-works__header {
  position: absolute;
  top: 64px;
  left: var(--edge);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 25px;
  color: var(--blue);
  z-index: 10;
  pointer-events: none;
}
.cs-works__stage {
  position: relative;
  width: 100%;
  height: 610px;
  overflow: hidden;
}
/* Tiles — start hidden; physics positions & reveals them */
.cs-works__item {
  display: block;
  width: 180px;
  height: 180px;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  overflow: hidden;
  border-radius: var(--tile-radius);
}
.cs-works__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── NEXT UP ─────────────────────────────────────────────────────────── */
.cs-nextup {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 120px;
}

.cs-nextup__heading {
  font-size: 24px;
  color: var(--blue);
  padding-left: var(--edge);
}

.cs-nextup__list {
  border-bottom: 0.5px solid var(--blue);
}

.cs-nextup__item {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  height: 111px;
  padding: 0 var(--edge);
  border-top: 0.5px solid var(--blue);
  color: var(--blue);
  text-decoration: none;
}

.cs-nextup__item:hover { z-index: 2; }

.cs-nextup__name {
  font-size: 32px;
  width: 464px;
  flex-shrink: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.cs-nextup__type {
  font-size: 18px;
  flex: 1;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.cs-nextup__item:hover .cs-nextup__name,
.cs-nextup__item:hover .cs-nextup__type {
  transform: translateX(32px);
  opacity: 0.6;
}

.cs-nextup__arrow {
  flex: 1;
  font-size: 24px;
  text-align: right;
  transition: opacity 0.35s ease;
}

.cs-nextup__item:hover .cs-nextup__arrow {
  opacity: 0.6;
}

.cs-nextup__thumb {
  position: absolute;
  right: calc(var(--edge) + 120px);
  top: 50%;
  transform: translateY(-50%);
  width: 240px;
  height: 200px;
  pointer-events: none;
  opacity: 0;
  filter: blur(16px);
  transition: opacity 0.4s ease, filter 0.5s ease;
  z-index: 5;
}

.cs-nextup__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cs-nextup__item:hover .cs-nextup__thumb {
  opacity: 1;
  filter: blur(0);
}

.cs-nextup__thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 0.5px solid color-mix(in srgb, var(--blue) 60%, transparent);
  pointer-events: none;
  z-index: 2;
}

.cs-nextup__thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background-image:
    linear-gradient(var(--blue), var(--blue)), linear-gradient(var(--blue), var(--blue)),   /* top-left   */
    linear-gradient(var(--blue), var(--blue)), linear-gradient(var(--blue), var(--blue)),   /* top-right  */
    linear-gradient(var(--blue), var(--blue)), linear-gradient(var(--blue), var(--blue)),   /* bot-left   */
    linear-gradient(var(--blue), var(--blue)), linear-gradient(var(--blue), var(--blue));   /* bot-right  */
  background-size:
    8px 1.2px, 1.2px 8px,
    8px 1.2px, 1.2px 8px,
    8px 1.2px, 1.2px 8px,
    8px 1.2px, 1.2px 8px;
  background-repeat: no-repeat;
  background-position:
    left top, left top,
    right top, right top,
    left bottom, left bottom,
    right bottom, right bottom;
}

/* ════════════════════════════════════════════════════════════════════════
   SITE FOOTER — reusable homepage footer.
   Fixed behind content (z-index:1) and revealed as the page scrolls over it
   (parallax). Same markup/behaviour as the homepage; sized by js/footer.js.
   ════════════════════════════════════════════════════════════════════════ */
body { padding-bottom: 600px; } /* reserve footer space; JS overrides precisely */

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 1;            /* below .cs-page (z-index:2) */
}

/* White card: top lip, same bg as page, with column grid + shadow. */
.footer__card {
  position: relative;
  height: 384px;
  background: var(--bg);
  box-shadow: 0 4px 62px 0 rgba(0, 0, 0, 0.10);
  overflow: hidden;
}
.footer__card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(
    to right,
    color-mix(in srgb, var(--blue) 10%, transparent) 0px,
    color-mix(in srgb, var(--blue) 10%, transparent) 1px,
    transparent 1px,
    transparent 100%
  );
  background-size: calc(var(--col-step) * 2) 100%;
  background-position: var(--edge) 0;
  background-repeat: repeat-x;
}

/* Blue section: main footer content. */
.footer__blue {
  position: relative;
  height: 600px;         /* updated by JS after font measurement */
  background: var(--blue);
  overflow: hidden;
  padding: 72px var(--edge) 0;
}
.footer__blue::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.05) 0px,
    rgba(255, 255, 255, 0.05) 1px,
    transparent 1px,
    transparent 100%
  );
  background-size: calc(var(--col-step) * 2) 100%;
  background-position: var(--edge) 0;
  background-repeat: repeat-x;
}

.footer__main-content {
  position: relative;
  z-index: 1;
  max-width: 1189px;
}
.footer__globe-wrap { width: 100px; height: 100px; margin-bottom: 32px; }
#footer-globe { display: block; width: 100%; height: 100%; }

.footer__sub {
  font-family: var(--font);
  font-size: 26px;
  color: #fff;
  line-height: normal;
  margin-bottom: 32px;
}
.footer__headline {
  font-family: var(--font);
  font-size: 40px;
  color: #fff;
  line-height: normal;
  margin-bottom: 64px;
}
.footer__download {
  font-family: var(--font);
  font-size: 32px;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
  line-height: normal;
  display: inline-block;
  transform-origin: center;
  transition: transform 0.25s ease;
}
.footer__download:hover {
  text-decoration: underline;
  text-decoration-skip-ink: none;
  text-underline-position: from-font;
  transform: rotate(-2deg) scale(1.08);
}

.footer__divider {
  position: absolute;
  left: var(--edge);
  right: var(--edge);
  top: 470px;            /* JS overrides with precise measurement */
  height: 0.5px;
  background: rgba(255, 255, 255, 0.4);
  z-index: 1;
}
.footer__bottom-bar {
  position: absolute;
  left: var(--edge);
  right: var(--edge);
  top: 518px;            /* JS overrides with precise measurement */
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}
.footer__social,
.footer__credit {
  font-family: var(--font);
  font-size: 20px;
  color: #fff;
  line-height: normal;
  white-space: nowrap;
}
.footer__social a {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  transform-origin: center;
  transition: transform 0.25s ease;
}
.footer__social a:hover { text-decoration: underline; transform: rotate(-2deg) scale(1.08); }

/* ── STAMP CURSOR (footer zone) ─────────────────────────────────────────── */
body.stamps-mode .site-footer   { cursor: none; }
body.stamps-mode .site-footer a { cursor: pointer; }

#stamp-cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 170px;
  height: 170px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  will-change: transform, opacity;
}
#stamp-cursor .stamp-svg {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--blue);   /* inline SVG fills use currentColor → tracks the theme */
}
#stamp-cursor .stamp-svg svg { display: block; width: 100%; height: 100%; }

.stamp-placed {
  position: fixed;
  width: 150px;
  height: 150px;
  pointer-events: none;
  z-index: 2;
  transform-origin: center;
}
.stamp-placed .stamp-svg {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--blue);   /* inline SVG fills use currentColor → tracks the theme */
}
.stamp-placed .stamp-svg svg { display: block; width: 100%; height: 100%; }

/* ════════════════════════════════════════════════════════════════════════
   ENTRANCE / REVEAL
   Content blocks start hidden; revealed (fade + rise) top-to-bottom after the
   hero settles. .cs-reveal is the per-block hook; JS adds .is-in to play.
   ════════════════════════════════════════════════════════════════════════ */
.cs-reveal {
  opacity: 0;
  transform: translateY(24px);
}
.js-reveal-ready .cs-reveal {
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.cs-reveal.is-in {
  opacity: 1;
  transform: none;
}
/* No-JS / reduced-motion fallback — show everything */
.no-js .cs-reveal { opacity: 1; transform: none; }

/* ── NAV MENU (bottom-left, identical to homepage) ──────────────────────── */
.nav-menu {
  --nav-bg: var(--bg);                                                /* panel fill   */
  --nav-stroke: color-mix(in srgb, var(--blue) 60%, transparent);     /* 0.5px stroke */
  --nav-fg: var(--blue);                                              /* corners/text/dots */
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 300;
  background: var(--nav-bg);
  border: 0.5px solid var(--nav-stroke);                                  /* 60% stroke, like the work images */
  border-radius: 0;                                                       /* square corners for the L-frames */
  padding: 24px;
  width: 240px;
  clip-path: inset(calc(100% - 72px) calc(100% - 72px) 0 0 round 0px);
  background-color: transparent;
  border-color: transparent;
  transition: opacity 0.3s ease, box-shadow 0.3s ease;
}

/* ── Corner frames (1.2px / 8px L-brackets, theme-coloured) ──────────────
   ::before = the two BOTTOM corners, ::after = the two TOP corners, so they
   can ease in separately: bottom first, then top, once the panel is open. */
.nav-menu::before,
.nav-menu::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  background-image:
    linear-gradient(var(--nav-fg), var(--nav-fg)), linear-gradient(var(--nav-fg), var(--nav-fg)),
    linear-gradient(var(--nav-fg), var(--nav-fg)), linear-gradient(var(--nav-fg), var(--nav-fg));
  background-size: 8px 1.2px, 1.2px 8px, 8px 1.2px, 1.2px 8px;
  background-repeat: no-repeat;
}
.nav-menu::before {
  background-position: left bottom, left bottom, right bottom, right bottom;   /* bottom-left, bottom-right */
  transition: opacity 0.3s ease;
}
.nav-menu::after {
  background-position: left top, left top, right top, right top;               /* top-left, top-right */
  transition: opacity 0.3s ease 0.3s;   /* top corners ease in after the bottom ones */
}
/* Eased in once the panel is fully open (set in nav-menu.js). */
.nav-menu.nm-frames-on::before,
.nav-menu.nm-frames-on::after { opacity: 1; }

body.footer-visible .nav-menu {
  opacity: 0;
  pointer-events: none;
}
.nav-menu.nm-phase-1 {
  clip-path: inset(calc(100% - 72px) 0 0 0 round 0);
  background-color: var(--nav-bg);
  border-color: var(--nav-stroke);
  transition: clip-path 200ms cubic-bezier(0.4, 0, 0.2, 1),
              background-color 80ms linear,
              border-color 80ms linear;
}
.nav-menu.nm-phase-2 {
  clip-path: inset(0 0 0 0 round 0);
  background-color: var(--nav-bg);
  border-color: var(--nav-stroke);
  transition: clip-path 320ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* Fully open: drop the clip-path (it would clip the shadow) and add the drop
   shadow. clip-path:none is visually identical to inset(0) for the content. */
.nav-menu.nm-content-in {
  clip-path: none;
  box-shadow: 4px 4px 20px 0 rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
}
.nav-menu.nm-closing-2 {
  clip-path: inset(calc(100% - 72px) 0 0 0 round 0);
  transition: clip-path 260ms cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-menu.nm-closing-1 {
  clip-path: inset(calc(100% - 72px) calc(100% - 72px) 0 0 round 0px);
  background-color: transparent;
  border-color: transparent;
  transition: clip-path 180ms cubic-bezier(0.4, 0, 0.2, 1),
              background-color 100ms linear 80ms,
              border-color 100ms linear 80ms;
}
.nav-menu__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 32px;
}
.nav-menu__main-links,
.nav-menu__sub-links {
  display: flex;
  flex-direction: column;
}
.nav-menu__main-links { gap: 11px; }
.nav-menu__sub-links  { gap: 11px; }
.nav-menu__main-links a {
  font-size: 18px;
  font-family: var(--font);
  color: var(--blue);
  text-decoration: none;
  line-height: normal;
  display: flex;
  align-items: center;
}
.nav-menu__main-links a::before {
  content: '→';
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  margin-right: 0;
  flex-shrink: 0;
  transition: max-width 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              opacity    0.18s ease,
              margin-right 0.22s ease;
}
.nav-menu__main-links a:hover::before {
  max-width: 1.5em;
  opacity: 1;
  margin-right: 6px;
}
.nav-menu__sub-links a {
  font-size: 14px;
  font-family: var(--font);
  color: var(--blue);
  text-decoration: none;
  line-height: normal;
  display: flex;
  align-items: center;
}
.nav-menu__sub-links a::before {
  content: '→';
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  margin-right: 0;
  flex-shrink: 0;
  transition: max-width 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              opacity    0.18s ease,
              margin-right 0.22s ease;
}
.nav-menu__sub-links a:hover::before {
  max-width: 1.5em;
  opacity: 1;
  margin-right: 6px;
}
.nav-menu__divider {
  height: 0;
  border: none;
  border-top: 0.5px solid var(--blue);
  opacity: 0.3;
  margin: 0;
}
.nav-menu__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.nav-menu__toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 24px;
  height: 24px;
  position: relative;
  flex-shrink: 0;
  color: var(--blue);
}
.nav-menu__icon-default,
.nav-menu__icon-open {
  display: block;
  transition: opacity 0.22s ease;
}
.nav-menu__icon-open {
  position: absolute;
  top: 0; left: 0;
  opacity: 0;
  pointer-events: none;
}
.nav-menu.nm-is-open .nav-menu__icon-default { opacity: 0; pointer-events: none; }
.nav-menu.nm-is-open .nav-menu__icon-open    { opacity: 1; pointer-events: auto; }
.nav-menu__icon-default circle {
  transition: fill 0.2s ease;
}
.nav-menu:not(.nm-is-open) .nav-menu__toggle:hover .nav-menu__icon-default circle:nth-child(1),
.nav-menu:not(.nm-is-open) .nav-menu__toggle:hover .nav-menu__icon-default circle:nth-child(3),
.nav-menu:not(.nm-is-open) .nav-menu__toggle:hover .nav-menu__icon-default circle:nth-child(7),
.nav-menu:not(.nm-is-open) .nav-menu__toggle:hover .nav-menu__icon-default circle:nth-child(9) {
  fill: none;
}
.nav-menu__colours {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.nav-menu.nm-content-in .nav-menu__colours {
  opacity: 1;
  transition-delay: 360ms;
}
.nav-menu__colour {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.15s ease, outline 0.15s ease;
}
.nav-menu__colour:hover { transform: scale(1.25); }
.nav-menu__colour.is-active {
  outline: 0.5px solid var(--blue);
  outline-offset: 2px;
}
.nav-menu__item {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.nav-menu.nm-content-in .nav-menu__item { opacity: 1; transform: translateY(0); }
.nav-menu__divider-wrap {
  opacity: 0;
  transition: opacity 0.25s ease;
}
.nav-menu.nm-content-in .nav-menu__divider-wrap { opacity: 1; }

/* ── CURSOR COORDS ───────────────────────────────────────────────────────── */
.cursor-coords {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 999;
  font-family: var(--font);
  font-size: 11px;
  line-height: 1.4;
  color: var(--blue);
  white-space: nowrap;
  user-select: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.cursor-coords.is-visible { opacity: 1; }
.cursor-coords.on-footer  { opacity: 0 !important; }
body.menu-hovering .cursor-coords { opacity: 0 !important; }

/* ── SCROLL PROGRESS (bottom-right) ─────────────────────────────────────── */
.scroll-progress {
  position: fixed;
  bottom: calc(var(--edge) - 2px);
  right: var(--edge);
  width: 32px;
  height: 32px;
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.scroll-progress.is-visible { opacity: 1; }
body.footer-visible .scroll-progress { opacity: 0 !important; }

@media (prefers-reduced-motion: reduce) {
  .cs-reveal { opacity: 1; transform: none; }
  .cs-accordion__body { transition: none; }
  .t-arrow { animation: none; }
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  /* Stack reading + caption columns to full width within the gutters. */
  .cs-col,
  .cs-col--narrow {
    margin-left: var(--edge);
    margin-right: var(--edge);
    width: auto;
  }
  /* Images edge-aligned on small screens (the per-column inset is desktop-only). */
  .cs-row,
  .cs-hero,
  .cs-image,
  .cs-pair {
    margin-left: var(--edge);
    margin-right: var(--edge);
  }
  /* 2× paired images stack vertically with 64px between them. */
  .cs-pair { flex-direction: column; gap: 64px; }
  /* Hero image: 88px taller than its natural aspect (object-fit cover crops). */
  .cs-hero__img {
    aspect-ratio: auto;
    height: calc((100vw - 96px) * 700 / 1404 + 88px);
  }
  /* Cursor X/Y readout is a desktop-pointer feature — hide on tablet/mobile. */
  .cursor-coords { display: none; }
  /* No Next Up hover-reveal image; neutralise the sticky-tap hover shift. */
  .cs-nextup__thumb { display: none; }
  .cs-nextup__item:hover .cs-nextup__name,
  .cs-nextup__item:hover .cs-nextup__arrow { transform: none; opacity: 1; }
  .cs-intro__header  { font-size: 22px; }
  .cs-intro__body    { font-size: 24px; }
  .cs-reflections__body { font-size: 24px; }
  .cs-accordion__header { font-size: 22px; min-height: 88px; padding: 28px 0; }
  .footer__headline  { font-size: 32px; }
  .footer__sub,
  .footer__download  { font-size: 24px; }
  .cs-works { display: none; }   /* physics scatter is desktop-only */
}

@media (max-width: 600px) {
  /* 32px edge gutter (case-study.css is only loaded by case-study pages, so this
     is safe on :root). Shifts the fixed chrome and the --edge-based content
     margins (set in the 1000px block) to 32px. */
  :root { --edge: 32px; }
  /* Grid overlay: 4 columns within 32px margins — match the index page. */
  .cs-grid {
    background-size: calc((100vw - 64px) / 4) 100%;
    background-position: 32px 0;
  }
  /* The first child's top margin was collapsing through .cs-page, pushing the
     page box (and its grid overlay) down and leaving an ungridded strip at the
     top. A block formatting context keeps the margin inside so the grid covers
     from y=0; content position is unchanged. */
  .cs-page { display: flow-root; }
  /* Centre the page-transition loader frames. */
  .wipe-loader__img { width: min(160px, 40vw); }

  /* Hero image: 32px taller than its natural aspect (object-fit cover crops). */
  .cs-hero__img {
    aspect-ratio: auto;
    height: calc((100vw - 64px) * 700 / 1404 + 32px);
  }
  /* Hero sits 40px below the chrome (≈55px tall); content flows up with it. */
  .cs-hero { margin-top: 95px; }
  .cs-header { font-size: 22px; padding-top: 32px; }   /* match the index chrome size + 32px top margin */

  /* Next Up: the fixed 464px name width overflowed the viewport (which pushed the
     fixed header's ©—26 off-screen). Let the name flex/ellipsis to fit. */
  .cs-nextup__name {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cs-nextup__type { display: none; }   /* drop the "Case Study" / "Selected Work" labels */
  .cs-nextup__arrow { flex: 0 0 auto; padding-left: 12px; }
  .cs-intro { margin-top: 48px; }
  .cs-intro__body { font-size: 20px; }
  .cs-reflections__body { font-size: 20px; }
  .cs-image, .cs-intro { margin-top: 56px; }
  .cs-pair { flex-direction: column; gap: 40px; }
  .cs-pair__img { height: auto; aspect-ratio: 16 / 10; }
  .footer__bottom-bar { flex-direction: column; align-items: flex-start; gap: 12px; }
  /* Drop the "Built by Tim Kennedy" credit. */
  .footer__credit { display: none; }
  /* Match the 4-column / 32px-margin grid of the section above. */
  .footer__card::before,
  .footer__blue::before {
    background-size: calc((100vw - 64px) / 4) 100%;
    background-position: 32px 0;
  }
  /* Scale the footer text down to fit the narrow viewport. */
  .footer__sub      { font-size: 16px; margin-bottom: 20px; }
  .footer__headline { font-size: 26px; line-height: 1.5; margin-bottom: 40px; }
  .footer__download { font-size: 24px; }
  .footer__social   { font-size: 16px; }
}

/* ════════════════════════════════════════════════════════════════════════
   PAGE WIPE TRANSITION
   A full-viewport coloured panel (::before on <html>) that covers the page
   during navigation. Classes are toggled by js/page-wipe.js.
   ════════════════════════════════════════════════════════════════════════ */
html.wipe-out::before,
html.wipe-cover::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: var(--blue);
  pointer-events: none;
  will-change: transform;
}
/* Outgoing — starts below the viewport, rises up to cover. */
html.wipe-out::before           { transform: translateY(100%); }
html.wipe-out.wipe-out-go::before {
  transform: translateY(0);
  transition: transform 0.7s cubic-bezier(0.76, 0, 0.24, 1);
}
/* Incoming — covers on load, then rises up and off the top to reveal. */
html.wipe-cover::before         { transform: translateY(0); }
html.wipe-cover.wipe-reveal::before {
  transform: translateY(-100%);
  transition: transform 0.85s cubic-bezier(0.76, 0, 0.24, 1);
}

/* Loader frames, eased through while the box covers the screen (mirrors styles.css) */
.wipe-loader {
  position: fixed;
  inset: 0;
  z-index: 100001;            /* above the wipe box (100000) */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.wipe-loader.is-on { opacity: 1; }
.wipe-loader__img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);   /* centre reliably (abspos isn't centred by the flex parent) */
  width: min(210px, 32vw);
  height: auto;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.wipe-loader__img.is-frame { opacity: 1; }
