/* ═══════════════════════════════════════════════════════════
   portfolio.css  —  shared design system for all case studies
   v2: all-Inter, flat stats/flow, WCAG AA both modes
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&display=swap');

/* ─────────────────────────────────────────────
   TOKENS — Light
   Contrast ratios (WCAG AA = 4.5:1 normal, 3:1 large)
   --primary  #e5501f  →  4.7:1 on white   ✓
   --text     #111111  →  19:1  on white    ✓
   --muted    #555555  →  7.5:1 on white    ✓ (body copy)
   --subtle   #7a7a77  →  4.6:1 on white    ✓ (captions/meta)
───────────────────────────────────────────── */
:root {
  --primary:  #e5501f;
  --bg:       #ffffff;
  --surface:  #f6f6f5;
  --surface2: #eceae8;
  --border:   #e2e0dd;
  --text:     #111111;
  --muted:    #555555;
  --subtle:   #7a7a77;
  --sans:     'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius:   4px;
  --content-max: 680px;
  --toc-w:       180px;

  /* Chips */
  --chip-pro-bg:   rgba(0,120,70,.07);  --chip-pro-text: #005c35;  --chip-pro-bd: rgba(0,120,70,.18);
  --chip-con-bg:   rgba(175,35,0,.07);  --chip-con-text: #8f1d00;  --chip-con-bd: rgba(175,35,0,.18);
  --chip-win-bg:   rgba(0,100,200,.07); --chip-win-text: #0055b3;  --chip-win-bd: rgba(0,100,200,.18);

  /* Tags */
  --tag-good-bg: rgba(229,80,31,.07);  --tag-good-txt: #b83a0c;  --tag-good-bd: rgba(229,80,31,.2);
  --tag-bad-bg:  rgba(150,25,0,.06);   --tag-bad-txt:  #8a1800;  --tag-bad-bd:  rgba(150,25,0,.16);
}

/* ─────────────────────────────────────────────
   TOKENS — Dark
   --primary  #ff7550  →  5.1:1 on #101010   ✓
   --text     #f2f2f0  →  16:1  on #101010   ✓
   --muted    #a8a8a5  →  6.2:1 on #101010   ✓
   --subtle   #737370  →  4.6:1 on #101010   ✓
───────────────────────────────────────────── */
[data-theme="dark"] {
  --primary:  #ff7550;
  --bg:       #101010;
  --surface:  #1c1c1c;
  --surface2: #262626;
  --border:   #303030;
  --text:     #f2f2f0;
  --muted:    #a8a8a5;
  --subtle:   #737370;

  --chip-pro-bg:   rgba(60,200,120,.08); --chip-pro-text: #36d494; --chip-pro-bd: rgba(60,200,120,.18);
  --chip-con-bg:   rgba(255,115,65,.07); --chip-con-text: #ff8c58; --chip-con-bd: rgba(255,115,65,.18);
  --chip-win-bg:   rgba(70,150,255,.1);  --chip-win-text: #6aadff; --chip-win-bd: rgba(70,150,255,.22);

  --tag-good-bg: rgba(255,117,80,.1);  --tag-good-txt: #ff9268; --tag-good-bd: rgba(255,117,80,.24);
  --tag-bad-bg:  rgba(255,85,65,.07);  --tag-bad-txt:  #ff7e68; --tag-bad-bd:  rgba(255,85,65,.16);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary:  #ff7550;
    --bg:       #101010;
    --surface:  #1c1c1c;
    --surface2: #262626;
    --border:   #303030;
    --text:     #f2f2f0;
    --muted:    #a8a8a5;
    --subtle:   #737370;

    --chip-pro-bg:   rgba(60,200,120,.08); --chip-pro-text: #36d494; --chip-pro-bd: rgba(60,200,120,.18);
    --chip-con-bg:   rgba(255,115,65,.07); --chip-con-text: #ff8c58; --chip-con-bd: rgba(255,115,65,.18);
    --chip-win-bg:   rgba(70,150,255,.1);  --chip-win-text: #6aadff; --chip-win-bd: rgba(70,150,255,.22);

    --tag-good-bg: rgba(255,117,80,.1);  --tag-good-txt: #ff9268; --tag-good-bd: rgba(255,117,80,.24);
    --tag-bad-bg:  rgba(255,85,65,.07);  --tag-bad-txt:  #ff7e68; --tag-bad-bd:  rgba(255,85,65,.16);
  }
}

