/* =========================================================================
   CASE PAGE — DESIGN SYSTEM
   8pt spacing · Editorial type scale · Reusable components
   Designed to read as a continuous extension of Portfolio.html
   ========================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Figtree:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");

/* ---------- TOKENS ---------- */
:root {
  /* spacing — 8pt scale */
  --s-1: 8px;
  --s-2: 16px;
  --s-3: 24px;
  --s-4: 32px;
  --s-5: 48px;
  --s-6: 64px;
  --s-7: 96px;
  --s-8: 128px;
  --s-9: 160px;
  --s-10: 192px;

  /* type scale */
  --t-display: clamp(3rem, 7.5vw, 6.5rem);   /* hero */
  --t-h1:      clamp(2.25rem, 4.4vw, 3.5rem); /* section title */
  --t-h2:      clamp(1.5rem, 2.4vw, 2rem);    /* subhead */
  --t-lead:    clamp(1.1875rem, 1.6vw, 1.5rem); /* lead paragraph */
  --t-body:    1.0625rem;                      /* 17 */
  --t-small:   0.9375rem;                      /* 15 */
  --t-caption: 0.8125rem;                      /* 13 */
  --t-mono:    0.75rem;                        /* 12 */

  /* typography families — match portfolio */
  --font-display: "Instrument Serif", Georgia, serif;
  --font-sans:    "Figtree", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  /* colors — match portfolio */
  --bg:      oklch(0.975 0.008 75);
  --bg-elev: oklch(0.985 0.006 75);
  --ink:     oklch(0.22 0.012 60);
  --ink-2:   oklch(0.42 0.012 60);
  --ink-3:   oklch(0.62 0.010 60);
  --rule:    oklch(0.90 0.010 75);

  /* case-tint accents (mirror portfolio palette) */
  --sage:  oklch(0.86 0.055 145);
  --sky:   oklch(0.87 0.050 230);
  --sand:  oklch(0.90 0.045 80);
  --blush: oklch(0.88 0.045 30);
  --lilac: oklch(0.88 0.050 305);

  /* layout */
  --max:        1320px;
  --gutter:     clamp(20px, 4vw, 56px);
  --col-gap:    var(--s-4);
  --content:    900px;       /* readable measure */
  --radius:     14px;
  --radius-lg:  22px;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--sage); color: var(--ink); }

html {
  /* native, smooth cross-page transition where supported */
  view-transition-name: root;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--t-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- LAYOUT PRIMITIVES ---------- */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.measure { max-width: var(--content); }

/* 12-col grid container for editorial layouts */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--col-gap);
  row-gap: var(--s-4);
}
.col-span-3  { grid-column: span 3; }
.col-span-4  { grid-column: span 4; }
.col-span-5  { grid-column: span 5; }
.col-span-6  { grid-column: span 6; }
.col-span-7  { grid-column: span 7; }
.col-span-8  { grid-column: span 8; }
.col-span-9  { grid-column: span 9; }
.col-span-12 { grid-column: span 12; }
.col-start-2 { grid-column-start: 2; }
.col-start-3 { grid-column-start: 3; }
.col-start-4 { grid-column-start: 4; }
.col-start-5 { grid-column-start: 5; }
.col-start-6 { grid-column-start: 6; }

/* ---------- TYPE COMPONENTS ---------- */
.t-display, .case-hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-display);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0;
}
.t-display em { font-style: italic; color: var(--ink-2); font-weight: 300; }
.t-display .em { font-style: italic; color: var(--ink-2); font-weight: 300; }

.t-h1, h1.t-h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-h1);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
}
.t-h1 em { font-style: italic; color: var(--ink-2); font-weight: 300; }

.t-h2, h2.t-h2, h3.t-h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-h2);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
}
.t-h2 em { font-style: italic; color: var(--ink-2); }

.t-lead {
  font-family: var(--font-display);
  font-size: var(--t-lead);
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0;
}
.t-lead em { font-style: italic; color: var(--ink-2); }

.t-body, p.t-body {
  font-size: var(--t-body);
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0;
  text-wrap: pretty;
}
.t-body b { color: var(--ink); font-weight: 500; }

.t-small {
  font-size: var(--t-small);
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
}

.t-caption {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0;
}

.t-mono {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- HEADER ---------- */
header.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklch, var(--bg) 85%, transparent);
  backdrop-filter: saturate(135%) blur(10px);
  -webkit-backdrop-filter: saturate(135%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s;
}
header.nav.scrolled { border-color: var(--rule); }
header.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  gap: var(--s-3);
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: var(--t-small);
}
.brand .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink); transform: translateY(-2px);
  display: inline-block;
}
.brand b { font-weight: 500; }
.brand .role {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-2);
  font-weight: 300;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: var(--t-small);
  padding: 8px 0;
  transition: color .2s, gap .25s;
}
.back-link:hover { color: var(--ink); gap: 14px; }
.back-link svg { transition: transform .25s; }
.back-link:hover svg { transform: translateX(-3px); }

