/* ==========================================================
   Portfolio styles
   Colours, fonts and spacing are all set here in :root,
   so you can restyle the whole site from this one block.
   ========================================================== */

:root {
  --bg: #0a0a0a;
  --surface: #151515;
  --line: #262626;
  --text: #ececea;
  --muted: #8f8f8a;
  --accent: #a13d3d;          /* deep red: lines, markers, large headings */
  --accent-text: #c75b5b;     /* lighter tint of the same red for small text, so it stays readable on black */
  --accent-dim: rgba(161, 61, 61, 0.18);

  --serif: "Merriweather", Georgia, serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;

  --max: 1320px;
  --gutter: clamp(16px, 4vw, 48px);
  --gap: clamp(12px, 1.6vw, 24px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--accent); color: #fff; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 10, 10, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; height: 68px;
}
.brand {
  font-family: var(--serif); font-size: 26px; text-decoration: none;
  letter-spacing: 0.01em; white-space: nowrap;
}
.nav { display: flex; gap: clamp(14px, 2.4vw, 32px); }
.nav a {
  text-decoration: none; font-size: 14px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  padding: 6px 0; border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); border-color: var(--accent); }

.menu-toggle {
  display: none; background: none; border: 0; color: var(--text);
  font: inherit; font-size: 14px; letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer; padding: 8px 0;
}
@media (max-width: 680px) {
  .menu-toggle { display: block; }
  .nav {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 16px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; font-size: 15px; }
}

/* ---------- Intro ---------- */
.intro {
  padding-top: clamp(50px, 2.2vw, 32px); padding-bottom: clamp(40px, 6vw, 72px);
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px); row-gap: clamp(50px, 2.6vw, 36px); align-items: start;
}
.intro-text h1 { margin-top: -0.12em; } /* line the top of the letters up with the top of the image */
/* Image matches the height of the title + intro text beside it */
.intro-media { justify-self: end; align-self: stretch; width: 100%; position: relative; background: var(--surface); overflow: hidden; }
.intro-media > img, .intro-media > video, .intro-media > .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; }
  .intro-media { aspect-ratio: 16 / 10; align-self: auto; }
}
.eyebrow {
  font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-text); margin: 0 0 20px;
}
.intro h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(40px, 6.4vw, 88px); line-height: 1.12;
  letter-spacing: -0.01em; margin: 0; max-width: 14ch;
}
.intro h1 em { color: var(--accent-text); }
/* Tagline runs across the full width above the title and image, centred */
.intro-tagline {
  grid-column: 1 / -1; text-align: center; margin: 0;
  padding-bottom: 0;
  font-size: 14px; line-height: 1.9;
}
.intro p.lede {
  color: var(--muted); font-size: clamp(17px, 1.5vw, 20px);
  max-width: 60ch; margin: 28px 0 0;
}

/* ---------- Editorial grid (front page) ---------- */
.grid {
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: var(--gap); padding-bottom: clamp(64px, 10vw, 120px);
}
.tile { grid-column: span 6; text-decoration: none; display: block; }
.tile.wide { grid-column: span 12; }
.tile.two-thirds { grid-column: span 8; }
.tile.third { grid-column: span 4; }
@media (max-width: 760px) {
  .tile, .tile.wide, .tile.two-thirds, .tile.third { grid-column: span 12; }
}

.tile .media {
  position: relative; overflow: hidden; background: var(--surface);
  aspect-ratio: 4 / 3;
}
.tile.wide .media { aspect-ratio: 21 / 9; }
.tile.two-thirds .media, .tile.third .media { aspect-ratio: auto; height: clamp(280px, 34vw, 480px); }
@media (max-width: 760px) {
  .tile .media, .tile.wide .media, .tile.two-thirds .media, .tile.third .media {
    aspect-ratio: 4 / 3; height: auto;
  }
}

