/* =========================================================
   Tokens
   ========================================================= */
:root {
  --bg: #f6f5f1;
  --bg-band: #efeee8;
  --surface: #ffffff;
  --text: #16171d;
  --muted: #595c69;
  --faint: #7c7f8c;
  --line: #e2e0d8;
  --line-strong: #cfccc2;
  --accent: #3f4bb0;
  --accent-ink: #ffffff;
  --accent-soft: #e8eaf8;
  --live: #23875a;
  --dot: rgb(22 23 29 / 0.09);
  --shadow: 0 1px 2px rgb(22 23 29 / 0.04), 0 12px 32px -18px rgb(22 23 29 / 0.28);
  --shadow-lg: 0 2px 4px rgb(22 23 29 / 0.04), 0 30px 60px -30px rgb(30 34 80 / 0.45);

  --panel-bg: #1f2458;
  --panel-text: #f3f2ee;
  --panel-muted: #c3c6e6;
  --panel-btn-bg: #ffffff;
  --panel-btn-text: #1f2458;

  --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 16px;
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101116;
    --bg-band: #14161d;
    --surface: #1a1c24;
    --text: #edece7;
    --muted: #a6a9b6;
    --faint: #80838f;
    --line: #272a35;
    --line-strong: #363a47;
    --accent: #a5aef3;
    --accent-ink: #13152b;
    --accent-soft: #252a4d;
    --live: #4cc38a;
    --dot: rgb(237 236 231 / 0.07);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -18px rgb(0 0 0 / 0.7);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / 0.3), 0 30px 60px -30px rgb(0 0 0 / 0.8);
    --panel-bg: #1c2048;
    --panel-text: #f3f2ee;
    --panel-muted: #b9bde3;
    --panel-btn-bg: #f3f2ee;
    --panel-btn-text: #1c2048;
  }
}

:root[data-theme="dark"] {
  --bg: #101116;
  --bg-band: #14161d;
  --surface: #1a1c24;
  --text: #edece7;
  --muted: #a6a9b6;
  --faint: #80838f;
  --line: #272a35;
  --line-strong: #363a47;
  --accent: #a5aef3;
  --accent-ink: #13152b;
  --accent-soft: #252a4d;
  --live: #4cc38a;
  --dot: rgb(237 236 231 / 0.07);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -18px rgb(0 0 0 / 0.7);
  --shadow-lg: 0 2px 4px rgb(0 0 0 / 0.3), 0 30px 60px -30px rgb(0 0 0 / 0.8);
  --panel-bg: #1c2048;
  --panel-text: #f3f2ee;
  --panel-muted: #b9bde3;
  --panel-btn-bg: #f3f2ee;
  --panel-btn-text: #1c2048;
}

/* =========================================================
   Base
   ========================================================= */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: var(--accent); color: var(--accent-ink); }

h1, h2, h3 { margin: 0; font-weight: 500; line-height: 1.2; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus { top: 12px; }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.5) blur(12px);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  margin-right: auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.02em;
}

