:root {
  --bg: #f7f8fa;
  --text: #0b1220;
  color-scheme: light;
  --accent: #d20a2e;
  --gap: 16px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* ---------- Themes: dark simply swaps background and text ---------- */
html[data-theme="dark"] { --bg: #0b1220; --text: #f7f8fa; --accent: #ff5a6e; --plate: #161d2b; color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] { --bg: #0b1220; --text: #f7f8fa; --accent: #ff5a6e; --plate: #161d2b; color-scheme: dark; }
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 300;
  font-size: 14px;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
}

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

/* Page: nav row (1 part) above work grid (4 parts), filling the viewport */
.page {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 4fr);
  gap: var(--gap);
  padding: var(--gap);
  min-height: 100vh;
  min-height: 100dvh;
}

.nav {
  position: relative;
  display: flex;
  align-self: start;
}

/* Theme switch, top right corner */
.theme {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 16px;
}
.cs .theme { top: 16px; right: 16px; }
.theme button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 200ms ease;
}
.theme button:hover { opacity: 0.75; }
.theme button[aria-pressed="true"] { opacity: 1; }
.nav__item { display: block; flex: 1 1 0; min-width: 0; line-height: 1; }

/* Work grid: feature tile (2 parts) + side column (1 part) */
.work {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--gap);
}
.work__side {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.work__pair {
  display: flex;
  flex: 1 0 0;
  gap: var(--gap);
}
.work__pair .tile { flex: 1 0 0; min-width: 0; }

.tile {
  display: flex;
  flex: 1 0 0;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.tile__label { align-self: flex-start; white-space: nowrap; }

/* Hover: the whole card (label + image) lifts 8px, softly */
.tile {
  transition: transform 700ms cubic-bezier(0.33, 1, 0.68, 1);
  will-change: transform;
}
.tile:hover,
.tile:focus-visible { transform: translateY(-8px); }
@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
  .tile:hover, .tile:focus-visible { transform: none; }
}
@media (hover: none) {
  .tile:hover { transform: none; }
}

.tile__media {
  position: relative;
  flex: 1 0 0;
  min-height: 0;
  /* --tile-fill: an image's own background colour, kept in both themes so the image fills its card */
  background: var(--tile-fill, var(--tile-bg, #d9d9d9));
  overflow: hidden;
}
.tile__media img,
.tile__media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.tile__media .cover { object-fit: cover; }
.tile__media .cover--right { object-position: right center; }
.tile__media .contain { object-fit: contain; }

/* Crop the video's edges slightly (hides outlines at the frame border) */
.tile__media video,
.cs__hero video { transform: scale(1.02); }

/* ---------- Case study page (Figma 479:450, 1920 frame) ---------- */
.cs { display: flex; flex-direction: column; gap: 100px; padding: var(--gap); }
.cs .nav {
  align-self: stretch;
  /* Sticky header: stays visible while scrolling. Same position as Figma at the top. */
  position: sticky;
  top: 0;
  z-index: 10;
  margin: -16px -16px -16px;
  padding: 16px;
}
.cs__body { display: flex; flex-direction: column; gap: 100px; }
.cs p, .cs h1, .cs h2, .cs figcaption { font-weight: 300; line-height: 1; }
.cs .cs__lines p, .cs .cs__learn p, .cs .cta, .cs .contact__value { line-height: 1.45; }
.cs .cs__big, .cs .about__title, .cs .contact__title { line-height: 1.05; }

.cs__intro { display: flex; flex-direction: column; gap: 32px; }
.cs__heading { display: flex; flex-direction: column; gap: 16px; }
.cs .cs__title, .cs .cs__big { font-size: 64px; font-weight: 400; }
.cs__subtitle { font-size: 14px; }
.cs__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 8px 0 0;
  list-style: none;
  line-height: 1;
  white-space: nowrap;
}
.cs__hero { position: relative; aspect-ratio: 1920 / 1080; background: #d9d9d9; overflow: hidden; }
.cs__fill { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }

/* Role + challenge: 1fr 1fr 3fr, first column empty */
.cs__facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 3fr);
  gap: 40px var(--gap);
  align-items: start;
  min-height: 226px;
  padding: 50px 0;
}
.cs__col { display: flex; flex-direction: column; gap: 16px; }
.cs__col--2 { grid-column: 2; }
.cs__col--3 { grid-column: 3; }
.cs__label { font-size: 14px; text-transform: uppercase; }
.cs__lines { display: flex; flex-direction: column; gap: 12px; font-size: 14px; }

/* Big statements: 1fr 3fr 1fr, text in the middle column */
.cs__statement {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr) minmax(0, 1fr);
  gap: 10px;
  padding: 50px 0;
}
.cs__statement > * { grid-column: 2; }
.cs__statement--hmw { padding-bottom: 150px; }
.cs__statement--top { gap: var(--gap); padding-bottom: 0; }