.tile .media > img,
.tile .media > .ph {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .9s var(--ease);
}
.tile:hover .media > img,
.tile:hover .media > .ph,
.tile:focus-visible .media > img,
.tile:focus-visible .media > .ph { transform: scale(1.045); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.tile .caption {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; padding: 16px 0 4px;
}
.tile h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(24px, 2.4vw, 34px); line-height: 1.1; margin: 0;
}
.tile.wide h2 { font-size: clamp(28px, 3.2vw, 44px); }
.tile .meta {
  font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.tile .summary { color: var(--muted); margin: 4px 0 0; max-width: 58ch; font-size: 16px; }
.tile:hover h2 { color: var(--accent); }
.tile h2 { transition: color .25s; }

/* ---------- Placeholders (delete once real images are in) ---------- */
.ph {
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: clamp(16px, 2vw, 28px);
  background:
    linear-gradient(135deg, rgba(161,61,61,.12), transparent 55%),
    repeating-linear-gradient(45deg, #121212 0 14px, #161616 14px 28px);
  border: 1px dashed #333;
  color: var(--muted); font-size: 14px; line-height: 1.45;
}
.ph strong {
  display: block; color: var(--accent-text); font-weight: 500;
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px;
}
.ph span { max-width: 52ch; }

/* ---------- Page headings (galleries, about) ---------- */
.page-head { padding: clamp(48px, 8vw, 70px) 0 clamp(28px, 4vw, 48px); }
.page-head h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(40px, 6vw, 80px); line-height: 1.12; margin: 0;
}
.page-head p { color: var(--muted); max-width: 60ch; margin: 20px 0 0; font-size: 18px; }

/* ---------- Masonry gallery + lightbox ---------- */
.masonry {
  columns: 3 300px; column-gap: var(--gap);
  padding-bottom: clamp(64px, 10vw, 120px);
}
.masonry figure {
  break-inside: avoid; margin: 0 0 var(--gap);
  cursor: zoom-in; position: relative; overflow: hidden; background: var(--surface);
}
.masonry figure img { width: 100%; height: auto; transition: transform .9s var(--ease); }
.masonry figure:hover img { transform: scale(1.03); }
.masonry figure .ph { position: static; }
.masonry figcaption {
  font-size: 14px; color: var(--muted); padding: 10px 2px 4px;
}
.masonry figcaption b { color: var(--text); font-weight: 500; }

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.95);
  display: none; align-items: center; justify-content: center;
  padding: 56px var(--gutter);
}
.lightbox.open { display: flex; }
.lightbox .lb-inner { max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lightbox img { max-height: calc(100vh - 140px); width: auto; object-fit: contain; }
.lightbox .lb-ph { width: min(80vw, 900px); aspect-ratio: 3 / 2; }
.lightbox .lb-caption { color: var(--muted); font-size: 15px; text-align: center; }
.lightbox button {
  position: absolute; background: none; border: 0; color: var(--text);
  font: inherit; font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer; padding: 12px; opacity: .7; transition: opacity .2s, color .2s;
}
.lightbox button:hover { opacity: 1; color: var(--accent-text); }
.lb-close { top: 10px; right: calc(var(--gutter) - 12px); }
.lb-prev { left: calc(var(--gutter) - 12px); top: 50%; transform: translateY(-50%); font-size: 28px !important; }
.lb-next { right: calc(var(--gutter) - 12px); top: 50%; transform: translateY(-50%); font-size: 28px !important; }

/* ---------- Case study pages ---------- */
.back {
  display: inline-block; margin-top: 32px; font-size: 14px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); text-decoration: none;
}
.back:hover { color: var(--accent-text); }

.cs-head { padding: 28px 0 clamp(28px, 4vw, 48px); }
.cs-head h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(40px, 6vw, 84px); line-height: 1.12; margin: 0; max-width: 18ch;
}
.cs-head p.lede { color: var(--muted); font-size: clamp(18px, 1.6vw, 21px); max-width: 60ch; margin: 22px 0 0; }

.cs-hero { position: relative; aspect-ratio: 16 / 9; background: var(--surface); overflow: hidden; }
.cs-hero > img, .cs-hero > iframe, .cs-hero > video, .cs-hero > .ph {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0;
}

.cs-body {
  display: grid; grid-template-columns: minmax(0, 1fr) 280px;
  gap: clamp(32px, 6vw, 96px);
  padding: clamp(48px, 7vw, 88px) 0;
}
@media (max-width: 900px) { .cs-body { grid-template-columns: 1fr; } .cs-side { order: -1; } }

.cs-main section + section { margin-top: 56px; }
.cs-main h2 {
  font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-text); font-weight: 500; margin: 0 0 16px;
}
.cs-main p { margin: 0 0 1em; max-width: 64ch; }
.cs-main ul { margin: 0 0 1em; padding-left: 1.1em; max-width: 64ch; }
.cs-main li { margin-bottom: .45em; }
.cs-main li::marker { color: var(--accent); }
.note {
  background: var(--accent-dim); border-left: 2px solid var(--accent);
  padding: 14px 18px; color: var(--text); font-size: 15px; margin: 0 0 1.2em; max-width: 64ch;
}
.note b { color: var(--accent-text); font-weight: 500; }

.pull {
  font-family: var(--serif); font-size: clamp(26px, 2.6vw, 36px); line-height: 1.2;
  margin: 8px 0 0; max-width: 24ch;
}

