/* ---------- Fonts (self-hosted, latin subset) ---------- */
@font-face {
  font-family: "Geologica";
  src: url("fonts/geologica-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: oblique 0deg 12deg;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #F3EFE8;
  --surface: #FAF8F4;
  --surface-2: #ECE6DC;
  --ink: #191612;
  --ink-2: #3E3933;
  --muted: #6F675D;
  --line: #E0D9CE;
  --accent: #FFD60A;       /* bright yellow, used as a fill: chips, marker, hovers */
  --on-accent: #17120D;    /* text on yellow */
  --accent-text: #191612;  /* yellow text is unreadable on paper, so accent text stays ink */
  --hl: #FFD60A;           /* marker stripe behind the cursive word */
  --accent-ring: rgba(25, 22, 18, .55);
  --focus: #191612;
  --ok: #2E9E57;

  --side-w: 288px;
  --radius: 18px;
  --sans: "Geologica", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131210;
    --surface: #1B1917;
    --surface-2: #25221E;
    --ink: #F1ECE4;
    --ink-2: #CEC6BA;
    --muted: #9A9186;
    --line: #2D2A26;
    --accent: #FFD60A;
    --accent-text: #FFD60A;
    --hl: transparent;
    --accent-ring: transparent;
    --focus: #FFD60A;
    --ok: #3CC46E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131210;
  --surface: #1B1917;
  --surface-2: #25221E;
  --ink: #F1ECE4;
  --ink-2: #CEC6BA;
  --muted: #9A9186;
  --line: #2D2A26;
  --accent: #FFD60A;
  --accent-text: #FFD60A;
  --hl: transparent;
  --accent-ring: transparent;
  --focus: #FFD60A;
  --ok: #3CC46E;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-weight: 500; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--on-accent); }

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 50;
  padding: 10px 14px; border-radius: 10px;
  background: var(--ink); color: var(--bg); text-decoration: none;
}
.skip:focus { top: 16px; }

.cursive {
  font-style: normal;
  font-variation-settings: "slnt" -12, "CRSV" 1;
  color: var(--accent-text);
  /* Marker stripe in the light theme; --hl is transparent in the dark one. */
  background-image: linear-gradient(to top, transparent .04em, var(--hl) .04em, var(--hl) .42em, transparent .42em);
  padding: 0 .08em; margin: 0 -.08em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.sep { color: var(--line); }

.label {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.label::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--accent); box-shadow: 0 0 0 1px var(--accent-ring);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px;
  font: 500 15px/1 var(--sans); text-decoration: none; white-space: nowrap;
  transition: background-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: var(--on-accent); }
.btn-ghost { box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--muted); }
.btn-invert { background: var(--bg); color: var(--ink); }
.btn-invert:hover { background: var(--accent); color: var(--on-accent); }

/* ---------- Sidebar ---------- */
.side {
  position: fixed; inset: 0 auto 0 0; z-index: 20;
  width: var(--side-w);
  display: flex; flex-direction: column;
  padding: 32px 20px 24px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}
.profile { display: flex; align-items: center; gap: 14px; text-decoration: none; padding: 0 8px; }
.avatar {
  width: 60px; height: 60px; flex: none; border-radius: 50%; overflow: hidden;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--line);
}
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-text { display: grid; gap: 2px; min-width: 0; }
.name { font-size: 16px; font-weight: 500; letter-spacing: -.01em; }
.role { font-family: var(--mono); font-size: 12px; line-height: 1.45; color: var(--muted); }
/* The Upwork title breaks only between its parts, never inside one */
.role > span { white-space: nowrap; }

.side-panel { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; margin-top: 22px; min-height: 0; }
.side-panel > .side-foot { margin-top: auto; }

/* Upwork status, as on the profile card */
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 24px; padding: 0 0 0 8px; text-decoration: none; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 999px;
  font-family: var(--mono); font-size: 10px; color: var(--ink);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .2s var(--ease);
}
.badge svg { width: 12px; height: 12px; fill: currentColor; }
.badge-top { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.badges:hover .badge:not(.badge-top) { box-shadow: inset 0 0 0 1px var(--muted); }
.badges:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 14px; }

.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-size: 15px;
  transition: color .2s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease);
}
.nav .num {
  margin-left: -5px; padding: 2px 5px; border-radius: 6px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="true"], .nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.nav a[aria-current="true"] .num, .nav a[aria-current="page"] .num { background: var(--accent); color: var(--on-accent); }