/* ─────────────────────────────────────────────
   RESET
───────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 17px; line-height: 1.7;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .2s, color .2s;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 2px; }

/* ─────────────────────────────────────────────
   NAV
───────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 200;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
}
.topnav-left a {
  color: var(--subtle); text-decoration: none;
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color .15s;
}
.topnav-left a:hover { color: var(--text); text-decoration: none; }
.theme-toggle {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 10px; cursor: pointer;
  color: var(--subtle); display: flex; align-items: center;
  transition: color .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ─────────────────────────────────────────────
   LAYOUT
───────────────────────────────────────────── */
.page-body { display: flex; justify-content: center; min-height: 100vh; }
.main-content { width: 100%; max-width: var(--content-max); padding: 0 28px; margin: 0 auto; }

/* Wide image breakout */
.img-wide {
  width: min(960px, 100vw);
  margin-left: 50%; transform: translateX(-50%);
  margin-top: 36px; margin-bottom: 8px;
  /* Matt Ström "placed" frame — surface colour bleeds around image */
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
}
.img-wide img, .img-wide video {
  width: 100%; display: block;
  border-radius: 10px;
  /* GIF fix: match background so baked-in white corners are invisible */
  background: var(--surface);
}

/* Dark mode: deeper surface so frame reads as a real stage */
[data-theme="dark"] .img-wide { background: var(--surface2); }
[data-theme="dark"] .img-wide img,
[data-theme="dark"] .img-wide video { background: var(--surface2); }
.img-full { width: 100vw; margin-left: 50%; transform: translateX(-50%); margin-top: 36px; margin-bottom: 8px; }
.img-full img, .img-full video { width: 100%; display: block; }

/* ─────────────────────────────────────────────
   TOC
───────────────────────────────────────────── */
.toc { position: fixed; top: 80px; right: 24px; left: auto; width: var(--toc-w); display: flex; flex-direction: column; z-index: 100; }
.toc-item {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; padding: 6px 0;
  font-size: 11px; font-weight: 400;
  color: var(--subtle); letter-spacing: .04em;
  transition: color .15s; line-height: 1.3;
}
.toc-item .toc-line { display: block; width: 14px; height: 1px; background: var(--border); flex-shrink: 0; transition: width .2s, background .2s; }
.toc-item:hover { color: var(--text); text-decoration: none; }
.toc-item.active { color: var(--text); font-weight: 500; }
.toc-item.active .toc-line { width: 22px; background: var(--primary); }

/* ─────────────────────────────────────────────
   SECTIONS
   Rule above each section only (not below).
   Hero never gets a rule.
───────────────────────────────────────────── */
section { padding: 80px 0; }
/* No dividers between sections — spacing + heading hierarchy is sufficient */
section.hero { border-top: none; }
section.hero + section { border-top: 1px solid var(--border); }

/* ─────────────────────────────────────────────
   TYPOGRAPHY — all Inter, no mono/serif
───────────────────────────────────────────── */
.section-tag {
  font-size: 11px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--subtle); margin-bottom: 14px;
}
h1, h2, h3, h4 { font-family: var(--sans); color: var(--text); }
h2 { font-size: clamp(26px, 4.5vw, 40px); font-weight: 600; line-height: 1.1; margin-bottom: 20px; letter-spacing: -.025em; }
h3 { font-size: 15px; font-weight: 600; line-height: 1.4; margin-bottom: 8px; }
p  { color: var(--muted); margin-bottom: 16px; font-size: 16px; line-height: 1.75; }
p:last-child { margin-bottom: 0; }
strong { color: var(--text); font-weight: 600; }
em { font-style: italic; }
h1 em, h2 em { color: var(--primary); font-style: italic; }