/* Numbered shots: centered label, image 1440 of 1888 */
.cs__shot { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.cs__frame { position: relative; overflow: hidden; width: 76.2712%; }
/* 1 + 2: two equal columns, 100px apart */
.cs__duo { display: flex; gap: 100px; align-items: flex-start; }
.cs__duo .cs__shot { flex: 1 0 0; min-width: 0; }
.cs__duo .sheet, .cs__shot > .sheet { width: 100%; }
.sheet > .cs__frame { width: 100%; }
.cs__frame--before { aspect-ratio: 1351 / 700; }
.cs__frame--room { aspect-ratio: 1514 / 909; }


/* 3: grid 1fr 2fr 2fr 1fr */
.cs__trio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--gap);
}
.cs__trio-label { grid-column: 2 / span 2; }
.cs__trio-media { display: contents; }
.cs__trio .sheet { align-self: start; }
.sheet--designer { grid-column: 2; }
.cs__frame--designer { aspect-ratio: 1536 / 2048; }
.sheet--inventory { grid-column: 3; }
.cs__frame--inventory { aspect-ratio: 1248 / 803.6; }

/* Learnings: 1fr 4fr, each row 1fr 3fr */
.cs__learn-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 4fr);
  gap: var(--gap);
  min-height: 226px;
  padding: 50px 0;
}
.cs__learn-list { grid-column: 2; display: flex; flex-direction: column; gap: 24px; }
.cs__learn {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  gap: var(--gap);
  font-size: 14px;
}
.cs__learn p:first-child { white-space: nowrap; }

/* 5: demo, full width */
.cs__frame--demo {
  width: 100%;
  aspect-ratio: 1800 / 1007;
  padding: 0;
  border: 0;
  background: #1e2235;
  cursor: pointer;
}
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Scroll reveal on case page images ----------
   Each image opens from its top edge downward as it enters the view.
   Only runs when JavaScript is on (html.js), so images never stay hidden. */
.js .reveal {
  clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
  transition: clip-path 1000ms cubic-bezier(0.33, 1, 0.68, 1);
}
.js .reveal.is-in { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { clip-path: none; transition: none; }
}

/* ---------- Page transition: card -> case page ----------
   The small label morphs into the big title, the video tile grows into the hero.
   Uses cross-document View Transitions (Chrome, Edge, Safari 18.2+).
   Other browsers just open the page normally. */
@view-transition { navigation: auto; }

/* Each project pairs its own tile with its own page (names set in the HTML),
   so every title and hero grows from where that project sits on the landing page. */
.cs__title { width: fit-content; }

::view-transition-group(*) {
  animation-duration: 700ms;
  animation-timing-function: cubic-bezier(0.33, 1, 0.68, 1);
}
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 450ms; }

/* The whole-page crossfade never stretches. On iPhone, Safari's toolbar can
   differ between the two pages, and the snapshot was stretched to the changing
   size, so titles jumped when the real page appeared. Pin each snapshot to the
   top at its real size instead. */
::view-transition-old(root),
::view-transition-new(root) {
  width: 100%;
  height: 100%;
  object-fit: none;
  object-position: top left;
}

