/* Theme ------------------------------------------------------------------ */
:root {
  --bg: #f5f3ee;
  --fg: #1b1915;
  --muted: #736e64;
  --faint: #a29d92;
  --line: #e2ded5;
  --panel: #ebe8e0;
  --panel-hi: #f1eee8;
  --accent: #4b5bff;
  --shadow: 0 1px 2px rgba(27, 25, 21, 0.06), 0 12px 40px -12px rgba(27, 25, 21, 0.18);

  --max: 1200px;
  --text: 720px;
  --pad: clamp(20px, 5vw, 64px);
  --radius: 20px;
  --serif: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;
  --sans: "Geist", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #13110e;
  --fg: #ece8df;
  --muted: #9a9488;
  --faint: #6c675e;
  --line: #29261f;
  --panel: #1c1a16;
  --panel-hi: #24211c;
  --accent: #8b97ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 48px -16px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #13110e;
    --fg: #ece8df;
    --muted: #9a9488;
    --faint: #6c675e;
    --line: #29261f;
    --panel: #1c1a16;
    --panel-hi: #24211c;
    --accent: #8b97ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 48px -16px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

/* Base ------------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 300 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}
img { display: block; width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

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

.eyebrow {
  font: 400 12px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel {
  position: relative;
  background:
    radial-gradient(120% 80% at 50% 0%, var(--panel-hi), transparent 70%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Header ----------------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--pad);
}
.wordmark { font: 400 16px/1 var(--sans); letter-spacing: -0.01em; }
.header-actions { display: flex; align-items: center; gap: 12px; }

.pill {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 14px;
  font-weight: 400;
  transition: opacity 0.2s ease;
}
.pill:hover { opacity: 0.85; }

.theme {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.theme button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: var(--faint);
  transition: color 0.2s ease, background-color 0.2s ease;
}
.theme button:hover { color: var(--fg); }
.theme button[aria-pressed="true"] { background: var(--panel); color: var(--fg); }
.theme svg { width: 15px; height: 15px; }

/* Case study top bar */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px var(--pad);
}
.bar .back { font-size: 14px; color: var(--muted); transition: color 0.2s ease; }
.bar .back:hover { color: var(--fg); }
.bar .eyebrow { text-align: center; }
.bar .theme { justify-self: end; }

/* Index ------------------------------------------------------------------ */
.intro { padding-top: clamp(56px, 10vw, 128px); padding-bottom: clamp(56px, 8vw, 104px); }
.intro h1 {
  max-width: 30ch;
  font: 300 clamp(28px, 3.2vw, 42px)/1.15 var(--serif);
  letter-spacing: -0.02em;
}
.intro p {
  margin-top: 28px;
  max-width: 44ch;
  font-size: 17px;
  color: var(--muted);
}
.intro p a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }

.work {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 24px);
}

.card {
  display: flex;
  flex-direction: column;
  min-height: clamp(420px, 44vw, 600px);
  transition: border-color 0.3s ease;
}
.card.full { grid-column: 1 / -1; min-height: clamp(420px, 46vw, 600px); }
.card:hover { border-color: color-mix(in srgb, var(--fg) 18%, var(--line)); }