.side-foot { display: grid; gap: 14px; padding: 20px 8px 0; border-top: 1px solid var(--line); }
.clock { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.status { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.dot {
  position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none;
}
.dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid var(--ok); opacity: 0;
  animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }

.side-actions { display: flex; gap: 8px; }
.side-actions .btn { flex: 1; }
.theme-btn {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .2s var(--ease), background-color .2s var(--ease);
}
.theme-btn:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--muted); }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: block; }
}

.menu-btn { display: none; }

/* ---------- Main ---------- */
.main { margin-left: var(--side-w); min-height: 100vh; }
.wrap { max-width: 800px; margin: 0 auto; padding: 0 48px; }

section { padding: 88px 0; border-top: 1px solid var(--line); }
section.hero { border-top: 0; padding: 128px 0 96px; }

h1 {
  margin: 22px 0 26px;
  font-size: clamp(2.5rem, 1.5rem + 3.4vw, 4rem);
  line-height: 1.02; letter-spacing: -.035em;
  text-wrap: balance;
}
h2 {
  margin: 16px 0 36px;
  font-size: clamp(1.65rem, 1.2rem + 1.4vw, 2.3rem);
  line-height: 1.12; letter-spacing: -.025em;
  text-wrap: balance;
}
h3 { font-size: 1.2rem; letter-spacing: -.01em; line-height: 1.25; }