/* ─────────────────────────────────────────────
   HERO
───────────────────────────────────────────── */
.hero { padding: 88px 0 64px; }
.hero-tag {
  font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  color: var(--primary); margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
}
.hero-tag::before { content: ''; width: 24px; height: 1px; background: var(--primary); display: block; }
.hero h1 { font-size: clamp(34px, 5.5vw, 56px); font-weight: 700; line-height: 1.07; margin-bottom: 18px; letter-spacing: -.03em; }
.hero-sub { font-size: 18px; color: var(--muted); max-width: 520px; line-height: 1.65; margin-bottom: 40px; }

/* Meta strip — no borders, pure spacing */
.meta-strip { display: grid; grid-template-columns: repeat(4,1fr); margin-top: 36px; }
.meta-item { padding: 0 24px 0 0; }
.meta-item + .meta-item { padding-left: 0; }
.meta-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--subtle); margin-bottom: 4px; }
.meta-value { font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--text); }


/* 3-item meta strip (when Timeline is omitted) */
.meta-strip.meta-strip--3 { grid-template-columns: repeat(3, 1fr); }
/* No separator lines on any meta strip variant */
@keyframes fadeUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.hero h1    { animation: fadeUp .5s ease both; }
.hero-sub   { animation: fadeUp .5s .07s ease both; }
.meta-strip { animation: fadeUp .5s .14s ease both; }

/* ─────────────────────────────────────────────
   STATS — flat, left-aligned, no background box
   Top + bottom rule. Column dividers.
───────────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); margin: 36px 0; gap: 0; }
.stat-item { padding: 0 32px 0 0; }
.stat-item + .stat-item { padding-left: 0; }
.stat-num  { font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -.03em; color: var(--primary); margin-bottom: 8px; }
.stat-label { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ─────────────────────────────────────────────
   CALLOUT
───────────────────────────────────────────── */
.callout {
  border-left: 2px solid var(--primary);
  padding: 14px 20px; background: var(--surface);
  border-radius: 0 calc(var(--radius)*2) calc(var(--radius)*2) 0;
  margin: 28px 0; font-size: 17px; line-height: 1.65;
  color: var(--text); font-style: italic;
}

/* ─────────────────────────────────────────────
   EXPANDABLE
───────────────────────────────────────────── */
.expandable { border: 1px solid var(--border); border-radius: calc(var(--radius)*2); overflow: hidden; margin-top: 16px; }
.expandable-trigger {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; cursor: pointer;
  background: var(--surface); font-size: 13px; font-weight: 500;
  user-select: none; transition: background .15s; gap: 10px; color: var(--muted);
}
.expandable-trigger .trigger-label svg { flex-shrink: 0; opacity: .5; }
.expandable-trigger:hover { background: var(--surface2); color: var(--text); }
.expandable-icon { width: 22px; height: 22px; border-radius: var(--radius); background: var(--surface2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: transform .25s; font-size: 14px; color: var(--muted); }
.expandable.open .expandable-icon { transform: rotate(45deg); }
.expandable-body { max-height: 0; overflow: hidden; transition: max-height .4s cubic-bezier(.4,0,.2,1); background: var(--surface); }
.expandable.open .expandable-body { max-height: 2000px; }
.expandable-content { padding: 18px 16px; border-top: 1px solid var(--border); }
.expandable-content p  { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.expandable-content ul { padding-left: 16px; color: var(--muted); font-size: 13px; }
.expandable-content li { margin-bottom: 6px; line-height: 1.65; }

/* ─────────────────────────────────────────────
   PLACEHOLDERS
───────────────────────────────────────────── */
.ph { background: var(--surface); border: 1px dashed var(--border); border-radius: calc(var(--radius)*3); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--subtle); font-size: 12px; text-align: center; padding: 24px 16px; line-height: 1.6; gap: 6px; }
.ph .phi { opacity: .28; display: flex; align-items: center; justify-content: center; }
.ph.tall  { min-height: 300px; }
.ph.med   { min-height: 200px; }
.ph.short { min-height: 140px; }

/* ─────────────────────────────────────────────
   IMAGE GRIDS
───────────────────────────────────────────── */
.grid-2x2 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; margin: 28px 0; border-radius: calc(var(--radius)*3); overflow: hidden; background: var(--surface2); border: 1px solid var(--border); min-height: 360px; }
.grid-2x2 .cell { overflow: hidden; position: relative; }
.grid-2x2 .cell img { width:100%; height:100%; object-fit:cover; display:block; }
.grid-2x2 .cell-left { grid-row: 1/3; }
.grid-2x2 .cell.ph { display:flex; flex-direction:column; align-items:center; justify-content:center; background:var(--surface); color:var(--subtle); font-size:11px; text-align:center; padding:12px; line-height:1.5; gap:4px; }
.grid-2x2 .cell.ph .phi { opacity:.25; display:flex; align-items:center; justify-content:center; }