.site-nav { display: flex; gap: 4px; }
.site-nav a {
  position: relative;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.site-nav a:hover { color: var(--text); background: var(--accent-soft); }
.site-nav a[aria-current="true"] { color: var(--text); }
.site-nav a[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.header-actions { display: flex; gap: 8px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.icon-btn:hover { border-color: var(--line-strong); }

.menu-toggle { display: none; }

/* Show the icon for the theme you'd switch to. */
.icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.2s var(--ease), border-color 0.15s ease, box-shadow 0.2s ease, filter 0.15s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--text); }
.btn svg { flex: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.btn-primary svg { transition: transform 0.2s var(--ease); }
.btn-primary:hover svg { transform: translateX(3px); }

.btn-quiet { background: transparent; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 17px; }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-top: clamp(40px, 7vw, 88px);
  padding-bottom: clamp(40px, 6vw, 72px);
}

/* Soft accent glow plus a dot grid that fades out toward the edges. */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.hero::before {
  background:
    radial-gradient(40% 50% at 78% 30%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}
.hero::after {
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 0);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(70% 70% at 60% 35%, #000 20%, transparent 75%);
  mask-image: radial-gradient(70% 70% at 60% 35%, #000 20%, transparent 75%);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 26px;
}

.status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
}
.status-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--live);
  opacity: 0;
  animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping {
  0% { transform: scale(0.5); opacity: 0.7; }
  80%, 100% { transform: scale(1.4); opacity: 0; }
}

/* Phone-only hero pieces. Desktop keeps the portrait, the two paragraphs and
   labelled buttons; below 720px these take over (see the responsive section). */
.avatar,
.hero-location,
.status-open,
.lead-short,
.stack-line { display: none; }

.avatar {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 3px var(--bg),
    0 0 0 4.5px color-mix(in srgb, var(--accent) 60%, transparent);
}
.hero-location {
  align-items: center;
  gap: 6px;
  margin: 0;
  padding-left: 4px;
  font-size: 13px;
  color: var(--muted);
}
.hero-location svg { color: var(--accent); }

.lead-short {
  font-size: 20px;
  line-height: 1.4;
  max-width: 24em;
  margin-bottom: 20px;
  text-wrap: pretty;
}

/* Each item carries its separator in front of it. The list is pulled 22px
   left and that strip is clipped away, which hides the dot in front of
   whichever item starts a line. */
.stack-line {
  list-style: none;
  margin: 0 0 0 -22px;
  padding: 0;
  clip-path: inset(0 0 0 22px);
  flex-wrap: wrap;
  row-gap: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}
.stack-line li {
  position: relative;
  padding-left: 22px;
}
.stack-line li::before {
  content: "·";
  position: absolute;
  left: 8px;
  color: var(--faint);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(48px, 7.5vw, 96px);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 0.98;
  margin-bottom: 30px;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.lead {
  font-size: clamp(19px, 2.2vw, 23px);
  line-height: 1.5;
  max-width: 32em;
  margin-bottom: 18px;
}

.sub {
  color: var(--muted);
  max-width: 36em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

/* Portrait */
.portrait {
  position: relative;
  margin: 0 12px 0 0;
  width: 300px;
}

.portrait::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 30px;
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--bg)));
  transform: translate(18px, 18px) rotate(3deg);
  opacity: 0.9;
}

.portrait-frame {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  background: #5a5b5d;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 2 / 3;
}
.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait-tag {
  position: absolute;
  left: -22px;
  bottom: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.portrait-tag svg { color: var(--accent); }

/* Stat tiles */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: clamp(48px, 7vw, 80px) 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  overflow: hidden;
}
.stat {
  padding: 22px 24px;
  border-left: 1px solid var(--line);
}
.stat:first-child { border-left: 0; }
.stat dt {
  font-size: 14px;
  color: var(--muted);
}
.stat dd { margin: 6px 0 0; }
.stat-value {
  display: block;
  font-size: clamp(32px, 3.6vw, 42px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stat-note {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--faint);
}

/* =========================================================
   Sections
   ========================================================= */
.section {
  padding-top: clamp(64px, 9vw, 112px);
  padding-bottom: clamp(64px, 9vw, 112px);
}
#projects,
#skills { background: var(--bg-band); }

.section-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: clamp(14px, 2.2vw, 28px);
  align-items: baseline;
  margin-bottom: clamp(32px, 4.5vw, 52px);
}

/* Large outlined numeral. Decorative: marked aria-hidden in the HTML. */
.section-num {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(52px, 9vw, 112px);
  font-weight: 400;
  line-height: 0.8;
  letter-spacing: -0.04em;
  color: color-mix(in srgb, var(--accent) 45%, transparent);
  user-select: none;
}
@supports (-webkit-text-stroke: 1px black) {
  .section-num {
    color: transparent;
    -webkit-text-stroke: 1.25px var(--accent);
  }
}

/* Rises into view behind a mask as its section is revealed. The negative
   insets keep the mask from trimming glyphs that overflow the tight line box. */
.js .reveal .section-num {
  clip-path: inset(100% -10% -25% -10%);
  transform: translateY(35%);
  transition:
    clip-path 0.9s var(--ease) 0.12s,
    transform 0.9s var(--ease) 0.12s;
}
.js .reveal.is-visible .section-num {
  clip-path: inset(-25% -10% -25% -10%);
  transform: none;
}

.section h2 {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 400;
  letter-spacing: -0.015em;
}

