/* =========================================================
   Tokens: midnight navy, warm white, brushed-brass accents
   ========================================================= */
:root {
  --navy: #0e1829;
  --navy-2: #15223a;
  --navy-3: #1d2c47;
  --ivory: #f8f5ef;
  --ivory-2: #f1ece2;
  --paper: #fffdf9;
  --ink: #142033;
  --muted: #5c6474;
  --line: #e3dccd;
  --gold: #7a5c28;          /* text brass on ivory: 5.6:1 contrast */
  --gold-deco: #b6955b;     /* decorative brass on ivory */
  --gold-hi: #d4bb84;       /* brass on navy */
  --gold-grad: linear-gradient(135deg, #e3cf9f 0%, #c3a265 45%, #9c7a41 100%);
  --on-navy: #ece6da;
  --on-navy-muted: #a7afbf;

  --bg: var(--ivory);
  --bg-tint: var(--ivory-2);
  --card: var(--paper);
  --text: var(--ink);
  --accent: var(--gold);
  --focus: #6e5222;          /* focus ring on ivory: >5:1 against background */

  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --maxw: 1080px;
  --r: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1322;
    --bg-tint: var(--navy);
    --card: var(--navy-2);
    --text: #ece6da;
    --muted: #a7afbf;
    --line: #26344d;
    --accent: var(--gold-hi);
    --focus: var(--gold-hi);
  }
}

/* ===================== Base ===================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1rem/1.7 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-wrap: anywhere;
}
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.1; }
h2 { font: 500 clamp(2rem, 6.5vw, 2.9rem)/1.08 var(--serif); letter-spacing: -0.01em; }
h3 { font: 600 clamp(1.5rem, 4.6vw, 1.9rem)/1.15 var(--serif); }
h4 { font: 600 .95rem/1.3 var(--sans); }
p { margin: 0 0 1.1rem; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
/* Navy surfaces get the bright brass ring */
.topbar, .hero, .page-hero, .feature, .personal, .footer, .nav-links { --focus: var(--gold-hi); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.fill { fill: currentColor; stroke: none; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
@media (min-width: 760px) { .wrap { padding: 0 40px; } }

.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--card); padding: 8px 12px; }
.skip:focus { left: 8px; }

.eyebrow {
  font: 600 .7rem/1 var(--sans); letter-spacing: .2em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 1rem;
}
.muted { color: var(--muted); }
.label {
  font: 600 .7rem/1 var(--sans); letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin: 2.25rem 0 1rem;
}

/* ===================== Top bar ===================== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--navy) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(212, 187, 132, .18);
}
.topbar-inner { min-height: 56px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding-top: 6px; padding-bottom: 6px; }
.topbar nav { flex-wrap: wrap; justify-content: flex-end; }
.mark { font: 600 1.35rem/1 var(--serif); color: var(--on-navy); text-decoration: none; letter-spacing: .04em; }
.mark span { color: var(--gold-hi); padding: 0 1px; }
.topbar nav { display: flex; align-items: center; gap: 4px; }
.nav-links { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2px; }
.nav-links a, .menu-btn {
  color: var(--on-navy-muted); text-decoration: none; font: 500 .85rem/1 var(--sans);
  padding: 10px 12px; border-radius: 999px; display: inline-flex; align-items: center; min-height: 40px;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--on-navy); }
.nav-links a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--gold-hi); border-radius: 0; }
.menu-btn { display: none; background: none; border: 1px solid rgba(236,230,218,.25); cursor: pointer; gap: 8px; color: var(--on-navy); }
.menu-btn svg { width: 16px; height: 16px; }
.topbar .nav-pill {
  color: var(--navy); background: var(--gold-grad); text-decoration: none; font: 600 .85rem/1 var(--sans);
  padding: 10px 14px; border-radius: 999px; min-height: 40px; display: inline-flex; align-items: center; margin-left: 4px;
}
.topbar .nav-pill:hover { filter: brightness(1.06); }
/* Compact menu on narrow screens (only when JS is available; without JS the links stay inline) */
@media (max-width: 699px) {
  .js .menu-btn { display: inline-flex; }
  .js .nav-links {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px 12px 14px;
    background: var(--navy); border-bottom: 1px solid rgba(212,187,132,.25); box-shadow: 0 18px 30px rgba(0,0,0,.35);
  }
  .js .nav-links.open { display: flex; }
  .js .nav-links a { padding: 14px 12px; font-size: 1rem; border-radius: 10px; min-height: 48px; }
  .js .nav-links a[aria-current="page"] { box-shadow: none; color: var(--gold-hi); }
  html:not(.js) .nav-links a { padding: 8px 7px; font-size: .8rem; }
}