.grid-phones { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin: 28px 0; align-items: end; }
.grid-phones .phone { background: var(--surface2); border: 1px solid var(--border); border-radius: calc(var(--radius)*5); overflow: hidden; }
.grid-phones .phone:nth-child(2) { transform: translateY(-22px); }
.grid-phones .phone img { width:100%; display:block; }
.grid-phones .phone.ph { display:flex; flex-direction:column; align-items:center; justify-content:center; color:var(--subtle); font-size:11px; text-align:center; padding:24px 14px; min-height:380px; line-height:1.5; gap:6px; }
.grid-phones .phone.ph .phi { opacity:.22; display:flex; align-items:center; justify-content:center; }

.img-cap { font-size: 12px; color: var(--subtle); text-align: center; margin-top: 8px; margin-bottom: 24px; letter-spacing: .03em; }

/* ─────────────────────────────────────────────
   FLOW — flat, no box/background on steps
   Arrow uses --muted: 7.5:1 light / 6.2:1 dark ✓
───────────────────────────────────────────── */
.flow { display: flex; align-items: center; justify-content: flex-start; margin: 24px 0; overflow-x: auto; padding-bottom: 4px; }
.flow-step { padding: 10px 8px; text-align: center; flex-shrink: 0; min-width: 88px; display: flex; flex-direction: column; align-items: center; }
.flow-step .fi { margin-bottom: 6px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.flow-step .fl { font-size: 12px; font-weight: 500; color: var(--muted); line-height: 1.3; text-align: center; }
.flow-arr { font-size: 14px; flex-shrink: 0; color: var(--muted); padding: 0 2px; margin-bottom: 20px; line-height: 1; }

/* ─────────────────────────────────────────────
   USER CARDS
───────────────────────────────────────────── */
.user-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; margin-bottom: 32px; }
.user-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--radius)*4); overflow: hidden;
}
/* Image sits flush at top of card */
.user-card-img {
  width: 100%; aspect-ratio: 4/3; overflow: hidden;
  background: var(--surface2);
}
.user-card-img img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
/* Placeholder when no image provided */
.user-card-img-ph {
  width: 100%; aspect-ratio: 4/3;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  color: var(--subtle); font-size: 11px;
}
.user-card-body { padding: 18px 20px 20px; }
/* Category label merged into heading area — plain text, no colour */
.user-type {
  font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--subtle); margin-bottom: 4px;
}
.user-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; line-height: 1.3; }
.user-card p  { font-size: 13px; line-height: 1.65; }
/* Tags — neutral pill, no colour coding */
.tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 12px; font-weight: 500;
  padding: 4px 11px; border-radius: 20px;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; gap: 5px;
}
/* Heroicon check inside tag — inherits text colour */
.tag svg { flex-shrink: 0; }
/* Keep good/bad classes but restyle both as neutral */
.tag.good { color: var(--muted); background: transparent; border-color: var(--border); }
.tag.bad  { color: var(--muted); background: transparent; border-color: var(--border); }

/* ─────────────────────────────────────────────
   EXPLORATION CARDS
───────────────────────────────────────────── */
/* ── Timeline (Design Exploration) — Variant C ── */
.timeline { position: relative; margin-top: 40px; padding-left: 0; }

/* Vertical spine — drawn as left-border on each item except the last */
.timeline::before { display: none; } /* disable global spine */
.tl-item::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 20px; /* start from node centre */
  bottom: -48px; /* extend to next item's node */
  width: 1px;
  background: var(--border);
  z-index: 0;
}
.tl-item:last-child::before { display: none; } /* no line after last step */