.section-intro {
  grid-column: 2;
  margin: 14px 0 0;
  max-width: 40em;
  color: var(--muted);
}

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px !important;
}

.when {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 4px;
}

/* =========================================================
   Experience
   ========================================================= */
.role {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 36px;
}

.where { font-size: 15px; margin: 0; }

.role h3 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 14px;
}
.role h3 .at { font-weight: 400; color: var(--muted); }

.role-body > p { color: var(--muted); max-width: 42em; }

.role-list {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}
.role-list li {
  position: relative;
  padding-left: 26px;
}
.role-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  border: 1.5px solid var(--accent);
  transform: rotate(45deg);
}
.role-list strong { font-weight: 600; }

/* =========================================================
   Cards
   ========================================================= */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 3vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.card h3 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.005em;
  margin-bottom: 12px;
}
.card p { color: var(--muted); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: auto 0 0;
  padding: 20px 0 0;
  list-style: none;
}
.tags li {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

/* Featured project */
.card-featured {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  margin-bottom: 20px;
  padding: clamp(24px, 4vw, 44px);
  background:
    radial-gradient(80% 120% at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    var(--surface);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
.card-featured h3 { font-size: clamp(34px, 4.4vw, 46px); }
.featured-copy { display: flex; flex-direction: column; }

.pipeline {
  list-style: none;
  margin: 0;
  padding: 22px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid;
  align-content: center;
  counter-reset: step;
}
.pipeline li {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}
.pipeline li + li { margin-top: 20px; }
.pipeline li + li::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -20px;
  width: 2px;
  height: 20px;
  margin-left: -1px;
  background: linear-gradient(var(--line-strong), var(--accent));
}
.pipeline li + li::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -6px;
  margin-left: -4px;
  border: 4px solid transparent;
  border-top-color: var(--accent);
  border-bottom-width: 0;
}
.pipeline li:last-child {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft);
}
.step { font-weight: 600; font-size: 15px; }
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero) "  ";
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 12px;
  color: var(--accent);
  white-space: pre;
}
.step-note {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

/* =========================================================
   GitHub repos
   ========================================================= */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.repo-wide { grid-column: 1 / -1; }
.repo-wide > p { max-width: 58em; }

.repo-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 14px;
}
.repo-name {
  margin: 0 !important;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text) !important;
}
.repo-name span { color: var(--faint); font-weight: 400; }
.repo-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint) !important;
}

