/* Portfolio pages (/, /work, /cv, case studies), v-taste direction.
   Petrol field, Bricolage Grotesque, type as the main material. See DESIGN.md.
   The /apps pages keep style.css. */

:root {
  --ground: #eceeef;
  --surface: #e0e5e7;
  --ink: #10272c;
  --muted: #3f5559;
  --petrol: #0b4f5c;
  --petrol-deep: #083e48;
  --on-petrol: #ffffff;
  --petrol-soft: #a9dbe3;
  --charcoal: #1d2326;
  --on-charcoal: #ffffff;
  --charcoal-soft: #b6c2c5;
  --charcoal-raised: #273035;

  /* Project colours: brand value on dark fields, darkened on the light ground */
  --mas: #35d0e8;
  --mas-ink: #0b6e80;
  --td: #f0b65a;
  --td-ink: #8a5a0c;

  --margin: clamp(20px, 3vw, 44px);
  --measure: 62ch;
  --gap-section: clamp(88px, 11vw, 168px);

  --step-small: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2.25rem, 1.3rem + 3.6vw, 4.5rem);
  --step-display: clamp(4.5rem, 1rem + 11vw, 13rem);

  --font: 'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace; /* taste-skill-ignore: only for real code (pre, code) */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Names still used by inline styles in the page markup */
  --text-primary: var(--ink);
  --text-secondary: var(--muted);
  --text-tertiary: var(--muted);
  --accent: var(--petrol);
  --border-subtle: var(--surface);
  --bg-glass: var(--surface);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-optical-sizing: auto;
  font-size: var(--step-body);
  line-height: 1.55;
  background: var(--ground);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; font-weight: 600; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