.card-head { position: relative; padding: 28px 88px 0 28px; }
.card-head h2 {
  margin-top: 10px;
  max-width: 24ch;
  font: 400 clamp(22px, 2.4vw, 30px)/1.2 var(--serif);
  letter-spacing: -0.01em;
}
/* Stretched link: the whole card is clickable unless the cover is an embed */
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
.card-link:focus-visible { outline: none; }
.card:has(.card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

.arrow {
  position: absolute;
  top: 24px;
  right: 24px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  transition: transform 0.4s var(--ease), color 0.2s ease, border-color 0.2s ease;
}
.arrow svg { width: 15px; height: 15px; }
.card:hover .arrow { transform: translateX(3px); color: var(--fg); border-color: var(--faint); }

.card-cover {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: clamp(32px, 5vw, 64px) clamp(20px, 6%, 72px) 0;
}
.card-cover > * {
  max-width: 100%;
  border-radius: 12px 12px 0 0;
  box-shadow: var(--shadow);
  transform: translateY(12px);
  transition: transform 0.6s var(--ease);
}
.card:hover .card-cover > * { transform: translateY(0); }
.card-cover .placeholder { width: 100%; border-radius: 12px 12px 0 0; }
.card-cover.is-embed { position: relative; z-index: 2; padding: 16px 0 0; }
.card-cover.is-embed > * { box-shadow: none; border-radius: 0; transform: none; background: transparent; }

/* Case study ------------------------------------------------------------- */
.cs-hero { padding-top: clamp(24px, 4vw, 48px); }
.cs-hero .panel { padding: clamp(24px, 5vw, 72px); }
.cs-hero .panel > * { border-radius: 12px; box-shadow: var(--shadow); }
.cs-hero .panel > .crop { width: clamp(260px, 26vw, 340px); margin: 0 auto; box-shadow: none; }

.cs-head { padding-top: clamp(48px, 7vw, 88px); }
.cs-head h1 {
  max-width: 20ch;
  font: 300 clamp(36px, 5.2vw, 64px)/1.06 var(--serif);
  letter-spacing: -0.02em;
}
.lede {
  margin-top: 20px;
  max-width: 54ch;
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.55;
  color: var(--muted);
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px 40px;
  margin-top: clamp(40px, 5vw, 64px);
}
.facts dt { margin-bottom: 6px; }
.facts dd { font-size: 15px; }

/* Background: label in the margin, prose in the column */
.story { padding-top: clamp(72px, 9vw, 120px); }
.story-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(0, 2.4fr);
  gap: 24px 48px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}
.story-row:last-child { border-bottom: 1px solid var(--line); }
.story-row .eyebrow { padding-top: 6px; }
.story-row p { max-width: 60ch; font-size: clamp(17px, 1.5vw, 19px); line-height: 1.6; }

.metrics-block { padding-top: clamp(80px, 10vw, 136px); }
.metrics-heading { margin-bottom: 32px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 40px;
}
.metric { padding-top: 24px; border-top: 1px solid var(--line); }
.metric-kicker { margin-bottom: 20px; font: 400 clamp(20px, 2vw, 24px)/1.2 var(--serif); }
.metric-value {
  font: 300 clamp(40px, 3.6vw, 52px)/1 var(--serif);
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums;
}
.metric-label { margin-top: 16px; max-width: 28ch; font-size: 15px; color: var(--muted); }

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(56px, 7vw, 96px) clamp(16px, 2vw, 24px);
  padding-top: clamp(96px, 11vw, 152px);
}
.shot.wide { grid-column: 1 / -1; }
.shot .panel { padding: clamp(20px, 4vw, 56px); }
.shot .canvas { position: relative; }
.shot .canvas img { border-radius: 10px; }
.shot figcaption { margin-top: 18px; max-width: 62ch; font-size: 15px; color: var(--muted); }
.shot:not(.wide) .canvas img { max-height: 620px; width: auto; max-width: 100%; margin: 0 auto; }

.shot.annotated { display: grid; grid-template-columns: minmax(0, 2.5fr) minmax(220px, 1fr); gap: clamp(24px, 3vw, 48px); align-items: start; }
.shot.annotated figcaption { margin-top: 4px; }
.shot.annotated figcaption > p { color: var(--fg); font-size: 16px; }

.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  box-shadow: 0 0 0 3px #fff, 0 4px 12px rgba(0, 0, 0, 0.25);
  font: 500 12px/26px var(--mono);
  text-align: center;
  cursor: default;
  transition: transform 0.2s var(--ease);
}
.pin.on, .pin:focus-visible { transform: translate(-50%, -50%) scale(1.15); outline: none; }

/* Images with markers already drawn in: invisible hover targets sized to the marker */
.pin.ghost {
  width: 4.4%;
  height: auto;
  aspect-ratio: 1;
  background: transparent;
  box-shadow: none;
  border: 2px solid transparent;
}
.pin.ghost.on, .pin.ghost:focus-visible {
  transform: translate(-50%, -50%);
  border-color: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent);
}