.lede { max-width: 58ch; font-size: 1.15rem; line-height: 1.6; color: var(--ink-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }
.now {
  display: flex; align-items: center; gap: 12px; margin-top: 48px;
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
}
.pill {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
}

/* ---------- Work ---------- */
.case {
  display: block; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit; text-decoration: none;
  transition: border-color .25s var(--ease), transform .35s var(--ease);
}
a.case:hover { border-color: var(--muted); }
a.case:hover .frame img { transform: scale(1.025); }
a.case:hover .case-link { color: var(--accent-text); }

.frame {
  margin: 10px 10px 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2);
}
.frame-bar {
  display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.frame-bar i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.frame-bar span { margin-left: 8px; min-width: 0; font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame img {
  display: block; width: 100%; height: auto; aspect-ratio: 1200 / 696; object-fit: cover; object-position: top;
  transition: transform .7s var(--ease);
}

.case-body { padding: 20px 22px 24px; }
.case-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.case-link { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; transition: color .2s var(--ease); }
/* Round arrow button on the grid cards */
.cases-grid .case-top { align-items: center; }
.case-arrow {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--ink);
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .25s var(--ease);
}
.case-arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
a.case:hover .case-arrow { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: rotate(45deg); }
a.case:hover .case-arrow.is-internal { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) { a.case:hover .case-arrow { transform: none; } }
.tags { margin: 6px 0 12px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.case-body > p:last-child, .case-own p:last-child { font-size: 15.5px; color: var(--ink-2); }
.frame video { display: block; width: 100%; height: auto; aspect-ratio: 1280 / 546; object-fit: cover; background: var(--surface-2); }
.frame video.is-card { aspect-ratio: 1200 / 696; } /* clips cut to the same ratio as the card images */
.case-featured .case-body { padding: 24px 26px 28px; }
.case-featured h3 { font-size: 1.45rem; }

.cases-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }

.case-own {
  display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start;
  margin-top: 16px; padding: 24px 26px;
}
.case-own .tags { margin: 0 0 4px; }
.case-own h3 { margin-bottom: 8px; }
.own-icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
}
.own-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.own-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.own-links a {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--mono); font-size: 12px; color: var(--ink); text-decoration: none;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.own-links a:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.case-quote { margin: 16px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); }
.case-quote p { font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.case-quote cite { display: block; margin-top: 8px; font-style: normal; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* ---------- Services ---------- */
.services { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.services li {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1.5fr); gap: 20px; align-items: baseline;
  padding: 24px 0; border-bottom: 1px solid var(--line);
}
.services .num {
  justify-self: start; padding: 2px 6px; border-radius: 6px;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--mono); font-size: 12px; line-height: 1.4;
}
.services h3 { font-size: 1.1rem; }
.services p { color: var(--ink-2); font-size: 15.5px; }

/* ---------- Fit ---------- */
.fit { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fit-card { padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.fit-card h3 { font-size: 1.1rem; margin-bottom: 18px; }
.fit-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.fit-card li { position: relative; padding-left: 26px; color: var(--ink-2); font-size: 15.5px; }
.fit-card li::before {
  position: absolute; left: 0; top: 0;
  font-family: var(--mono); font-size: 14px; line-height: 1.6;
}
.fit-yes li::before {
  content: "+"; top: .22em; width: 18px; height: 18px; border-radius: 50%;
  text-align: center; font-size: 13px; line-height: 18px;
  background: var(--accent); color: var(--on-accent);
}
.fit-no { background: transparent; }
.fit-no li::before { content: "×"; color: var(--muted); }

/* ---------- Reviews ---------- */
.quotes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.quote {
  margin: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.quote blockquote { margin: 0; }
.quote blockquote p { font-size: 1.12rem; line-height: 1.5; letter-spacing: -.01em; }
.quote blockquote p::before {
  content: "\201C"; display: block; width: 40px; height: 40px; margin-bottom: 18px;
  border-radius: 50%; background: var(--accent); color: var(--on-accent);
  font-size: 40px; line-height: 64px; text-align: center; overflow: hidden;
  font-variation-settings: "slnt" -12, "CRSV" 1;
}
.quote figcaption { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- Stack ---------- */
.stack { margin: 0; display: grid; gap: 4px; }
.stack-row {
  display: grid; grid-template-columns: 130px 1fr; gap: 16px; align-items: baseline;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.stack-row:first-child { border-top: 1px solid var(--line); }
.stack dt { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.stack dd { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px;
}

/* ---------- Notes list ---------- */
.notes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.notes a {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 20px; align-items: baseline;
  padding: 22px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit;
}
.notes time, .note-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.note-main { display: grid; gap: 4px; }
.note-title { font-size: 1.12rem; font-weight: 500; letter-spacing: -.01em; line-height: 1.3; }
.note-excerpt { color: var(--ink-2); font-size: 15px; }
/* Marker on hover in the light theme (--hl), yellow text in the dark one (--accent-text). */
.notes a .note-title { background-image: linear-gradient(var(--hl), var(--hl)); background-size: 0 .34em; background-position: 0 88%; background-repeat: no-repeat; transition: background-size .35s var(--ease), color .2s var(--ease); }
.notes a:hover .note-title { background-size: 100% .34em; color: var(--accent-text); }
.notes a:hover .note-meta { color: var(--ink); }

/* ---------- Notes list page ---------- */
.notes-all { margin-top: 28px; }
.notes-header { padding-bottom: 8px; }
.notes-block { padding: 48px 0 0; border-top: 0; }
.notes-block > .label { margin: 0 0 18px; }
.note-related { margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--line); }
.note-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.note-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit; text-decoration: none;
  transition: border-color .25s var(--ease);
}
a.note-card:hover { border-color: var(--muted); }
.note-card-body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 22px; }
.note-card-date { margin-top: auto; padding-top: 6px; }
.note-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.note-card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.note-topic {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink); font-size: 11px;
}
.note-card .case-arrow { width: 36px; height: 36px; }
.note-card .case-arrow svg { width: 16px; height: 16px; }
a.note-card:hover .case-arrow { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: translateX(3px); }
.note-card h3 { font-size: 1.18rem; line-height: 1.28; }
.note-card.is-featured h3 { font-size: 1.36rem; }
/* Marker on hover in the light theme (--hl), yellow text in the dark one (--accent-text). */
.note-card-title { background-image: linear-gradient(var(--hl), var(--hl)); background-size: 0 .34em; background-position: 0 88%; background-repeat: no-repeat; transition: background-size .35s var(--ease), color .2s var(--ease); }
a.note-card:hover .note-card-title { background-size: 100% .34em; color: var(--accent-text); }
.note-card-lede {
  font-size: 15px; line-height: 1.5; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* Featured cover: dot grid with the topic icon, drawn with theme tokens instead of a picture */
.note-cover {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; margin: 10px 10px 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 11px;
  background-color: var(--surface-2);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--muted) 42%, transparent) 1px, transparent 1.5px);
  background-size: 16px 16px; background-position: 8px 8px;
}
.note-cover-icon {
  display: grid; place-items: center; width: 84px; height: 84px; border-radius: 24px;
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 16%, transparent), 0 0 0 1px var(--accent-ring);
  transition: transform .5s var(--ease);
}
.note-cover-icon svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
a.note-card:hover .note-cover-icon { transform: rotate(-6deg) scale(1.04); }
.note-cover-topic {
  position: absolute; left: 14px; bottom: 12px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
@media (prefers-reduced-motion: reduce) {
  .note-cover-icon, .note-card .case-arrow { transition: none; }
  a.note-card:hover .note-cover-icon, a.note-card:hover .case-arrow { transform: none; }
}

/* Cover art: inline SVG (viewBox 1200 x 630) drawn with theme tokens, on cards and on the note page.
   tools/render_covers.py renders the same SVG in the light theme for og:image. */
.cover-box {
  background-color: var(--surface-2);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--muted) 42%, transparent) 1px, transparent 1.5px);
  background-size: 16px 16px; background-position: 8px 8px;
}
.note-cover.has-art { display: block; aspect-ratio: 1200 / 630; }
.note-hero { margin: 32px 0 8px; aspect-ratio: 1200 / 630; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.cover-art { display: block; width: 100%; height: 100%; }
.cover-art text { font-family: var(--sans); fill: var(--ink); }
.cover-art .mono { font-family: var(--mono); }
.cover-art .c-ink { fill: var(--ink); }
.cover-art .c-ink2 { fill: var(--ink-2); }
.cover-art .c-mut { fill: var(--muted); }
.cover-art .c-acc { fill: var(--accent); }
.cover-art .c-onacc { fill: var(--on-accent); }
.cover-art .c-surf { fill: var(--surface); }
.cover-art .c-surf2 { fill: var(--surface-2); }
.cover-art .c-none { fill: none; }
.cover-art .st-ink { stroke: var(--ink); }
.cover-art .st-mut { stroke: var(--muted); }
.cover-art .st-line { stroke: var(--line); }
.cover-art .st-acc { stroke: var(--accent); }

/* YouTube facade: a link until the reader presses play (main.js swaps in the player) */
.video-embed { margin: 28px 0 32px; }
.video-facade, .video-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; }
.video-facade {
  position: relative; overflow: hidden; border: 1px solid var(--line);
  background-color: #131210; color: #F1ECE4; text-decoration: none;
  background-image: radial-gradient(circle, rgba(241, 236, 228, .16) 1px, transparent 1.5px);
  background-size: 16px 16px; background-position: 8px 8px;
}
.prose a.video-facade { color: #F1ECE4; text-decoration: none; }
.video-play {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px;
  border-radius: 50%; background: var(--accent); transition: transform .3s var(--ease);
}
.video-play::after {
  content: ""; position: absolute; left: 30px; top: 25px;
  border-style: solid; border-width: 13px 0 13px 21px; border-color: transparent transparent transparent var(--on-accent);
}
.video-facade:hover .video-play { transform: scale(1.06); }
.video-facade:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.video-title { position: absolute; left: 20px; right: 20px; bottom: 16px; font-weight: 500; font-size: 1rem; line-height: 1.35; }
.video-frame { border: 0; background: #000; }
.video-embed figcaption { margin-top: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .video-play { transition: none; } .video-facade:hover .video-play { transform: none; } }

/* ---------- Note page ---------- */
.note-header h1 { font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3.2rem); line-height: 1.06; }
.note-prose { margin-top: 0; }
.note-prose > p, .note-prose > h2, .note-prose > h3, .note-prose > ul, .note-prose > ol, .note-prose > blockquote { max-width: 66ch; }
.prose { margin-top: 40px; font-size: 1.06rem; line-height: 1.7; color: var(--ink-2); }
.prose p + p, .prose p + ul, .prose ul + p, .prose pre + p, .prose p + pre { margin-top: 1.1em; }
.prose h2 { margin: 2em 0 .6em; font-size: 1.35rem; line-height: 1.25; letter-spacing: -.015em; color: var(--ink); }
.prose ul, .prose ol { margin: 0; padding-left: 1.2em; }
.prose p + ol, .prose ol + p, .prose p + blockquote, .prose blockquote + p, .prose p + table, .prose table + p, .prose ul + h2, .prose ol + h2 { margin-top: 1.1em; }
.prose h3 { margin: 1.7em 0 .5em; font-size: 1.12rem; line-height: 1.3; letter-spacing: -.01em; color: var(--ink); }
.prose blockquote { margin: 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); color: var(--ink); }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.prose th, .prose td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-weight: 500; color: var(--ink); }
.prose li + li { margin-top: .4em; }
.prose a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose code {
  font-family: var(--mono); font-size: .86em; padding: .12em .38em; border-radius: 6px;
  background: var(--surface-2); color: var(--ink);
}
.prose pre {
  margin: 0; padding: 18px 20px; overflow-x: auto; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 13.5px; line-height: 1.6; color: var(--ink);
}
.prose pre code { padding: 0; background: none; font-size: inherit; }