.pill {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.pill-live {
  background: color-mix(in srgb, var(--live) 16%, transparent);
  color: var(--live);
}

.repo h3 { font-size: 24px; }

.repo-link {
  margin-top: 20px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}
.repo-link span { display: inline-block; transition: transform 0.2s var(--ease); }
/* The link covers the whole card, so the card is one click target. */
.repo-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.repo:hover .repo-link span { transform: translateX(4px); }
.repo:focus-within { border-color: var(--accent); }
.repo-link:focus-visible { outline: none; }

.more {
  margin-top: clamp(40px, 6vw, 64px);
}
.more-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.more-list {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
}
.more-list li {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.more-list a {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
}
.more-list span { color: var(--muted); }
.more-list .lang {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

/* =========================================================
   Skills
   ========================================================= */
.skills-label {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.core-grid {
  list-style: none;
  margin: 0 0 clamp(44px, 6vw, 64px);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.core {
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, box-shadow 0.25s ease;
}
.core:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: var(--shadow);
}

.core-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.core-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.core-kind {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.core > p:not(.used-in) {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 18px;
}

.used-in {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin: auto 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
  font-size: 14px;
}
.used-in a {
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.used-in a:hover { text-decoration: underline; }

.used-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.toolbox {
  margin: 0;
  border-top: 1px solid var(--line);
}
.toolbox > div {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.toolbox dt {
  font-weight: 600;
  font-size: 15px;
}
.toolbox dd { margin: 0; }

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chips li {
  padding: 3px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
}

.work-style {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  margin: 28px 0 0;
  color: var(--muted);
}

/* A card reached from a "Used in" link gets a brief highlight. */
.card:target {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
  animation: target-flash 1.6s var(--ease);
}
@keyframes target-flash {
  0%, 30% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 30%, transparent); }
  100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
}

/* =========================================================
   Education
   ========================================================= */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 36px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.timeline li:first-child { padding-top: 0; }
.timeline .when { padding-top: 5px; }
.timeline h3 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.timeline p { color: var(--muted); }
.timeline li:first-child .when { color: var(--accent); }

.aside-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 44px;
}
.aside {
  padding: 22px 24px;
  border-radius: var(--radius);
  background: var(--bg-band);
  border: 1px solid var(--line);
}
.aside-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

/* =========================================================
   Contact
   ========================================================= */
.contact { padding-top: 0; }

.contact-card {
  position: relative;
  overflow: hidden;
  padding: clamp(36px, 6vw, 72px);
  border-radius: 28px;
  background: var(--panel-bg);
  color: var(--panel-text);
}
.contact-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(50% 80% at 100% 0%, rgb(165 174 243 / 0.35), transparent 70%),
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.08) 1px, transparent 0) 0 0 / 22px 22px;
  pointer-events: none;
}
.contact-card > * { position: relative; }
.contact-card h2 {
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.contact-lead {
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.5;
  color: var(--panel-muted);
  max-width: 30em;
  margin-bottom: 32px;
}
.contact-card .btn-primary {
  background: var(--panel-btn-bg);
  border-color: var(--panel-btn-bg);
  color: var(--panel-btn-text);
  box-shadow: none;
  overflow-wrap: anywhere;
}
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
}
.contact-links a {
  color: var(--panel-text);
  font-weight: 500;
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  color: var(--faint);
  font-size: 14px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 32px;
  padding-bottom: 40px;
}
.site-footer a { color: var(--muted); }

/* =========================================================
   Scroll reveal (only when JS is running)
   ========================================================= */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 980px) {
  .core-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

@media (max-width: 900px) {
  .menu-toggle { display: grid; }
  .site-nav {
    position: absolute;
    top: 68px;
    left: var(--gutter);
    right: var(--gutter);
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
  }
  .site-nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }
  .site-nav a { padding: 10px 12px; font-size: 16px; }
  .site-nav a[aria-current="true"]::after { display: none; }
  .site-nav a[aria-current="true"] { background: var(--accent-soft); }

  .card-featured,
  .repo-grid,
  .grid-2 { grid-template-columns: 1fr; }
  .more-list li { grid-template-columns: 1fr auto; gap: 4px 16px; }
  .more-list li > span:not(.lang) { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .hero-inner { grid-template-columns: 1fr; }

  /* Compact hero: avatar, location and availability next to one another,
     a one-line summary, and icon-only social buttons. Keeps the name and
     "Get in touch" on a phone's first screen. */
  .portrait,
  .lead,
  .sub,
  .status-role,
  .btn-label,
  .stat-extra { display: none; }
  .hero-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
  }
  .hero-meta-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .status { margin: 0; }
  .avatar { display: block; }
  .hero-location { display: inline-flex; }
  .status-open { display: inline; }
  .lead-short { display: block; }
  .stack-line { display: flex; }
  .btn-social { width: 46px; padding: 0; justify-content: center; }
  .btn-social svg { width: 18px; height: 18px; }

  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 1px solid var(--line); }
  .stat:nth-child(n + 3) { border-top: 0; }
  .role,
  .timeline li { grid-template-columns: 1fr; gap: 6px; }
  .role-meta { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
  .section-head { row-gap: 6px; }
  .section-intro { grid-column: 1 / -1; }
  .core-grid,
  .aside-grid { grid-template-columns: 1fr; }
  .toolbox > div { grid-template-columns: 1fr; gap: 10px; }
  .contact-card .btn-lg { font-size: 15px; padding: 0 20px; }
  .stat { padding: 16px; }
  .stat dt { font-size: 13px; }
  .stat-value { font-size: 28px; }
  .stat-note { font-size: 13px; }
}

@media (max-width: 400px) {
  .avatar { width: 56px; height: 56px; }
  .status { font-size: 13px; }
  .stat { padding: 14px 12px; }
  .stat dt { font-size: 12px; }
  .stat-value { font-size: 26px; }
  .stat-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .js .reveal .section-num { clip-path: none; transform: none; }
  .card:hover,
  .btn:hover { transform: none; }
}