.cs-side { position: relative; }
.cs-side dl { margin: 0; position: sticky; top: 100px; }
.cs-side dt {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  margin-top: 22px;
}
.cs-side dt:first-child { margin-top: 0; }
.cs-side dd { margin: 4px 0 0; font-size: 16px; }
.cs-side dd a { color: var(--accent-text); text-underline-offset: 3px; }

.cs-figures {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap);
  padding-bottom: clamp(48px, 7vw, 88px);
}
.cs-figures figure { margin: 0; }
.cs-figures .frame { position: relative; aspect-ratio: 4 / 3; background: var(--surface); overflow: hidden; }
.cs-figures .frame > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cs-figures figcaption { font-size: 14px; color: var(--muted); padding-top: 10px; }
@media (max-width: 680px) { .cs-figures { grid-template-columns: 1fr; } }

.next {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  border-top: 1px solid var(--line); padding: 28px 0 clamp(40px, 5vw, 64px);
  text-decoration: none;
}
.next span { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.next strong { font-family: var(--serif); font-weight: 400; font-size: clamp(20px, 1.9vw, 28px); transition: color .25s; }
.next:hover strong { color: var(--accent); }

/* ---------- About ---------- */
.about {
  display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: clamp(32px, 6vw, 96px);
  padding-bottom: clamp(64px, 10vw, 120px);
}
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }
.about .portrait { position: relative; aspect-ratio: 4 / 5; background: var(--surface); overflow: hidden; }
.about .portrait > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.about p { max-width: 62ch; margin: 0 0 1em; }
.about h2 {
  font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-text); font-weight: 500; margin: 40px 0 14px;
}
.about ul { list-style: none; padding: 0; margin: 0; columns: 2 220px; }
.about li { padding: 6px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 56px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; align-items: baseline; }
.site-footer .cta { font-family: var(--serif); font-size: clamp(26px, 3vw, 40px); margin: 0; }
.site-footer .cta a { text-decoration: none; }
.site-footer .cta a:hover { color: var(--accent); }
.site-footer .links { display: flex; gap: 24px; flex-wrap: wrap; }
.site-footer .links a {
  font-size: 14px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
}
.site-footer .links a:hover { color: var(--accent-text); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Text still to fill in — shows in amber so it's easy to spot. Remove the span when done. */
.fill { color: var(--accent-text); background: var(--accent-dim); padding: 0 4px; border-radius: 2px; }

@media (max-width: 760px) {
  .tile .caption { flex-direction: column-reverse; gap: 6px; }
}
.nw { white-space: nowrap; }

/* Front-page showreel: no controls, can't be clicked or paused */
.intro-media video { pointer-events: none; }
.intro-media video::-webkit-media-controls { display: none !important; }

/* Larger white dots between the tagline phrases */
.intro-tagline .sep {
  color: var(--text); font-size: 1.9em; line-height: 0;
  vertical-align: -0.12em; margin: 0 0.25em;
}
@media (max-width: 680px) {
  .intro-tagline .sep { display: none; }
  .intro-tagline .nw { display: block; }
}

/* Row-by-row masonry (set up by script.js; falls back to CSS columns without JS) */
.masonry.js-masonry { columns: auto; display: flex; gap: var(--gap); align-items: flex-start; }
.masonry-col { flex: 1 1 0; min-width: 0; }
.masonry-col figure:last-child { margin-bottom: 0; }
.masonry figure img { display: block; width: 100%; height: auto; }
.about .portrait > img { object-position: 50% 30%; }

/* Small credit label on an image (sits on top, doesn't zoom on hover) */
.tile .media > .credit, .cs-hero > .credit {
  position: absolute; left: 0; bottom: 0; z-index: 2;
  padding: 6px 12px; background: rgba(0, 0, 0, 0.62);
  color: rgba(236, 236, 234, 0.85); font-size: 12px; letter-spacing: 0.04em;
  pointer-events: none;
}

/* Category label sits above the title so longer titles get the full tile width */
.tile .caption { flex-direction: column-reverse; align-items: flex-start; gap: 6px; }

/* Before/after swipe comparison */
.compare { position: relative; overflow: hidden; background: var(--surface); user-select: none; touch-action: pan-y; --pos: 50%; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.compare-top { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }
.compare-line {
  position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px;
  background: var(--text); pointer-events: none; box-shadow: 0 0 6px rgba(0,0,0,.5);
}
.compare-line::after {
  content: "\2039\00a0\203A"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 38px; height: 38px; border-radius: 50%; background: var(--text); color: #000;
  display: flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1;
}
.compare-label {
  position: absolute; bottom: 10px; padding: 4px 10px; background: rgba(0,0,0,.62);
  color: var(--text); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; pointer-events: none;
}
.compare-label.left { left: 10px; } .compare-label.right { right: 10px; }
.compare input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize;
}
.compare:focus-within .compare-line { background: var(--accent-text); }
.next span { white-space: nowrap; }
.next strong { text-align: right; }
@media (max-width: 680px) {
  .next { flex-direction: column; align-items: flex-start; gap: 10px; }
  .next strong { text-align: left; font-size: 22px; }
}

/* Looping video tiles: no controls, crop keeps the bottom-right in view */
.tile .media > video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: right bottom;
  pointer-events: none; transition: transform .9s var(--ease);
}
.tile .media > video::-webkit-media-controls { display: none !important; }
.tile:hover .media > video, .tile:focus-visible .media > video { transform: scale(1.045); transform-origin: right bottom; }
.cs-figures a.frame { display: block; cursor: zoom-in; }
.cs-figures a.frame img { transition: transform .9s var(--ease); }
.cs-figures a.frame:hover img { transform: scale(1.03); }

