:root, :root[data-theme="light"] {
  --bg: #f3f6f5; --surface: #e6ecea; --card: #ffffff; --fg: #142320; --muted: #52625e; --rule: #c9d4d0;
  --accent: #1d6b73; --accent-ink: #ffffff; --signal: #b8781f; --glow: none; --card-glow: none;
  --term-bg: #10201d; --term-fg: #d6f2ec; --term-dim: #8fb5ad; --term-ok: #7fd8c4;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --bg: #0e1614; --surface: #17221f; --card: #13201c; --fg: #e2eae7; --muted: #94a5a0; --rule: #2a3935;
          --accent: #63b5bd; --accent-ink: #0e1614; --signal: #e0a54b; --term-bg: #08100e; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0e1614; --surface: #17221f; --card: #13201c; --fg: #e2eae7; --muted: #94a5a0; --rule: #2a3935;
  --accent: #63b5bd; --accent-ink: #0e1614; --signal: #e0a54b; --term-bg: #08100e; color-scheme: dark; }
/* Retro: the two arcade looks. Neon sign and green-phosphor CRT. */
:root[data-theme="neon"] { --bg: #0a0614; --surface: #160d26; --card: #120a20; --fg: #f5eaff; --muted: #c9b6e0; --rule: #3a2259;
  --accent: #ff3ea5; --accent-ink: #1a0010; --signal: #5ff5ff;
  --glow: 0 0 6px #ff3ea5, 0 0 18px rgba(95,245,255,.55); --card-glow: 0 0 0 1px #ff3ea5, 0 0 16px rgba(255,62,165,.28);
  --term-bg: #05020c; --term-fg: #f5eaff; --term-dim: #c9b6e0; --term-ok: #5ff5ff; color-scheme: dark; }
:root[data-theme="crt"] { --bg: #020a04; --surface: #06140a; --card: #041008; --fg: #9dffa8; --muted: #5fd06c; --rule: #134d1f;
  --accent: #7dff8a; --accent-ink: #021004; --signal: #c8e86b;
  --glow: 0 0 6px rgba(125,255,138,.8); --card-glow: 0 0 0 1px #1d6e2c, 0 0 12px rgba(125,255,138,.16);
  --term-bg: #010602; --term-fg: #9dffa8; --term-dim: #5fd06c; --term-ok: #c8ffcf;
  --display: var(--mono); --body: var(--mono); color-scheme: dark; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.6 var(--body); }
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; max-width: 65ch; }

.wrap { max-width: 920px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }

/* header */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--fg); text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.nav a:hover { color: var(--fg); background: var(--surface); }
.nav a[aria-current="page"] { color: var(--fg); background: var(--surface); }

/* buttons */
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; font: 600 0.95rem var(--body); text-decoration: none; padding: 11px 18px; border-radius: 8px; border: 1.5px solid var(--accent); white-space: nowrap; cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--surface); }

/* sections */
main { display: block; }
section { padding: 56px 0; }
section + section { border-top: 1px solid var(--rule); }
.kicker { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); margin-bottom: 18px; }

/* hero */
.hero { padding: 72px 0 56px; }
.route { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 18px; }
.route span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); margin-right: 7px; vertical-align: 1px; }
.hero h1 { font-size: clamp(2.6rem, 8vw, 4.4rem); font-weight: 700; letter-spacing: -0.025em; margin-bottom: 14px; }
.hero .role { font-family: var(--display); font-size: clamp(1.2rem, 3.4vw, 1.55rem); font-weight: 500; line-height: 1.35; max-width: 32ch; margin-bottom: 16px; }
.hero .lede { color: var(--muted); font-size: 1.05rem; margin-bottom: 28px; }