.notes { list-style: none; padding: 0; display: grid; gap: 0; margin-top: 20px; }
.notes li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  cursor: default;
  transition: color 0.2s ease, opacity 0.2s ease;
}
.notes li::before {
  content: attr(data-n);
  font: 500 12px/1.9 var(--mono);
  color: var(--fg);
}
.notes li.on { color: var(--fg); }
.has-focus .notes li:not(.on) { opacity: 0.45; }

/* Placeholders + embeds */
.placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  border: 1px dashed var(--faint);
  border-radius: 12px;
  color: var(--muted);
  font: 400 12px/1.4 var(--mono);
  letter-spacing: 0.04em;
  text-align: center;
  padding: 16px;
}
.embed { display: block; width: 100%; border: 0; border-radius: 12px; background: var(--bg); }

/* Footer ----------------------------------------------------------------- */
.site-footer { padding-top: clamp(112px, 12vw, 168px); padding-bottom: 40px; }
.next { display: block; padding-bottom: clamp(64px, 8vw, 104px); }
.next-title {
  display: inline-block;
  margin-top: 12px;
  font: 300 clamp(32px, 4.6vw, 56px)/1.08 var(--serif);
  letter-spacing: -0.02em;
}
.next-title span { display: inline-block; transition: transform 0.4s var(--ease); }
.next:hover .next-title span { transform: translateX(8px); }
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.footer-row a { transition: color 0.2s ease; }
.footer-row a:hover { color: var(--fg); }
.footer-links { display: flex; gap: 24px; }

.notfound { padding-top: 120px; }
.notfound h1 { font: 300 48px/1.1 var(--serif); }
.notfound p { margin-top: 16px; color: var(--muted); }

/* Motion ----------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0s !important; }
}

/* Responsive ------------------------------------------------------------- */
@media (max-width: 860px) {
  .work { grid-template-columns: 1fr; }
  .card { min-height: 0; }
  .card-cover { padding-top: 40px; }
  .gallery { grid-template-columns: 1fr; }
  .shot.annotated { grid-template-columns: 1fr; }
  .story-row { grid-template-columns: 1fr; gap: 8px; }
  .bar-inner { grid-template-columns: auto 1fr; }
  .bar .eyebrow { display: none; }
}

/* Embeds paint a flat background, so drop the panel's highlight to avoid a seam */
.card:has(.is-embed) { background: var(--panel); }

/* Cropped embeds: a window onto one region of a larger, fixed-size prototype */
.crop { position: relative; overflow: hidden; isolation: isolate; }
.crop .embed { position: absolute; top: 0; left: 0; max-width: none; transform-origin: 0 0; border-radius: 0; }
/* Portrait crops and phone recordings in the gallery stay phone-sized instead of filling the column */
.shot .crop.is-portrait { width: clamp(260px, 28vw, 380px); margin: 0 auto; }
.shot video.clip { display: block; width: clamp(260px, 28vw, 380px); margin: 0 auto; border-radius: 28px; box-shadow: var(--shadow); }

/* Labeled note columns under a visual (Before / Proposed) */
.shot figcaption.has-compare { max-width: none; }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 clamp(24px, 4vw, 56px); margin-top: 28px; }
.compare .notes { margin-top: 12px; }
.card-cover.is-crop { padding: clamp(24px, 3vw, 40px) 0 clamp(32px, 4vw, 48px); align-items: center; }
.card-cover.is-crop .crop { width: clamp(240px, 24vw, 300px); }
/* Framed phone PNGs carry their own outline, so they get a soft drop shadow instead of a box */
img.phone { box-shadow: none !important; border-radius: 0 !important; background: none; filter: drop-shadow(0 18px 30px rgb(0 0 0 / 0.16)); }
/* On cards, a cropped phone sits on the bottom edge and lifts on hover; sized so the card matches the returns card height */
.card-cover > img.phone { width: clamp(224px, 22.4vw, 280px); filter: drop-shadow(0 -6px 24px rgb(0 0 0 / 0.10)); }
/* In the hero, match the height of the returns phone (a 340×694 crop at the same widths); the framed
   Autos phone is 840×2122, so it's 0.808 as wide for the same height. */
.cs-hero .panel > img.phone { display: block; width: calc(clamp(260px, 26vw, 340px) * 0.808); margin: 0 auto; }

