/* ============ Tokens ============ */
:root {
  --paper: #f4f1ea;
  --paper-2: #ebe6db;
  --card: #fffdf8;
  --ink: #16140f;
  --ink-2: #4a463d;
  --ink-3: #6b665a;
  --line: #d9d3c4;
  --grid: rgba(22, 20, 15, 0.06);
  --accent: #ff5a1f;      /* signal orange */
  --accent-ink: #16140f;
  --accent-text: #c2410c;  /* darker orange for small text on paper */
  --accent-flip: #ff5a1f;  /* accent on the inverted (ink) boxes */
  --lime: #c8f04a;        /* highlighter */
  --blue: #3b5bff;
  --sticky: #ffe680;
  --sticky-2: #ffd1dc;
  --sticky-3: #cdeccf;
  --term-bg: #16140f;
  --term-ink: #ece7da;
  /* inverted blocks (dark cards/bands): stay dark in dark mode too, just lifted */
  --inv-bg: #16140f;
  --inv-ink: #f4f1ea;
  --shadow: 0 1px 0 rgba(22,20,15,.08), 0 10px 30px -12px rgba(22,20,15,.25);

  --f-display: "Instrument Serif", Georgia, serif;
  --f-sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --f-hand: "Caveat", "Comic Sans MS", cursive;

  --max: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-text: #ff5a1f;
    --paper: #12110e;
    --paper-2: #1b1915;
    --card: #1e1c17;
    --ink: #f1ece0;
    --ink-2: #bfb8a8;
    --ink-3: #8a8476;
    --line: #34302820;
    --line: #35312a;
    --grid: rgba(241, 236, 224, 0.05);
    --term-bg: #0a0907;
    --inv-bg: #2a2721;
    --inv-ink: #f1ece0;
    --sticky: #e9cf5a;
    --sticky-2: #e7a9b9;
    --sticky-3: #9fcfa3;
    --shadow: 0 1px 0 rgba(0,0,0,.4), 0 14px 34px -14px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  --accent-text: #ff5a1f;
  --paper: #12110e;
  --paper-2: #1b1915;
  --card: #1e1c17;
  --ink: #f1ece0;
  --ink-2: #bfb8a8;
  --ink-3: #8a8476;
  --line: #35312a;
  --grid: rgba(241, 236, 224, 0.05);
  --term-bg: #0a0907;
  --inv-bg: #2a2721;
  --inv-ink: #f1ece0;
  --sticky: #e9cf5a;
  --sticky-2: #e7a9b9;
  --sticky-3: #9fcfa3;
  --shadow: 0 1px 0 rgba(0,0,0,.4), 0 14px 34px -14px rgba(0,0,0,.7);
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  text-wrap: pretty; /* avoid a lone word on the last line */
}
h1, h2, h3, h4 { text-wrap: balance; }
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
::selection { background: var(--lime); color: #16140f; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--f-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.hand { font-family: var(--f-hand); }
.hl { background: linear-gradient(transparent 55%, var(--lime) 55%, var(--lime) 92%, transparent 92%); color: inherit; padding: 0 .1em; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 12px; }

/* ============ Nav ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  border-bottom: 1px dashed var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.logo { font-family: var(--f-mono); font-weight: 600; font-size: 15px; text-decoration: none; display: flex; align-items: center; gap: 2px; }
.logo .caret { display: inline-block; width: 8px; height: 16px; background: var(--accent); margin-left: 3px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav a.link { font-family: var(--f-mono); font-size: 13px; text-decoration: none; padding: 6px 10px; border-radius: 999px; color: var(--ink-2); }
.nav a.link:hover { background: var(--ink); color: var(--paper); }
.theme-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px; display: grid; place-items: center; }
.nav-right { display: flex; align-items: center; gap: 8px; }
@media (max-width: 720px) {
  .nav ul .hide-sm { display: none; }
  .nav a.link { padding: 6px 7px; font-size: 12px; }
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  padding: 12px 18px; border-radius: 999px;
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.accent:hover { box-shadow: 3px 3px 0 var(--ink); }

/* ============ Hero ============ */
.hero { padding: clamp(48px, 9vw, 110px) 0 60px; position: relative; overflow-x: clip; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 12px; padding: 6px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #2fbf5b; box-shadow: 0 0 0 4px rgba(47,191,91,.18); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(47,191,91,0); } }
.hero h1 {
  font-family: var(--f-display); font-weight: 400;
  font-size: clamp(46px, 8vw, 104px); line-height: .95; letter-spacing: -.02em;
  margin: 22px 0 22px;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero h1 .swap { display: inline-block; position: relative; }
.hero p.lede { font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-2); max-width: 44ch; margin: 0 0 28px; }
.avatar {
  display: inline-block; width: 1.8em; height: 1.8em; margin: -.3em .1em; vertical-align: middle;
  border-radius: 50%; object-fit: cover;
  border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line), var(--shadow);
  transform: rotate(-4deg);
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: 10px; }
.annot { position: absolute; font-family: var(--f-hand); font-size: 24px; color: var(--accent-text); line-height: 1; pointer-events: none; white-space: nowrap; }
.annot svg { display: block; }
@media (max-width: 900px) { .annot { display: none; } }

/* Terminal */
.term {
  background: var(--term-bg); color: var(--term-ink);
  border-radius: 14px; box-shadow: var(--shadow);
  font-family: var(--f-mono); font-size: 13.5px; line-height: 1.65;
  overflow: hidden; transform: rotate(1.2deg);
  border: 1px solid rgba(255,255,255,.06);
}
.term-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a362e; display: block; }
.term-bar i:nth-child(1) { background: #ff5f57; } .term-bar i:nth-child(2) { background: #febc2e; } .term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-left: 8px; color: #8a8476; font-size: 12px; }
.term-body { padding: 16px 18px 6px; min-height: 250px; max-height: 320px; overflow-y: auto; }
@media (max-width: 600px) { .term { font-size: 12.5px; } .term-body { padding: 14px 14px 4px; min-height: 170px; max-height: 260px; } }
.term-body .q { color: var(--lime); }
.term-body .q::before { content: "› "; color: var(--accent); }
.term-body .a { color: var(--term-ink); margin: 2px 0 14px; white-space: pre-wrap; text-wrap: pretty; }
.term-body .a a { color: var(--lime); }
.term-body .a b { color: #ff8a5c; font-weight: 600; }
.term-body .a .ln { display: block; }
.term-body .a .ln + .ln { margin-top: 3px; }
.term-body .cursor { display: inline-block; width: 8px; height: 15px; background: var(--term-ink); vertical-align: -2px; animation: blink 1s steps(1) infinite; }
.term-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 14px; border-top: 1px solid rgba(255,255,255,.08); }
.term-chips button {
  font: inherit; font-size: 12px; cursor: pointer;
  background: rgba(255,255,255,.06); color: var(--term-ink);
  border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 5px 11px;
}
.term-chips button:hover { background: var(--lime); color: #16140f; border-color: var(--lime); }
.term-chips button[disabled] { opacity: .45; cursor: default; background: transparent; color: var(--term-ink); }

/* Marquee */
.marquee { border-block: 1.5px solid var(--ink); background: var(--ink); color: var(--paper); overflow: hidden; transform: rotate(-1deg); margin: 30px -20px 0; }
.marquee-track { display: flex; gap: 36px; padding: 12px 0; width: max-content; animation: scroll 38s linear infinite; font-family: var(--f-mono); font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.marquee-track span::after { content: "✦"; margin-left: 36px; color: var(--accent); }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ============ Sections ============ */
section.block { padding: clamp(70px, 10vw, 120px) 0 0; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 36px; }
.sec-head .label { display: flex; align-items: center; gap: 10px; color: var(--ink-3); }
.sec-head .label b { color: var(--accent-text); font-weight: 600; }
.sec-head h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(38px, 5.4vw, 68px); line-height: 1; letter-spacing: -.015em; margin: 10px 0 0; }
.sec-head h2 em { color: var(--accent); }
.sec-head p { max-width: 40ch; color: var(--ink-2); margin: 0; }

/* Work cards */
.work-list { display: grid; gap: 28px; }
.work-card {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0;
  background: var(--card); border: 1.5px solid var(--ink); border-radius: 18px; overflow: hidden;
  text-decoration: none; position: relative;
  transition: transform .25s ease, box-shadow .25s ease;
}
.work-card:hover { transform: translate(-4px, -4px); box-shadow: 8px 8px 0 var(--ink); }
.work-card:nth-of-type(even) { grid-template-columns: 1fr 1.15fr; }
.work-card:nth-of-type(even) .work-media { order: 2; }
.work-media { position: relative; min-height: 320px; background: #0d0f14; overflow: hidden; }
.work-media img, .work-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.work-card:hover .work-media img { transform: scale(1.04); }
.work-body { padding: clamp(24px, 3.5vw, 40px); display: flex; flex-direction: column; gap: 14px; }
.work-body .meta { color: var(--ink-3); }
.work-body h3 { font-family: var(--f-display); font-weight: 400; font-size: clamp(34px, 4vw, 50px); line-height: 1; margin: 0; }
.work-body p { margin: 0; color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.tag { font-family: var(--f-mono); font-size: 11.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: var(--paper); }
.work-body .go { font-family: var(--f-mono); font-size: 13px; display: inline-flex; align-items: center; gap: 8px; }
.work-body .go span { transition: transform .2s; }
.work-card:hover .go span { transform: translateX(5px); }
.sticker {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  font-family: var(--f-hand); font-size: 22px; line-height: 1;
  background: var(--sticky); color: #16140f; padding: 8px 12px 6px; transform: rotate(-4deg);
  box-shadow: 0 6px 14px -6px rgba(0,0,0,.4);
}
@media (max-width: 820px) {
  .work-card, .work-card:nth-of-type(even) { grid-template-columns: 1fr; }
  .work-card:nth-of-type(even) .work-media { order: 0; }
  .work-media { min-height: 0; aspect-ratio: 16/9; }
}

/* Approach / principles */
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 820px) { .principles { grid-template-columns: 1fr; } }
.principle { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px; position: relative; }
.principle .n { font-family: var(--f-mono); font-size: 12px; color: var(--accent-text); }
.principle h3 { font-family: var(--f-display); font-weight: 400; font-size: 30px; margin: 10px 0 8px; line-height: 1.05; }
.principle p { margin: 0; color: var(--ink-2); font-size: 15.5px; }

/* Lab */
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.lab-card {
  background: var(--card); border: 1.5px solid var(--ink); border-radius: 14px; padding: 20px;
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
}
a.lab-card:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--accent); }
.lab-card .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.status { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.live { background: #dff5e4; color: #157a37; }
.status.building { background: #fff1c2; color: #8a6200; }
.status.idea { background: var(--paper-2); color: var(--ink-3); }
.lab-card h3 { font-size: 21px; font-weight: 600; margin: 4px 0 0; line-height: 1.2; letter-spacing: -.01em; }
.lab-card p { margin: 0; font-size: 15px; color: var(--ink-2); }
.lab-card .built { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); }
.lab-card .thumb { height: 140px; border-radius: 9px; overflow: hidden; background: #0d0f14; margin-bottom: 4px; position: relative; }
.lab-card .lab-note { font-family: var(--f-hand); font-size: 22px; color: var(--accent); line-height: 1; margin-top: auto; transform: rotate(-2deg); }
/* phones: lab cards become one swipeable row, next card peeks in */
@media (max-width: 600px) {
  .lab-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px; margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 18px; scrollbar-width: none; }
  .lab-grid::-webkit-scrollbar { display: none; }
  .lab-card { flex: 0 0 80%; scroll-snap-align: center; }
}
.swipe-hint { display: none; color: var(--ink-3); font-size: 12px; align-self: flex-end; }
@media (max-width: 600px) { .swipe-hint { display: block; } }
.lab-card.placeholder { border-style: dashed; background: transparent; justify-content: center; align-items: center; text-align: center; min-height: 260px; color: var(--ink-3); }
.lab-card.placeholder .big { font-family: var(--f-hand); font-size: 30px; color: var(--ink-2); line-height: 1.1; }

/* mini globe thumb for Places */
.globe { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 120%, #1f2a44, #0b0e16 70%); }
.globe .ball { width: 104px; height: 104px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #3a4766, #121826 70%); box-shadow: inset -12px -10px 24px rgba(0,0,0,.6), 0 0 40px rgba(120,150,255,.15); position: relative; }
.globe .pin { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #ffcf5a; box-shadow: 0 0 10px #ffcf5a; animation: twinkle 2.4s infinite; }
@keyframes twinkle { 50% { opacity: .35; } }
/* site thumb */
.site-thumb { position: absolute; inset: 0; background: var(--paper); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 14px 14px; padding: 16px; font-family: var(--f-display); font-size: 30px; line-height: .95; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; }
.site-thumb em { color: var(--accent); }
.site-thumb small { display: block; font-family: var(--f-mono); font-size: 10px; color: var(--ink-3); margin-bottom: 8px; }

/* Now board */
.now-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px; padding: 10px 4px; }
.note {
  background: var(--sticky); color: #16140f; padding: 22px 20px 24px; min-height: 190px; position: relative;
  box-shadow: 0 12px 22px -12px rgba(0,0,0,.45);
  transform: rotate(var(--r, -1.5deg)); transition: transform .2s ease;
}
.note:hover { transform: rotate(0deg) scale(1.03); z-index: 2; }
.note:nth-child(2) { background: var(--sticky-2); --r: 1.8deg; }
.note:nth-child(3) { background: var(--sticky-3); --r: -.8deg; }
.note:nth-child(4) { --r: 2.2deg; }
.note::before { content: ""; position: absolute; top: -12px; left: 50%; transform: translateX(-50%) rotate(-3deg); width: 86px; height: 24px; background: rgba(255,255,255,.55); border: 1px solid rgba(0,0,0,.05); }
.note .k { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .65; }
.note .v { font-family: var(--f-hand); font-size: 29px; line-height: 1.1; margin-top: 10px; }
.now-updated { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); margin-top: 18px; }

/* Contact */
.contact { padding: clamp(80px, 12vw, 140px) 0 60px; text-align: center; }
.contact h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(52px, 10vw, 140px); line-height: .9; letter-spacing: -.025em; margin: 18px 0 30px; }
.contact h2 em { color: var(--accent); }
.contact .row { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.copy-mail { position: relative; }
.copy-mail .toast { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) rotate(-3deg); font-family: var(--f-hand); font-size: 22px; background: var(--lime); color: #16140f; padding: 2px 10px; opacity: 0; transition: opacity .2s; pointer-events: none; white-space: nowrap; }
.copy-mail.copied .toast { opacity: 1; }

/* Footer */
footer.site { border-top: 1px dashed var(--line); padding: 26px 0 34px; margin-top: 40px; }
footer.site .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--ink-3); font-family: var(--f-mono); font-size: 12px; }
footer.site a { color: var(--ink-2); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ============ Case study pages ============ */
.case-hero { padding: clamp(40px, 7vw, 80px) 0 30px; }
.back { font-family: var(--f-mono); font-size: 13px; text-decoration: none; color: var(--ink-2); display: inline-flex; gap: 6px; margin-bottom: 28px; }
.back:hover { color: var(--accent); }
.case-hero h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(54px, 9vw, 120px); line-height: .92; letter-spacing: -.025em; margin: 14px 0 20px; }
.case-hero .jump { font-size: 13px; color: var(--ink-2); margin: 18px 0 0; }
.case-hero .jump a { color: var(--accent); white-space: nowrap; }
.case-hero .lede { font-size: clamp(18px, 2vw, 23px); max-width: 46ch; color: var(--ink-2); margin: 0; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--card); margin-top: 40px; overflow: hidden; }
.facts div { padding: 16px 18px; border-right: 1px dashed var(--line); }
.facts div:last-child { border-right: 0; }
.facts .mono { color: var(--ink-3); font-size: 11px; display: block; margin-bottom: 4px; }
.facts span:last-child { font-size: 15px; }
@media (max-width: 760px) { .facts { grid-template-columns: 1fr 1fr; } .facts div:nth-child(2) { border-right: 0; } .facts div:nth-child(-n+2) { border-bottom: 1px dashed var(--line); } }
@media (max-width: 480px) {
  .facts { grid-template-columns: 1fr; }
  .facts div { display: grid; grid-template-columns: 84px 1fr; column-gap: 12px; align-items: baseline; padding: 12px 16px; border-right: 0; border-bottom: 1px dashed var(--line); }
  .facts div:last-child { border-bottom: 0; }
  .facts div > :not(.mono) { grid-column: 2; }
  .facts .mono { margin-bottom: 0; }
}
.cover { margin-top: 36px; border-radius: 18px; overflow: hidden; border: 1.5px solid var(--ink); background: #0d0f14; }
.cover img { width: 100%; }
/* images that already have their own panel/background: no extra frame around them */
.cover.plain { border: 0; background: none; border-radius: 14px; }

.case section { padding: clamp(60px, 8vw, 100px) 0 0; }
.kicker { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); display: flex; align-items: center; gap: 10px; }
.kicker::after { content: ""; flex: 0 0 40px; height: 1px; background: currentColor; }
.case h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(36px, 5vw, 62px); line-height: 1.02; letter-spacing: -.015em; margin: 14px 0 18px; max-width: none; }
.case h2 em { color: var(--accent); }
.case .body { color: var(--ink-2); max-width: 62ch; font-size: 18px; }
.case .body p { margin: 0 0 1em; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 30px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 30px; }
.four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 24px; }
@media (max-width: 900px) { .four { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .two, .three { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .four { grid-template-columns: 1fr; } }
.box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.box.ink { background: var(--inv-bg); color: var(--inv-ink); border-color: var(--inv-bg); }
.box.ink .muted { color: color-mix(in srgb, var(--inv-ink) 65%, transparent); }
.box .n { font-family: var(--f-mono); font-size: 12px; color: var(--accent-text); }
.box h3 { font-size: 20px; font-weight: 600; margin: 8px 0 6px; line-height: 1.25; letter-spacing: -.01em; }
.box p { margin: 0; font-size: 15.5px; color: var(--ink-2); }
.box.ink p { color: inherit; opacity: .8; }
.muted { color: var(--ink-3); }
.quote-q { font-family: var(--f-display); font-style: italic; font-size: 30px; line-height: 1.1; margin: 8px 0 6px; }

.question {
  margin-top: 30px; background: var(--inv-bg); color: var(--inv-ink); border-radius: 18px;
  padding: clamp(28px, 5vw, 56px); position: relative; overflow: hidden;
}
.question .mono { color: var(--lime); }
.question p { font-family: var(--f-display); font-size: clamp(30px, 4.4vw, 54px); line-height: 1.05; margin: 14px 0 0; }
.question p em { color: var(--accent-flip); }

.video-frame { margin-top: 26px; border-radius: 16px; overflow: hidden; border: 1.5px solid var(--ink); background: #000; box-shadow: var(--shadow); }
.video-frame video { width: 100%; }
.video-cap { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); margin-top: 10px; }

.feature { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(24px, 4vw, 50px); align-items: start; margin-top: 30px; }
@media (max-width: 860px) { .feature { grid-template-columns: 1fr; } }
.feature h3 { font-family: var(--f-display); font-weight: 400; font-size: clamp(34px, 4vw, 48px); line-height: 1; margin: 12px 0 10px; }
.feature .tagline { font-size: 20px; font-weight: 500; margin: 0 0 10px; }
.feature .steps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.feature .steps div { border-top: 1.5px solid var(--ink); padding-top: 8px; font-size: 14.5px; }
.feature .steps b { display: block; font-weight: 600; }
.feature .steps .muted { font-size: 13.5px; }
.feature .foot { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); margin-top: 16px; }
.feature .video-frame { margin-top: 0; }

.flow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-family: var(--f-mono); font-size: 14px; margin-top: 20px; }
.flow .from { text-decoration: line-through; color: var(--ink-3); }
.flow .to { background: var(--lime); color: #16140f; padding: 4px 10px; border-radius: 6px; }

.big-close { text-align: center; padding: clamp(70px, 10vw, 120px) 0 0; }
.big-close h2 { margin: 0 auto 16px; max-width: 30ch; }
.big-close p { color: var(--ink-2); max-width: 58ch; margin: 0 auto; }

.next {
  display: block; text-decoration: none; margin-top: clamp(60px, 9vw, 110px);
  border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); padding: 36px 0;
}
.next .wrap { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.next h3 { font-family: var(--f-display); font-weight: 400; font-size: clamp(34px, 5vw, 64px); margin: 6px 0 0; line-height: 1; }
.next .arrow { font-size: 48px; transition: transform .25s; }
.next:hover .arrow { transform: translateX(10px); color: var(--accent); }
.next:hover h3 { color: var(--accent); }

/* ============ Resume ============ */
.resume { padding: clamp(40px, 7vw, 80px) 0 0; }
.resume-grid { display: grid; grid-template-columns: 260px 1fr; gap: clamp(28px, 5vw, 70px); }
@media (max-width: 820px) { .resume-grid { grid-template-columns: 1fr; } }
.resume aside { position: sticky; top: 90px; align-self: start; }
@media (max-width: 820px) { .resume aside { position: static; } }
.resume h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(54px, 7vw, 84px); line-height: .95; margin: 10px 0 8px; }
.resume aside p { color: var(--ink-2); font-size: 15.5px; }
.resume aside .links { display: flex; flex-direction: column; gap: 6px; font-family: var(--f-mono); font-size: 13px; margin: 18px 0 22px; }
.resume aside .links a { text-decoration: none; }
.resume aside .links a:hover { color: var(--accent); }
.r-sec { padding-bottom: 36px; margin-bottom: 36px; border-bottom: 1px dashed var(--line); }
.r-sec:last-child { border-bottom: 0; }
.r-sec > .mono { color: var(--accent-text); display: block; margin-bottom: 18px; }
.job { display: grid; grid-template-columns: 150px 1fr; gap: 18px; margin-bottom: 28px; }
@media (max-width: 560px) { .job { grid-template-columns: 1fr; gap: 4px; } }
.job .when { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.job h3 { margin: 0; font-size: 21px; font-weight: 600; }
.job .role { color: var(--ink-2); margin: 0 0 8px; }
.job ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 15.5px; }
.job li { margin-bottom: 5px; }
.skill-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 640px) { .skill-cols { grid-template-columns: 1fr; } }
.skill-cols h3 { margin: 0 0 10px; font-size: 15px; }
.skill-cols .tags { padding-top: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Content case pages: stats, cover gallery, vertical videos */
.work-subhead { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 26px 0 -6px; display: flex; align-items: center; gap: 10px; }
.work-subhead::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 30px; }
.stats .box b { display: block; font-family: var(--f-display); font-weight: 400; font-size: clamp(36px, 4.4vw, 54px); line-height: 1; color: var(--accent); }
.stats .box span { font-size: 14px; color: var(--ink-2); }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 30px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); display: block; }
.gallery figcaption { font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.gallery figcaption .mono { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.cn { font-size: 20px; font-weight: 600; margin: 8px 0 4px; }
.vfeature { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: clamp(24px, 4vw, 56px); align-items: center; margin-top: 30px; }
.vfeature .video-frame { margin-top: 0; }
.vgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 30px; }
.vgrid .video-frame { margin-top: 0; box-shadow: none; }
.vgrid .mono { display: block; font-size: 11px; color: var(--accent-text); margin-top: 12px; }
.vgrid h3 { font-size: 17px; font-weight: 600; margin: 4px 0; }
.vgrid p { font-size: 14px; color: var(--ink-2); margin: 0; }
.video-frame.tall video { display: block; aspect-ratio: 9/16; object-fit: cover; }
@media (max-width: 900px) { .stats, .vgrid { grid-template-columns: 1fr 1fr; } .gallery { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .vfeature { grid-template-columns: 1fr; } .vfeature .video-frame { max-width: 320px; } }
.two > img { width: 100%; display: block; border-radius: 12px; border: 1px solid var(--line); }
.case p.mono { text-transform: none; letter-spacing: 0; }
.cues { list-style: none; padding: 0; margin: 12px 0 0; font-size: 14px; }
.cues li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line); color: var(--ink-2); }
.cues li span:last-child { font-family: var(--f-mono); font-size: 12px; color: var(--accent-text); text-align: right; }
.cues.plain li { display: block; }
.stats .box span { display: block; line-height: 1.4; margin-top: 8px; }
/* Content & storytelling: lighter gallery tiles, so they read as secondary to the case studies */
.content-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin: clamp(56px, 7vw, 84px) 0 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.content-head h3 { font-family: var(--f-display); font-weight: 400; font-size: clamp(28px, 3.4vw, 40px); margin: 0; line-height: 1; }
.content-head p { margin: 0; max-width: 46ch; color: var(--ink-2); }
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 3vw, 36px); }
.content-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; }
.content-media { aspect-ratio: 16/10; border-radius: 14px; overflow: hidden; background: var(--paper-2); margin-bottom: 10px; }
.content-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; display: block; }
.content-card:hover .content-media img { transform: scale(1.04); }
.content-card .meta { color: var(--ink-3); font-size: 11.5px; }
.content-card h3 { font-family: var(--f-display); font-weight: 400; font-size: clamp(26px, 2.8vw, 34px); line-height: 1.05; margin: 0; }
.content-card:hover h3 { color: var(--accent); }
.content-card p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.content-card .go { font-family: var(--f-mono); font-size: 13px; margin-top: 4px; }
.content-card .go span { display: inline-block; transition: transform .2s; }
.content-card:hover .go span { transform: translateX(5px); }
@media (max-width: 720px) { .content-grid { grid-template-columns: 1fr; } }
/* MISM covers come in mixed shapes, so lay them out like a feed (masonry columns) */
.gallery { display: block; columns: 3; column-gap: 16px; }
.gallery figure { break-inside: avoid; margin: 0 0 18px; }
.gallery img { aspect-ratio: auto; height: auto; }
@media (max-width: 900px) { .gallery { columns: 2; } }
.contact-note { color: var(--ink-2); font-size: 18px; margin: 0 0 22px; }