.tl-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 0 20px;
  margin-bottom: 48px;
  position: relative;
}
.tl-item:last-child { margin-bottom: 0; }

/* Step number node — top-aligned via align-self */
.tl-n {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  color: var(--subtle); letter-spacing: .04em;
  flex-shrink: 0;
  align-self: flex-start; /* FIX: pins to top of card, not centre */
  position: relative; z-index: 1;
  transition: border-color .15s, color .15s;
}
.tl-item.sel .tl-n {
  border-color: #16a34a;
  color: #16a34a;
  background: color-mix(in srgb, #16a34a 6%, var(--bg));
}

/* Content area — no top padding, node aligns to card top */
.tl-body { padding-top: 0; }

/* Card — image on top, text below (Variant C) */
.tl-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tl-item.sel .tl-card {
  border-color: color-mix(in srgb, #16a34a 35%, var(--border));
}

/* Image — full width at top */
.tl-img {
  width: 100%;
  height: 220px;
  overflow: hidden;
  position: relative;
  background: var(--surface2);
  display: flex; align-items: flex-start;
}
.tl-img img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
/* Gradient fade: image bleeds into card background */
.tl-img::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
/* Shipped card: plain image bg — no tint (tint obscures image detail) */
.tl-item.sel .tl-img {
  background: var(--surface2);
}

/* Placeholder when no image */
.tl-img-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--subtle); font-size: 11px;
}

/* Text area */
.tl-text { padding: 14px 22px 22px; }
.tl-text h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.tl-text p  { font-size: 13px; line-height: 1.65; color: var(--muted); }

/* Shipped badge */
.tl-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 600;
  color: var(--primary); letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 4px;
}
.tl-badge svg { opacity: .9; }
/* Shipped card badge uses green to match node + border */
.tl-item.sel .tl-badge { color: #16a34a; }

/* Chips */
.chips { display: flex; gap: 5px; margin-top: 10px; flex-wrap: wrap; }
.chip  {
  font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 5px;
}
.chip svg { flex-shrink: 0; }
.chip.pro { background: var(--chip-pro-bg); color: var(--chip-pro-text); border: 1px solid var(--chip-pro-bd); }
.chip.con { background: var(--chip-con-bg); color: var(--chip-con-text); border: 1px solid var(--chip-con-bd); }
.chip.win { background: var(--chip-win-bg); color: var(--chip-win-text); border: 1px solid var(--chip-win-bd); }

/* Legacy */
.sel-badge { font-size: 10px; font-weight: 600; color: var(--primary); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 3px; }

/* Responsive */
@media (max-width: 620px) {
  .tl-img  { height: 180px; }
  .timeline::before { left: 15px; }
  .tl-n { width: 32px; height: 32px; font-size: 10px; }
  .tl-item { grid-template-columns: 32px 1fr; gap: 0 14px; }
}

/* ─────────────────────────────────────────────
   SOLUTION GRID
───────────────────────────────────────────── */
.sol-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.sol-card { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius)*3); padding: 20px; }
.sol-n { font-size: 10px; font-weight: 600; color: var(--primary); letter-spacing: .1em; margin-bottom: 8px; }
.sol-card h3 { font-size: 14px; margin-bottom: 6px; }
.sol-card p  { font-size: 13px; }