::selection { background: var(--petrol); color: #fff; }

.container, .container-narrow { padding-inline: var(--margin); max-width: none; margin: 0; }

/* Animation hooks from the old markup: always visible; motion comes from site.js */
.animate-in, .scroll-fade-up, .scroll-fade, .scroll-scale, .stagger-item { opacity: 1; transform: none; }

/* ---------- Bar ---------- */
nav { position: relative; z-index: 5; }
nav .container { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: var(--step-small); font-weight: 600; text-decoration: none;
}
.logo img { flex-shrink: 0; }
.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a { font-size: var(--step-small); font-weight: 500; text-decoration: none; }
.nav-links a:hover { text-decoration: underline; }

/* The bar sits on the petrol field on every page */
nav { background: var(--petrol); color: var(--on-petrol); }

/* ---------- Buttons: square, flat ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  font: 600 var(--step-small)/1 var(--font);
  text-decoration: none; border: 2px solid transparent; border-radius: 0;
  transition: transform 0.15s var(--ease-out), background-color 0.15s ease, color 0.15s ease;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-primary { background: var(--petrol); color: #fff; }
.btn-primary:hover { background: var(--ink); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--ground); }
.field-petrol .btn-primary, .field-petrol .btn-mas { background: var(--on-petrol); color: var(--petrol); }
.field-petrol .btn-primary:hover, .field-petrol .btn-mas:hover { background: var(--petrol-soft); }
.field-petrol .btn-secondary { color: var(--on-petrol); border-color: var(--on-petrol); }
.field-petrol .btn-secondary:hover { background: var(--on-petrol); color: var(--petrol); }
.btn-mas { background: var(--petrol); color: #fff; }

/* ---------- Fields ---------- */
.field-petrol { background: var(--petrol); color: var(--on-petrol); }
.field-charcoal { background: var(--charcoal); color: var(--on-charcoal); }

/* ---------- Masked headline lines ---------- */
.mask { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.mask > span { display: block; }

/* ---------- Home ---------- */
.home-hero {
  min-height: calc(100svh - 72px);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto 1fr auto;
  column-gap: 24px;
  padding: clamp(32px, 7vh, 96px) var(--margin) clamp(28px, 5vh, 56px);
}
.home-hero h1 {
  grid-column: 1 / -1;
  font-size: var(--step-display);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.86;
}
.home-hero h1 .ink-soft { color: var(--petrol-soft); }
.home-hero .hero-copy {
  grid-column: 7 / -1;
  grid-row: 3;
  align-self: end;
  max-width: 46ch;
}
.home-hero .role { font-size: var(--step-lead); font-weight: 600; line-height: 1.25; margin-bottom: 10px; }
.home-hero .status { display: block; color: var(--petrol-soft); font-weight: 500; margin-bottom: 18px; }
.home-hero .pitch { margin-bottom: 28px; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; }
.cta-row .text-link { font-weight: 500; }

.projects { padding: var(--gap-section) var(--margin); }
.projects-head { font-size: var(--step-head); letter-spacing: -0.03em; line-height: 1; max-width: 14ch; margin-bottom: clamp(48px, 6vw, 88px); }
.projects-body { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
.project-list { grid-column: 1 / 6; display: grid; gap: clamp(56px, 6vw, 88px); align-content: start; }
.project { display: block; text-decoration: none; color: var(--charcoal-soft); transition: color 0.2s ease; }
.project:hover, .project:focus-visible, .project.is-active { color: var(--on-charcoal); }
.project-top { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.project-top h3 { font-size: var(--step-lead); color: var(--on-charcoal); }
.project-name { font-size: var(--step-lead); color: var(--on-charcoal); margin-bottom: 14px; }
.project-name .kind { font-size: var(--step-small); font-weight: 500; color: var(--charcoal-soft); margin-left: 10px; }
.project .kind { font-size: var(--step-small); }
.project-figure {
  font-size: clamp(3.5rem, 2rem + 5vw, 7rem);
  font-weight: 600; letter-spacing: -0.04em; line-height: 0.95;
}
.project.mas .project-figure { color: var(--mas); }
.project.td .project-figure { color: var(--td); }
.project-figure { margin-top: 8px; }
.project-label { margin: 8px 0 22px; color: var(--on-charcoal); font-weight: 500; }
.project p { max-width: 46ch; margin-bottom: 18px; }
.project .read { color: var(--on-charcoal); font-weight: 600; text-decoration: underline; }
.project .shot-mobile { display: none; }

.preview { grid-column: 7 / -1; position: sticky; top: 32px; align-self: start; aspect-ratio: 16 / 10; background: var(--charcoal-raised); overflow: hidden; }
.preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; opacity: 0; transition: opacity 0.35s ease, transform 0.6s var(--ease-out); transform: scale(1.03); }
.preview img.is-active { opacity: 1; transform: none; }

.more { margin-top: clamp(80px, 9vw, 136px); display: flex; align-items: end; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.more .icons { display: flex; gap: clamp(12px, 2vw, 24px); }
.more .icons img { width: clamp(96px, 11vw, 160px); height: auto; aspect-ratio: 1; border-radius: 22%; object-fit: cover; transition: transform 0.3s var(--ease-out); }
.more .icons img:hover { transform: translateY(-4px); }
.more a { font-size: var(--step-lead); font-weight: 600; color: var(--on-charcoal); }

/* ---------- Footer: the name returns ---------- */
footer { background: var(--petrol); color: var(--on-petrol); padding: clamp(72px, 9vw, 128px) var(--margin) 32px; overflow: hidden; }
footer .container { padding: 0; }
.footer-name {
  font-size: clamp(3.5rem, 1rem + 10.5vw, 12.5rem);
  font-weight: 600; letter-spacing: -0.045em; line-height: 0.86;
  margin-bottom: clamp(40px, 5vw, 72px);
}
.footer-row { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.footer-links { display: grid; gap: 4px; }
.footer-links a { font-size: var(--step-lead); font-weight: 500; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-legal { font-size: var(--step-small); color: var(--petrol-soft); }
footer > .container > p.footer-legal { margin-top: 0; }

/* ---------- Page header (Work, CV) ---------- */
.page-header { background: var(--petrol); color: var(--on-petrol); padding: clamp(48px, 8vw, 120px) 0 clamp(56px, 7vw, 104px); }
.page-header h1 { font-size: var(--step-display); letter-spacing: -0.045em; line-height: 0.86; margin-bottom: 24px; }
.page-header p { font-size: var(--step-lead); max-width: 40ch; }
.cv-page .page-header h1 { font-size: clamp(3.5rem, 1rem + 8vw, 9.5rem); }
.cv-page .page-header p[style] { color: var(--petrol-soft) !important; font-size: var(--step-body) !important; font-weight: 500; }
.cv-page .page-header [style*="justify-content: center"] { justify-content: flex-start !important; }
.cv-page .page-header .btn-primary { background: var(--on-petrol); color: var(--petrol); }
.cv-page .page-header .btn-secondary { color: var(--on-petrol); border-color: var(--on-petrol); }
.cv-page .page-header .btn-secondary:hover { background: var(--on-petrol); color: var(--petrol); }

.section { padding: var(--gap-section) 0; }

/* ---------- Work ---------- */
.work-page .section { padding-top: clamp(72px, 8vw, 120px); }
.work-group { margin-bottom: var(--gap-section); }
.work-group:last-child { margin-bottom: 0; }
.group-title { font-size: var(--step-head); letter-spacing: -0.03em; line-height: 1; margin-bottom: clamp(36px, 4vw, 56px); }
.featured {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: start;
  text-decoration: none; color: inherit; padding: clamp(28px, 3.5vw, 48px) 0;
}
.featured + .featured { margin-top: 0 !important; background: var(--surface); padding-inline: clamp(20px, 3vw, 40px); margin-inline: calc(-1 * clamp(20px, 3vw, 40px)); }
.featured-top, .featured > p, .featured .stack-row { grid-column: 1 / 7; }
.featured-top { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.featured-top h3 { font-size: var(--step-head); letter-spacing: -0.03em; line-height: 1; }
.featured:hover h3 { text-decoration: underline; text-decoration-thickness: 2px; }
.live-badge { font-size: var(--step-small); font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #1c7c4a; }
.featured ~ .featured .live-dot { display: none; }
.featured > p { color: var(--ink); max-width: 52ch; margin-bottom: 20px; }
.stack-row { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.stack-tag { font-size: var(--step-small); color: var(--muted); }
.featured .work-shot { grid-column: 8 / -1; grid-row: 1 / span 3; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; }

.grid { display: grid; gap: 0; }
.grid-2 { grid-template-columns: 1fr; }
.card-link { display: block; text-decoration: none; color: inherit; }
.card { padding: 22px 0; }
.card-link + .card-link .card { }
.app-card { display: grid; grid-template-columns: 72px 1fr; gap: 24px; align-items: center; }
.app-icon { width: 72px; height: 72px; border-radius: 16px; overflow: hidden; }
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-info h3 { font-size: var(--step-lead); line-height: 1.2; margin-bottom: 2px; }
.card-link:hover .app-info h3 { text-decoration: underline; }
.app-info p { color: var(--ink); margin-bottom: 6px; max-width: 56ch; }
.app-badge { font-size: var(--step-small); color: var(--muted); }

/* ---------- CV ---------- */
.cv-page .section > .container-narrow { display: block; }
.cv-section {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px;
  padding: clamp(48px, 6vw, 88px) 0;
}
.cv-section + .cv-section { background: none; }
.cv-section:nth-of-type(even) { background: var(--surface); margin-inline: calc(-1 * var(--margin)); padding-inline: var(--margin); }
.cv-section > h2 { grid-column: 1 / 4; font-size: var(--step-lead); line-height: 1.2; }
.cv-section > *:not(h2) { grid-column: 4 / 12; }
.cv-section > p { max-width: var(--measure); }
.cv-section > p[style*="uppercase"] {
  text-transform: none !important; letter-spacing: 0 !important;
  font-size: var(--step-small) !important; font-weight: 600; color: var(--muted) !important;
}
.cv-item { margin-bottom: 40px; }
.cv-item:last-child { margin-bottom: 0; }
.cv-item h3 { font-size: var(--step-lead); line-height: 1.2; margin-bottom: 4px; }
.cv-item .company { color: var(--petrol); font-weight: 600; }
.cv-item .company a { color: var(--petrol) !important; }
.cv-item .date { color: var(--muted); font-size: var(--step-small); margin-bottom: 10px; }
.cv-item p { max-width: var(--measure); }
.cv-item [style*="border-left"] { border-left: none !important; padding-left: 0 !important; margin-top: 28px !important; }
.cv-item [style*="border-left"] h3 { font-size: var(--step-body) !important; }
.skills-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tag { background: var(--ground); padding: 6px 12px; font-size: var(--step-small); transition: background-color 0.15s ease, color 0.15s ease; }
.cv-section:nth-of-type(odd) .skill-tag { background: var(--surface); }
.skill-tag:hover { background: var(--petrol) !important; color: #fff; }

/* ---------- Case studies ---------- */
.case code { font-family: var(--mono); font-size: 0.86em; padding: 1px 6px; background: var(--surface); white-space: nowrap; }
.case-hero { background: var(--petrol); color: var(--on-petrol); padding: clamp(48px, 7vw, 104px) 0 clamp(56px, 6vw, 96px); }
.case-hero h1 { font-size: var(--step-display); letter-spacing: -0.045em; line-height: 0.86; margin-bottom: 18px; }
.case-kind { font-size: var(--step-body); font-weight: 500; color: var(--petrol-soft); margin-bottom: 14px; }
.case-tagline { font-size: var(--step-lead); line-height: 1.35; max-width: 34ch; margin-bottom: 32px; }
.case-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: clamp(56px, 7vw, 96px); }
.case-hero .btn-secondary { color: var(--on-petrol); border-color: var(--on-petrol); }
.case-hero .btn-secondary:hover { background: var(--on-petrol); color: var(--petrol); }
.case-hero .btn-mas { background: var(--on-petrol); color: var(--petrol); }
.case-hero .btn-mas:hover { background: var(--petrol-soft); }

.figures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.figure strong { display: block; font-size: clamp(2.5rem, 1.4rem + 3.2vw, 5rem); font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.p-mas .figure strong { color: var(--mas); }
.p-td .figure strong { color: var(--td); }
.figure span { display: block; margin-top: 10px; max-width: 22ch; }
.figures-note { margin-top: 24px; color: var(--petrol-soft); font-size: var(--step-small); }

.case-shot { margin-top: clamp(56px, 6vw, 88px); }
.case-shot img { width: 100%; }
.shot { margin-top: clamp(56px, 6vw, 88px); background: #f6f6f3; }
.shot img { width: 100%; }
.shot-crop { max-height: 640px; overflow: hidden; display: block; }
.shot-crop img { margin-top: -38%; }
.shot-caption, .case-shot figcaption { font-size: var(--step-small); color: var(--petrol-soft); margin-top: 12px; }

.case > .container { padding-inline: var(--margin); }
.case-section { padding: var(--gap-section) 0 0; }
.case-section h2 { font-size: var(--step-head); letter-spacing: -0.03em; line-height: 1; max-width: 18ch; margin-bottom: 32px; }
.case-section h3 { font-size: var(--step-lead); line-height: 1.2; margin-bottom: 10px; }
.prose { max-width: var(--measure); }
.prose p { margin-bottom: 18px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 600; }
.prose a { color: var(--petrol); font-weight: 500; }
.lead { font-size: var(--step-lead); line-height: 1.35; max-width: 40ch; margin-bottom: 40px; }

.stack-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 48px 64px; max-width: 1100px; margin-top: 16px; }
.stack-item .role { font-size: var(--step-small); font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.stack-item p { max-width: 44ch; }

.steps { counter-reset: step; margin-top: 32px; max-width: 760px; }
.step { position: relative; padding: 0 0 26px 64px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: -0.15em;
  font-size: 2.2rem; font-weight: 600; line-height: 1; letter-spacing: -0.03em; color: var(--petrol);
}
.step p { margin: 0; }

/* Decisions: the one charcoal band of the MetArenaStats page */
.p-mas .case-section:has(.decisions) {
  background: var(--charcoal); color: var(--on-charcoal);
  margin: var(--gap-section) calc(-1 * var(--margin)) 0; padding: var(--gap-section) var(--margin);
}
.p-mas .case-section:has(.decisions) .prose a { color: var(--mas); }
.decisions { display: grid; gap: clamp(48px, 5vw, 72px); max-width: 1100px; }
.decision { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
.decision h3, .decision p { grid-column: 1 / 7; }
.decision p { color: var(--charcoal-soft); max-width: 52ch; }
.decision .ba { grid-column: 8 / -1; grid-row: 1 / span 2; align-self: start; font-size: var(--step-lead); line-height: 1.3; color: var(--charcoal-soft); }
.ba b { display: block; font-size: clamp(2rem, 1.2rem + 2.4vw, 3.5rem); line-height: 1.05; letter-spacing: -0.03em; color: var(--mas); font-weight: 600; }
.ba .arrow { display: none; }
.pull { max-width: 40ch; margin-top: clamp(48px, 5vw, 72px); font-size: var(--step-lead); line-height: 1.35; font-weight: 500; }

pre.snippet {
  max-width: 760px; margin-top: 24px; padding: 24px 28px;
  background: var(--charcoal); color: var(--charcoal-soft);
  overflow-x: auto; font-family: var(--mono); font-size: 0.84rem; line-height: 1.8;
}
pre.snippet .c { color: #8a989c; }
pre.snippet .k { color: var(--mas); }

/* Trustdesk */
.outcomes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 40px; max-width: 1200px; }
.outcome { padding: 28px 24px 30px; }
.outcome b { display: block; font-size: var(--step-lead); font-weight: 600; line-height: 1.2; margin-bottom: 10px; }
.outcome p { margin: 0; max-width: 28ch; }
.o-ok { background: #d9ebe1; }
.o-part { background: #f3e6cd; }
.o-none { background: var(--surface); }
.o-conf { background: #f1dad6; }

.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; margin-top: 40px; max-width: 1200px; }
.flow-step .n { font-size: var(--step-small); font-weight: 600; color: var(--td-ink); margin-bottom: 8px; }
.flow-step h3 { font-size: var(--step-lead); }
.flow-step p { margin: 0; max-width: 30ch; }
.p-td .pull { color: var(--ink); }

.chart { max-width: 760px; margin-top: 40px; padding: clamp(24px, 3vw, 40px); background: var(--charcoal); color: var(--on-charcoal); }
.chart-title { font-weight: 600; margin-bottom: 20px; }
.chart-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 16px; padding: 12px 0; }
.chart-label { font-weight: 600; }
.chart-label small { display: block; font-weight: 500; font-size: var(--step-small); color: var(--td); }
.bars { display: grid; gap: 8px; }
.bar { display: flex; align-items: center; gap: 12px; font-size: var(--step-small); color: var(--charcoal-soft); }
.bar i { display: block; height: 12px; min-width: 3px; }
.bar.m i { background: var(--td); }
.bar.g i { background: #8fb3c9; }
.bar em { font-style: normal; color: var(--on-charcoal); min-width: 38px; }
.legend { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 18px; font-size: var(--step-small); color: var(--charcoal-soft); }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; }
.legend .m::before { background: var(--td); }
.legend .g::before { background: #8fb3c9; }

.findings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px; margin-top: 40px; }
.finding strong { display: block; font-size: clamp(2.5rem, 1.4rem + 3vw, 4.5rem); font-weight: 600; letter-spacing: -0.04em; line-height: 1; color: var(--td-ink); margin-bottom: 18px; }
.finding h3 { font-size: var(--step-lead); }
.finding p { margin: 0; max-width: 36ch; }

.closing { margin-top: var(--gap-section); padding: var(--gap-section) 0; background: var(--charcoal); color: var(--on-charcoal); }
.closing h2 { font-size: var(--step-head); letter-spacing: -0.03em; line-height: 1; margin-bottom: 24px; }
.closing p { font-size: var(--step-lead); line-height: 1.35; max-width: 40ch; margin-bottom: 36px; }
.closing .case-actions { margin-bottom: 0; }
.closing .btn-primary, .closing .btn-mas { background: var(--on-charcoal); color: var(--charcoal); }
.closing .btn-primary:hover, .closing .btn-mas:hover { background: var(--charcoal-soft); }
.closing .btn-secondary { color: var(--on-charcoal); border-color: var(--on-charcoal); }
.closing .btn-secondary:hover { background: var(--on-charcoal); color: var(--charcoal); }
.closing + footer, .case + footer { margin-top: 0; }

/* ---------- Motion (site.js adds .js on <html>) ---------- */
.js .rv { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
.js .rv.is-in { opacity: 1; transform: none; }
.js .mask > span { transform: translateY(105%); transition: transform 0.9s var(--ease-out); }
.js .is-loaded .mask > span { transform: none; }
.js .is-loaded .mask:nth-child(2) > span { transition-delay: 0.11s; }
@media (prefers-reduced-motion: reduce) {
  .js .rv { transform: none; transition: opacity 0.3s linear; }
  .js .mask > span { transform: none; transition: none; }
  .preview img, .btn { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .home-hero .hero-copy { grid-column: 1 / -1; }
  .project-list { grid-column: 1 / -1; }
  .preview { display: none; }
  .project .shot-mobile { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; margin-bottom: 20px; }
  .featured-top, .featured > p, .featured .stack-row, .featured .work-shot { grid-column: 1 / -1; }
  .featured .work-shot { grid-row: auto; order: -1; margin-bottom: 24px; }
  .featured { display: flex; flex-direction: column; }
  .cv-section > h2, .cv-section > *:not(h2) { grid-column: 1 / -1; }
  .cv-section > h2 { margin-bottom: 20px; }
  .figures { grid-template-columns: repeat(2, 1fr); row-gap: 36px; }
  .stack-grid, .findings { grid-template-columns: 1fr; }
  .outcomes, .flow { grid-template-columns: repeat(2, 1fr); }
  .decision h3, .decision p, .decision .ba { grid-column: 1 / -1; grid-row: auto; }
  .decision .ba { margin-top: 16px; }
}
@media (max-width: 560px) {
  .home-hero h1 { font-size: 21vw; }
  .page-header h1, .case-hero h1 { font-size: clamp(3rem, 15vw, 5rem); }
  .cv-page .page-header h1 { font-size: 16vw; }
  .outcomes, .flow { grid-template-columns: 1fr; }
  .chart-row { grid-template-columns: 1fr; gap: 8px; }
  .app-card { grid-template-columns: 56px 1fr; gap: 16px; }
  .app-icon { width: 56px; height: 56px; border-radius: 13px; }
  .nav-links { gap: 18px; }
}
.case > .container figcaption { color: var(--muted); }

/* ---------- Round 2: editorial grid for case sections, fewer sizes ---------- */
:root { --step-head: clamp(1.9rem, 1.1rem + 3.4vw, 4.5rem); }
.figures { margin-top: clamp(48px, 6vw, 80px); }
.figure strong, .finding strong, .project-figure, .ba b { font-size: var(--step-head); }
.footer-name { font-size: var(--step-display); }

.case-section {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: start;
}
.case-section > .prose { display: contents; }
.case-section > * { grid-column: 5 / -1; }
.case-section h2 { grid-column: 1 / 5; grid-row: 1 / span 8; margin-bottom: 24px; position: sticky; top: 32px; }
.case-section > .prose > * { grid-column: 5 / -1; max-width: var(--measure); }
.case-section > .prose > h2 { grid-column: 1 / 5; max-width: 14ch; }
.case-section > .prose > h3 { margin-top: 32px; }
.case-section > .prose > h3:first-of-type { margin-top: 0; }
.case-section > .prose > p { margin-bottom: 18px; }
.case-section .case-shot.side { margin-top: 40px; }
.case-section .stack-grid { grid-template-columns: 1fr 1fr; gap: 40px 48px; }
.case-section .outcomes, .case-section .flow { grid-template-columns: repeat(2, 1fr); gap: 16px; }
.case-section .flow { gap: 36px 40px; }
.case-section .findings { grid-template-columns: 1fr; gap: 48px; }
.case-section pre.snippet, .case-section .steps, .case-section .chart, .case-section .pull, .case-section .lead { max-width: none; }
.decision h3, .decision p { grid-column: 1 / 8; }
.decision .ba { grid-column: 8 / -1; }
.p-mas .case-section:has(.decisions) .decisions { grid-column: 5 / -1; }

.closing .container { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
.closing h2 { grid-column: 1 / 6; }
.closing p, .closing .case-actions { grid-column: 7 / -1; }

.cv-section > *:not(h2) { grid-column: 4 / -1; }
.app-card { grid-template-columns: clamp(96px, 10vw, 140px) 1fr; gap: 32px; }
.app-icon { width: clamp(96px, 10vw, 140px); height: auto; aspect-ratio: 1; border-radius: 22%; }

@media (max-width: 900px) {
  .case-section > *, .case-section h2, .case-section > .prose > *, .case-section > .prose > h2,
  .p-mas .case-section:has(.decisions) .decisions { grid-column: 1 / -1; grid-row: auto; position: static; }
  .closing h2, .closing p, .closing .case-actions { grid-column: 1 / -1; }
  .decision h3, .decision p, .decision .ba { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .case-section .outcomes, .case-section .flow, .case-section .stack-grid { grid-template-columns: 1fr; }
}

/* Round 3 */
.case-section h2, .case-section > .prose > h2 { grid-column: 1 / 6; font-size: clamp(1.9rem, 1rem + 2.3vw, 3.25rem); max-width: 13ch; }
.case-section > *, .case-section > .prose > *, .p-mas .case-section:has(.decisions) .decisions { grid-column: 6 / -1; }
.decision { display: block; }
.decision .ba { display: block; margin-top: 18px; font-size: var(--step-body); }
.ba b { font-size: clamp(1.6rem, 1rem + 1.4vw, 2.4rem); }
.app-card { grid-template-columns: 160px 1fr; }
.app-icon { width: 160px; }
@media (max-width: 900px) {
  .app-card { grid-template-columns: 96px 1fr; }
  .app-icon { width: 96px; }
}
.case-section h2, .case-section > .prose > h2 { max-width: none; }
@media (max-width: 900px) {
  .case-section { display: block; }
  .case-section > .prose { display: block; }
  .case-section h2, .case-section > .prose > h2 { position: static; margin-bottom: 24px; }
  .case-section > * + *, .case-section > .prose > * + * { margin-top: 0; }
  .case-section .case-shot.side, .case-section .stack-grid, .case-section .outcomes,
  .case-section .flow, .case-section .findings, .case-section .chart, .case-section pre.snippet,
  .case-section .steps, .case-section .decisions, .case-section .pull { margin-top: 32px; }
  .closing .container { display: block; }
}
.p-mas .case-section:has(.decisions) h2 { position: static; }
.app-icon img { width: 100% !important; height: 100% !important; border-radius: 0 !important; }
.work-page .section { padding-top: clamp(72px, 8vw, 120px) !important; }
.case-section .outcomes { margin-bottom: 32px; }
.cv-section > p[style] { color: var(--ink) !important; }
.cv-item p, .cv-section > p { max-width: 56ch; }

/* ---------- Round 4: calmer scale, easier reading ---------- */
:root {
  --step-small: clamp(0.875rem, 0.86rem + 0.05vw, 0.9375rem);
  --step-body: clamp(1.0625rem, 1.02rem + 0.15vw, 1.125rem);
  --step-lead: clamp(1.1875rem, 1.1rem + 0.35vw, 1.375rem);
  --step-head: clamp(1.75rem, 1.2rem + 1.8vw, 3rem);
  --step-display: clamp(2.75rem, 1.4rem + 5vw, 6rem);
  --gap-section: clamp(72px, 8vw, 128px);
}
body { line-height: 1.6; }

/* Home: the name on one line, the copy beside it rather than in a far corner */
.home-hero { min-height: auto; padding-top: clamp(56px, 9vh, 112px); padding-bottom: clamp(64px, 9vh, 112px); row-gap: 28px; }
.home-hero h1 { font-size: var(--step-display); letter-spacing: -0.035em; line-height: 0.95; }
.home-hero .hero-copy { grid-column: 1 / 8; grid-row: auto; align-self: start; max-width: 58ch; }
.project-figure { font-size: clamp(2.5rem, 1.6rem + 2.6vw, 4rem); }

/* Page and case headers: a band, not a poster */
.page-header { padding: clamp(40px, 5vw, 72px) 0 clamp(40px, 5vw, 64px); }
.page-header h1, .case-hero h1, .cv-page .page-header h1 { font-size: var(--step-display); letter-spacing: -0.035em; line-height: 0.95; margin-bottom: 14px; }
.page-header p { font-size: var(--step-lead); }
.case-hero { padding: clamp(40px, 5vw, 72px) 0 clamp(48px, 5vw, 80px); }
.case-tagline { font-size: var(--step-lead); max-width: 46ch; }
.figure strong, .finding strong { font-size: clamp(2rem, 1.4rem + 1.8vw, 3.25rem); }
.case-section h2, .case-section > .prose > h2 { font-size: var(--step-head); }

/* Work: first project visible in the first screen */
.work-page .section { padding-top: clamp(48px, 5vw, 72px) !important; }
.group-title { font-size: var(--step-head); margin-bottom: 24px; }
.featured-top h3 { font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.5rem); }

/* Footer: one quiet line */
footer { padding: clamp(40px, 5vw, 64px) var(--margin); }
.footer-links { display: flex; gap: 28px; flex-wrap: wrap; }
.footer-links a { font-size: var(--step-body); }

@media (max-width: 900px) {
  .home-hero .hero-copy { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .home-hero h1 { font-size: clamp(2.5rem, 12vw, 3.25rem); }
  .page-header h1, .case-hero h1, .cv-page .page-header h1 { font-size: clamp(2.25rem, 11vw, 3rem); }
}
.projects { padding-top: clamp(56px, 6vw, 88px); }
.projects-head { max-width: none; margin-bottom: clamp(36px, 4vw, 56px); }
.case-section h2, .case-section > .prose > h2 { position: static; }
@media (prefers-reduced-motion: reduce) {
  .js .rv { opacity: 1 !important; transform: none !important; }
}
/* Only MetArenaStats is a live product: the dot follows the project, not the position */
.featured .live-dot { display: inline-block !important; }
a[href="/work/trustdesk"] .live-dot { display: none !important; }
.more { justify-content: flex-start; }

/* Home preview: stick at mid-screen and end level with the last project.
   --preview-h is the preview's height (columns 7-12 of the 12-column grid, 16:10). */
.projects-body { --col: calc((100vw - 2 * var(--margin) - 11 * 24px) / 12); --preview-h: calc((6 * var(--col) + 5 * 24px) * 0.625); }
.preview { top: max(88px, calc(50vh - var(--preview-h) / 2)); }
.project { min-height: var(--preview-h); }
@media (max-width: 900px) { .project { min-height: 0; } }