/* Video project pages: details beside the summary, videos in two columns */
.cs-head-split {
  display: grid; grid-template-columns: minmax(0, 1fr) 280px;
  gap: clamp(32px, 6vw, 96px); align-items: end;
}
.cs-head-split .cs-side dl { position: static; }
@media (max-width: 900px) { .cs-head-split { grid-template-columns: 1fr; } }
.video-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap); padding-bottom: clamp(48px, 7vw, 88px);
}
@media (max-width: 680px) { .video-grid { grid-template-columns: 1fr; } }
.video-embed { position: relative; aspect-ratio: 16 / 9; background: var(--surface); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 900px) { .cs-head-split .cs-side { order: 0; } }
/* Tutorials collage keeps its full shape on phones so all six scenes show */
@media (max-width: 760px) {
  .tile .media:has(> img[src*="usd/thumbnail-tall"]), .tile .media:has(> img[src*="webinars/thumbnail"]) { aspect-ratio: 800 / 980; }
}
.tile .media > .credit.credit-right, .cs-hero > .credit.credit-right { left: auto; right: 0; }

/* Playlist link card (used where a video can't be embedded) */
a.playlist-link { display: block; overflow: hidden; text-decoration: none; }
a.playlist-link img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease), filter .3s; filter: brightness(.7); }
a.playlist-link:hover img { transform: scale(1.03); filter: brightness(.55); }
.playlist-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  background: rgba(0,0,0,.72); color: var(--text); font-size: 14px; letter-spacing: .04em; white-space: nowrap;
}
.playlist-badge .play { width: 0; height: 0; border-style: solid; border-width: 8px 0 8px 13px; border-color: transparent transparent transparent var(--accent-text); }
a.playlist-link:hover .playlist-badge { color: var(--accent-text); }
@media (max-width: 420px) { .playlist-badge { font-size: 12px; padding: 10px 14px; } }

/* Three videos in a row (the wrapper sits inside .cs-figures) */
.cs-figures:has(> .video-grid-3) { display: block; }
.video-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-bottom: 0; }
@media (max-width: 900px) { .video-grid-3 { grid-template-columns: 1fr; } }
a.playlist-link .playlist-badge { padding: 14px 16px 14px 20px; border-radius: 50%; }
a.playlist-link > .credit {
  position: absolute; left: 0; bottom: 0; z-index: 2; padding: 6px 12px;
  background: rgba(0,0,0,.62); color: rgba(236,236,234,.85); font-size: 12px; letter-spacing: .04em;
}
/* Hero images with transparent areas sit straight on the page background */
.cs-hero:has(> img.hero-transparent) { background: transparent; }

/* Looping motion graphics above the YouTube videos */
.loop-grid { padding-bottom: var(--gap); }
.loop-fig { margin: 0; }
.loop-fig video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.loop-fig video::-webkit-media-controls { display: none !important; }
.loop-fig figcaption { font-size: 14px; color: var(--muted); padding-top: 10px; }

/* Footer now holds just the LinkedIn link */
.site-footer { padding: 28px 0 36px; }

/* LinkedIn link under the About portrait */
.about-side { align-self: start; }
.about-link {
  display: inline-block; margin-top: 16px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-text); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .2s;
}
.about-link:hover { border-color: var(--accent-text); }
.about-side ul { columns: 2; column-gap: 24px; }

/* Looping video in a figure slot */
.cs-figures .frame-video > video { pointer-events: none; }
.cs-figures .frame-video > video::-webkit-media-controls { display: none !important; }
.cs-figures .frame-video > .credit {
  position: absolute; inset: auto auto 0 0; width: auto; height: auto; z-index: 2; padding: 6px 12px;
  background: rgba(0,0,0,.62); color: rgba(236,236,234,.85); font-size: 12px; letter-spacing: .04em;
}