/* Text: both snapshots stretch to the moving box, so the label scales up as one piece */
::view-transition-old(.vt-title),
::view-transition-new(.vt-title) {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

/* Video: keep it filling its frame while the frame changes shape */
::view-transition-old(.vt-media),
::view-transition-new(.vt-media) {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

/* Tablet and mobile: stack the tiles */
@media (max-width: 800px) {
  .page { grid-template-rows: auto auto; align-content: start; gap: 64px; }
  .nav { gap: var(--gap); }
  .nav { justify-content: space-between; }
  .nav__item { flex: none; white-space: nowrap; }
  .nav { flex-wrap: wrap; row-gap: 14px; }
  .theme, .cs .theme { position: static; width: 100%; }
  .work { grid-template-columns: 1fr; gap: 32px; }
  .work__side, .work__pair { gap: 32px; }
  .tile, .work__pair { flex: none; }
  .tile__media { flex: none; aspect-ratio: 4 / 3; }


  /* Case study: not in Figma (desktop only), stacked fallback */
  .cs, .cs__body { gap: 64px; }
  .cs .cs__title, .cs .cs__big { font-size: 40px; line-height: 1.05; }
  .cs__lines, .cs__learn { line-height: 1.3; }
  .cs__duo { flex-direction: column; gap: 64px; }
  .cs__duo .cs__shot { flex: none; width: 100%; }
  .cs__statement--hmw { padding-bottom: 0; }
  .cs__summary, .cs__learnings { display: flex; flex-direction: column; gap: 40px; }
  .cs__facts, .cs__statement, .cs__trio, .cs__learn-grid, .cs__learn { grid-template-columns: 1fr; }
  .cs__facts { height: auto; gap: 40px; padding: 0; }
  .cs__statement { padding: 0; }
  .cs__col--2, .cs__col--3, .cs__statement > *, .cs__trio-label,
  .sheet--designer, .sheet--inventory, .cs__learn-list { grid-column: 1; }
  .cs__frame { width: 100%; }
  .cs__learn { gap: 8px; }
  .cs__learn p:first-child { white-space: normal; font-weight: 400; }
  .cs__learn-grid { padding: 0; min-height: 0; }
}

@media (max-width: 480px) {
  .work__pair { flex-direction: column; }
  .work__pair .tile { flex: none; }
  .tile__label { white-space: normal; }
}


/* =========================================================
   Drawing set: the site as a set of architectural drawings
   ========================================================= */
:root {
  --grid-line: color-mix(in srgb, var(--text) 7%, transparent);
  --mark: color-mix(in srgb, var(--text) 45%, transparent);
}

/* 1. Drafting grid: the layout's own columns, shown as hairlines behind everything */
.is-landing::before,
.is-case::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  --l: linear-gradient(var(--grid-line), var(--grid-line));
  background-repeat: no-repeat;
  background-size: 1px 100%;
}
/* Landing: 2fr | 1fr, right column split in two; lines sit in the gutters */
.is-landing::before {
  background-image: var(--l), var(--l), var(--l), var(--l);
  background-position:
    15.5px 0,
    calc(24px + (100% - 48px) * 2 / 3) 0,
    calc(32px + (100% - 48px) * 2 / 3 + ((100% - 48px) / 3 - 16px) / 2 + 8px) 0,
    calc(100% - 16.5px) 0;
}
/* Case page: 1fr | 1fr | 3fr */
.is-case::before {
  background-image: var(--l), var(--l), var(--l), var(--l);
  background-position:
    15.5px 0,
    calc(24px + (100% - 64px) / 5) 0,
    calc(40px + (100% - 64px) * 2 / 5) 0,
    calc(100% - 16.5px) 0;
}

.sheet { position: relative; }

@media (max-width: 800px) {
  .is-landing::before, .is-case::before { display: none; }
}

/* Image captions: number + label, quiet and technical */
.caption { display: inline-flex; gap: 12px; line-height: 1; }
.caption__no { opacity: 0.5; }


/* Film grain over the whole page, like a shader: a fixed layer of neutral
   per-pixel noise blended on top of everything (text, images, video).
   It never takes clicks, and stays still while the page scrolls. */
html { position: relative; min-height: 100%; }
html::after {
  /* Covers the whole page and scrolls with it (not pinned to the screen), so
     when a phone bounces past the top or bottom, the revealed edge is plain
     background, not un-blended grain. */
  content: ""; position: absolute; inset: 0; z-index: 2000; pointer-events: none;
  background: url("assets/grain-overlay.png") 0 0 / 128px 128px;
  mix-blend-mode: overlay; opacity: 0.14;
}
html[data-theme="dark"]::after { opacity: 0.2; }
@media (prefers-color-scheme: dark) { html[data-theme="system"]::after { opacity: 0.2; } }

/* (Previous background-only grain, now replaced by the layer above.)
   Fine grain: a barely-there texture on the page background only
   (images and text stay crisp). Independent per-pixel noise, 256px tiles
   drawn at 128px, so each grain is a single device pixel on retina. */
body { background-image: none; }

/* Tags roll out from under the title on arrival, one after another.
   The row clips them, so they appear to slide out of the title's baseline. */
.cs__tags {
  overflow: hidden;
  padding-bottom: 4px;
  margin-bottom: -4px;
}
.cs__tags li {
  animation: tag-roll-out 700ms cubic-bezier(0.33, 1, 0.68, 1) both;
  animation-delay: calc(380ms + var(--i, 0) * 70ms);
}
.cs__tags li:nth-child(2) { --i: 1; }
.cs__tags li:nth-child(3) { --i: 2; }
.cs__tags li:nth-child(4) { --i: 3; }
.cs__tags li:nth-child(5) { --i: 4; }
@keyframes tag-roll-out {
  from { opacity: 0; transform: translateY(-120%); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .cs__tags li { animation: none; }
}


/* ---------- Micro-motion: the same calm roll-out, everywhere it helps ----------
   Small (8px), soft, ordered, once only. Nothing loops, nothing parallaxes. */
@keyframes roll-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Scroll-triggered groups: children appear one after another */
.js [data-roll] > *,
.js [data-roll]:not(:has(> *)) { opacity: 0; }
.js [data-roll].is-in > *,
.js [data-roll].is-in:not(:has(> *)) {
  animation: roll-in 700ms cubic-bezier(0.33, 1, 0.68, 1) both;
  animation-delay: calc(var(--roll-delay, 0ms) + var(--i, 0) * 70ms);
}

/* Landing: project labels roll out in reading order on load */
.is-landing .tile__label {
  animation: roll-in 700ms cubic-bezier(0.33, 1, 0.68, 1) both;
  animation-delay: 250ms;
}
.is-landing .work__side .tile:first-child .tile__label { animation-delay: 320ms; }
.is-landing .work__pair .tile:first-child .tile__label { animation-delay: 390ms; }
.is-landing .work__pair .tile:last-child .tile__label { animation-delay: 460ms; }

/* Drafting grid draws itself down the sheet once per page */
.is-landing::before,
.is-case::before { animation: grid-draw 1400ms cubic-bezier(0.65, 0, 0.35, 1) 100ms both; }
@keyframes grid-draw {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
  .js [data-roll] > *, .js [data-roll]:not(:has(> *)) { opacity: 1; }
  .js [data-roll].is-in > *, .js [data-roll].is-in:not(:has(> *)),
  .is-landing .tile__label, .is-landing::before, .is-case::before { animation: none; }
}

/* Placeholder hero for case pages without media yet */
.cs__hero:empty { background: color-mix(in srgb, var(--text) 8%, transparent); }

/* Opening a project: the other cards and labels step back first,
   so only the chosen card travels into its page. */
.is-landing .tile,
.is-landing .nav { transition: opacity 320ms ease, transform 700ms cubic-bezier(0.33, 1, 0.68, 1); }
.is-leaving .tile:not(.is-chosen) { opacity: 0; transform: scale(0.98); }
.is-leaving .tile.is-chosen { transform: none; }
/* the old page's leftovers vanish quickly instead of ghosting */
::view-transition-old(root) { animation-duration: 180ms; }

/* About page */
.about__title { max-width: 18ch; line-height: 1.05; }
.about__photos {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--gap);
}
.about__photo { aspect-ratio: 4 / 5; background: color-mix(in srgb, var(--text) 8%, transparent); }
.about__facts { grid-template-columns: repeat(3, minmax(0, 1fr)); height: auto; }
.about__facts .cs__col--3 { grid-column: auto; }
.about__facts .cs__lines p { max-width: 34ch; line-height: 1.4; }
.is-about .cs__learn p:first-child { white-space: normal; }
@media (max-width: 800px) {
  .about__photos { grid-template-columns: 1fr 1fr; }
  .about__photos .about__photo:first-child { grid-column: 1 / -1; }
  .about__facts { grid-template-columns: 1fr; }
}

/* Contact page */
.contact__title { max-width: 16ch; line-height: 1.05; }
.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 3fr);
  gap: var(--gap);
  align-items: start;
}
.contact__info { grid-column: 1 / span 2; display: flex; flex-direction: column; gap: 32px; }
.contact__info .cs__label { margin-bottom: 12px; }
.contact__value { font-size: 14px; }
.contact__value a, .cs__body a { text-decoration: none; }
.contact__value a:hover, .cs__body a:hover { color: var(--accent); }
.contact__form { grid-column: 3; display: flex; flex-direction: column; gap: 28px; max-width: 720px; }
.field { display: flex; flex-direction: column; gap: 12px; }
.field input, .field textarea {
  width: 100%;
  padding: 0 0 10px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
  border-radius: 0;
  background: none;
  color: var(--text);
  font: 300 24px/1.3 var(--font);
  resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--text); }