/* Per-project accent colors: same site frame, each case study gets its own color */
body.t-navpilot { --accent: #4a4ad6; }
body.t-proslang { --accent: #8b3fd0; }
body.t-acemode  { --accent: #10777a; }
body.t-mism     { --accent: #00519e; --lime: #ffcb05; }
:root[data-theme="dark"] body.t-navpilot { --accent: #9b98ff; }
:root[data-theme="dark"] body.t-proslang { --accent: #c592ff; }
:root[data-theme="dark"] body.t-acemode  { --accent: #4fd6cf; }
:root[data-theme="dark"] body.t-mism     { --accent: #ffcb05; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.t-navpilot { --accent: #9b98ff; }
  :root:not([data-theme="light"]) body.t-proslang { --accent: #c592ff; }
  :root:not([data-theme="light"]) body.t-acemode  { --accent: #4fd6cf; }
  :root:not([data-theme="light"]) body.t-mism     { --accent: #ffcb05; }
}
.case-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* Per-project: small text uses the theme color; inverted boxes use the opposite-mode shade */
body.t-navpilot, body.t-proslang, body.t-acemode, body.t-mism { --accent-text: var(--accent); }
body.t-navpilot { --accent-flip: #9b98ff; } body.t-proslang { --accent-flip: #c592ff; }
body.t-acemode { --accent-flip: #4fd6cf; } body.t-mism { --accent-flip: #ffcb05; }
@media (prefers-color-scheme: dark) {
}
/* Outbound platform cards (Xiaohongshu, YouTube): icon + what you'll find */
.platform { display: inline-flex; align-items: center; gap: 14px; padding: 12px 18px 12px 12px; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--card); text-decoration: none; color: var(--ink); transition: transform .2s ease, box-shadow .2s ease; }
.platform:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }
.pl-icon { width: 44px; height: 44px; flex: none; display: block; }
.pl-text { display: flex; flex-direction: column; line-height: 1.3; }
.pl-text b { font-weight: 600; font-size: 15.5px; }
.pl-text span { font-size: 13px; color: var(--ink-2); }
.pl-go { font-size: 20px; margin-left: 6px; transition: transform .2s; }
.platform:hover .pl-go { transform: translate(3px, -3px); color: var(--accent); }
.case-links.reveal { margin-top: 26px; }
/* Platform link inside the facts box */
.pl-link { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-size: 15px; }
.pl-link .pl-icon { width: 26px; height: 26px; border-radius: 6px; }
.pl-link span { border-bottom: 1.5px solid var(--accent); line-height: 1.2; }
.pl-link:hover span { color: var(--accent); }
.pl-link.sub { display: flex; margin-top: 6px; font-size: 13.5px; }
.pl-link.sub .pl-icon { width: 22px; height: 22px; }
.text-link { color: var(--ink); text-decoration: none; border-bottom: 1.5px solid var(--accent); font-size: 14.5px; }
.text-link:hover { color: var(--accent); }
.r-sec > h2.r-label { font-weight: 400; line-height: inherit; margin: 0 0 18px; }

/* Navigation Pilot: one-trip timeline */
.trip { margin: 32px 0 0; }
.trip figcaption { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }
.trip-line { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.trip-line::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed var(--line); z-index: 0; }
.trip-line > span { position: relative; z-index: 1; background: var(--paper); }
.trip-end { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); padding: 4px 8px; border: 1.5px solid var(--line); border-radius: 999px; }
.trip-quiet { font-family: var(--f-hand); font-size: 18px; color: var(--ink-3); padding: 0 4px; }
.trip-stop { display: flex; flex-direction: column; align-items: center; text-align: center; font-weight: 600; font-size: 15px; padding: 8px 14px; border: 1.5px solid var(--accent); border-radius: 12px; background: var(--card) !important; }
.trip-stop b { font-family: var(--f-mono); font-size: 11px; color: var(--accent); font-weight: 500; }
.trip-stop small { font-weight: 400; font-size: 12px; color: var(--ink-3); }
@media (max-width: 760px) {
  .trip-line { flex-direction: column; align-items: flex-start; gap: 6px; padding-left: 14px; }
  .trip-line::before { left: 26px; right: auto; top: 0; bottom: 0; border-top: 0; border-left: 2px dashed var(--line); }
  .trip-stop { align-items: flex-start; text-align: left; }
}

/* Proslang: phone → watch → watch + phone */
.devflow { display: flex; align-items: stretch; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.dev-step { flex: 1 1 0; min-width: 150px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px 12px; border: 1.5px dashed var(--line); border-radius: 14px; }
.dev-step b { font-size: 15px; margin-top: 6px; }
.dev-step small { font-size: 12.5px; color: var(--ink-3); }
.dev-step.past { color: var(--ink-3); }
.dev-step.past b { text-decoration: line-through; font-weight: 500; }
.dev-step.now { border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); }
.dev-step.now b { background: var(--lime); color: #16140f; padding: 2px 8px; border-radius: 6px; }
.dev { width: 30px; height: 46px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.dev .face { fill: var(--card); }
.dev-pair { display: flex; align-items: flex-end; gap: 6px; }
.dev-step.now .dev { color: var(--accent); }
.dev-arrow { align-self: center; font-size: 22px; color: var(--ink-3); }
@media (max-width: 600px) {
  .devflow { flex-direction: column; gap: 6px; }
  .dev-step { min-width: 0; display: grid; grid-template-columns: 64px 1fr; column-gap: 12px; align-items: center; justify-items: start; text-align: left; padding: 10px 14px; }
  .dev-step > .dev, .dev-step > .dev-pair { grid-row: span 2; justify-self: center; }
  .dev-step b { margin-top: 0; }
  .dev-arrow { transform: rotate(90deg); font-size: 18px; }
}

/* Case-study variety: open columns, research stat, pull quotes, numbered rules, chat bubbles */
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 30px; }
.cols3 > div { border-top: 2px solid var(--ink); padding-top: 14px; }
.cols3 .n { font-family: var(--f-mono); font-size: 12px; color: var(--accent); }
.cols3 h3 { font-size: 20px; margin: 6px 0 6px; line-height: 1.2; }
.cols3 p { margin: 0; color: var(--ink-2); }
.steps3 > div { position: relative; }
.steps3 > div:not(:last-child)::after { content: "→"; position: absolute; top: -15px; right: -22px; font-size: 18px; color: var(--accent); background: var(--paper); padding: 0 4px; }
@media (max-width: 760px) { .cols3 { grid-template-columns: 1fr; gap: 22px; } .steps3 > div:not(:last-child)::after { content: "↓"; top: auto; bottom: -22px; right: auto; left: 0; } }

.research { display: grid; grid-template-columns: 1fr 1.3fr; gap: 40px; margin-top: 30px; align-items: start; }
.research-stat b { display: block; font-family: var(--f-display); font-weight: 400; font-size: clamp(90px, 12vw, 150px); line-height: .85; color: var(--accent); }
.research-stat .mono { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 10px 0 12px; }
.research-stat p { margin: 0; font-size: 17px; max-width: 34ch; }
.research-notes > div { padding: 0 0 18px; margin-bottom: 18px; border-bottom: 1px dashed var(--line); }
.research-notes > div:last-child { border-bottom: 0; margin-bottom: 0; }
.research-notes .mono { font-size: 12px; color: var(--ink-3); }
.research-notes p { margin: 6px 0 0; color: var(--ink-2); }
.insights { margin-top: 44px; }
.insights > .mono { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.insights blockquote { margin: 14px 0 0; padding-left: 18px; border-left: 3px solid var(--accent); font-family: var(--f-display); font-size: clamp(24px, 3vw, 34px); line-height: 1.15; }
.insights blockquote em { color: var(--accent); }
@media (max-width: 760px) { .research { grid-template-columns: 1fr; gap: 24px; } }

.rules { list-style: none; padding: 0; margin: 30px 0 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 48px; }
.rules li { display: grid; grid-template-columns: 70px 1fr; column-gap: 14px; padding: 20px 0; border-top: 1px dashed var(--line); }
.rules .n { grid-row: span 2; font-family: var(--f-display); font-size: 54px; line-height: .9; color: var(--accent); }
.rules h3 { margin: 0 0 6px; font-size: 21px; }
.rules p { margin: 0; color: var(--ink-2); }
@media (max-width: 760px) { .rules { grid-template-columns: 1fr; } .rules li { grid-template-columns: 52px 1fr; } .rules .n { font-size: 40px; } }

.chat { display: flex; flex-direction: column; gap: 16px; margin-top: 30px; max-width: 720px; }
.chat-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.chat-row:nth-child(2) { margin-left: clamp(0px, 8vw, 90px); }
.chat-row:nth-child(3) { margin-left: clamp(0px, 16vw, 180px); }
.bubble { font-family: var(--f-display); font-size: clamp(24px, 3vw, 32px); line-height: 1.1; background: var(--card); border: 1.5px solid var(--ink); border-radius: 22px 22px 22px 6px; padding: 12px 20px; }
.thought { font-family: var(--f-hand); font-size: 21px; color: var(--accent); }
.thought::before { content: "← "; }
@media (max-width: 600px) { .chat-row { gap: 6px; } .chat-row:nth-child(n) { margin-left: 0; } .thought::before { content: "↳ "; } }

/* Chapters: panels and a dark band so sections don't blend into the grid */
.panel { background: var(--card); border: 1.5px solid var(--ink); border-radius: 22px; padding: clamp(22px, 4vw, 44px); }
.panel.soft { background: var(--paper-2); border-color: transparent; }
.feature.panel { margin-top: 0; }
.case section:has(> .wrap > .feature.panel) { padding-top: 22px; }
.band-dark, .band-tint, .band-soft { margin-top: clamp(60px, 8vw, 100px); padding: clamp(56px, 7vw, 90px) 0 !important; }
.band-dark { background: var(--inv-bg); color: var(--inv-ink); }
.band-soft { background: var(--paper-2); }
.band-tint { background: color-mix(in srgb, var(--accent) 9%, var(--paper)); border-block: 1.5px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.band-dark .body { color: var(--inv-ink); opacity: .75; }
.band-dark .video-frame { border-color: rgba(255,255,255,.18); }
/* timeline on the dark band */
.band-dark .trip figcaption { color: var(--inv-ink); opacity: .6; }
.band-dark .trip-line::before { border-color: rgba(255,255,255,.25); }
.band-dark .trip-line > span { background: var(--inv-bg); }
.band-dark .trip-quiet { color: var(--inv-ink); opacity: .55; }
.band-dark .trip-end { color: var(--inv-ink); border-color: rgba(255,255,255,.3); }
.band-dark .trip-line > .trip-stop { background: var(--inv-bg) !important; border-color: var(--accent-flip); color: var(--inv-ink); }
.band-dark .trip-stop b { color: var(--accent-flip); }
.band-dark .trip-stop small { color: var(--inv-ink); opacity: .6; }
.band-dark .kicker { color: var(--accent-flip); }
.band-dark .kicker::after { background: var(--accent-flip); }
.band-dark h2 em { color: var(--accent-flip); }
.band-dark .rules li { border-top-color: rgba(255,255,255,.18); }
.band-dark .rules .n { color: var(--accent-flip); }
.band-dark .rules p { color: var(--inv-ink); opacity: .72; }

/* zig-zag feature cards; "future" ideas drawn as dashed sketches */
.feature.flip { grid-template-columns: 1.1fr .9fr; }
.feature.flip > :first-child { order: 2; }
@media (max-width: 860px) { .feature.flip { grid-template-columns: 1fr; } .feature.flip > :first-child { order: 0; } }
.future .box { background: transparent; border-style: dashed; box-shadow: none; }
.band-dark .muted, .band-dark .video-cap { color: var(--inv-ink); opacity: .6; }

/* AceMode: two parts (videos / covers) */
.part-label { display: inline-flex; align-items: center; gap: 10px; border: 1.5px solid var(--ink); border-radius: 999px; padding: 7px 16px 7px 10px; margin-bottom: 26px; background: var(--card); }
.part-label .mono { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--card); background: var(--accent); border-radius: 999px; padding: 3px 9px; }
.part-label b { font-family: var(--f-mono); font-weight: 500; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.cols3.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .cols3.c4 { grid-template-columns: 1fr 1fr; } .cols3.c4.steps3 > div::after { display: none; } }
@media (max-width: 760px) { .cols3.c4 { grid-template-columns: 1fr; } }

/* AceMode covers: before / after as two aligned rows of 4 steps */
.flowcmp { display: grid; gap: 12px; margin-top: 24px; }
.fc-row { display: grid; grid-template-columns: 64px 1fr 18px 1fr 18px 1fr 18px 1fr; align-items: center; gap: 6px; }
.fc-row i { font-style: normal; text-align: center; color: var(--ink-3); }
.fc-label { font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.chip { font-size: 14px; line-height: 1.25; padding: 7px 10px; border-radius: 999px; text-align: center; }
.fc-before .chip { border: 1.5px dashed var(--ink-3); color: var(--ink-2); }
.fc-after .fc-label { color: var(--accent); }
.fc-after .chip { border: 1.5px solid var(--ink); background: var(--card); }
.fc-after .chip.main { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.fc-after i { color: var(--accent); }
.fc-notes { margin: 2px 0 0 70px; }
.fc-note { font-family: var(--f-hand); font-size: 19px; color: var(--accent-text); }
.fc-note.link { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 820px) {
  .flowcmp { grid-template-columns: 1fr 1fr; gap: 10px; }
  .fc-row { grid-template-columns: 1fr; gap: 6px; }
  .fc-row i { transform: rotate(90deg); line-height: 1; }
  .fc-notes { grid-column: 1 / -1; margin-left: 0; }
}

/* Handwritten margin note: used ONLY where AI changed how the owner works (max 1–2 per page) */
.ai-note { font-family: var(--f-hand); font-size: 22px; line-height: 1.1; color: var(--accent-text); margin: 8px 0 0 4px; rotate: -1.5deg; transform-origin: left center; }
.band-dark .ai-note { color: var(--accent-flip); }

/* A simple phone shell for the one hero short-video (AceMode). Don't use on rows of videos. */
.video-frame.phone { position: relative; border: 0; background: #0e0d0b; padding: 9px; border-radius: 44px; box-shadow: var(--shadow), inset 0 0 0 1.5px #34312b; }
.video-frame.phone video { border-radius: 35px; }
.video-frame.phone::before { content: ""; position: absolute; top: 20px; left: 50%; transform: translateX(-50%); width: 76px; height: 22px; border-radius: 999px; background: #0e0d0b; z-index: 2; pointer-events: none; }

/* Home: chapter indicator — appears after the hero, hides at the contact section */
.chapters { position: fixed; left: 50%; bottom: 18px; z-index: 40; display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--ink); box-shadow: var(--shadow); font-family: var(--f-mono); font-size: 12.5px; letter-spacing: .04em; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .3s ease, transform .3s ease; }
.chapters.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.chapters a { text-decoration: none; color: var(--ink-3); transition: color .2s; }
.chapters a.on { color: var(--accent-text); font-weight: 600; }
.chapters a:hover { color: var(--ink); }
.chapters i { font-style: normal; color: var(--ink-3); }
@media (prefers-reduced-motion: reduce) { .chapters { transition: none; } }

/* Lab cards: the "built with" line slides in on hover (always shown on touch screens) */
@media (hover: hover) {
  .lab-card .built { max-height: 0; opacity: 0; padding-top: 0; border-top-color: transparent; overflow: hidden; transition: max-height .3s ease, opacity .3s ease, padding .3s ease; }
  .lab-card:hover .built, .lab-card:focus-visible .built { max-height: 60px; opacity: 1; padding-top: 10px; border-top-color: var(--line); }
}
/* AceMode card: muted vertical preview over the dimmed thumbnail */
.content-media { position: relative; }
.content-media video { position: absolute; top: 6%; bottom: 6%; left: 50%; transform: translateX(-50%); height: 88%; aspect-ratio: 9/16; object-fit: cover; border-radius: 12px; box-shadow: var(--shadow); opacity: 0; transition: opacity .3s ease; background: #000; }
.content-media.playing video { opacity: 1; }
.content-media.playing img { opacity: .35; }
/* Contact: live local time */
.local-time { font-size: 12.5px; color: var(--ink-3); margin: -6px 0 18px; }

/* Page switch: a soft cross-fade between pages (browsers without support just jump); the nav stays put */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .nav { view-transition-name: nav; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }
}

/* Case pages: thin reading-progress line in the project color, along the bottom of the nav */
.read-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; pointer-events: none; }

/* AceMode before/after: steps light up one by one when the diagram comes into view */
.flowcmp .fc-row > * { opacity: 0; transform: translateY(6px); transition: opacity .4s ease, transform .4s ease; }
.flowcmp.in .fc-row > * { opacity: 1; transform: none; }
.flowcmp.in .fc-row > :nth-child(2) { transition-delay: .15s; }
.flowcmp.in .fc-row > :nth-child(3) { transition-delay: .25s; }
.flowcmp.in .fc-row > :nth-child(4) { transition-delay: .35s; }
.flowcmp.in .fc-row > :nth-child(5) { transition-delay: .45s; }
.flowcmp.in .fc-row > :nth-child(6) { transition-delay: .55s; }
.flowcmp.in .fc-row > :nth-child(7) { transition-delay: .65s; }
.flowcmp.in .fc-row > :nth-child(8) { transition-delay: .75s; }
/* the "after" row starts once "before" has finished, and moves faster (fewer, quicker steps) */
.flowcmp.in .fc-after > :nth-child(1) { transition-delay: 1s; }
.flowcmp.in .fc-after > :nth-child(2) { transition-delay: 1.1s; }
.flowcmp.in .fc-after > :nth-child(3) { transition-delay: 1.15s; }
.flowcmp.in .fc-after > :nth-child(4) { transition-delay: 1.2s; }
.flowcmp.in .fc-after > :nth-child(5) { transition-delay: 1.25s; }
.flowcmp.in .fc-after > :nth-child(6) { transition-delay: 1.3s; }
.flowcmp.in .fc-after > :nth-child(7) { transition-delay: 1.35s; }
.flowcmp.in .fc-after > :nth-child(8) { transition-delay: 1.4s; }

/* Home "Build it": equal cards (3 columns; 2 below 900px; swipe row on phones) */
@media (min-width: 601px) { .lab-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 601px) and (max-width: 900px) { .lab-grid { grid-template-columns: repeat(2, 1fr); } }
.lab-card .inside { font-size: 11.5px; color: var(--accent-text); }
/* the featured card: same size, just a small accent shadow and a "Try it" line */
.lab-card.featured { box-shadow: 4px 4px 0 var(--accent); }

/* Home "Explain it": one key number per card; AceMode card hints that it plays on hover */
.content-stat { font-size: 14px; color: var(--ink-2); display: flex; align-items: baseline; gap: 8px; }
.content-stat b { font-family: var(--f-display); font-weight: 400; font-size: 34px; line-height: 1; color: var(--accent); }
.hover-hint { position: absolute; left: 12px; bottom: 12px; z-index: 2; font-size: 11.5px; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--paper) 88%, transparent); color: var(--ink-2); transition: opacity .3s ease; }
.content-media.playing .hover-hint { opacity: 0; }
@media (hover: none) { .hover-hint { display: none; } }
/* Home "Design it": proof tags under each case study; a tag never splits inside */
.work-body .tag { white-space: nowrap; }

/* Home "Build it" as a workbench: cards rest at slightly different angles, a few held by tape;
   hovering picks a card up (straightens and lifts it) */
.lab-grid .lab-card { --r: 0deg; transform: rotate(var(--r)); transition: opacity .7s ease, transform .3s ease, box-shadow .3s ease; }
.lab-grid .lab-card:nth-child(6n+1) { --r: -1.2deg; }
.lab-grid .lab-card:nth-child(6n+2) { --r: .8deg; }
.lab-grid .lab-card:nth-child(6n+3) { --r: -.5deg; }
.lab-grid .lab-card:nth-child(6n+4) { --r: 1deg; }
.lab-grid .lab-card:nth-child(6n+5) { --r: -.8deg; }
.lab-grid .lab-card:nth-child(6n+6) { --r: .6deg; }
.lab-grid .lab-card:hover, .lab-grid .lab-card:focus-visible { transform: rotate(0) translateY(-4px); }
.lab-grid .lab-card:nth-child(odd)::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 64px; height: 18px; z-index: 2;
  transform: translateX(-50%) rotate(-3deg);
  background: color-mix(in srgb, var(--sticky) 70%, transparent); box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.lab-grid .lab-card:nth-child(4n+3)::before { left: 22%; transform: translateX(-50%) rotate(4deg); background: color-mix(in srgb, var(--sticky-2) 70%, transparent); }
@media (max-width: 600px) {
  .lab-grid { padding-top: 16px; }
  .lab-grid .lab-card { --r: 0deg !important; }
}

/* Copy email: a red seal stamps down instead of a plain label */
.copy-mail .toast {
  font-family: var(--f-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  background: transparent; color: var(--seal); border: 2px solid var(--seal); border-radius: 4px; padding: 3px 8px;
  transform: translateX(-50%) rotate(-8deg) scale(1.6);
  transition: opacity .15s ease, transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.copy-mail.copied .toast { transform: translateX(-50%) rotate(-8deg) scale(1); }
:root { --seal: #c8322b; }

/* 404: "return to sender" seal next to the heading */
.lost-seal { display: inline-block; font-family: var(--f-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--seal); border: 2px solid var(--seal); border-radius: 4px; padding: 4px 10px; transform: rotate(-6deg); margin-bottom: 8px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --seal: #ff6b5e; } }
:root[data-theme="dark"] { --seal: #ff6b5e; }

/* Home "Explain it": Michigan ISM covers sit in a small pile and fan out on hover, like scrolling past posts */
.content-media.fan img { position: absolute; top: 16%; left: 50%; width: auto; height: 68%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; box-shadow: var(--shadow); transition: transform .45s cubic-bezier(.3, 1.3, .5, 1); }
.content-media.fan .f1 { transform: translateX(-50%) translateX(-55%) rotate(-6deg); }
.content-media.fan .f2 { transform: translateX(-50%); z-index: 1; }
.content-media.fan .f3 { transform: translateX(-50%) translateX(55%) rotate(6deg); }
.content-card:hover .content-media.fan .f1 { transform: translateX(-50%) translateX(-104%) rotate(-2deg); }
.content-card:hover .content-media.fan .f2 { transform: translateX(-50%) translateY(-4px); }
.content-card:hover .content-media.fan .f3 { transform: translateX(-50%) translateX(104%) rotate(2deg); }

/* Say hi: a hand-drawn underline draws itself under "good." when the heading comes into view */
.contact h2 em { position: relative; display: inline-block; }
.contact h2 em::after {
  content: ""; position: absolute; left: 2%; right: 4%; bottom: -.04em; height: .14em; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'%3E%3Cpath d='M3 9 C 40 3, 80 12, 120 6 S 180 4, 197 8' fill='none' stroke='black' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'%3E%3Cpath d='M3 9 C 40 3, 80 12, 120 6 S 180 4, 197 8' fill='none' stroke='black' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  clip-path: inset(0 100% 0 0); transition: clip-path .9s ease .5s;
}
.contact h2.in em::after { clip-path: inset(0 0 0 0); }