/* ---------- Case study pages ---------- */
.case-header { padding: 96px 0 36px; }
.back-link {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 28px;
  font-family: var(--mono); font-size: 12px; color: var(--muted); text-decoration: none;
  transition: color .2s var(--ease);
}
.back-link:hover { color: var(--ink); }
.case-header h1 { margin: 16px 0 20px; font-size: clamp(2.3rem, 1.4rem + 3vw, 3.6rem); }
.frame.case-hero { margin: 0 0 40px; border-radius: 16px; }
.case-meta { margin: 0 0 40px; }
.case-meta dd { display: block; }
.case-meta dd a { color: var(--ink); text-underline-offset: 3px; }
.case-stats { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 12px; margin: 0 0 56px; }
.case-stat {
  display: grid; gap: 10px; align-content: start; padding: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
}
.case-stat-value {
  justify-self: start; font-size: clamp(1.6rem, 1.2rem + 1.1vw, 2.2rem); font-weight: 500; line-height: 1.05; letter-spacing: -.02em;
  color: var(--accent-text);
  background-image: linear-gradient(to top, transparent .02em, var(--hl) .02em, var(--hl) .34em, transparent .34em);
}
.case-stat-caption { font-size: 14px; line-height: 1.4; color: var(--ink-2); }
.case-prose { margin-top: 0; }
.case-prose > p, .case-prose > h2 { max-width: 64ch; }
.case-prose > h2:first-child { margin-top: 0; }
/* Cases split into parts with sub-sections: larger part headings, smaller h3 under them */
.case-prose > h3 { max-width: 64ch; margin: 1.9em 0 .5em; font-size: 1.12rem; line-height: 1.3; letter-spacing: -.01em; color: var(--ink); }
.case-prose:has(> h3) > h2 { margin-top: 2.4em; font-size: 1.7rem; }
.case-prose:has(> h3) > h2:first-child { margin-top: 0; }
.case-figure { margin: 28px 0 32px; }
.case-figure .frame { margin: 0; border-radius: 14px; }
.case-figure .frame img { aspect-ratio: auto; }
.case-figure figcaption { margin-top: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.case-prose .case-quote { margin: 16px 0 0; padding: 22px 24px; }
.case-prose .case-quote p { font-size: 1.15rem; line-height: 1.5; }
.case-next {
  display: flex; flex-direction: column; gap: 10px; margin-top: 64px; padding: 26px 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit; text-decoration: none; transition: border-color .2s var(--ease);
}
.case-next:hover { border-color: var(--muted); }
.case-next-title { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); font-weight: 500; letter-spacing: -.02em; }
.footer-inner a { color: inherit; }