.field.is-invalid input, .field.is-invalid textarea { border-bottom-color: var(--accent); }
.contact__actions { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.button {
  padding: 14px 24px;
  border: 1px solid var(--text);
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font: 400 14px/1 var(--font);
  cursor: pointer;
  transition: transform 700ms cubic-bezier(0.33, 1, 0.68, 1), opacity 200ms ease;
}
.button:hover { transform: translateY(-2px); }
.contact__hint { font-size: 14px; opacity: 0.6; }
@media (max-width: 800px) {
  .contact { grid-template-columns: 1fr; gap: 56px; }
  .contact__info, .contact__form { grid-column: 1; }
  .field input, .field textarea { font-size: 20px; }
}

/* Landing intro: one positioning line in the band above the projects */
.is-landing .page { grid-template-rows: auto minmax(0, 1fr) minmax(0, 4fr); }
.is-landing .page > .nav { grid-row: 1; }
.intro {
  grid-row: 2;
  align-self: end;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 44ch;
  margin-bottom: 16px;
  font-size: 24px;
  line-height: 1.2;
}
.intro__lead { color: color-mix(in srgb, var(--text) 55%, transparent); }
.is-landing .work { grid-row: 3; }
@media (max-width: 800px) {
  .is-landing .page { grid-template-rows: auto auto auto; }
  .intro { font-size: 20px; }
}

/* Closing invitation on case pages */
.cta { grid-column: 2; font-size: 24px; line-height: 1.3; max-width: 34ch; }
.cta a { display: inline-block; margin-top: 8px; }
@media (max-width: 800px) { .cta { font-size: 20px; } }

/* Dark mode: light image plates become dark, so screenshots don't glow */
html[data-theme="dark"] [style*="--tile-bg"] { --tile-bg: var(--plate) !important; }
html[data-theme="dark"] .cs__hero[style*="background"] { background: var(--plate) !important; }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] [style*="--tile-bg"] { --tile-bg: var(--plate) !important; }
  html[data-theme="system"] .cs__hero[style*="background"] { background: var(--plate) !important; }
}