/* figures */
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--rule); margin-top: 44px; }
.figures div { padding: 18px 16px 16px 0; display: grid; gap: 4px; align-content: start; }
.figures div + div { padding-left: 16px; border-left: 1px solid var(--rule); }
.figures b { font-family: var(--display); font-size: clamp(1.7rem, 5vw, 2.4rem); color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.figures span { font-size: 0.88rem; color: var(--muted); line-height: 1.35; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 20px; display: grid; gap: 8px; align-content: start; }
.card h3 { font-size: 1.1rem; }
.card p { color: var(--muted); font-size: 0.97rem; }

/* quote */
.philosophy { font-family: var(--display); font-size: clamp(1.25rem, 3.4vw, 1.6rem); line-height: 1.4; font-weight: 500; max-width: 34ch; }
.philosophy + p { color: var(--muted); margin-top: 14px; }

/* cv */
.jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: 26px; }
.jobs li { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr); gap: 4px 24px; }
.jobs time { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); padding-top: 3px; white-space: nowrap; }
.jobs h3 { font-size: 1.08rem; }
.jobs .org { font-weight: 400; color: var(--muted); }
.jobs ul { margin: 8px 0 0; padding-left: 1.1em; color: var(--muted); font-size: 0.97rem; display: grid; gap: 4px; }
.skills { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 10px 24px; margin: 0; }
.skills dt { font-weight: 700; }
.skills dd { margin: 0; color: var(--muted); min-width: 0; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; color: var(--muted); }

/* contact */
.contact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.contact-row code { font-family: var(--mono); font-size: 0.95rem; background: var(--surface); padding: 6px 10px; border-radius: 6px; user-select: all; }

.empty { background: var(--surface); border-radius: 10px; padding: 22px; color: var(--muted); }

.site-foot { border-top: 1px solid var(--rule); padding: 24px 0 40px; font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }

@media (max-width: 680px) {
  .figures { grid-template-columns: minmax(0, 1fr); }
  .figures div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .jobs li, .skills { grid-template-columns: minmax(0, 1fr); }
  .skills dt { margin-top: 8px; }
  section { padding: 44px 0; }
  .hero { padding: 48px 0 40px; }
}
@media print {
  .site-head, .site-foot, .btns, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  section { padding: 14px 0; border: 0 !important; }
  a { color: #000; text-decoration: none; }
}

/* ---- themes: retro touches ---- */
:root[data-theme="neon"] .hero h1, :root[data-theme="crt"] .hero h1, :root[data-theme="neon"] .figures b, :root[data-theme="crt"] .figures b { text-shadow: var(--glow); }
:root[data-theme="neon"] .card, :root[data-theme="crt"] .card { box-shadow: var(--card-glow); border-color: transparent; }
:root[data-theme="neon"] .btn-primary, :root[data-theme="crt"] .btn-primary { box-shadow: 0 0 12px var(--accent); }
:root[data-theme="crt"] body { font-size: 15.5px; }
:root[data-theme="crt"] .hero h1 { letter-spacing: -0.04em; }
:root[data-theme="crt"] .hero h1::after { content: "_"; animation: jk-blink 1.1s steps(1) infinite; }
:root[data-theme="crt"] body::after { content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.25) 2px 3px); }
@keyframes jk-blink { 50% { opacity: 0; } }

/* theme button: one tap cycles Light, Dark, Neon, CRT */
.theme-btn { font: 600 0.85rem var(--mono); color: var(--fg); background: var(--surface); border: 1.5px solid var(--rule); border-radius: 999px;
  padding: 5px 12px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.theme-btn:hover { border-color: var(--accent); }
.theme-btn .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: var(--glow); flex: none; }
.head-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* traceroute terminal */
.term { background: var(--term-bg); color: var(--term-fg); border-radius: 12px; font: 0.86rem/1.65 var(--mono); overflow: hidden;
  border: 1px solid var(--rule); box-shadow: var(--card-glow); margin-bottom: 26px; }