/* ─────────────────────────────────────────────
   IMPACT GRID — same flat ruled treatment as stats
───────────────────────────────────────────── */
.impact-grid { display: grid; grid-template-columns: repeat(4,1fr); margin: 32px 0; }
.impact-item { padding: 0 28px 0 0; }
.impact-num   { font-size: 24px; font-weight: 700; line-height: 1; color: var(--primary); margin-bottom: 7px; letter-spacing: -.02em; }
.impact-label { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ─────────────────────────────────────────────
   TRADE-OFFS
───────────────────────────────────────────── */
.prob-list { list-style: none; margin: 16px 0; }
.prob-list li { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 15px; color: var(--muted); align-items: flex-start; line-height: 1.65; }
.prob-list li:last-child { border-bottom: none; }
.p-dash { font-size: 12px; font-weight: 600; color: var(--primary); padding-top: 3px; flex-shrink: 0; }

/* ─────────────────────────────────────────────
   REFLECTION
───────────────────────────────────────────── */
.ref-list { display: flex; flex-direction: column; gap: 24px; margin-top: 24px; }
.ref-item { display: grid; grid-template-columns: 28px 1fr; gap: 14px; }
.r-n { font-size: 11px; font-weight: 600; color: var(--primary); padding-top: 2px; letter-spacing: .04em; }
.r-b h3 { font-size: 15px; margin-bottom: 5px; }
.r-b p  { font-size: 15px; }

/* ─────────────────────────────────────────────
   SIGN OFF
───────────────────────────────────────────── */
.signoff { text-align: center; padding: 72px 0 80px; }
.signoff p { font-size: 18px; color: var(--muted); font-style: italic; max-width: 420px; margin: 0 auto 20px; line-height: 1.55; }
.signoff a { color: var(--primary); text-decoration: none; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.signoff a:hover { text-decoration: underline; }



/* ── Video frame — 2-up videos with surface background ──
   Same Matt Ström "placed" treatment as .img-wide but for
   side-by-side video pairs. Each video gets a subtle frame
   with rounded corners, surface bg bleeds in dark mode.      */
/* ── Video container — single grey frame, two side-by-side videos
   One background container, videos scaled to ~70% width so padding
   is visible on both sides. No gap between the videos themselves.
   Matches img-wide breakout: 960px wide, surface bg, 16px radius.  */
.video-frame-pair {
  width: min(960px, 100vw);
  margin-left: 50%;
  transform: translateX(-50%);
  margin-top: 36px;
  margin-bottom: 8px;
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 40px;          /* generous L/R padding = visible bg */
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
[data-theme="dark"] .video-frame-pair { background: var(--surface2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .video-frame-pair { background: var(--surface2); }
}
/* Each video wrapper — no individual bg, just clip + label */
.video-frame {
  flex: 1;
  min-width: 0; /* prevent flex overflow */
  display: flex;
  flex-direction: column;
  align-items: center;
}
.video-frame video {
  /* 70% of its flex column = scaled down with padding visible */
  width: 70%;
  display: block;
  border-radius: 10px;
  background: var(--surface2);
}
.video-frame-label {
  font-size: 11px; font-weight: 500;
  color: var(--subtle);
  text-align: center;
  margin-top: 10px;
  letter-spacing: .03em;
}
@media (max-width: 680px) {
  .video-frame-pair {
    flex-direction: column;
    padding: 24px 28px;
    align-items: center;
  }
  .video-frame { width: 100%; }
  .video-frame video { width: 75%; }
}
/* ── Image blend — removes baked-in white/grey backgrounds ──
   Apply class="img-blend" to any <img> sitting on --surface bg
   multiply: white pixels become transparent on light backgrounds
   In dark mode we switch to a subtle override since multiply
   inverts on dark surfaces                                        */
/* img-blend: removes baked-in white/grey outer frames from images
   The parent .tl-img or .img-wide must have a background set (it does).
   isolation: isolate on the parent keeps multiply contained.           */
.img-blend {
  mix-blend-mode: multiply;
  display: block;
  width: 100%;
}
/* In dark mode multiply inverts — switch to normal, image shows as-is */
[data-theme="dark"] .img-blend {
  mix-blend-mode: normal;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .img-blend {
    mix-blend-mode: normal;
  }
}
/* The container needs isolation so blend doesn't leak to page bg */
.tl-img, .user-card-img {
  isolation: isolate;
}
/* Single-video variant — constrains width so the video matches the
   height/scale of videos in the two-up layout.
   The video stays at 70% of a ~half-width column, same as 2-up.    */
.video-frame-pair--single {
  justify-content: center;  /* centre the single video in the container */
}
.video-frame-pair--single .video-frame {
  flex: 0 0 45%;  /* same effective width as one column in the 2-up grid */
}
@media (max-width: 680px) {
  .video-frame-pair--single .video-frame { flex: 0 0 80%; }
}

/* img-wide--flush: removes padding for images that already have their
   own background (e.g. hero GIFs with a baked-in background colour).
   The inner border-radius matches the container so corners still clip. */
.img-wide--flush {
  padding: 0;
}
.img-wide--flush img,
.img-wide--flush video {
  border-radius: 16px;
}

/* ── 4-column image + caption grid ──────────────────────────────────────────
   Outer container matches video-frame treatment: surface bg, 16px radius,
   24px padding. Inner grid holds 4 columns with arrows between them.       */
.img-col-container {
  width: min(960px, 100vw);
  margin-left: 50%;
  transform: translateX(-50%);
  margin-top: 28px;
  margin-bottom: 8px;
  background: var(--surface);
  border-radius: 16px;
  padding: 24px 28px 20px;
}
[data-theme="dark"] .img-col-container { background: var(--surface2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .img-col-container { background: var(--surface2); }
}
.img-col-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: start;
  gap: 0 8px;
}
.img-col { display: flex; flex-direction: column; align-items: center; }
.img-col-frame {
  width: 100%;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: unset;
  display: flex; align-items: flex-start;
}
[data-theme="dark"] .img-col-frame { background: #1a1a1a; }
.img-col-frame img {
  height: auto;         /* was 100% — now natural height */
  object-fit: unset;    /* was cover — no longer needed */
}
.img-col-icon {
  margin-top: 8px;
  color: var(--muted);
  opacity: .55;
  display: flex; align-items: center; justify-content: center;
}
.img-col-label {
  font-size: 11px; font-weight: 500;
  color: var(--subtle);
  text-align: center;
  margin-top: 3px;
  letter-spacing: .02em;
}
/* Align arrow to image centre dynamically */
.img-col-arrow {
  padding-top: 0;       /* remove the fixed 60px offset */
  align-self: center;   /* vertically centres in the grid row */
  margin-bottom: 42px;  /* eyeballed offset to account for icon + label below image */
}
@media (max-width: 680px) {
  .img-col-container { padding: 20px 16px 16px; }
  .img-col-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .img-col-arrow { display: none; }
}

/* flow-wrap: centers the step diagram under the img-wide container
   matches the 960px breakout width so it aligns optically            */
.flow-wrap {
  width: min(960px, 100vw);
  margin-left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  margin-top: 20px;
  margin-bottom: 4px;
}
/* Longer arrow — give it more visual weight between steps */
.flow-arr {
  font-size: 13px;
  flex-shrink: 0;
  color: var(--muted);
  padding: 0 4px;
  margin-bottom: 20px;
  line-height: 1;
  opacity: .45;
  letter-spacing: -2px; /* tighten the dashes */
}

/* ─────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────── */
@media (max-width: 1140px) { .toc { display: none; } }

@media (max-width: 680px) {
  body { font-size: 16px; }
  section { padding: 56px 0; }
  .hero { padding: 56px 0 44px; }
  .main-content { padding: 0 20px; }
  .meta-strip,
  .meta-strip.meta-strip--3 { grid-template-columns: 1fr 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .stat-item { padding: 0 0 24px; }
  .stat-item + .stat-item { padding-left: 0; }
  .user-grid  { grid-template-columns: 1fr; }
  .sol-grid   { grid-template-columns: 1fr; }
  .impact-grid { grid-template-columns: 1fr 1fr; }
  .grid-phones { grid-template-columns: repeat(3,160px); overflow-x: auto; padding-bottom: 8px; }
  .grid-phones .phone:nth-child(2) { transform: none; }
  .grid-2x2 { grid-template-columns: 1fr; grid-template-rows: auto; min-height: auto; }
  .grid-2x2 .cell-left { grid-row: auto; }
  .grid-2x2 .cell.ph { min-height: 150px; }
  .exp-card { grid-template-columns: 28px 1fr; }
  h2 { font-size: 24px; }
  .stat-num { font-size: 36px; }
  .img-wide { margin-top: 24px; }
}

@media (max-width: 440px) {
  .impact-grid { grid-template-columns: 1fr; gap: 20px 0; }
  .meta-strip,
  .meta-strip.meta-strip--3 { grid-template-columns: 1fr; }
  .meta-item + .meta-item { padding-top: 16px; }
}

/* ─────────────────────────────────────────────
   VIDEO PAIR (2-up side by side)
───────────────────────────────────────────── */
.video-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 36px;
  overflow: hidden;
}
.video-pair video {
  width: 100%;
  display: block;
  border-radius: calc(var(--radius) * 3);
}
@media (max-width: 480px) {
  .video-pair { grid-template-columns: 1fr; }
}


/* ═══════════════════════════════════════════════════════════
   GLASS PILL NAV  — centered segmented control, Apple-inspired
═══════════════════════════════════════════════════════════ */

/* Rework topnav to support centered pill */
.topnav-right { display: flex; justify-content: flex-end; }

.glass-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 100px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 0 0 0.5px rgba(0,0,0,.04);
}

.gnav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--sans);
  color: var(--subtle);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color .2s ease;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
}
.gnav-item:hover { color: var(--text); text-decoration: none; }

.gnav-item.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.10), 0 0 0 0.5px rgba(0,0,0,.06);
}