/* Page transition: the small label snapshot leaves quickly, so the title never looks stretched */
::view-transition-old(.vt-title) { animation-duration: 150ms; }

/* Statements and page headlines rise in line by line from a mask */
.js .rise .line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.js .rise .line > span { display: inline-block; transform: translateY(105%); }
.js .rise.is-in .line > span {
  transform: none;
  transition: transform 800ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--l, 0) * 70ms);
}
@media (prefers-reduced-motion: reduce) { .js .rise .line > span { transform: none; } }

/* Next project link at the end of case pages */
.next {
  display: block;
  padding-top: 32px;
}
.next .cs__label { display: block; margin-bottom: 16px; opacity: 0.6; }
.next__title { font-size: 64px; font-weight: 400; line-height: 1.05; transition: color 250ms ease; }
.next:hover .next__title { color: var(--accent); }
@media (max-width: 800px) { .next__title { font-size: 40px; } }

/* ---------- Loader ---------- */
/* Covers the page from the first paint until the loader's canvas takes over.
   Falls away on its own after 4s, so the page can never stay hidden. */
html.boot body::after { content: ""; position: fixed; inset: 0; z-index: 1000; background: var(--bg); animation: boot-fallback 0s 4s forwards; }
@keyframes boot-fallback { to { visibility: hidden; } }

/* ---------- Employer mark, Advisor and Control Hub links ---------- */
.org { white-space: nowrap; }
.org__mark { height: 0.62em; width: auto; margin: 0 0.28em 0 0.12em; vertical-align: 0.02em; }
.intro span:first-child .org { color: var(--text); }
.tile__kicker { margin-left: 10px; color: color-mix(in srgb, var(--text) 50%, transparent); }
.cs__kicker { margin-top: 14px; font-size: 14px; font-weight: 300; color: color-mix(in srgb, var(--text) 60%, transparent); }
.cs__kicker a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.cs__chapter { display: flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; }
.cs .cs__body a.cs__chapter, .cs .cs__body a.cs__chapter:hover { text-decoration: none; }
.cs__chapter .cs__big { transition: opacity 300ms ease; }
.cs__chapter:hover .cs__big { opacity: 0.6; }