/* ===================== Hero ===================== */
.hero {
  background:
    radial-gradient(120% 70% at 85% 0%, rgba(212,187,132,.10), transparent 60%),
    radial-gradient(90% 60% at 0% 100%, rgba(80,110,170,.14), transparent 60%),
    var(--navy);
  color: var(--on-navy);
  padding: 28px 0 56px;
}
.hero-grid { display: grid; gap: 32px; }
.portrait { margin: 0; position: relative; max-width: 360px; }
.portrait::before {
  content: ""; position: absolute; inset: 10px -10px -10px 10px;
  border: 1px solid rgba(212,187,132,.55); border-radius: var(--r); pointer-events: none;
}
.portrait img {
  position: relative; width: 100%; height: auto; aspect-ratio: 687 / 859; object-fit: cover;
  border-radius: var(--r); box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.hero .eyebrow { color: var(--gold-hi); }
.hero h1 {
  font: 500 clamp(2.6rem, 11vw, 4.6rem)/1.0 var(--serif); letter-spacing: -0.015em; color: #f6f1e7;
}
.hero h1 .nick { font-style: italic; color: var(--gold-hi); }
.hero h1 .md { white-space: nowrap; }
@media (max-width: 380px) { .hero h1 .md { white-space: normal; } }
.role { margin: 1rem 0 0; font-size: 1rem; font-weight: 500; color: var(--on-navy); letter-spacing: .01em; }
.role .dot { color: var(--gold-hi); padding: 0 .3em; }
.role .nw { display: inline-block; max-width: 100%; }
.rule { width: 64px; height: 1px; border: 0; background: var(--gold-grad); margin: 1.5rem 0; }
.hero-lede { color: var(--on-navy-muted); font-size: 1.05rem; max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.75rem; }

/* Mobile-first hero: full-bleed portrait with the name over its lower edge,
   so name, title and "Add to contacts" all land above the fold for QR visitors. */
@media (max-width: 859px) {
  .hero { padding: 0 0 48px; }
  .hero-grid { gap: 0; padding: 0; }
  .portrait { max-width: none; margin: 0; }
  .portrait::before { display: none; }
  .portrait::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(14,24,41,0) 45%, rgba(14,24,41,.85) 82%, var(--navy) 100%);
  }
  .portrait img {
    border-radius: 0; box-shadow: none;
    aspect-ratio: 1 / 1; max-height: 62vh; object-position: 50% 12%;
  }
  .hero-copy {
    position: relative; z-index: 1; margin-top: -112px; padding: 0 20px;
    display: flex; flex-direction: column;
  }
  .hero-copy .eyebrow { order: 1; margin-bottom: .6rem; }
  .hero h1 { order: 2; }
  .role { order: 3; margin-top: .7rem; font-size: .95rem; }
  .hero-actions { order: 4; margin-top: 1.25rem; }
  .rule { order: 5; margin: 1.75rem 0 1.25rem; }
  .hero-lede { order: 6; margin: 0; }
}
@media (min-width: 600px) and (max-width: 859px) {
  .portrait img { aspect-ratio: 16 / 11; object-position: 50% 18%; }
  .hero-copy { padding: 0 40px; }
}

@media (min-width: 860px) {
  .hero { padding: 72px 0 96px; }
  .hero-grid { grid-template-columns: 340px 1fr; gap: 72px; align-items: center; }
  .portrait { max-width: none; }
}

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 999px; font: 600 .92rem/1 var(--sans); text-decoration: none;
  transition: transform .15s ease, filter .15s ease, border-color .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-gold { background: var(--gold-grad); color: var(--navy); box-shadow: 0 6px 20px rgba(195,162,101,.25); }