/* ---------- CASE HERO ---------- */
.case-hero {
  padding-top: var(--s-7);
  padding-bottom: var(--s-6);
}
.case-hero .meta-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--ink-3);
  margin-bottom: var(--s-5);
  flex-wrap: wrap;
}
.case-hero .pip {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--ink-3); display: inline-block;
}
.case-hero h1 {
  margin: 0 0 var(--s-5);
  max-width: 16ch;
}
.case-hero .hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: var(--col-gap);
  align-items: end;
}
.case-hero .intro {
  display: flex; flex-direction: column;
  gap: var(--s-3);
  padding-bottom: var(--s-3);
}
.case-hero .intro p { max-width: 38ch; }
.case-hero .key-visual {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  overflow: hidden;
  view-transition-name: case-cover;
}
.case-hero .key-visual.tinted.lilac { background: var(--lilac); }
.case-hero .key-visual.tinted.sage  { background: var(--sage); }
.case-hero .key-visual.tinted.sky   { background: var(--sky); }
.case-hero .key-visual.tinted.sand  { background: var(--sand); }
.case-hero .key-visual.tinted.blush { background: var(--blush); }
.case-hero .key-visual img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.case-hero .key-visual img.contain {
  object-fit: contain;
  padding: var(--s-4);
}

/* fact strip under hero */
.case-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-2) var(--s-4);
  margin-top: var(--s-6);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.case-facts .fact { display: flex; flex-direction: column; gap: 4px; }
.case-facts .fact .k { font-family: var(--font-mono); font-size: var(--t-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.case-facts .fact .v { font-size: var(--t-small); color: var(--ink); }

/* ---------- SECTION CONTAINER ---------- */
section.section {
  padding: var(--s-7) 0;
}
section.section.tight { padding: var(--s-5) 0; }
section.section + section.section { padding-top: 0; }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--col-gap);
  margin-bottom: var(--s-5);
  align-items: baseline;
}
.section-head .label { color: var(--ink-3); }
.section-head .title em { font-style: italic; color: var(--ink-2); }

/* simple two-column text block for context/problem */
.text-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--col-gap);
  align-items: start;
}
.text-block .body { display: flex; flex-direction: column; gap: var(--s-3); }
.text-block ul { margin: 0; padding: 0 0 0 1.1em; color: var(--ink-2); }
.text-block ul li { margin: 0 0 6px; }

/* pull quote */
.pull {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.6vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
  max-width: 22ch;
  margin: 0;
}
.pull em { font-style: italic; color: var(--ink-2); }

/* ---------- IMAGE BLOCKS (reusable) ---------- */
.figure {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.figure .frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  aspect-ratio: var(--ratio, 16 / 10);
}
.figure .frame.tinted.lilac { background: var(--lilac); border-color: transparent; }
.figure .frame.tinted.sage  { background: var(--sage);  border-color: transparent; }
.figure .frame.tinted.sky   { background: var(--sky);   border-color: transparent; }
.figure .frame.tinted.sand  { background: var(--sand);  border-color: transparent; }
.figure .frame.tinted.blush { background: var(--blush); border-color: transparent; }
.figure .frame > img,
.figure .frame > .ph {
  position: absolute; inset: 0;
}
.figure .frame > img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.figure .frame > img.contain {
  object-fit: contain; padding: var(--s-3);
}
.figure .frame > .ph {
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--ink) 65%, transparent);
  text-transform: uppercase;
  background:
    repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--ink) 5%, transparent) 10px 11px);
}
.figure .caption {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--t-caption);
  color: var(--ink-3);
}
.figure .caption .num {
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.figure .caption .desc { font-family: var(--font-sans); text-transform: none; letter-spacing: 0; }

/* aspect ratio helpers */
.ratio-21x9  { --ratio: 21 / 9; }
.ratio-16x9  { --ratio: 16 / 9; }
.ratio-16x10 { --ratio: 16 / 10; }
.ratio-4x3   { --ratio: 4 / 3; }
.ratio-1x1   { --ratio: 1 / 1; }
.ratio-3x4   { --ratio: 3 / 4; }
.ratio-9x16  { --ratio: 9 / 16; }

/* full-bleed visual */
.bleed {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- PROCESS STEPS ---------- */
.steps { display: flex; flex-direction: column; gap: var(--s-7); }
.step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--col-gap);
  align-items: start;
}
.step .step-meta {
  position: sticky;
  top: 92px;
  display: flex; flex-direction: column;
  gap: var(--s-2);
}
.step .step-num {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.step .step-title {
  font-family: var(--font-display);
  font-size: var(--t-h2);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
}
.step .step-blurb {
  color: var(--ink-2);
  font-size: var(--t-small);
  max-width: 30ch;
}
.step .step-visuals {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--col-gap);
  row-gap: var(--s-3);
}
.step .step-visuals > .figure { grid-column: span 12; }
.step .step-visuals > .figure.half { grid-column: span 6; }
.step .step-visuals > .figure.third { grid-column: span 4; }