.cs__frame--ui { aspect-ratio: 3 / 2; background: #f4f4f5; }
.cs__credit { text-align: center; font-size: 14px; font-weight: 300; color: color-mix(in srgb, var(--text) 55%, transparent); margin-top: -40px; }
.cs__shot--wide > .sheet { width: 62%; }
@media (max-width: 860px) { .cs__shot--wide > .sheet { width: 100%; } }

.cs__statement .cs__label + .cs__big { margin-top: 12px; }
.yt::after { content: ""; position: absolute; left: 50%; top: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; border-radius: 50%;
  background: rgba(11,18,32,0.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 7l8 5-8 5z' fill='%23fff'/%3E%3C/svg%3E") center / 30px no-repeat;
  backdrop-filter: blur(4px); transition: transform 400ms cubic-bezier(0.33,1,0.68,1); pointer-events: none; }
.yt:hover::after { transform: scale(1.08); }
.yt.is-playing::after, .yt:has(iframe)::after { display: none; }

/* The two narrow Volue cards: the year sits under the name */
.work__pair .tile__label { white-space: normal; }
.work__pair .tile__kicker { display: block; margin-left: 0; margin-top: 2px; }

/* On-screen elements during the loader: already in their final place (the loader is their entrance) */
.js .boot-static, .js .boot-static > *, .js .boot-static li, .js .boot-static .line > span {
  animation: none !important; opacity: 1 !important; transform: none !important; clip-path: none !important;
}
/* The landing intro line stays on one line on wide screens */
@media (min-width: 1000px) { .intro { max-width: none; } }

/* Company and years sit at the end of the tag row, quieter */
.cs__tags .cs__meta { color: color-mix(in srgb, var(--text) 55%, transparent); }
.cs__tags .cs__meta a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* Dotted notepad grid (default). Old column lines remain via ?grid=lines for comparison. */
html:not([data-grid="lines"]) .is-landing::before,
html:not([data-grid="lines"]) .is-case::before {
  --dot: color-mix(in srgb, var(--text) 20%, transparent);
  background-image: radial-gradient(circle at center, var(--dot) 0 0.9px, transparent 1.25px);
  background-size: 28px 28px;
  background-position: 2px 2px;
  background-repeat: repeat;
}
@media (max-width: 800px) {
  html:not([data-grid="lines"]) .is-landing::before,
  html:not([data-grid="lines"]) .is-case::before { display: block; }
}

/* Theme toggle: one small half-filled circle, top right; it turns over on switch */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; margin: -6px -6px 0 0; padding: 0;
  border: 0; background: none; color: inherit; cursor: pointer; border-radius: 50%;
}
.theme-toggle svg { display: block; transition: transform 600ms cubic-bezier(0.33, 1, 0.68, 1); }
.theme-toggle.is-dark svg { transform: rotate(180deg); }
.theme-toggle:hover svg { opacity: 0.7; }
.theme-toggle:focus-visible { outline: 1px solid currentColor; outline-offset: 2px; }
@media (max-width: 800px) {
  .theme.theme-toggle, .cs .theme.theme-toggle { position: static; flex: none; width: 28px; height: 16px; margin: 0 -6px 0 0; }
}

/* Tools I played with: a quiet panel of cards */
.tools { grid-column: 2; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent); border-radius: 16px; overflow: hidden;
  background: color-mix(in srgb, var(--text) 2%, var(--bg)); }
.tool { display: flex; gap: 16px; align-items: flex-start; padding: 24px; }
.tool:nth-child(odd) { border-right: 1px solid color-mix(in srgb, var(--text) 10%, transparent); }
.tool:nth-child(n+3) { border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent); }
.tool__icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent); background: var(--bg);
  font: 500 12px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.02em; }
.tool__name { font-size: 16px; font-weight: 400; line-height: 1.3; }
.tool__text { margin-top: 6px; font-size: 14px; font-weight: 300; line-height: 1.45; color: color-mix(in srgb, var(--text) 60%, transparent); }
@media (max-width: 800px) {
  .tools { grid-column: 1; grid-template-columns: 1fr; }
  .tool:nth-child(odd) { border-right: 0; }
  .tool + .tool { border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent); }
}

/* Softer grid dots, fading out toward the bottom of the screen */
html:not([data-grid="lines"]) .is-landing::before,
html:not([data-grid="lines"]) .is-case::before {
  --dot: color-mix(in srgb, var(--text) 11%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 50%, transparent 100%);
}
/* The loader already builds the grid from dots: don't replay its draw-in */
/* Theme switch: a soft crossfade of the whole page */
html.theme-fading::view-transition-group(*),
html.theme-fading::view-transition-old(*), html.theme-fading::view-transition-new(*) {
  animation-duration: 500ms; animation-timing-function: cubic-bezier(0.33, 1, 0.68, 1); }
/* Fallback for browsers without view transitions */
body, .tile__media, .cs__hero, .cs__frame { transition: background-color 400ms ease, color 400ms ease; }
/* Same color behind the page, so pull-to-refresh and bounce show no lighter edge */
html { background-color: var(--bg); transition: background-color 400ms ease; }

/* Case text written as short paragraphs, not stacked lines */
.cs .cs__para { max-width: 52ch; font-size: 15px; line-height: 1.55; text-wrap: pretty; }
@media (max-width: 800px) { .cs .cs__para { font-size: 15px; line-height: 1.5; } }

/* Big lines: even line lengths, no single word left on its own line */
.cs .cs__big { text-wrap: balance; }
/* The question gets the full width to the right, so it sits on two lines on a laptop */
@media (min-width: 801px) { .cs__statement--hmw > * { grid-column: 2 / 4; } }
@media (min-width: 801px) { .cs .cs__statement--hmw .cs__big { font-size: min(64px, 3.6vw); } }
.cs .cs__lines p { text-wrap: balance; }
.cs .cs__lines .cs__para { text-wrap: pretty; }