/* ---------- About page ---------- */
.about-hero { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 36px; align-items: end; }
.about-hero h1 { font-size: clamp(2.1rem, 1.2rem + 2.3vw, 3.1rem); }
.about-photo {
  margin: 0; overflow: hidden; border-radius: 24px; aspect-ratio: 1 / 1;
  background: var(--accent); border: 1px solid var(--line);
}
.about-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.about-section .prose { margin-top: 0; max-width: 62ch; }
.facts dd { display: block; }
.facts dd a { color: var(--ink); text-underline-offset: 3px; }
/* course badges on About */
.course-badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 24px; }
.course-badge { margin: 0; }
.course-badge-img { display: block; overflow: hidden; border-radius: 14px; border: 1px solid var(--line); }
.course-badge-img img { display: block; width: 100%; height: auto; transition: transform .4s ease; }
.course-badge-img:hover img { transform: scale(1.02); }
.course-badge figcaption { display: grid; gap: 4px; margin-top: 12px; }
.course-badge figcaption strong { font-weight: 600; }
.course-badge figcaption span { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.course-badge figcaption a { justify-self: start; color: var(--ink); font-size: 14px; text-underline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .course-badge-img img { transition: none; } .course-badge-img:hover img { transform: none; } }
@media (max-width: 720px) { .course-badges { grid-template-columns: 1fr; } }
.btn-invert-ghost { color: var(--bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bg) 35%, var(--ink)); }
.btn-invert-ghost:hover { background: color-mix(in srgb, var(--bg) 12%, var(--ink)); }