.btn-gold:hover { filter: brightness(1.06); }
.btn-line { color: var(--on-navy); border: 1px solid rgba(236,230,218,.28); }
.btn-line:hover { border-color: var(--gold-hi); color: #fff; }
.btn-icon { width: 48px; padding: 0; justify-content: center; }
@media (max-width: 420px) { .hero-actions .btn-gold { flex: 1 1 100%; justify-content: center; } }

/* ===================== Sections ===================== */
.section { padding: 72px 0; }
@media (min-width: 860px) { .section { padding: 112px 0; } }
.section-tint { background: var(--bg-tint); }
.section-title { margin-bottom: 40px; }

/* About */
.about-grid { display: grid; gap: 28px; }
@media (min-width: 860px) { .about-grid { grid-template-columns: 1fr 1.6fr; gap: 72px; } }
.prose p { font-size: 1.05rem; color: var(--text); }
.facts { margin: 2rem 0 0; border-top: 1px solid var(--line); }
.facts div { display: grid; gap: 2px; padding: 14px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 560px) { .facts div { grid-template-columns: 9.5rem 1fr; gap: 16px; } }
.facts dt { font: 600 .7rem/1.9 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }

/* Work threads */
.thread { display: grid; gap: 20px; padding: 40px 0; border-top: 1px solid var(--line); }
.thread:last-child { padding-bottom: 0; }
@media (min-width: 860px) { .thread { grid-template-columns: 1fr 2fr; gap: 72px; padding: 56px 0; } }
.thread-head { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 860px) { .thread-head { position: sticky; top: 96px; align-self: start; } }
.num {
  font: 500 1.05rem/1 var(--serif); letter-spacing: .12em; color: var(--accent);
  display: inline-flex; align-items: center; gap: 12px;
}
.num::after { content: ""; width: 40px; height: 1px; background: var(--gold-grad); }
.thread-body > p { color: var(--text); }

.ledger { list-style: none; margin: 1.5rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.ledger li {
  display: flex; justify-content: space-between; gap: 16px; padding: 12px 0;
  border-bottom: 1px solid var(--line); font-size: .95rem;
}
.ledger li span:last-child { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .85rem; }

.states { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.states li {
  min-width: 46px; text-align: center; padding: 6px 10px; border-radius: 8px;
  font: 600 .8rem/1.2 var(--sans); letter-spacing: .08em;
  border: 1px solid color-mix(in srgb, var(--gold-deco, var(--accent)) 60%, transparent); color: var(--accent);
}

.services { display: grid; gap: 1px; margin-top: 1.5rem; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
@media (min-width: 560px) { .services { grid-template-columns: 1fr 1fr; } }
.services > div { background: var(--card); padding: 20px; }
.services h4 { margin-bottom: 6px; }
.services p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.6; }

.stats { list-style: none; margin: 0 0 2rem; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stats li { background: var(--card); padding: 18px 16px; display: grid; gap: 4px; }
.stats b { font: 500 2.4rem/1 var(--serif); color: var(--accent); }
.stats span { font-size: .8rem; color: var(--muted); line-height: 1.35; }

.feature {
  margin: 0; padding: 28px 24px; border-radius: var(--r);
  background: var(--navy); color: var(--on-navy); position: relative; overflow: hidden;
}
.feature::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold-grad); }
.feature-tag { font: 600 .7rem/1.4 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-hi); }
.feature p { color: var(--on-navy-muted); font-size: .97rem; }
.feature blockquote {
  margin: 1.25rem 0 .75rem; padding: 0;
  font: italic 500 clamp(1.25rem, 4vw, 1.5rem)/1.35 var(--serif); color: #f6f1e7;
}
.feature figcaption { font-size: .85rem; color: var(--on-navy-muted); }
.feature a { color: var(--gold-hi); }

.selected { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.selected li { counter-increment: s; display: grid; gap: 2px; padding: 14px 0 14px 40px; border-bottom: 1px solid var(--line); position: relative; }
.selected li::before {
  content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: 16px;
  font: 500 .9rem/1 var(--serif); color: var(--accent); letter-spacing: .06em;
}
.selected li > a { color: var(--text); text-decoration: none; font-weight: 500; }
.selected li > a:hover { color: var(--accent); }
.selected li span { font-size: .85rem; color: var(--muted); }

.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.plain li { position: relative; padding-left: 20px; }
.plain li::before { content: ""; position: absolute; left: 0; top: .78em; width: 8px; height: 1px; background: var(--accent); }

.thread-links { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 2.25rem; }
.arrow { font-weight: 600; text-decoration: none; color: var(--accent); }
.arrow::after { content: " →"; transition: margin .15s; }
.arrow:hover::after { margin-left: 4px; }

/* Personal */
.personal {
  background:
    radial-gradient(1px 1px at 12% 22%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1px 1px at 78% 18%, rgba(255,255,255,.45), transparent 60%),
    radial-gradient(1.5px 1.5px at 64% 70%, rgba(212,187,132,.7), transparent 60%),
    radial-gradient(1px 1px at 32% 82%, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(1px 1px at 90% 58%, rgba(255,255,255,.4), transparent 60%),
    radial-gradient(1px 1px at 45% 35%, rgba(255,255,255,.3), transparent 60%),
    linear-gradient(180deg, var(--navy-2), var(--navy));
  color: var(--on-navy);
}
.personal-inner { max-width: 760px; text-align: center; }
.personal .eyebrow { color: var(--gold-hi); }
.personal h2 { color: #f6f1e7; margin-bottom: 1.25rem; }
.personal p { color: var(--on-navy-muted); font-size: 1.05rem; }

/* Connect */
.connect-grid { display: grid; gap: 32px; }
@media (min-width: 860px) { .connect-grid { grid-template-columns: 1fr 1fr; gap: 72px; align-items: start; } }
.connect-grid h2 { margin-bottom: 1rem; }
.connect-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.connect-list a {
  display: flex; align-items: center; gap: 16px; padding: 16px 18px; min-height: 64px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  text-decoration: none; color: var(--text);
  transition: border-color .15s, transform .15s;
}
.connect-list a:hover { border-color: var(--accent); transform: translateY(-1px); }
.connect-list svg { width: 22px; height: 22px; color: var(--accent); }
.connect-list span { display: grid; line-height: 1.35; }
.connect-list b { font-weight: 600; }
.connect-list small { color: var(--muted); font-size: .85rem; word-break: break-word; }
.connect-list li:first-child a { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.connect-list li:first-child svg { color: var(--gold-hi); }
.connect-list li:first-child small { color: var(--on-navy-muted); }

/* Footer */
.footer { background: var(--navy); color: var(--on-navy-muted); padding: 32px 0 calc(32px + env(safe-area-inset-bottom)); font-size: .85rem; }
.footer p { margin: 0 0 .35rem; }
.footer .fine { font-size: .78rem; opacity: .8; }
.footer a { color: var(--gold-hi); }

/* ===================== Research page ===================== */
.page-hero { background: var(--navy); color: var(--on-navy); padding: 56px 0 48px; }
.page-hero h1 { font: 500 clamp(2.4rem, 9vw, 3.8rem)/1.02 var(--serif); color: #f6f1e7; }
.page-hero p { color: var(--on-navy-muted); max-width: 40em; margin-top: 1rem; }
.page-hero .eyebrow { color: var(--gold-hi); }
.page-hero .hero-actions { margin-top: 1.5rem; }
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.5rem; }
.jump a {
  font-size: .82rem; font-weight: 500; text-decoration: none; color: var(--on-navy);
  border: 1px solid rgba(236,230,218,.25); border-radius: 999px; padding: 6px 14px;
}
.jump a:hover { border-color: var(--gold-hi); }

.rec { padding: 56px 0; border-bottom: 1px solid var(--line); }
.rec:last-of-type { border-bottom: 0; }
.rec h2 { font-size: clamp(1.8rem, 5vw, 2.3rem); margin-bottom: .4rem; }
.rec .count { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.year { font: 600 .75rem/1 var(--sans); letter-spacing: .16em; color: var(--accent); margin: 2rem 0 .5rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.cites { list-style: none; margin: 0; padding: 0; }
.cites li { padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: .93rem; line-height: 1.6; color: var(--muted); }
.cites li:last-child { border-bottom: 0; }
.cites .t { color: var(--text); font-weight: 500; display: block; margin-bottom: 2px; }
.cites b { color: var(--text); font-weight: 600; }
.cites a { white-space: nowrap; }
.two-col { display: grid; gap: 32px; }
@media (min-width: 860px) { .two-col { grid-template-columns: 1fr 1fr; gap: 64px; } }

/* Sub-heading inside thread titles */
.sub-h { display: block; margin-top: .45rem; font: 600 .7rem/1.3 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

/* Apps */
.apps { list-style: none; margin: 1.75rem 0 0; padding: 0; display: grid; gap: 14px; }
@media (min-width: 720px) { .apps { grid-template-columns: 1fr 1fr; } }
.app {
  display: grid; grid-template-columns: 56px 1fr; gap: 16px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px;
}
.app img { width: 56px; height: 56px; border-radius: 22%; box-shadow: 0 2px 8px rgba(14,24,41,.16); background: #fff0; }
.app h4 { font: 600 1.4rem/1.1 var(--serif); }
.app .tagline { margin: .2rem 0 .6rem; font-size: .85rem; font-weight: 500; color: var(--accent); }
.app p { font-size: .92rem; line-height: 1.6; color: var(--muted); margin-bottom: .6rem; }
.app .stack { margin: 0; font-size: .74rem; letter-spacing: .04em; color: var(--muted); opacity: .85; }

/* Full-width thread (Apps) */
@media (min-width: 860px) {
  .thread-wide { grid-template-columns: 1fr; gap: 28px; }
  .thread-wide .thread-head { position: static; }
  .thread-wide .thread-body > p { max-width: 46em; }
}
@media (min-width: 1040px) { .apps { grid-template-columns: repeat(3, 1fr); } }

.label .asof { letter-spacing: .06em; text-transform: none; font-weight: 500; opacity: .8; margin-left: .4em; }
.states-pending li { border-style: dashed; color: var(--muted); }

.stats .stat-link { display: grid; gap: 4px; text-decoration: none; color: inherit; }
.stats li:has(.stat-link):hover { background: color-mix(in srgb, var(--card) 92%, var(--accent)); }

/* ===================== Case studies ===================== */
.case-grid { display: grid; gap: 18px; }
.case {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 24px 20px; display: grid; gap: 18px; scroll-margin-top: 80px;
}
@media (min-width: 900px) { .case { grid-template-columns: 1.35fr 1fr; gap: 36px; padding: 32px; align-items: start; } }
.case-tag { font: 600 .7rem/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: .5rem; }
.case h3 { font-size: clamp(1.45rem, 4.4vw, 1.8rem); margin-bottom: 1rem; }
.case dl { margin: 0; display: grid; gap: 12px; }
.case dt { font: 600 .68rem/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.case dd { margin: 2px 0 0; font-size: .95rem; line-height: 1.6; }
.case .links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 4px; font-size: .9rem; }
.case figure { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.case figcaption { font-size: .8rem; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.case figure svg { width: 100%; height: auto; display: block; overflow: visible; stroke: none; }
.viz-text { fill: var(--text); font: 500 12px var(--sans); }
.viz-muted { fill: var(--muted); font: 500 11px var(--sans); }
.viz-bar { fill: var(--accent); }
.viz-bar-2 { fill: color-mix(in srgb, var(--accent) 45%, var(--bg)); }
.viz-line { stroke: var(--line); stroke-width: 1; }
.viz-box { fill: var(--card); stroke: var(--accent); stroke-width: 1.2; }
.viz-arrow { stroke: var(--muted); stroke-width: 1.4; fill: none; }
.viz-mark { fill: var(--text); }
.case-preview { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .case-preview { grid-template-columns: 1fr 1fr; } }
.case-preview a {
  display: grid; gap: 4px; height: 100%; padding: 18px; border-radius: var(--r); background: var(--card);
  border: 1px solid var(--line); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s;
}
.case-preview a:hover { border-color: var(--accent); transform: translateY(-1px); }
.case-preview .k { font: 600 .68rem/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.case-preview .h { font: 600 1.25rem/1.2 var(--serif); }
.case-preview .r { font-size: .86rem; color: var(--muted); line-height: 1.5; }

/* ===================== Publication filters ===================== */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 1rem; }
.filters button {
  font: 500 .84rem/1 var(--sans); padding: 10px 14px; min-height: 40px; border-radius: 999px; cursor: pointer;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
}
.filters button[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
@media (prefers-color-scheme: dark) { .filters button[aria-pressed="true"] { background: var(--gold-hi); color: var(--navy); border-color: var(--gold-hi); } }
.filter-status { font-size: .85rem; color: var(--muted); margin: 0 0 .5rem; min-height: 1.4em; }
[hidden] { display: none !important; }

/* ===================== App portfolio ===================== */
.badge {
  display: inline-flex; max-width: 100%; white-space: normal; align-items: center; gap: 6px; font: 600 .7rem/1 var(--sans); letter-spacing: .1em;
  text-transform: uppercase; padding: 6px 10px; border-radius: 999px; color: var(--muted);
  border: 1px solid var(--line); background: var(--card); line-height: 1.2;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-deco); }
.project { display: grid; gap: 24px; padding: 40px 0; border-top: 1px solid var(--line); scroll-margin-top: 72px; }
.project:first-of-type { border-top: 0; padding-top: 8px; }
@media (min-width: 900px) {
  .project { grid-template-columns: 1fr 1.05fr; gap: 56px; align-items: start; padding: 56px 0; }
  .project:nth-of-type(even) .shot { order: 2; }
}
.project-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.project-head img { width: 52px; height: 52px; border-radius: 22%; box-shadow: 0 2px 8px rgba(14,24,41,.16); }
.project-head h2 { font-size: clamp(1.8rem, 5vw, 2.3rem); }
.project .tagline { color: var(--accent); font-weight: 500; margin: 0 0 1.25rem; }
.project dl { margin: 0; display: grid; gap: 14px; }
.project dt { font: 600 .68rem/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.project dd { margin: 3px 0 0; line-height: 1.65; }
.project .stack { font-size: .8rem; color: var(--muted); margin-top: 18px; }
.shot { margin: 0; }
.shot img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(14,24,41,.16); background: var(--card); }
.shot.phone img { max-width: 320px; margin: 0 auto; border-radius: 22px; }
.shot figcaption { font-size: .8rem; color: var(--muted); margin-top: 10px; text-align: center; }
.shot-missing {
  border: 1px dashed var(--line); border-radius: 12px; padding: 28px 20px; text-align: center; color: var(--muted); font-size: .9rem;
}
.more { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 760px) { .more { grid-template-columns: repeat(3, 1fr); } }
.more li { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 8px; align-content: start; }
.more .row { display: flex; align-items: center; gap: 12px; }
.more img { width: 44px; height: 44px; border-radius: 22%; }
.more h3 { font-size: 1.3rem; }
.more p { margin: 0; font-size: .9rem; color: var(--muted); line-height: 1.55; }
.more .stack { font-size: .74rem; }
.app-preview { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 14px; }
@media (min-width: 760px) { .app-preview { grid-template-columns: repeat(3, 1fr); } }
.app-preview a {
  display: grid; gap: 10px; height: 100%; text-decoration: none; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); padding: 14px; transition: border-color .15s, transform .15s;
}
.app-preview a:hover { border-color: var(--accent); transform: translateY(-1px); }
.app-preview .thumb { aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.app-preview .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.app-preview .thumb.icon-only { display: grid; place-items: center; }
.app-preview .thumb.icon-only img { width: 72px; height: 72px; border-radius: 22%; object-fit: contain; }
.app-preview .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.app-preview .h { font: 600 1.3rem/1.1 var(--serif); }
.app-preview .r { font-size: .86rem; color: var(--muted); line-height: 1.5; }
.more-inline { margin-top: 14px; font-size: .9rem; color: var(--muted); }
.draft-note { border-left: 3px solid var(--gold-deco); background: var(--card); padding: 12px 16px; border-radius: 8px; font-size: .9rem; }

/* Phones in landscape / very short screens: put the portrait beside the name instead of behind it */
@media (max-width: 859px) and (max-height: 520px) and (orientation: landscape) {
  .hero { padding: 20px 0 32px; }
  .hero-grid { grid-template-columns: 170px 1fr; gap: 28px; padding: 0 32px; align-items: center; }
  .portrait::after { display: none; }
  .portrait img { aspect-ratio: 687 / 859; max-height: none; border-radius: var(--r); object-position: 50% 0; }
  .hero-copy { margin-top: 0; padding: 0; }
  .hero h1 { font-size: 2.4rem; }
  .rule, .hero-lede { display: none; }
}
.shot-link { display: block; border-radius: 12px; }
@media (max-width: 600px) {
  .shot img { max-width: 300px; margin: 0 auto; border-radius: 20px; }
}