/* ---------- RESULTS ---------- */
.results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--col-gap);
  border-top: 1px solid var(--rule);
  padding-top: var(--s-4);
}
.results .result {
  display: flex; flex-direction: column;
  gap: 4px;
  padding-right: var(--s-3);
}
.results .result .num {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 4.5vw, 3.75rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.results .result .num em { font-style: italic; color: var(--ink-2); font-weight: 300; }
.results .result .lbl { font-size: var(--t-small); color: var(--ink-2); max-width: 22ch; }

/* ---------- REFLECTION ---------- */
.insights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--col-gap);
}
.insight { display: flex; flex-direction: column; gap: var(--s-2); }
.insight .num { font-family: var(--font-mono); font-size: var(--t-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.insight .body { color: var(--ink-2); font-size: var(--t-small); line-height: 1.6; }
.insight .body b { color: var(--ink); font-weight: 500; }

/* ---------- NEXT NAV ---------- */
.next-nav {
  border-top: 1px solid var(--rule);
  padding: var(--s-6) 0 var(--s-7);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--col-gap);
  align-items: end;
}
.next-nav .label { color: var(--ink-3); align-self: start; }
.next-nav .to {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-3);
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.022em;
  color: var(--ink);
  transition: gap .25s;
}
.next-nav .to:hover { gap: var(--s-4); }
.next-nav .to em { font-style: italic; color: var(--ink-2); font-weight: 300; }
.next-nav .to .arrow {
  width: 28px; height: 28px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--ink); border-radius: 50%;
  align-self: center;
  transition: background .2s, color .2s;
}
.next-nav .to:hover .arrow { background: var(--ink); color: var(--bg); }

/* ---------- FOOTER ---------- */
footer.ft {
  border-top: 1px solid var(--rule);
  padding: var(--s-3) 0;
  font-size: var(--t-caption);
  color: var(--ink-3);
}
footer.ft .wrap {
  display: flex; justify-content: space-between; gap: var(--s-2);
  flex-wrap: wrap;
}
footer.ft a:hover { color: var(--ink); }

/* ---------- COMING-SOON STUB ---------- */
.stub {
  padding: var(--s-7) 0 var(--s-9);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
}
.stub .badge {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--rule);
  padding: 6px 14px;
  border-radius: 999px;
}
.stub h2 { max-width: 22ch; }
.stub p { color: var(--ink-2); max-width: 50ch; margin: 0; }
.stub .actions {
  display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center;
  margin-top: var(--s-2);
}
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: var(--t-small);
  font-weight: 500;
  background: var(--ink);
  color: var(--bg);
  transition: background .2s;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 82%, white); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}
.btn.ghost:hover { background: var(--bg-elev); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 960px) {
  .case-hero .hero-grid { grid-template-columns: 1fr; }
  .case-facts { grid-template-columns: repeat(2, 1fr); }
  .section-head, .text-block, .step, .next-nav {
    grid-template-columns: 1fr;
  }
  .step .step-meta { position: static; }
  .results { grid-template-columns: repeat(2, 1fr); }
  .insights { grid-template-columns: 1fr; }
  .step .step-visuals > .figure.half,
  .step .step-visuals > .figure.third { grid-column: span 12; }
  .col-span-3, .col-span-4, .col-span-5, .col-span-6,
  .col-span-7, .col-span-8, .col-span-9 { grid-column: span 12; }
  .col-start-2, .col-start-3, .col-start-4, .col-start-5, .col-start-6 { grid-column-start: 1; }
}

/* ---------- VIEW TRANSITIONS (smooth in/out) ---------- */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 360ms;
    animation-timing-function: cubic-bezier(.2, .7, .2, 1);
  }
  ::view-transition-old(case-cover),
  ::view-transition-new(case-cover) {
    animation-duration: 460ms;
    animation-timing-function: cubic-bezier(.2, .7, .2, 1);
  }
}