/* Step labels: a quiet numbered caption under each phone, linked to its note on hover */
.canvas.has-steps { margin-bottom: 40px; }
.step {
  position: absolute;
  top: calc(100% + 14px);
  transform: translateX(-50%);
  white-space: nowrap;
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: default;
  transition: color 0.2s ease, opacity 0.2s ease;
}
.step b { font-weight: 500; color: var(--fg); margin-right: 4px; }
.step.on, .step:focus-visible { color: var(--fg); outline: none; }
.has-focus .step:not(.on) { opacity: 0.4; }

/* Stacked: image at full width, notes in columns beneath (one per screen) */
.shot.annotated.stacked { grid-template-columns: 1fr; gap: 28px; }
.shot.stacked .panel { padding: clamp(20px, 3vw, 40px); }
.shot.stacked .notes { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 0 clamp(16px, 2vw, 28px); }
.shot.stacked .notes li { display: block; padding-top: 16px; }
.shot.stacked .notes li::before { display: inline; margin-right: 8px; }
.note-label {
  font: 500 11px/1.9 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
}
.note-label::after { content: ""; display: block; margin-bottom: 6px; }
@media (max-width: 860px) {
  .shot.stacked .notes { grid-template-columns: 1fr; }
}
.shot.stacked figcaption { max-width: none; }

/* Half-width annotated shots (before/after pairs): notes stack under the image */
.shot.annotated.half { grid-template-columns: 1fr; gap: 20px; align-content: start; }
.shot.half figcaption > p { font: 400 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.shot.half .notes { margin-top: 12px; }
/* Pair images fill their panels edge to edge, and the pair breaks slightly wider than the text column */
.shot.half .panel { padding: 0; border: 0; }
.shot.half .canvas img { border-radius: 0; }
@media (min-width: 1100px) {
  .shot.half:nth-child(odd of .half) { margin-left: -40px; }
  .shot.half:nth-child(even of .half) { margin-right: -40px; }
}
.shot.half .canvas img { max-height: none; width: 100%; }

/* Cover backdrop ---------------------------------------------------------- */
/* Fine flowing lines behind every cover (home cards and case study heroes). The SVG is a mask,
   so the lines take the theme's text color and work in light and dark; they fade out toward the top. */
.card,
.cs-hero .panel { isolation: isolate; }
.card::before,
.cs-hero .panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--fg);
  opacity: 0.09;
  -webkit-mask: url("images/cover-lines.svg") center / cover no-repeat, linear-gradient(to bottom, transparent 18%, #000 70%);
  -webkit-mask-composite: source-in;
  mask: url("images/cover-lines.svg") center / cover no-repeat, linear-gradient(to bottom, transparent 18%, #000 70%);
  mask-composite: intersect;
}
.cs-hero .panel::before {
  -webkit-mask: url("images/cover-lines.svg") center / cover no-repeat;
  mask: url("images/cover-lines.svg") center / cover no-repeat;
}

/* Bleed shots: desktop screenshots fill their panel edge to edge and break slightly wider than the text column */
.shot.bleed .panel { padding: 0; }
.shot.bleed .canvas img { border-radius: 0; }
@media (min-width: 1100px) {
  .shot.bleed .panel { margin: 0 -40px; }
}

/* Note spotlight: hovering a note (or its pin) dims the image except what the note points at */
.spot-layer { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; border-radius: inherit; }
.spot {
  position: absolute;
  top: 0;
  height: 100%;
  transform: translateX(-50%);
  border-radius: 14px;
  box-shadow: 0 0 0 2px rgb(255 255 255 / 0.85), 0 0 0 200vmax rgb(20 18 15 / 0.42);
  opacity: 0;
  transition: opacity 0.25s ease, left 0.35s var(--ease), top 0.35s var(--ease), width 0.35s var(--ease);
}
.spot.ring { width: 14%; height: auto; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); }
.has-focus .spot { opacity: 1; }
.pin { z-index: 2; }
@media (prefers-reduced-motion: reduce) { .spot { transition: opacity 0.2s ease; } }
.shot .spot-layer { border-radius: 10px; }
.shot.bleed .spot-layer, .shot.half .spot-layer { border-radius: 0; }