.term-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: rgba(255,255,255,.06); }
.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: #e0625a; }
.term-bar i:nth-child(2) { background: #e0b04a; } .term-bar i:nth-child(3) { background: #5ec07a; }
.term-bar span { margin-left: 8px; color: var(--term-dim); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-bar button { margin-left: auto; font: 600 0.75rem var(--mono); color: var(--term-fg); background: transparent; border: 1px solid var(--term-dim);
  border-radius: 6px; padding: 3px 9px; cursor: pointer; white-space: nowrap; }
.term-bar button:hover { border-color: var(--term-ok); color: var(--term-ok); }
.term-body { padding: 14px 16px 16px; min-height: 15.5em; }
.term-body p { margin: 0; max-width: none; display: grid; grid-template-columns: 2ch minmax(0, 1fr) auto; gap: 0 1.2ch; }
.term-body p.cmd, .term-body p.done { display: block; }
.term-body .n, .term-body .t { color: var(--term-dim); }
.term-body .t { white-space: nowrap; text-align: right; }
.term-body .sub { display: block; color: var(--term-dim); font-size: 0.8rem; }
.term-body .ok { color: var(--term-ok); font-weight: 700; }
.term-body .done { margin-top: 10px; }
.term-body .done a { color: var(--term-ok); }
.term-body .caret::after { content: "\2588"; animation: jk-blink 1s steps(1) infinite; color: var(--term-ok); }
.term-note { color: var(--muted); font-size: 0.85rem; margin: -16px 0 24px; }
@media (max-width: 680px) { .term { font-size: 0.78rem; } .term-body p { grid-template-columns: 2ch minmax(0, 1fr); } .term-body .t { grid-column: 2; text-align: left; } }
@media (prefers-reduced-motion: reduce) { .term-body .caret::after, :root[data-theme="crt"] .hero h1::after { animation: none; } }
@media print {
  :root, :root[data-theme] { --bg: #fff; --card: #fff; --fg: #000; --muted: #333; --rule: #ccc; --accent: #1d6b73; --glow: none; --card-glow: none;
    --display: "Bricolage Grotesque", system-ui, sans-serif; --body: "Atkinson Hyperlegible", system-ui, sans-serif; }
  body::after, .term, .term-note, .theme-btn { display: none !important; }
}

/* Aurora: dark sky with faint northern lights drifting behind everything. Subtle on purpose; still when reduced motion is on. */
:root[data-theme="aurora"] { --bg: #07101a; --surface: #0f1c2a; --card: rgba(13,25,38,.92); --fg: #e6f0f4; --muted: #9fb3be; --rule: #22384a;
  --accent: #5fe0b4; --accent-ink: #04140e; --signal: #b38cff; --glow: 0 0 14px rgba(95,224,180,.35); --card-glow: 0 0 0 1px #22384a;
  --term-bg: rgba(3,9,15,.88); --term-fg: #e6f0f4; --term-dim: #9fb3be; --term-ok: #5fe0b4; color-scheme: dark; background: #07101a; }
:root[data-theme="aurora"] body { background: transparent; }
:root[data-theme="aurora"] body::before { content: ""; position: fixed; z-index: -1; pointer-events: none;
  top: -8vh; left: -30vw; width: 160vw; height: 70vh;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.07) 0 2px, transparent 2px 11px),
    linear-gradient(100deg, transparent 12%, rgba(95,224,180,.38) 30%, rgba(70,205,215,.26) 46%, rgba(179,140,255,.26) 62%, transparent 82%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 38%, transparent 92%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 38%, transparent 92%);
  filter: blur(9px); transform-origin: 50% 0; animation: jk-aurora 30s ease-in-out infinite alternate; will-change: transform, opacity; }
:root[data-theme="aurora"] body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .7;
  background:
    radial-gradient(1.2px 1.2px at 12% 14%, #fff, transparent 60%), radial-gradient(1px 1px at 28% 6%, #fff, transparent 60%),
    radial-gradient(1.4px 1.4px at 46% 18%, #fff, transparent 60%), radial-gradient(1px 1px at 63% 9%, #fff, transparent 60%),
    radial-gradient(1.2px 1.2px at 81% 16%, #fff, transparent 60%), radial-gradient(1px 1px at 92% 4%, #fff, transparent 60%),
    radial-gradient(1px 1px at 7% 38%, #fff, transparent 60%), radial-gradient(1.2px 1.2px at 88% 41%, #fff, transparent 60%),
    radial-gradient(1px 1px at 55% 33%, #fff, transparent 60%), radial-gradient(1px 1px at 36% 47%, #fff, transparent 60%); }
:root[data-theme="aurora"] .hero h1 { text-shadow: var(--glow); }
@keyframes jk-aurora {
  0%   { transform: translateX(-4%) skewX(-6deg) scaleY(1);    opacity: .8; }
  50%  { transform: translateX(2%)  skewX(4deg)  scaleY(1.12); opacity: 1; }
  100% { transform: translateX(5%)  skewX(-2deg) scaleY(.94);  opacity: .85; } }
@media (prefers-reduced-motion: reduce) { :root[data-theme="aurora"] body::before { animation: none; } }
@media print { body::before { display: none !important; } }

/* projects */
.project { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 26px; box-shadow: var(--card-glow); }
.project h2 { margin-bottom: 10px; }
.project h3 { font-size: 1.05rem; margin: 22px 0 8px; }
.project p + p { margin-top: 12px; }
.project .lede-sm { color: var(--muted); font-size: 1.05rem; margin-bottom: 14px; }
.project ul { margin: 0; padding-left: 1.1em; display: grid; gap: 8px; color: var(--muted); }
.project ul b { color: var(--fg); }
.project .chips { list-style: none; padding: 0; margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.project .chips li { font: 0.78rem var(--mono); color: var(--fg); background: var(--surface); border: 1px solid var(--rule); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
@media (max-width: 680px) { .project { padding: 18px; } }


/* header layout (v3): name and links only; the theme picker floats bottom-right */
.site-head .wrap { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "brand nav"; align-items: center; gap: 4px 16px; min-height: 64px; }
.head-right { display: contents; }
.brand { grid-area: brand; }
.nav { grid-area: nav; justify-self: end; flex-wrap: nowrap; }
.theme-btn { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60;
  box-shadow: 0 4px 14px rgba(0,0,0,.18), var(--glow); background: var(--card); padding: 8px 14px; }
@media (max-width: 680px) {
  .site-head .wrap { grid-template-columns: 1fr; grid-template-areas: "brand" "nav"; padding-top: 14px; padding-bottom: 4px; min-height: 0; }
  .nav { justify-self: stretch; justify-content: space-between; gap: 0; margin: 0 -8px; }
  .nav a { padding: 8px; font-size: 0.98rem; }
  .route { font-size: 0.74rem; }
}

/* live cargo radar */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e0625a; margin-right: 8px; vertical-align: 1px; animation: jk-pulse 1.8s ease-in-out infinite; }
@keyframes jk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.live-intro { color: var(--muted); margin-bottom: 22px; }
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.radar-wrap { background: var(--term-bg); border: 1px solid var(--rule); border-radius: 14px; padding: 10px; box-shadow: var(--card-glow); }
.radar { display: block; width: 100%; height: auto; max-width: 460px; margin: 0 auto; }
.radar .ring { fill: none; stroke: var(--term-ok); stroke-opacity: .22; stroke-width: .5; }
.radar .axis { stroke: var(--term-ok); stroke-opacity: .12; stroke-width: .4; }
.radar .sweep { fill: url(#jk-sweep); }
.radar .town circle { fill: var(--term-dim); }
.radar .town text { fill: var(--term-dim); font: 6.6px var(--mono); }
.radar .plane path, .radar .plane circle { fill: var(--term-ok); }
.radar .plane.bush path, .radar .plane.bush circle { fill: var(--signal); }
.radar .plane text { fill: var(--term-fg); font: 700 6.4px var(--mono); }
.live-head { font: 700 1.05rem var(--display); margin-bottom: 10px; }
.live-head small { display: block; font: 0.78rem var(--mono); color: var(--muted); margin-top: 4px; font-weight: 400; }
.flights { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.flights li { background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
.flights .cs { font: 700 0.95rem var(--mono); white-space: nowrap; }
.flights .cs i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
.flights li.bush .cs i { background: var(--signal); }
.flights .num { font: 0.85rem var(--mono); color: var(--fg); white-space: nowrap; text-align: right; }
.flights .who, .flights .where { font-size: 0.85rem; color: var(--muted); }
.flights .where { text-align: right; white-space: nowrap; }
.live-note { font-size: 0.8rem; color: var(--muted); }
@media (max-width: 760px) { .live-grid { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
@media print { #live { display: none !important; } }

/* headshot */
.hero-id { display: flex; align-items: center; gap: 22px; margin-bottom: 14px; }
.hero-id h1 { margin-bottom: 0; }
.avatar { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; flex: none; border: 3px solid var(--card); box-shadow: 0 0 0 2px var(--accent), var(--glow); }
:root[data-theme="crt"] .avatar { filter: grayscale(1) sepia(1) hue-rotate(70deg) saturate(2.2) brightness(.95); }
@media (max-width: 680px) { .hero-id { gap: 14px; } .avatar { width: 76px; height: 76px; } }
@media print { .avatar { box-shadow: none; border: 0; width: 90px; height: 90px; } }

.philosophy + p + p { color: var(--muted); margin-top: 12px; }

/* CV: extra results behind a toggle; opened automatically for print */
.jobs details.more { margin-top: 10px; }
.jobs details.more summary { cursor: pointer; display: inline-block; font-weight: 700; color: var(--fg); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.jobs details.more summary:hover { text-decoration-thickness: 2px; }

/* What I do: four outcome cards in a 2x2 grid */
.cards.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 680px) { .cards.four { grid-template-columns: minmax(0, 1fr); } }