[data-theme="dark"] .gnav-item.active {
  background: var(--surface2);
  box-shadow: 0 1px 4px rgba(0,0,0,.3), 0 0 0 0.5px rgba(255,255,255,.06);
}

/* Divider pip between About and theme icon */
.gnav-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

/* Theme toggle inside pill */
.gnav-theme {
  padding: 6px 10px;
  line-height: 0;
}
.gnav-theme svg { display: block; }


/* ═══════════════════════════════════════════════════════════
   NEXT CASE STUDY  — end-of-page crosslink
═══════════════════════════════════════════════════════════ */

.next-study {
  padding: 48px 0 0;
  margin-top: 0;
}

.next-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: 16px;
}

/* Image-top card layout */
.next-card {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  overflow: hidden;
  transition: background .2s, border-color .2s, transform .25s cubic-bezier(.22,.68,0,1.2);
}
.next-card:hover {
  background: var(--surface2);
  border-color: color-mix(in srgb, var(--border) 60%, var(--subtle));
  transform: translateY(-3px);
}

/* Hero image strip */
.next-card-img {
  width: 100%;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  background: var(--surface2);
}
.next-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.next-card:hover .next-card-img img { transform: scale(1.02); }

/* Text body */
.next-card-body {
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Title row: name left, year right */
.next-card-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.next-card h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.next-year {
  font-size: 12px;
  font-weight: 500;
  color: var(--subtle);
  white-space: nowrap;
  flex-shrink: 0;
}

.next-card p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}