/* ---------- Contact ---------- */
.contact-section { border-top: 0; padding-top: 40px; }
.contact {
  padding: 56px 48px; border-radius: 26px;
  background: var(--ink); color: var(--bg);
}
.contact .label { color: color-mix(in srgb, var(--bg) 60%, var(--ink)); }
.contact .label::before { box-shadow: 0 0 0 1px color-mix(in srgb, var(--bg) 70%, transparent); }
.contact h2 { margin: 18px 0 18px; font-size: clamp(1.9rem, 1.3rem + 2vw, 2.9rem); max-width: 16ch; }
.contact > p:not(.label):not(.contact-meta) { max-width: 52ch; font-size: 1.08rem; color: color-mix(in srgb, var(--bg) 78%, var(--ink)); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.contact-meta { margin-top: 36px; font-family: var(--mono); font-size: 12px; color: color-mix(in srgb, var(--bg) 60%, var(--ink)); }
.contact .sep { color: color-mix(in srgb, var(--bg) 30%, var(--ink)); }

/* ---------- Footer ---------- */
.footer { padding: 8px 0 48px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- Reveal on scroll (only when JS is on) ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .dot::after { animation: none; }
  .frame img, .case { transition: none; }
}

/* ---------- Tablet & phone ---------- */
@media (max-width: 1080px) {
  .wrap { padding: 0 32px; }
}

@media (max-width: 960px) {
  .side {
    position: sticky; top: 0; bottom: auto; width: auto; height: 64px;
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 0 16px; border-right: 0; border-bottom: 1px solid var(--line);
    background: transparent;
  }
  /* Blur lives on a pseudo-element: backdrop-filter on .side itself would
     become the containing block for the fixed menu panel and collapse it. */
  .side::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
  .side.open::before { background: var(--bg); }
  .profile { padding: 0; gap: 10px; }
  .avatar { width: 36px; height: 36px; }
  .name { font-size: 15px; }
  .role { display: none; }

  .menu-btn {
    display: inline-flex; align-items: center; gap: 10px;
    height: 40px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer;
    background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line);
    font: 500 14px/1 var(--sans);
  }
  .menu-btn-icon { position: relative; width: 14px; height: 8px; }
  .menu-btn-icon::before, .menu-btn-icon::after {
    content: ""; position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; border-radius: 2px;
    transition: transform .25s var(--ease), top .25s var(--ease);
  }
  .menu-btn-icon::before { top: 0; }
  .menu-btn-icon::after { top: 6.5px; }
  .menu-btn[aria-expanded="true"] .menu-btn-icon::before { top: 3.25px; transform: rotate(45deg); }
  .menu-btn[aria-expanded="true"] .menu-btn-icon::after { top: 3.25px; transform: rotate(-45deg); }

  .side-panel {
    position: fixed; left: 0; right: 0; top: 64px; bottom: 0;
    margin: 0; padding: 16px 16px 24px; gap: 24px; justify-content: flex-start;
    background: var(--bg); overflow-y: auto;
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility 0s .25s;
  }
  .side.open .side-panel { visibility: visible; opacity: 1; transform: none; transition: opacity .25s var(--ease), transform .25s var(--ease); }
  .nav a { font-size: 18px; padding: 14px 12px; }
  .side-panel > .side-foot { margin-top: 0; }
  .badges { margin: 0; padding: 0 4px; }
  .side-foot { padding: 20px 4px 0; }

  .main { margin-left: 0; }
  section.hero { padding: 64px 0 72px; }
  section { padding: 64px 0; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .cases-grid, .fit, .quotes, .note-grid { grid-template-columns: 1fr; }
  .note-card-body { padding: 16px 18px 20px; }
  .notes-block { padding-top: 36px; }
  .services li { grid-template-columns: 36px minmax(0, 1fr); gap: 6px 12px; }
  .services li p { grid-column: 2; }
  .stack-row { grid-template-columns: 1fr; gap: 10px; }
  .case-body, .case-featured .case-body { padding: 18px 18px 22px; }
  .case-own { grid-template-columns: 1fr; padding: 20px 18px; }
  .case-featured .case-link { display: none; }
  .contact { padding: 36px 22px; border-radius: 20px; }
  .case-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .case-header { padding: 48px 0 28px; }
  .case-stat { padding: 16px; }
  .about-hero { grid-template-columns: 1fr; gap: 28px; }
  .about-photo { max-width: 320px; }
  .notes a { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; }
  .notes time { grid-column: 1 / -1; }
  .lede { font-size: 1.06rem; }
  h1 { letter-spacing: -.03em; }
}

/* Flow diagram (automation case hero): plain HTML boxes so it follows the theme and stacks on phones */
.flow { display: grid; gap: 8px; padding: clamp(18px, 3.2vw, 32px); background: var(--bg); font-size: .92rem; line-height: 1.35; }
.flow-node { margin: 0; padding: 11px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); }
.flow-node b { display: block; font-weight: 600; }
.flow-node span { display: block; margin-top: 2px; font-size: .82rem; color: var(--muted); }
.flow-hub { justify-self: center; min-width: min(100%, 280px); text-align: center; background: var(--accent); border-color: transparent; color: var(--on-accent); }
.flow-hub span { color: var(--on-accent); opacity: .72; }
.flow-mid { justify-self: center; min-width: min(100%, 280px); text-align: center; }
.flow-arrow { margin: 0; text-align: center; font-family: var(--mono); font-size: .9rem; line-height: 1; color: var(--muted); }
.flow-pair, .flow-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flow-col { display: grid; gap: 8px; align-content: start; }
.flow-label { margin: 0 0 2px; font-family: var(--mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: center; }
.flow-foot { margin: 6px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); font-size: .84rem; color: var(--muted); text-align: center; }
@media (max-width: 480px) {
  .flow-cols { grid-template-columns: 1fr; gap: 18px; }
}

