/* Shared styles for every case study page.
   Page-specific colour comes from --page-bg, set in a <style> block by scripts/build.mjs. */
:root {
  --bg: #141414;
  --card: #f7f7f7;
  --card2: #ebebeb;
  --text: #141414;
  --text-inv: #f7f7f7;
  --muted: #5f5f5f;
  --border: #141414;
  --shadow: rgba(0,0,0,0.16);
}
[data-theme="light"] {
  --bg: #eeeae4;
  --card: #ffffff;
  --card2: #e4dfd9;
  --text: #141414;
  --text-inv: #141414;
  --muted: #5f5f5f;
  --border: #141414;
  --shadow: rgba(0,0,0,0.08);
}

@font-face {
  font-family:'Trapix';
  src:url('../fonts/Trapix-Regular.woff2') format('woff2'),
      url('../fonts/Trapix-Regular.woff') format('woff');
  font-weight:100 400; font-style:normal; font-display:swap;
}
@font-face {
  font-family:'Trapix';
  src:url('../fonts/Trapix-Italic.woff2') format('woff2'),
      url('../fonts/Trapix-Italic.woff') format('woff');
  font-weight:100 400; font-style:italic; font-display:swap;
}

*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { scroll-behavior:smooth; }
body {
  background:var(--page-bg,#141414);
  font-family:'Hanken Grotesk',sans-serif;
  min-height:100vh; overflow-x:hidden;
  transition:background .45s;
}

/* SCROLL REVEAL */
.reveal { opacity:0; transform:translateY(26px); transition:opacity .7s ease,transform .7s ease; }
.reveal.visible { opacity:1; transform:translateY(0); }
.rd1{transition-delay:.1s} .rd2{transition-delay:.2s} .rd3{transition-delay:.3s}

/* ── NAV ── */
.nav {
  position:fixed; top:0; left:50%; transform:translateX(-50%);
  z-index:300; background:var(--bg); border-radius:0 0 10px 10px;
  padding:25px 32px; display:flex; align-items:center;
  justify-content:space-between; width:min(700px,92vw); gap:32px;
  white-space:nowrap; transition:background .45s;
  box-shadow:0 4px 28px var(--shadow);
  animation:navDrop .5s ease both;
}
@keyframes navDrop { from{opacity:0;transform:translateX(-50%) translateY(-14px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }
.nav-logo { display:flex; align-items:center; color:var(--text-inv); text-decoration:none; transition:color .45s; height:28px; }
.nav-logo svg { height:100%; width:auto; }
.nav-links { display:flex; gap:20px; align-items:center; }
.nav-item { position:relative; }
.nav-link {
  font-family:'Trapix',Georgia,serif; font-size:15px; font-weight:200;
  color:var(--text-inv); text-decoration:none; line-height:1.3;
  display:flex; align-items:center; gap:5px;
  transition:opacity .2s, color .45s; cursor:pointer;
  background:none; border:none; padding:0;
}
.nav-link:hover { opacity:.6; }
.px-wrap { position:relative; display:inline-block; cursor:pointer; }
.px-text { display:block; font-family:'Trapix',Georgia,serif; font-weight:200; color:transparent; line-height:1.3; user-select:none; pointer-events:none; }
.px-canvas { position:absolute; top:0; left:0; pointer-events:none; }
.theme-toggle { display: none; }
.nav-hamburger { display:none; background:none; border:none; cursor:pointer; color:var(--text-inv); padding:4px; flex-shrink:0; }
.nav-hamburger img { transition:filter .3s; }
.nav-hamburger.dark-icon img { filter:invert(1); }

/* ── MOBILE MENU ── */
.mobile-menu {
  display:none; position:fixed; inset:0; z-index:400;
  background:var(--bg); flex-direction:column;
  padding:20px 24px 40px; transition:background .45s;
}
.mobile-menu.open { display:flex; }
.mobile-menu-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:60px; }
.mobile-menu-logo { color:var(--text-inv); }
.mobile-menu-close { background:none; border:none; cursor:pointer; color:var(--text-inv); padding:4px; }
.mobile-menu-links { display:flex; flex-direction:column; gap:0; flex:1; justify-content:center; }
.mobile-menu-link {
  font-family:'Trapix',Georgia,serif; font-weight:200; font-size:clamp(36px,9vw,56px);
  color:var(--text-inv); text-decoration:none; line-height:1;
  padding:20px 0; border-bottom:1px solid rgba(255,255,255,.1);
  transition:opacity .2s; display:block;
}
.mobile-menu-link:first-child { border-top:1px solid rgba(255,255,255,.1); }
.mobile-menu-link:hover { opacity:.5; }
.mobile-menu-link .px-text { font-size:clamp(36px,9vw,56px); color:var(--text-inv); }
.mobile-menu-link .px-canvas { display:none; }

/* ── PAGE WRAPPER ── */
.page { padding-top:0; }

/* ── HERO ── */
.cs-hero {
  height:732px; overflow:hidden; position:relative;
  border-radius:0 0 10px 10px;
  background:transparent;
}
.cs-hero img {
  width:100%; height:100%; object-fit:cover; object-position:center;
  display:block;
}

/* ── ROW WRAPPER ── */
.row { padding:30px 30px 0; display:flex; gap:30px; align-items:stretch; }

/* ── META ROW ── */
/* Left: client/type/year pill */
.meta-pill {
  background:var(--card); border-radius:10px;
  padding:37.5px 30px; display:flex; align-items:center;
  flex-shrink:0; transition:background .45s; align-self:stretch;
}
.meta-pill-inner { display:flex; flex-direction:column; gap:30px; }
.meta-group { display:flex; flex-direction:column; gap:10px; }
.meta-label {
  font-family:'Hanken Grotesk',sans-serif; font-weight:800; font-size:14px;
  text-transform:uppercase; line-height:1; color:var(--text); transition:color .45s;
}
.meta-value {
  font-family:'Hanken Grotesk',sans-serif; font-weight:300; font-size:16px;
  line-height:1.4; color:var(--text); transition:color .45s;
}

/* Centre: big H1 tagline */
.meta-tagline {
  background:var(--card); border-radius:10px;
  padding:50px 40px; flex:1; display:flex; align-items:flex-start;
  transition:background .45s; align-self:stretch;
}
.meta-tagline h1 {
  font-family:'Trapix',Georgia,serif; font-weight:400;
  font-size:40px; line-height:1.3; color:var(--text); transition:color .45s;
}

/* Right: my role */
.meta-role {
  background:var(--card); border-radius:10px;
  padding:50px 60px; width:424px; flex-shrink:0;
  display:flex; align-items:flex-start; justify-content:space-between;
  transition:background .45s; align-self:stretch;
}
.meta-role-label {
  font-family:'Hanken Grotesk',sans-serif; font-weight:800; font-size:14px;
  text-transform:uppercase; line-height:1; color:var(--text); flex-shrink:0; transition:color .45s;
}
.meta-role-list {
  display:flex; flex-direction:column; gap:24px; align-items:flex-end;
}
.meta-role-list span {
  font-family:'Trapix',Georgia,serif; font-weight:400; font-size:22px;
  line-height:1.3; color:var(--text); display:block; transition:color .45s;
  text-align:right;
}

/* ── BIG PICTURE ── */
.big-picture {
  background:var(--card); border-radius:10px; flex:1;
  padding:50px 60px; display:flex; align-items:flex-start;
  justify-content:space-between; gap:40px;
  transition:background .45s;
}
.big-picture-label {
  font-family:'Hanken Grotesk',sans-serif; font-weight:800; font-size:14px;
  text-transform:uppercase; line-height:1; color:var(--text);
  flex-shrink:0; width:193px; transition:color .45s;
}
.big-picture p {
  font-family:'Trapix',Georgia,serif; font-weight:400; font-size:32px;
  line-height:1.3; color:var(--text); flex:1; transition:color .45s;
}

/* ── CONTEXT ROW ── */
.context-card {
  background:var(--card); border-radius:10px; flex:1;
  padding:50px 60px; display:flex; align-items:flex-start;
  justify-content:space-between; gap:40px;
  transition:background .45s;
}
.context-left {
  flex-shrink:0; width:321px;
  display:flex; flex-direction:column; justify-content:space-between;
  align-self:stretch;
}
.context-label {
  font-family:'Hanken Grotesk',sans-serif; font-weight:800; font-size:14px;
  text-transform:uppercase; line-height:1; color:var(--text); transition:color .45s;
}
.context-read-more {
  display:flex; align-items:center; gap:16px; cursor:pointer;
  background:none; border:none; padding:0;
}
.context-read-more span {
  font-family:'Hanken Grotesk',sans-serif; font-weight:700; font-size:16px;
  color:var(--text); letter-spacing:.02em; transition:color .45s;
}
.context-read-more img { width:25px; height:25px; display:block; flex-shrink:0; }
.context-cols { display:flex; gap:40px; flex:1; }
.context-col { flex:1; display:flex; flex-direction:column; gap:16px; }
.context-col h3 {
  font-family:'Trapix',Georgia,serif; font-weight:400; font-size:24px;
  line-height:1.3; color:var(--text); transition:color .45s;
}
.context-col p {
  font-family:'Hanken Grotesk',sans-serif; font-weight:300; font-size:16px;
  line-height:1.4; color:var(--muted);
}
.context-col p + p { margin-top:10px; }

/* ── CONTEXT EXPANDED ── */
.context-expanded {
  display:none; flex-direction:column; gap:50px;
  flex:1;
}
.context-expanded.open { display:flex; }
.context-expanded-row { display:flex; gap:40px; }
.context-expanded-row.gap-20 { gap:20px; }

/* Arrow rotation for read more/less */
.context-arrow-img {
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.context-arrow-img.rotated { transform: rotate(180deg); }

/* ── NEXT PROJECT ── */
.cs-next-wrap { padding:30px 30px 0; }
.cs-next {
  background:var(--card); border-radius:10px; padding:40px 60px;
  display:flex; align-items:center; justify-content:space-between; gap:32px;
  text-decoration:none; transition:background .25s;
}
.cs-next:hover { background:var(--card2); }
.cs-next-label { font-family:'Hanken Grotesk',sans-serif; font-weight:800; font-size:11px; text-transform:uppercase; letter-spacing:.1em; color:var(--muted); margin-bottom:10px; }
.cs-next-name { font-family:'Trapix',Georgia,serif; font-weight:400; font-size:clamp(28px,4vw,56px); line-height:1; color:var(--text); letter-spacing:-1px; transition:color .45s; }
.cs-next-arrow { width:48px; height:48px; flex-shrink:0; transition:transform .3s cubic-bezier(.4,0,.2,1); color:var(--text); }
.cs-next:hover .cs-next-arrow { transform:rotate(-45deg); }

/* ── FOOTER ── */
.footer-wrap { padding:30px; overflow-x:clip; }
.footer-row { display:flex; gap:30px; align-items:stretch; min-height:321px; }
.footer-logo-card { background:var(--card); border-radius:10px; padding:60px; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:background .25s; color:var(--text); }
.footer-logo-card:hover { background:var(--card2); }
.footer-logo-wrap { position:relative; display:inline-flex; align-items:center; justify-content:center; }
.footer-logo-wrap svg { display:block; height:clamp(40px,5vw,80px); width:auto; color:#141414; }
.footer-avatar { background:var(--card); border-radius:10px; width:241px; flex-shrink:0; overflow:hidden; }
.footer-avatar img { width:100%; height:100%; object-fit:contain; object-position:bottom; display:block; }
.footer-contact { background:var(--card); border-radius:10px; display:flex; align-items:center; justify-content:center; flex:1; min-width:0; cursor:pointer; transition:background .25s; position:relative; overflow:hidden; text-decoration:none; min-height:160px; }
.footer-contact:hover { background:var(--card2); }
.footer-contact-icon-closed,.footer-contact-icon-open { width:92px; height:74px; object-fit:contain; image-rendering:pixelated; position:absolute; transition:opacity .25s, transform .25s; }
.footer-contact-icon-closed { opacity:1; transform:scale(1); }
.footer-contact-icon-open   { opacity:0; transform:scale(.85); }
.footer-contact:hover .footer-contact-icon-closed { opacity:0; transform:scale(1.1); }
.footer-contact:hover .footer-contact-icon-open   { opacity:1; transform:scale(1); }
.footer-links { display:flex; flex-direction:column; gap:30px; flex:1; min-width:0; }
.footer-link-btn { background:var(--card); border-radius:10px; flex:1; display:flex; align-items:center; justify-content:center; cursor:pointer; border:none; transition:background .25s; position:relative; overflow:hidden; text-decoration:none; }
.footer-link-btn:hover { background:var(--card2); }
.footer-link-text { font-family:'Trapix',Georgia,serif; font-weight:200; font-size:27px; color:var(--text); letter-spacing:-.3px; transition:opacity .2s, transform .2s; position:absolute; }
.footer-link-icon { width:92px; height:92px; object-fit:contain; image-rendering:pixelated; opacity:0; transform:scale(.8); transition:opacity .2s, transform .2s; position:absolute; }
.footer-link-btn:hover .footer-link-text { opacity:0; transform:scale(1.1); }
.footer-link-btn:hover .footer-link-icon { opacity:1; transform:scale(1); }

::-webkit-scrollbar{width:5px}
::-webkit-scrollbar-track{background:var(--bg)}
::-webkit-scrollbar-thumb{background:#444;border-radius:3px}

/* ── MEDIA BLOCKS ──
   Generated by scripts/build.mjs from the "Media above/below Context" lists in the CMS.
   Per-cell values arrive as CSS variables: --cell-bg, --cell-pad, --cell-min, --w (width %). */
.blk { padding:30px 30px 0; }

/* Row: any number of cells side by side. A cell with --w has a fixed share of the row, the rest fill. */
.blk-row { display:flex; gap:30px; }
.cell {
  flex:1 1 0; min-width:0; border-radius:10px; overflow:hidden; position:relative;
  background:var(--cell-bg,transparent); padding:var(--cell-pad,0px); min-height:var(--cell-min,0px);
}
.cell.sized { flex:0 0 calc(var(--w) - 15px); }
.cell img, .cell video { width:100%; height:100%; display:block; object-fit:cover; }
.cell.fit-contain img, .cell.fit-contain video { object-fit:contain; border-radius:6px; }
.cell.fit-fixed img, .cell.fit-fixed video { position:absolute; inset:0; }

/* Framed: media sitting inside a coloured frame, 16:9, evenly split */
.frame {
  background:var(--frame-bg,#e0e0e0); border-radius:10px; min-height:var(--frame-min,0px);
  display:flex; align-items:center; justify-content:center; gap:24px; padding:5% 6.25%;
}
.frame-cell {
  width:calc((100% - (var(--n) - 1) * 24px) / var(--n)); flex-shrink:0;
  border-radius:8px; overflow:hidden; aspect-ratio:16/9; position:relative;
}
.frame-cell img, .frame-cell video { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; }

/* Grid: equal square tiles */
.blk-grid { display:grid; grid-template-columns:repeat(var(--cols,2),1fr); gap:20px; }
.blk-grid .cell { aspect-ratio:1/1; border-radius:8px; }

/* Full width: one image or video at its natural proportions */
.blk-full img, .blk-full video { width:100%; display:block; border-radius:10px; }

/* ── IMAGES ──
   width/height attributes reserve space before an image loads. This keeps the CSS-driven size
   and aspect ratio in charge; any class rule that sets a height still overrides it. */
:where(img[decoding="async"]) { height:auto; }

/* ── ACCESSIBILITY ── */
.skip-link { position:absolute; left:16px; top:-100px; z-index:1000; padding:12px 18px; background:#f7f7f7; color:#141414; border-radius:8px; font:700 14px 'Hanken Grotesk',sans-serif; text-decoration:none; }
.skip-link:focus { top:16px; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline:2px solid #141414; outline-offset:3px; box-shadow:0 0 0 5px #f7f7f7; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior:auto; }
  *, *::before, *::after { animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
  .reveal { opacity:1; transform:none; }
}

/* ── RESPONSIVE ── */
@media (max-width:768px) {
  .nav { width:calc(100% - 32px); padding:14px 20px 18px; gap:16px; }
  .nav-links { display:none; }
  .nav-hamburger { display:flex; align-items:center; justify-content:center; }
  .cs-hero { height:280px; }
  .row, .blk, .cs-next-wrap, .footer-wrap { padding-left:16px; padding-right:16px; }
  .row { flex-direction:column; }
  .meta-tagline h1 { font-size:clamp(28px,8vw,40px); }
  .meta-role { width:100%; }
  .big-picture { flex-direction:column; gap:16px; }
  .big-picture p { font-size:24px; }
  .context-card { flex-direction:column; gap:24px; }
  .context-left { width:100%; flex-direction:row; align-items:center; justify-content:space-between; }
  .context-cols { flex-direction:column; gap:24px; }
  .cs-next { padding:28px 24px; }
  .footer-wrap { padding:16px; }
  .footer-row { flex-direction:column; gap:12px; min-height:unset; }
  .footer-logo-card { padding:32px; width:100%; }
  .footer-avatar { width:100%; height:200px; }
  .footer-contact { min-height:120px; }
  .footer-links { gap:12px; }
  .footer-link-btn { min-height:80px; }
  .footer-link-text { font-size:20px; }
  .footer-link-icon { width:60px; height:60px; }
  .blk-row { flex-direction:column; }
  .blk { padding-top:16px; }
  .blk-row .cell, .blk-row .cell.sized { flex:0 0 auto; min-height:240px; }
  .blk-row .cell.fit-contain img, .blk-row .cell.fit-contain video { height:auto; }
  .frame { padding:5% 4%; gap:12px; min-height:unset; flex-direction:column; }
  .frame-cell { width:100%; }
  .blk-grid { gap:12px; }
}
@media (min-width:769px) and (max-width:1024px) {
  .cs-hero { height:480px; }
  .meta-tagline h1 { font-size:36px; }
  .meta-role { width:300px; }
  .footer-wrap { padding:20px; }
  .footer-row { gap:16px; }
}