/* ---------- Loader: the page is drafted, then appears ----------
   osifont by hikikomori82 (ISO 3098 CAD lettering), LGPL 3 with font exception. */
@font-face { font-family: "Drafting"; src: url("assets/osifont.woff") format("woff"); font-display: block; }
/* Until the drafting starts, the page's own entrance motion waits */
html.booting body *, html.booting body::before { animation-play-state: paused !important; }
/* The drafting pass: outlines, dimension lines and lettering guidelines over the page */
.draft { position: fixed; inset: 0; z-index: 1002; pointer-events: none; color: var(--text); overflow: visible; }
.draft path { fill: none; stroke: currentColor; stroke-width: 1; stroke-dasharray: 1; stroke-dashoffset: 1; }
.draft__line { opacity: 0.55; }
.draft__dim { opacity: 0.45; }
.draft__guide { opacity: 0.35; }
.draft__num { font-family: "Drafting", ui-monospace, monospace; font-size: 10px; letter-spacing: 0.08em;
  fill: currentColor; opacity: 0.6; text-anchor: middle; }
/* Drafted elements are already in their final place: the drafting is their entrance */
.js .drafted, .js .drafted > :not(img, video), .js .drafted li, .js .drafted .line > span { animation: none !important; transform: none !important; clip-path: none !important; }
.js .drafted > :is(img, video) { animation: none !important; clip-path: none !important; }
.js .drafted > *, .js .drafted li, .js .drafted .line > span { opacity: 1 !important; }
.js .drafted { opacity: 1; }

/* No background grid: a plain page with the grain on top (the old column lines remain via ?grid=lines) */
html:not([data-grid="lines"]) .is-landing::before,
html:not([data-grid="lines"]) .is-case::before { display: none; }

/* Hover: a thin drafting guideline draws under the text (the same line as in the loader).
   It draws in from the left on hover and slides out to the right when you leave. */
.hl, .tile__label, .next__title, .contact__value a, .cs__body a:not(.cs__chapter, .next) {
  --hl: color-mix(in srgb, currentColor 45%, transparent);
  background-image: linear-gradient(var(--hl), var(--hl));
  background-repeat: no-repeat; background-position: 100% 100%; background-size: 0% 1px;
  padding: 0 4px 3px; margin: 0 -4px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-size 450ms cubic-bezier(0.65, 0, 0.35, 1);
}
a:hover .hl, a:focus-visible .hl, .tile:hover .tile__label, .tile:focus-visible .tile__label,
.next:hover .next__title, .next:focus-visible .next__title,
.contact__value a:hover, .contact__value a:focus-visible, .cs__body a:not(.cs__chapter, .next):hover, .cs__body a:not(.cs__chapter, .next):focus-visible {
  background-position: 0 100%; background-size: 100% 1px;
}
/* Links inside text keep a faint line at rest, so they still read as links */
.contact__value a, .cs__body a:not(.cs__chapter, .next) {
  background-image: linear-gradient(var(--hl), var(--hl)), linear-gradient(color-mix(in srgb, currentColor 22%, transparent), color-mix(in srgb, currentColor 22%, transparent));
  background-size: 0% 1px, 100% 1px; background-position: 100% 100%, 0 100%;
}
.contact__value a:hover, .contact__value a:focus-visible, .cs__body a:not(.cs__chapter, .next):hover, .cs__body a:not(.cs__chapter, .next):focus-visible {
  background-size: 100% 1px, 100% 1px; background-position: 0 100%, 0 100%;
}
.contact__value a:hover, .cs__body a:hover { color: inherit; }
.next:hover .next__title { color: inherit; }
.cs__lines.cta > a { align-self: flex-start; }
.next__title { display: inline-block; }
/* Hover and click only on the words themselves, not the empty space around them */
.nav__item, .next { pointer-events: none; }
.nav__item .hl, .next .cs__label, .next__title { pointer-events: auto; }