/* Workflow illustration on the automation card: inline SVG drawn with theme tokens */
.case-flowcard { margin-top: 16px; }
.wf { display: block; width: 100%; height: auto; aspect-ratio: 1280 / 546; }
.wf-dot { fill: var(--line); }
.wf-node { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.wf-hub { fill: var(--accent); stroke: none; }
.wf-end { stroke: var(--ink); stroke-width: 2.5; }
.wf-ico { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.wf-hub + .wf-ico { stroke: var(--on-accent); }
.wf-link { fill: none; stroke: var(--muted); stroke-width: 2.5; opacity: .75; }
.wf-port { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.wf-label { fill: var(--muted); font-family: var(--mono); font-size: 19px; letter-spacing: .02em; text-anchor: middle; }
.wf-packet { fill: var(--accent); stroke: var(--on-accent); stroke-width: 2; }
a.case:hover .wf-link { opacity: 1; }
@media (max-width: 720px) { .wf-label { display: none; } }
@media (prefers-reduced-motion: reduce) { .wf-packet { display: none; } }

/* Wide drawn image on a featured card (same proportions as the Hustle clip) */
.frame img.is-wide { aspect-ratio: 1280 / 546; }

/* ---------- Case galleries ---------- */
/* Brand images sit without a browser frame; site screenshots keep theirs */
.case-figure > img, .case-gallery > img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 14px; }
.case-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.case-gallery .frame { margin: 0; border-radius: 12px; }
.case-gallery .frame img { aspect-ratio: auto; }
.case-figure .frame video.is-natural { aspect-ratio: auto; }
/* Phone recording: narrow and rounded like a handset */
.case-phone { display: block; width: min(100%, 300px); height: auto; margin: 0 auto; border: 1px solid var(--line); border-radius: 32px; background: var(--surface-2); }
.case-figure:has(.case-phone) figcaption { text-align: center; }
/* A wide card between two grids of pairs */
.cases-grid + .case-featured { margin-top: 16px; }
@media (max-width: 720px) { .case-gallery { grid-template-columns: 1fr; } }
