/* ============================================================
   BRAND SWAP POINT. Rebrand = change values in :root + the dark blocks below,
   plus /public/favicon.svg. Nothing else in the codebase hardcodes colour or font.
   v2 2026-09-06: cool teal-biased ground (was warm cream), display sans + body serif
   + data mono (was serif display on system sans).
   ============================================================ */
:root {
  --bg:        #F5F7F6;
  --bg-sunk:   #EBEFED;
  --surface:   #FFFFFF;
  --text:      #101413;
  --text-mute: #5A6663;
  --rule:      #D5DDDA;
  /* One accent, spent on actions. Amber carries one meaning only: not answering. */
  --accent:      #0B7A62;
  --accent-ink:  #FFFFFF;
  --accent-mute: #0B7A6214;
  --ok:          #0B7A62;
  --warn:        #B7791F;

  --font-display: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --font-ui:      'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans:    'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --step--1: clamp(0.83rem, 0.80rem + 0.15vw, 0.92rem);
  --step-0:  clamp(1.02rem, 0.97rem + 0.22vw, 1.14rem);
  --step-1:  clamp(1.25rem, 1.15rem + 0.50vw, 1.55rem);
  --step-2:  clamp(1.65rem, 1.40rem + 1.10vw, 2.30rem);
  --step-3:  clamp(2.30rem, 1.70rem + 2.60vw, 3.90rem);
  --measure: 66ch;
  --gap:     clamp(1rem, 0.6rem + 2vw, 2rem);
  --page:    1180px;
  --radius:  4px;
  --spring:  cubic-bezier(.16, 1, .3, 1);
}

/* Explicit choice wins; otherwise follow the OS. Every token above is defined on bare
   :root, so nothing is undefined in any of the three theme states. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0E1211; --bg-sunk: #0A0D0C; --surface: #151A18;
    --text: #E8ECEA; --text-mute: #98A39F; --rule: #26302B;
    --accent: #46D3AE; --accent-ink: #0E1211; --accent-mute: #46D3AE1F; --ok: #46D3AE; --warn: #D9A756;
  }
}
:root[data-theme='dark'] {
  --bg: #0E1211; --bg-sunk: #0A0D0C; --surface: #151A18;
  --text: #E8ECEA; --text-mute: #98A39F; --rule: #26302B;
  --accent: #46D3AE; --accent-ink: #0E1211; --accent-mute: #46D3AE1F; --ok: #46D3AE; --warn: #D9A756;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: var(--step-0); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 {
  font-family: var(--font-display); font-weight: 500; line-height: 1.08;
  letter-spacing: -0.02em; margin: 0; text-wrap: balance;
  font-variation-settings: 'opsz' 96, 'wdth' 100;
}
h1 { font-size: var(--step-3); font-weight: 600; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; text-decoration-color: var(--rule); }
a:hover { text-decoration-color: var(--accent); }
img { max-width: 100%; height: auto; }
code, kbd, pre { font-family: var(--font-mono); font-size: 0.9em; }
table { font-variant-numeric: tabular-nums; }

.wrap { max-width: var(--page); margin-inline: auto; padding-inline: var(--gap); }
.prose { max-width: var(--measure); }
.mute { color: var(--text-mute); }
.small { font-size: var(--step--1); }
.eyebrow {
  font-family: var(--font-sans); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-mute);
}
.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Buttons: one filled (the action), one text link. Never two filled side by side. */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; text-decoration: none;
  font-family: var(--font-sans); font-weight: 600; font-size: .95rem;
  padding: .72rem 1.25rem; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  transition: transform .5s var(--spring), background .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.link-go { font-family: var(--font-sans); font-weight: 600; text-decoration: none; color: var(--accent); }
.link-go::after { content: " →"; }

/* Scroll reveal: visible at rest, nudged into place. Never opacity 0. */
.reveal { opacity: .72; transform: translateY(10px); transition: opacity .9s var(--spring), transform .9s var(--spring); }
.reveal.in { opacity: 1; transform: none; }