/* ═══════════════════════════════════════════════════════════
   SITE FOOTER
═══════════════════════════════════════════════════════════ */

.site-footer {
  margin-top: 48px;
  padding: 28px 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--subtle);
  text-decoration: none;
  transition: color .15s;
}
.footer-link:hover { color: var(--text); text-decoration: none; }
.footer-link svg { flex-shrink: 0; }


/* ── Nav logo ── */
.nav-logo {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.02em;
  white-space: nowrap;
  transition: opacity .15s;
}
.nav-logo:hover { opacity: .65; text-decoration: none; }

/* ── About page: remove top border from first row after a section label ── */
.ab-label + .exp-item,
.ab-label + .edu-item,
.ab-label + .award-item { border-top: none; }

.about-photo img {border-radius: 50%;}

/* ── Index project card: theme-aware body bar ── */
.pc-body {
  background: var(--surface2);
  padding: 22px 28px 26px;
  transition: background .2s;
}
.pc-title { color: var(--text); }
.pc-desc  { color: var(--muted); }
.pc-year  { color: var(--subtle); }

/* ── Topnav inner wrapper — constrains nav content to match page body width ── */
.topnav-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* Wide variant matches index-body 720px */
.topnav-inner--wide {
  max-width: 720px;
  margin: 0 auto;
  padding: 0;
}
/* Default (case studies) — matches content-max 680px */
.topnav-inner--narrow {
  max-width: calc(var(--content-max) - 56px);
  margin: 0 auto;
}