/* Credit on a piece of media made by someone else, in the corner like a video attribution */
.media-credit { position: absolute; right: 16px; bottom: 16px; z-index: 1; margin: 0; padding: 6px 10px;
  font-size: 12px; line-height: 1.2; color: #fff; background: rgba(11, 18, 32, 0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border-radius: 999px; pointer-events: none; }
@media (max-width: 700px) { .media-credit { right: 8px; bottom: 8px; font-size: 11px; padding: 4px 8px; } }

/* External links: a small up-right arrow after the text */
.cta a .ext { display: inline-block; width: 0.7em; height: 0.7em; margin-left: 0.15em; vertical-align: 0.05em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Screenshots with their own flat background (the Volue projects): the card and the page hero
   share that colour in both themes, and the image keeps its proportions while it grows,
   so the card turns into the hero as one piece instead of two images fading over each other. */
.cs__hero[style*="--hero-fill"] { background: var(--hero-fill); }
::view-transition-new(volue-gemini-media), ::view-transition-new(volue-wave-media) { object-fit: contain; }
::view-transition-new(volue-gemini-media) { background: #e9edf2; }
::view-transition-new(volue-wave-media) { background: #ebf1f6; }
/* Cards that don't continue onto the new page (the other projects) fade out quickly */
::view-transition-old(*):only-child { animation-duration: 200ms; }
::view-transition-image-pair(volue-gemini-media), ::view-transition-image-pair(volue-wave-media) { overflow: hidden; }

/* More air around role, challenge and the "How might we" question (all case pages) */
@media (min-width: 801px) {
  .cs__facts:has(+ .cs__statement--hmw) { padding: 110px 0 70px; }
  .cs__statement--hmw { padding-top: 100px; padding-bottom: 210px; }
}
@media (max-width: 800px) {
  .cs__summary:has(.cs__statement--hmw) { gap: 64px; padding: 24px 0 32px; }
}

/* ---------- About ---------- */
.about__hero { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--gap); align-items: end; padding-top: 24px; }
.about__photo { position: relative; aspect-ratio: 1 / 1; background: none; max-width: 460px; color: var(--text); }
.about__photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.about__intro { display: flex; flex-direction: column; gap: 32px; padding-bottom: 8px; }
.cs .about__title { max-width: 16ch; }
.cs .about__lead { max-width: 46ch; font-size: 17px; line-height: 1.5; }
.about__row { min-height: 0; padding: 56px 0; }
.about__row .cs__para a { color: inherit; }
@media (max-width: 800px) {
  .about__hero { grid-template-columns: 1fr; gap: 32px; }
  .about__photo { max-width: 320px; }
  .about__row { padding: 0; }
}
/* The portrait is drafted when the page opens: an outline and dimension lines, then the photo */
.draft--local { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; overflow: visible; pointer-events: none; }
@media (min-width: 801px) {
  .about__hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 3fr); gap: 40px var(--gap); }
  .about__photo { grid-column: 1 / 3; }
  .about__intro { grid-column: 3; }
}
/* The portrait stays hidden until its drafting lines have drawn */
.js [data-draft]:not(.is-shown) img { opacity: 0; }
.draft--local .draft__line { opacity: 0.75; }
.draft--local .draft__dim { opacity: 0.6; }
.draft--local .draft__num { opacity: 0.75; }
.cs .about__title { max-width: 22ch; text-wrap: balance; }
@media (min-width: 801px) { .cs .about__title { font-size: min(64px, 4.7vw); } }
.about__lead .org { white-space: nowrap; }
.about__lead .org__mark { height: 0.7em; margin: 0 0.25em 0 0.12em; vertical-align: 0; }

/* About: a calmer rhythm, a pull quote for skimmers, tidy mobile */
.about__row { padding: 36px 0; }
.about__row:first-child { padding-top: 72px; }
.about__quote { margin: 10px 0; max-width: 30ch; font-size: 22px; line-height: 1.35; text-wrap: balance; }
.is-about .cta { justify-content: flex-start; text-align: left; }
@media (max-width: 800px) {
  .is-about .cs__summary { gap: 12px; }
  .is-about .cs__statement > * { justify-self: start; }
  .about__quote { font-size: 20px; }
}
.is-about .about__row { padding: 0; }
.is-about .about__row:first-child { padding-top: 40px; }
@media (max-width: 800px) {
  .cta { grid-column: 1 / -1; }
  .is-about .about__row:first-child { padding-top: 0; }
  .cs .about__title { font-size: 36px; }
}
/* Contact: the headline on two lines and a tighter page, so "Send message" is visible without scrolling */
.cs .contact__title { max-width: 32ch; text-wrap: balance; }
@media (min-width: 801px) {
  .cs .contact__title { font-size: min(64px, 4.4vw); }
  .is-contact .cs__body { gap: 64px; }
  .is-contact .contact__form { gap: 22px; }
}
.contact__form .button:disabled { opacity: 0.5; cursor: progress; }

/* About and Contact: arriving from another page fades the content in
   (these pages skip the browser crossfade, see their <head>) */
@keyframes arrive { from { opacity: 0; } }
html.arrive .cs { animation: arrive 320ms cubic-bezier(0.33, 1, 0.68, 1) both; }
@media (prefers-reduced-motion: reduce) { html.arrive .cs { animation: none; } }