/* Focus is never removed — only restyled. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

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

/* ====== portfolio layout (shares the blog's tokens above; one system, two sites) ====== */
.site { border-bottom: 1px solid var(--rule); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.bar { display: flex; align-items: center; gap: 2rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; margin-right: auto; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; letter-spacing: -.02em; }
.brand-mark { color: var(--accent); font-size: .8rem; }
nav.primary { display: flex; gap: 1.6rem; }
nav.primary a { text-decoration: none; font-family: var(--font-sans); font-size: .92rem; color: var(--text-mute); }
nav.primary a:hover { color: var(--text); }
#theme { background: none; border: 1px solid var(--rule); color: var(--text-mute); border-radius: var(--radius); width: 32px; height: 32px; cursor: pointer; font-size: .9rem; line-height: 1; flex-shrink: 0; }
#theme:hover { color: var(--accent); border-color: var(--accent); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; position: fixed; background: var(--surface); padding: .6rem 1rem; z-index: 99; }

.band { padding-block: clamp(2.6rem, 5vw, 4.5rem); border-top: 1px solid var(--rule); }
.band > .eyebrow { margin-bottom: .6rem; }
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(2rem, 4vw, 4rem); align-items: start; padding-top: clamp(3rem, 7vw, 6.5rem); padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.hero h1 { margin-top: .9rem; }
.hero h1 .w { display: inline-block; }
.lede { font-size: var(--step-1); font-weight: 300; color: var(--text-mute); margin: 1.4rem 0 0; }
.cta-row { display: flex; align-items: center; gap: 1.4rem; margin: 2rem 0 .6rem; flex-wrap: wrap; }
.who { font-family: var(--font-sans); font-size: .9rem; color: var(--text-mute); margin: 0; }

.readout { font-family: var(--font-mono); font-size: .8rem; background: var(--bg-sunk); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.1rem; }
.readout-head { display: flex; align-items: center; gap: .5rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: .06em; font-size: .68rem; margin-bottom: .8rem; }
.readout-when { margin-left: auto; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--accent-mute); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.readout table { width: 100%; border-collapse: collapse; }
.readout td { padding: .26rem 0; border-bottom: 1px solid var(--rule); }
.readout .v { text-align: right; padding-right: .8rem; }
.readout .v.ok { color: var(--ok); } .readout .v.warn { color: var(--warn); }
.readout .s { color: var(--text-mute); text-align: right; width: 3.2em; }
.ro-row { transition: background .6s var(--spring); } .ro-row.hit { background: var(--accent-mute); }
.readout-foot { margin: .8rem 0 0; color: var(--text-mute); font-size: .74rem; line-height: 1.5; } .readout-foot strong { color: var(--text); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.stat { background: var(--surface); padding: 1.3rem 1.4rem; text-decoration: none; display: grid; gap: .2rem; }
.stat:hover { background: var(--accent-mute); }
.stat-n { font-family: var(--font-display); font-size: var(--step-2); font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.stat-l { font-family: var(--font-sans); font-size: .92rem; } .stat-s { font-size: .78rem; color: var(--text-mute); }

.pipe { margin: 1.4rem 0 0; }
.pipe svg { width: 100%; height: auto; display: block; overflow: visible; }
.pipe .lane { stroke: var(--rule); stroke-width: 2; fill: none; }
.pipe .node rect { fill: var(--surface); stroke: var(--rule); }
.pipe .node text { fill: var(--text); font-family: var(--font-sans); font-size: 12px; font-weight: 600; }
.pipe .node .n { fill: var(--text-mute); font-family: var(--font-mono); font-size: 10.5px; font-weight: 400; }
.pipe .pulse { fill: var(--accent); }
.pipe.arm .pulse { animation: travel 6s linear infinite; }
@keyframes travel { from { transform: translateX(0); } to { transform: translateX(860px); } }

.stage { margin-top: 2rem; }
.stage h3 { font-size: 1.05rem; color: var(--text-mute); font-family: var(--font-sans); font-weight: 600; letter-spacing: .02em; margin-bottom: .8rem; }
.bento { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.tile { background: var(--surface); padding: 1.3rem 1.3rem 1.2rem; display: flex; flex-direction: column; gap: .45rem; transition: background .3s; }
.tile:hover { background: var(--accent-mute); }
.tile h4 { font-family: var(--font-display); font-weight: 500; font-size: 1.15rem; margin: 0; display: flex; align-items: center; gap: .5rem; }
.tile .st { font-family: var(--font-mono); font-size: .68rem; color: var(--ok); border: 1px solid var(--rule); border-radius: 999px; padding: .1rem .5rem; }
.tile .st.warn { color: var(--warn); }
.tile p { font-size: .92rem; margin: 0; flex: 1; }
.tile-links { display: flex; gap: 1.2rem; }

.method { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.4rem, 3vw, 3rem); margin-top: 1.2rem; }
.method h3 { margin-bottom: .5rem; } .method p { margin: 0; font-size: .95rem; }

.lead { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem 3rem; margin-top: 1.4rem; }
.lead-item h3 { margin-bottom: .5rem; } .lead-item p { margin: 0 0 .6rem; font-size: .95rem; }
.lead-item ul { margin: 0; padding-left: 1.1rem; font-size: .9rem; color: var(--text-mute); display: grid; gap: .25rem; }

.writing { display: grid; grid-template-columns: 1fr 1.4fr; gap: clamp(2rem, 4vw, 4rem); align-items: start; }
.posts { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 1.2rem; }
.posts a { text-decoration: none; display: grid; gap: .25rem; } .posts time { font-size: .78rem; color: var(--text-mute); }
.posts h3 { font-size: 1.15rem; } .posts p { margin: 0; font-size: .92rem; }
.books { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem 2rem; }
.books a { text-decoration: none; display: block; padding: .55rem 0; border-bottom: 1px solid var(--rule); font-family: var(--font-sans); font-size: .95rem; }
.books a:hover { color: var(--accent); }

.contact { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(2rem, 4vw, 4rem); align-items: center; }
.contact-b { display: grid; gap: .8rem; justify-items: start; }
.site-foot { margin-top: 5rem; padding-bottom: 4rem; }
.site-foot p { margin: 1.5rem 0 0; font-size: .9rem; max-width: var(--measure); }

@media (max-width: 900px) {
  .hero, .writing, .contact { grid-template-columns: 1fr; }
  .stats, .bento, .lead, .method { grid-template-columns: repeat(2, 1fr); }
  .method { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .bar { gap: .8rem; }
  nav.primary { gap: 1rem; flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 85%, transparent); }
  nav.primary::-webkit-scrollbar { display: none; } nav.primary a { flex-shrink: 0; font-size: .85rem; } .brand { flex-shrink: 0; }
  .stats, .bento, .lead, .books { grid-template-columns: 1fr; }
}

/* The lead-capture widget (/assets/leadbot.js, shared with other pages) paints its own
   blues inline. On this page it takes the site accent; the script itself is untouched. */
.ccb-b, .ccb-btn { background: var(--accent) !important; color: var(--accent-ink) !important; border-color: var(--accent) !important; box-shadow: none !important; }
.ccb-panel { background: var(--surface) !important; color: var(--text) !important; border-color: var(--rule) !important; font-family: var(--font-sans) !important; }
