/* ==========================================================================
   Haleh Nobar — case studies, and the base of every page but the homepage
   Same type, grid and colours as the homepage journey (css/journey.css).
   A case study is: arrival · the explained screen · See · Understand ·
   Make clear · folded details (+) · the next project.
   About, Blog and ST deburring add css/pages.css on top of this file.
   ========================================================================== */

:root {
  --u: clamp(16px, .5vw + 9.8px, 19px);          /* base size; every size is u × 1.5ⁿ */
  --m: 28px;                                     /* page margin */
  --col: calc((100vw - 2 * var(--m)) / 12);      /* one grid column */
  --ink: #EDEDE8;
  --dim: #A3A39C;
  --line: #2B2B29;
  --ground: #171716;
  --tint: #F2A87A;                               /* the project's colour, set per page */
  --small: max(13px, calc(var(--u) * .78));      /* labels: never below 11 px */
  --stage-w: min(86vw, (100vh - 270px) * 2);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 var(--u)/1.5 'Space Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
body::after {                                    /* film grain, as on the homepage */
  content: '';
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
p, h1, h2, h3, figure, ol, ul, dl, dd, blockquote { margin: 0; padding: 0; font-weight: 400; }
ol, ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .3em; text-decoration-color: rgba(237, 237, 232, .45); }
a:hover { text-decoration-color: var(--ink); }
a:focus-visible, summary:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

/* skip straight to the content, for keyboard users */
.skip { position: fixed; z-index: 20; left: var(--m); top: 10px; padding: 10px 14px; background: var(--ink); color: var(--ground); text-decoration: none; transform: translateY(-160%); opacity: 0; transition: transform .2s, opacity .2s; }   /* unseen too: phones show the page above its top edge, behind the clock */
.skip:focus { transform: none; opacity: 1; }

/* ---- Type scale ---------------------------------------------------------- */

.label { font-family: 'Space Mono', monospace; font-size: var(--small); line-height: 1.5; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.body  { font-size: var(--u); line-height: 1.5; color: var(--dim); max-width: 46ch; }
.lead  { font-size: calc(var(--u) * 1.5); line-height: 1.25; letter-spacing: -.012em; max-width: 30ch; }
.title { font-size: calc(var(--u) * 3.375); line-height: 1.02; letter-spacing: -.035em; font-weight: 500; max-width: 16ch; }
.hero-title { font-size: clamp(56px, 11.5vw, 190px); line-height: .95; letter-spacing: -.045em; font-weight: 500; }
.hero-title i { font-style: normal; color: #FF5242; }
.ink { color: var(--ink); }
.gap-1 { margin-top: calc(var(--u) * .75); }
.gap-2 { margin-top: calc(var(--u) * 1.5); }

.gap-4 { margin-top: calc(var(--u) * 3.375); }

/* measures: the longest a line of a heading or lead may run */
/* one-off adjustments, named; they win over the component's own values */
.gap-25 { margin-top: calc(var(--u) * 2.25) !important; }
.gap-3 { margin-top: calc(var(--u) * 3) !important; }
.ch-18 { max-width: 18ch !important; } .ch-20 { max-width: 20ch !important; } .ch-34 { max-width: 34ch !important; }
.ch-36 { max-width: 36ch !important; } .ch-40 { max-width: 40ch !important; }
.tinted { border-color: var(--tint) !important; }                /* a rule in the project's colour */
.phone-shot { max-height: 420px; width: auto !important; margin: 0 auto; }   /* a phone screen in a row of screens */
.wide-shot { width: min(100%, 1500px) !important; margin: 0 auto; }
.short { min-height: 72vh !important; }

/* ---- Chrome: the same bar as the homepage -------------------------------- */

.chrome { position: fixed; z-index: 6; inset: 0 0 auto 0; height: 76px; background: linear-gradient(var(--ground) 74%, transparent); }   /* solid behind the navigation, so scrolling text never runs through it */
.chrome > * { position: absolute; top: 12px; }
.chrome a { display: inline-block; padding: 12px 0; color: var(--ink); text-decoration: none; }
.chrome .home { left: var(--m); }
.chrome nav { display: flex; gap: calc(var(--u) * 1.6); }
.chrome .crumbs { left: calc(var(--m) + 4 * var(--col)); gap: .8em; align-items: center; }
.chrome .crumbs span { color: var(--dim); white-space: nowrap; }
.chrome .site { right: var(--m); }

/* back to top: appears after the first screen */
#to-top { position: fixed; z-index: 6; right: var(--m); bottom: 16px; padding: 10px 12px; color: var(--ink); background: var(--ground); border: 1px solid var(--line); text-decoration: none; opacity: 0; visibility: hidden; transition: opacity .4s, visibility .4s; }
#to-top.far { opacity: 1; visibility: visible; }
#to-top:hover { border-color: var(--ink); }

/* ---- Layout: a 12-column grid -------------------------------------------- */

main { padding: 0 var(--m); }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
.c-1-4 { grid-column: 1 / 5; } .c-5-8 { grid-column: 5 / 9; } .c-9-12 { grid-column: 9 / 13; }
.c-1-6 { grid-column: 1 / 7; } .c-5-12 { grid-column: 5 / 13; } .c-7-12 { grid-column: 7 / 13; }
.chapter { padding-top: calc(var(--u) * 11); }
.chapter > .grid + .grid, .chapter > .grid + figure, .chapter > figure + .grid { margin-top: calc(var(--u) * 5); }
.rule { border-top: 1px solid var(--line); padding-top: 14px; }

/* ---- Arrival ------------------------------------------------------------- */

.arrival { min-height: 100vh; display: flex; flex-direction: column; justify-content: flex-end; padding: 120px 0 calc(var(--u) * 3); }
.facts { margin-top: calc(var(--u) * 4); }
.facts > div { grid-column: span 3; border-top: 1px solid var(--line); padding-top: 14px; }
.facts b { display: block; font-weight: 400; font-size: calc(var(--u) * 2.25); letter-spacing: -.025em; line-height: 1.1; }

/* ---- The explained screen: stays in place while its three notes pass ----- */

.explained { height: 340vh; margin: 0 calc(var(--m) * -1); }
.explained .pin { position: sticky; top: 0; height: 100vh; }
.stage {
  position: absolute;
  left: calc(50% - var(--stage-w) / 2);
  top: calc(50% - 26px - var(--stage-w) / 4);
  width: var(--stage-w);
  aspect-ratio: 2 / 1;
  overflow: hidden;
  outline: 1px solid color-mix(in srgb, var(--tint) 38%, transparent);
  outline-offset: 0;
}
.stage .sheet { position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 2 / 1; transform-origin: 0 0; transition: transform .9s cubic-bezier(.3, .7, .2, 1); will-change: transform; --k: 1; }
.stage img { position: absolute; inset: 0 auto auto 0; width: 100%; opacity: 0; transition: opacity .7s ease; }
.stage img.on { opacity: 1; }

/* the part a note is about: lit, with four fine corners; the rest steps back */
.focus {
  position: absolute;
  z-index: 1;
  box-shadow: 0 0 0 200vmax rgba(8, 8, 8, .36);
  opacity: 0;
  transition: left .8s cubic-bezier(.3, .7, .2, 1), top .8s cubic-bezier(.3, .7, .2, 1),
              width .8s cubic-bezier(.3, .7, .2, 1), height .8s cubic-bezier(.3, .7, .2, 1), opacity .5s ease;
  --c: color-mix(in srgb, var(--tint) 50%, #fff);
  --l: calc(22px / var(--k, 1)); --t: calc(1px / var(--k, 1));     /* corners keep their size when the view moves in */
  background:
    linear-gradient(var(--c) 0 0) 0 0 / var(--l) var(--t), linear-gradient(var(--c) 0 0) 0 0 / var(--t) var(--l),
    linear-gradient(var(--c) 0 0) 100% 0 / var(--l) var(--t), linear-gradient(var(--c) 0 0) 100% 0 / var(--t) var(--l),
    linear-gradient(var(--c) 0 0) 0 100% / var(--l) var(--t), linear-gradient(var(--c) 0 0) 0 100% / var(--t) var(--l),
    linear-gradient(var(--c) 0 0) 100% 100% / var(--l) var(--t), linear-gradient(var(--c) 0 0) 100% 100% / var(--t) var(--l);
  background-repeat: no-repeat;
  outline: 6px solid transparent;
}
.focus.on { opacity: 1; }
.explained .notes { position: absolute; left: calc(50% - var(--stage-w) / 2); width: var(--stage-w); top: calc(50% - 26px + var(--stage-w) / 4 + 24px); }
.explained .notes li { position: absolute; inset: 0 auto auto 0; width: min(540px, 100%); opacity: 0; transform: translateY(6px); transition: opacity .5s ease, transform .5s ease; }
.explained .notes li.on { opacity: 1; transform: none; }
.explained .notes .label { color: var(--ink); }
.explained .notes .lead { max-width: none; margin-top: calc(var(--u) * .4); }
.explained .notes a { text-decoration: none; }

/* ---- Figures ------------------------------------------------------------- */

.screen { position: relative; }
.screen img { width: 100%; }
.screen .focus { opacity: 1; box-shadow: none; }
figcaption { margin-top: 14px; }
.phones { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 24px; align-items: start; }
.phones img { width: min(100%, 300px); margin: 0 auto; }
.phones li > .label { margin-top: calc(var(--u) * 1.5); color: var(--ink); }
.pair { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.option { border-top: 1px solid var(--line); padding-top: 14px; }
.option.chosen { border-color: var(--tint); }
.tradeoff { border-left: 1px solid var(--tint); padding-left: 20px; }

/* ---- Drawers: the depth behind a claim, opened where the claim is made ---- */

.more { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.more + .more { border-top: 0; }
.chapter > .more:first-of-type, .chapter > .grid + .more { margin-top: calc(var(--u) * 5); }
.more[open] { border-color: color-mix(in srgb, var(--tint) 55%, var(--line)); }
.more summary { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; padding: 22px 0; cursor: pointer; list-style: none; font-size: calc(var(--u) * 1.5); letter-spacing: -.012em; }
.more summary::-webkit-details-marker { display: none; }
.more summary .label { margin-left: auto; text-align: right; }
.more summary::after { content: '+'; font-family: 'Space Mono', monospace; font-size: calc(var(--u) * 1.5); line-height: 1; color: var(--tint); }
.more summary:hover { color: var(--tint); }
.more[open] summary::after { content: '–'; }
.more .inside { padding: 8px 0 calc(var(--u) * 4); }
.table { width: 100%; border-collapse: collapse; font-size: var(--u); }
.table th { text-align: left; font: inherit; font-family: 'Space Mono', monospace; font-size: var(--small); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); font-weight: 400; padding: 0 16px 12px 0; }
.table td { border-top: 1px solid var(--line); padding: 12px 16px 12px 0; color: var(--dim); vertical-align: top; }
.table tr.us td, .table td.ink { color: var(--ink); }
.table tr.us td { border-color: var(--tint); }
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(var(--u) * 3) 24px; }

/* ---- The next project ---------------------------------------------------- */

.next { padding: calc(var(--u) * 11) 0 calc(var(--u) * 5); }
.next a { text-decoration: none; display: block; }
.end { display: flex; justify-content: space-between; gap: 24px; padding: 24px 0 84px; border-top: 1px solid var(--line); }

/* ---- Phone --------------------------------------------------------------- */

@media (max-width: 720px) {
  :root { --m: 20px; --stage-w: calc(100vw - 2 * var(--m)); }
  .chrome .crumbs { left: auto; right: var(--m); max-width: 58vw; }
  .chrome .crumbs span[aria-current] { overflow: hidden; text-overflow: ellipsis; }
  .chrome .site { display: none; }
  .grid { display: block; }
  .grid > * + * { margin-top: calc(var(--u) * 2.25); }
  .title { font-size: calc(var(--u) * 2.25); }
  .chapter { padding-top: calc(var(--u) * 7); }
  .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 20px; }
  .facts > div { grid-column: auto; }
  .facts > * + * { margin-top: 0; }
  /* the explained screen fills the width; the view moves in on the framed part (study.js) */
  .explained:not(.counting) .pin { height: calc(84px + var(--stage-w) * .75 + 190px); }
  .stage { top: 84px; aspect-ratio: 4 / 3; background: #080808; }           /* the whole screen fills two thirds of it */
  .explained:not(.counting) .notes { top: calc(84px + var(--stage-w) * .75 + 22px); }
  .explained:not(.counting):not(.sequence) { height: 290vh; }               /* shorter holds once a note has settled */
  .phones { grid-template-columns: 1fr; row-gap: calc(var(--u) * 3); }
  .phones img { width: min(70%, 260px); }
  .pair, .shots { grid-template-columns: 1fr; row-gap: calc(var(--u) * 2.25); }
  .table { font-size: calc(var(--u) * .86); }
  .end { flex-wrap: wrap; }
}

/* a picture with a framed part: percentages refer to the picture itself */
.shot { position: relative; }
.big { font-size: clamp(64px, 9vw, 150px); line-height: .95; letter-spacing: -.045em; font-weight: 500; color: var(--tint); }

/* a sequence inside a chapter: shorter, and set off from the text around it */
.explained.sequence { height: 280vh; margin-top: calc(var(--u) * 3); margin-bottom: calc(var(--u) * 3); }

/* ---- Evidence: a journey table, a before/after flow, a results chart ----- */

.scroll { overflow-x: auto; }
.journey { min-width: 760px; font-size: calc(var(--u) * .86); }
.journey td:first-child { font-family: 'Space Mono', monospace; font-size: var(--small); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.journey .hot { color: var(--ink); background: color-mix(in srgb, var(--tint) 9%, transparent); }
.journey th.hot { color: var(--tint); }

.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 0; font-size: calc(var(--u) * 1.5); letter-spacing: -.012em; color: var(--dim); }
.flow li + li::before { content: '→'; margin: 0 .7em; color: var(--dim); text-decoration: none; display: inline-block; }
.flow .cut { text-decoration: line-through; text-decoration-thickness: 1px; }
.flow.kept { color: var(--ink); }

.facts b small { font-size: .5em; letter-spacing: 0; color: var(--dim); }
.facts b.tinted { color: var(--tint); }

.ueq li { display: grid; grid-template-columns: 9.5em 1fr 3.2em 8.5em; align-items: center; column-gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.ueq .track { position: relative; height: 6px; background: var(--line); }
.ueq .track::after { content: ''; position: absolute; left: 50%; top: -5px; bottom: -5px; width: 1px; background: var(--dim); }   /* zero */
.ueq .track i { position: absolute; top: 0; height: 100%; background: var(--dim); }
.axis { display: grid; grid-template-columns: 9.5em 1fr 3.2em 8.5em; column-gap: 16px; margin-top: 8px; }
.axis span { grid-column: 2; grid-row: 1; }
.axis span:nth-child(2) { text-align: center; }
.axis span:nth-child(3) { text-align: right; }
.swipe { display: none; }
.ueq .track i.top { background: var(--tint); }
.ueq .value { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  .flow { font-size: calc(var(--u) * 1.125); }
  .ueq li { grid-template-columns: 1fr 3.2em; row-gap: 6px; }
  .ueq .track { grid-column: 1 / -1; grid-row: 2; }
  .ueq .label { grid-column: 1 / -1; grid-row: 3; }
  .axis { display: flex; justify-content: space-between; }
  .swipe { display: inline; }
}

.shots.four { grid-template-columns: repeat(4, 1fr); }
.shots a { display: block; }
.beforeafter { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; align-items: end; }
.beforeafter img { max-height: 300px; width: auto; margin: 0 auto; }
@media (max-width: 720px) {
  .shots.four { grid-template-columns: 1fr 1fr; gap: calc(var(--u) * 1.5) 16px; }
  .more summary { flex-wrap: wrap; row-gap: 4px; }
  .more summary .label { margin-left: 0; text-align: left; width: 100%; order: 3; }
}

/* ==========================================================================
   A Highway to Greenness — its own language: counting, colour per engine,
   film. (The other case studies explain screens; this one explains adverts.)
   ========================================================================== */

.petrol { --engine: #F2C94C; } .hybrid { --engine: #2BBEAC; } .electric { --engine: #E846A0; }
.engine { color: var(--engine); }

/* the opening film strip */
.film { position: relative; margin: calc(var(--u) * 3) calc(var(--m) * -1) 0; aspect-ratio: 21 / 8; overflow: hidden; background: #000; }
.film video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* 90 adverts, one dot each; the dots that show a pattern light up */
.tally { position: absolute; left: calc(50% - var(--stage-w) / 2); width: var(--stage-w); top: 50%; transform: translateY(-62%); }
.tally .total { font-size: clamp(64px, 11vw, 190px); line-height: .9; letter-spacing: -.05em; font-weight: 500; font-variant-numeric: tabular-nums; }
.tally .total small { font-size: .3em; letter-spacing: 0; color: var(--dim); }
.tally .rows { margin-top: calc(var(--u) * 3); }
.tally .row { display: grid; grid-template-columns: 6.5em 1fr 4.5em; align-items: center; column-gap: 18px; padding: 10px 0; }
.tally .dots { display: grid; grid-template-columns: repeat(30, 1fr); gap: clamp(2px, .5vw, 8px); }
.tally .dots i { aspect-ratio: 1; border-radius: 50%; background: #2B2B29; transition: background .5s ease, box-shadow .5s ease, transform .5s ease; }
.tally .dots i.on { background: var(--engine); box-shadow: 0 0 14px color-mix(in srgb, var(--engine) 55%, transparent); }
.tally .n { text-align: right; font-variant-numeric: tabular-nums; }
.counting .notes { top: calc(50% + 150px); }

/* the one-second experiment */
.second { border: 1px solid var(--line); padding: clamp(20px, 3vw, 44px); min-height: 19em; display: flex; flex-direction: column; justify-content: space-between; }
.second .print { font-size: calc(var(--u) * .86); line-height: 1.5; color: var(--ink); max-width: 78ch; opacity: 0; transition: opacity .12s linear; }
.second.showing .print, .second.reading .print { opacity: 1; }
.second .verdict { opacity: 0; transition: opacity .6s ease .3s; }
.second.done .verdict { opacity: 1; }
.second .controls { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: calc(var(--u) * 1.5); }
.second button { font: inherit; font-family: 'Space Mono', monospace; font-size: var(--small); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); background: none; border: 0; border-bottom: 1px solid rgba(237, 237, 232, .45); padding: 10px 0 3px; cursor: pointer; }
.second button:hover { border-color: var(--ink); }
.second .clock b { font-weight: 400; font-size: calc(var(--u) * 3.375); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* the four films */
.reels { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--u) * 3) 24px; }
.reels video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.reels .count { font-variant-numeric: tabular-nums; color: var(--tint); }

.findings { display: grid; grid-template-columns: repeat(2, 1fr); gap: calc(var(--u) * 3) 24px; }

@media (max-width: 720px) {
  .film { aspect-ratio: 16 / 10; }
  .tally { transform: none; top: 12vh; }
  .tally .row { grid-template-columns: 1fr auto; row-gap: 6px; }
  .tally .dots { grid-column: 1 / -1; grid-row: 2; }
  .counting .notes { top: calc(12vh + 330px); }
  .reels, .findings { grid-template-columns: 1fr; }
}

/* diagrams redrawn for the dark ground, and colour samples */
.diagram svg { display: block; width: 100%; height: auto; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px 16px; }
.swatches i { display: block; height: 56px; margin-bottom: 8px; border: 1px solid var(--line); }
@media (max-width: 720px) { .swatches { grid-template-columns: 1fr 1fr; } }

/* captions and key figures carry information: larger than metadata */
figcaption.label, .facts .label, .tally .label { font-size: max(12.5px, var(--small)); }

/* reduced motion: no moving in, no fades; the whole screen stays with its frame */
@media (prefers-reduced-motion: reduce) {
  .stage .sheet, .stage img, .focus, .explained .notes li { transition: none !important; }
}

/* ---- From page to page -------------------------------------------------------
   Pages are not cut: the leaving page (its dust already let go, see journey.ts)
   dissolves into the arriving one, where the same dust gathers as the title.
   Browsers without view transitions simply load the page.                        */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: page-out .3s ease both; }
::view-transition-new(root) { animation: page-in .3s ease both; }   /* short: the dust carries the move, not the fade */
@keyframes page-out { to { opacity: 0; filter: blur(6px); } }
@keyframes page-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
