/* Sunny Vishwakarma — portfolio. Static, zero-dependency, craft-first UI. */

:root {
  color-scheme: light dark;
  --page: #f6f7fb;
  --surface: #ffffff;
  --surface-subtle: #edf0f8;
  --text: #131628;
  --muted: #525870;
  --accent: #5142c5;
  --accent-hover: #3b2ea3;
  --teal: #0d9488;
  --accent-soft: rgba(81, 66, 197, 0.08);
  --accent-mid: rgba(81, 66, 197, 0.22);
  --border: #dde1ef;
  --focus: #4338ca;
  --ok: #12613b;
  --ok-bg: #ecf8f2;
  --ok-border: #addbc3;
  --warn: #92400e;
  --warn-bg: #fef7ec;
  --warn-border: #ebd0a4;
  --pill-accent: #5142c5;
  --pill-ok: #12613b;
  --pill-warn: #92400e;
  --diagram-bg: #f9fafd;
  --diagram-node: #ffffff;
  --diagram-node-alt: #edf2f7;
  --diagram-stroke: #748094;
  --diagram-accent-fill: #ebe9fb;
  --code-bg: #121722;
  --code-header: #1a2130;
  --code-border: #2a3346;
  --code-text: #e6edf3;
  --code-muted: #9aa4b2;
  --content-width: 1120px;
  --reading-width: 68ch;
  --radius: 12px;
  --gutter: 20px;
  --header-h: 64px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --section-y: var(--space-12);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  /* At large text sizes a long name, email or stack token would otherwise
     push the page sideways. Break the word, never clip the page. */
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 var(--space-4); }
ul, ol { margin: 0 0 var(--space-4); padding-left: 1.15em; }
li { margin-bottom: var(--space-2); }
li:last-child { margin-bottom: 0; }
img { max-width: 100%; height: auto; }
code { font-family: var(--mono); font-size: 0.92em; }

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

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

.container {
  width: 100%;
  max-width: calc(var(--content-width) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: fixed;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  text-decoration: none;
}
.skip-link:focus { top: var(--space-4); color: #fff; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 247, 251, 0.84);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2.5px;
  transform-origin: 0 50%;
  transform: scaleX(var(--scroll-progress, 0));
  background: linear-gradient(90deg, var(--accent) 0%, #7c6df2 52%, var(--teal) 100%);
  pointer-events: none;
  opacity: 0.92;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-h);
  position: relative;
}

.wordmark {
  font-weight: 740;
  font-size: 1.0625rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  /* Must be able to wrap: at 200% text size a nowrap wordmark pushes the
     menu button off the edge of the header. */
  min-width: 0;
}
.wordmark:hover { color: var(--accent); }

.site-nav ul {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav li { margin: 0; }
.site-nav a {
  position: relative;
  display: inline-block;
  padding: var(--space-2) 0;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  font-size: 0.9375rem;
  transition: color 0.2s ease;
}
.site-nav a:hover,
.site-nav a.is-active,
.site-nav a[aria-current="page"] {
  color: var(--accent);
}
.site-nav a.is-active::after,
.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
}
.site-nav a.nav-resume {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  box-shadow: 0 2px 6px rgba(19, 22, 40, 0.04);
}
.site-nav a.nav-resume:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* The toggle stays hidden until the script confirms it can drive it. */
.nav-toggle { display: none; }

/* ---------- sections ---------- */

section { padding: var(--section-y) 0; }
section + section { border-top: 1px solid var(--border); }

/* Anchor targets clear the sticky header. */
section[id], h1[id], h2[id], h3[id] { scroll-margin-top: calc(var(--header-h) + var(--space-4)); }

.section-title { font-size: 1.5625rem; margin-bottom: var(--space-3); }
.section-intro {
  color: var(--muted);
  max-width: var(--reading-width);
  margin-bottom: var(--space-8);
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: var(--space-12) 0 var(--space-12);
  border-top: 0;
  background:
    radial-gradient(ellipse at 92% 14%, rgba(114, 98, 255, 0.19), transparent 34rem),
    radial-gradient(ellipse at 6% 96%, rgba(13, 148, 136, 0.12), transparent 28rem),
    linear-gradient(135deg, #f3f4fc 0%, #fcfcff 54%, #eef1fb 100%);
}
.hero::before {
  position: absolute;
  z-index: -1;
  content: "";
  inset: 0;
  background-image: radial-gradient(rgba(81, 66, 197, 0.13) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(160deg, rgba(0, 0, 0, 0.65), transparent 72%);
  pointer-events: none;
}
.hero::after {
  position: absolute;
  z-index: -1;
  content: "";
  width: 520px;
  height: 520px;
  right: -280px;
  top: -280px;
  border: 1px solid rgba(81, 66, 197, 0.14);
  border-radius: 50%;
  box-shadow: 0 0 0 40px rgba(81, 66, 197, 0.03), 0 0 0 84px rgba(13, 148, 136, 0.025);
  pointer-events: none;
}
.hero .container { position: relative; }
.hero-copy { min-width: 0; }
.hero-role {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 650;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(81, 66, 197, 0.22);
  box-shadow: 0 2px 10px rgba(81, 66, 197, 0.07);
  margin-bottom: var(--space-4);
}
.status-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}
.hero h1 {
  font-size: clamp(2.45rem, 4.9vw, 4.15rem);
  font-weight: 780;
  letter-spacing: -0.05em;
  line-height: 1.05;
  margin-bottom: var(--space-3);
}
.hero-subtitle {
  font-size: clamp(1.08rem, 1.8vw, 1.32rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--accent);
  margin-bottom: var(--space-3);
  max-width: 58ch;
}
.hero-lede {
  font-size: 1.02rem;
  max-width: 62ch;
  color: var(--muted);
  margin-bottom: var(--space-3);
}
.hero-meta { color: var(--muted); font-size: 0.92rem; margin-bottom: var(--space-6); }

.hero-visual {
  position: relative;
  overflow: hidden;
  margin: var(--space-8) 0 0;
  padding: clamp(22px, 3vw, 30px);
  color: #f7f7ff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  background:
    radial-gradient(280px circle at var(--mx, 80%) var(--my, 20%), rgba(139, 124, 255, 0.26), transparent 60%),
    radial-gradient(ellipse at 85% 0%, rgba(121, 106, 255, 0.36), transparent 47%),
    radial-gradient(ellipse at 0% 100%, rgba(20, 184, 166, 0.22), transparent 46%),
    linear-gradient(145deg, #141731 0%, #1e2247 57%, #141933 100%);
  box-shadow: 0 24px 64px rgba(32, 34, 82, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}
.hero-visual:hover {
  transform: translateY(-2px);
  box-shadow: 0 28px 72px rgba(32, 34, 82, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.hero-visual::before {
  position: absolute;
  content: "";
  inset: 0;
  opacity: 0.14;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.14) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.14) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(135deg, #000, transparent 82%);
}
.hero-visual__topline, .hero-visual__foot {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #bfc3e0;
  font: 600 0.68rem/1.4 var(--mono);
  letter-spacing: 0.075em;
}
.hero-visual__signal { width: 8px; height: 8px; margin-right: -4px; border-radius: 50%; background: #5eead4; box-shadow: 0 0 14px #5eead4; animation: swarm-pulse 2.2s ease-in-out infinite; }
.hero-visual__index { margin-left: auto; opacity: .72; }
.hero-visual__headline {
  position: relative;
  margin: 22px 0 20px;
  font-size: clamp(1.3rem, 1.9vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.22;
}
.hero-visual__headline span { color: #b1a6ff; }
.hero-visual__flow { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.hero-visual__node {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(211, 215, 255, .16);
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  backdrop-filter: blur(8px);
  transition: border-color 0.25s ease, background 0.25s ease;
}
.hero-visual__node:hover { border-color: rgba(169, 157, 255, 0.45); background: rgba(255, 255, 255, 0.09); }
.hero-visual__node > span { grid-row: span 2; color: #aaa2ff; font: 600 .72rem var(--mono); }
.hero-visual__node strong { font-size: .91rem; font-weight: 620; }
.hero-visual__node small { color: #c0c6e0; font-size: .76rem; }
.hero-visual__node--model { border-color: rgba(169, 157, 255, .42); background: rgba(112, 96, 233, .18); }
.hero-visual__node--model > span { color: #c2b8ff; }
.hero-visual__node--verified { border-color: rgba(94, 234, 212, 0.34); background: rgba(13, 148, 136, 0.14); }
.hero-visual__node--verified > span { color: #5eead4; }
.hero-visual__connector { display: flex; flex-direction: column; gap: 3px; width: 2px; height: 14px; margin-left: 27px; }
.hero-visual__connector i { width: 2px; height: 3px; border-radius: 2px; background: #9388ff; animation: flow-pulse 1.8s ease-in-out infinite; }
.hero-visual__connector i:nth-child(2) { animation-delay: 0.22s; }
.hero-visual__connector i:nth-child(3) { animation-delay: 0.44s; }
@keyframes flow-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; background: #5eead4; } }
.hero-visual__foot { margin-top: 20px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.14); font-size: .59rem; letter-spacing: .04em; white-space: nowrap; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 9px 15px;
  border-radius: var(--radius);
  font-size: 0.905rem;
  font-weight: 560;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-sm { min-height: 38px; padding: 7px 14px; font-size: 0.875rem; }
.btn-primary {
  background: linear-gradient(135deg, #5142c5, #6353e4);
  border-color: #5142c5;
  color: #fff;
  box-shadow: 0 8px 20px rgba(81, 66, 197, 0.25);
}
.btn-primary:hover { background: linear-gradient(135deg, #4334b6, #5142c5); border-color: #4334b6; color: #fff; box-shadow: 0 12px 24px rgba(81, 66, 197, 0.32); }
.btn-secondary { background: var(--surface); color: var(--accent); }
.btn-secondary:hover { background: #eef1fa; color: var(--accent-hover); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }

.btn-kbd {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #d6d9e8;
}

.inline-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: var(--space-4) 0 0; }
.inline-links a { font-size: 0.92rem; font-weight: 500; }
.inline-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent-mid);
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 0.8rem/1.3 var(--mono);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.inline-link-btn:hover { background: rgba(81, 66, 197, 0.14); border-color: var(--accent); }
.inline-link-btn[aria-pressed="false"] {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: var(--space-6);
}
.hero-metric {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  box-shadow: 0 2px 10px rgba(19, 22, 40, 0.035);
  font-variant-numeric: tabular-nums;
}
.hero-metric strong {
  display: block;
  font-size: 1.125rem;
  font-weight: 760;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}
.hero-metric span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- selected projects ---------- */

.project-entry {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: var(--space-6);
  box-shadow: 0 6px 22px rgba(29, 35, 75, 0.05);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.project-entry::before {
  position: absolute;
  content: "";
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #7a6cff 48%, var(--teal));
  opacity: .9;
}
.project-entry:last-child { margin-bottom: 0; }

.project-entry__identity {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.project-kicker {
  display: inline-block;
  width: fit-content;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-radius: 5px;
  padding: 2px 8px;
}
.project-entry__identity h3 { font-size: 1.25rem; margin: 0; }
.project-status,
.project-stack {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}
.project-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--text);
  font-weight: 600;
}
.project-status::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}
.project-status--staging::before {
  background: #6659d9;
  box-shadow: 0 0 0 3px rgba(102, 89, 217, 0.14);
}
.project-scale {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--page);
  border: 1px solid var(--border);
}
.stack-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
}
.stack-chips li {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.74rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text);
}

.project-entry__summary > *:last-child { margin-bottom: 0; }
.project-entry__summary ul { margin-bottom: var(--space-4); }

.project-evidence {
  border-left: 3px solid var(--accent);
  padding: var(--space-1) 0 var(--space-1) var(--space-4);
  margin: 0 0 var(--space-4);
}

.case-link { font-weight: 620; }

/* ---------- experience timeline ---------- */

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding-left: 26px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--border) 60%, transparent 100%);
}
.role {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.role::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 24px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--accent);
  box-shadow: 0 0 0 4px var(--page);
}
.role--current::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--page), 0 0 0 7px rgba(81, 66, 197, 0.18);
}
.role:hover {
  border-color: var(--accent-mid);
  box-shadow: 0 10px 26px rgba(29, 35, 75, 0.06);
  transform: translateY(-1px);
}
.role-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-2);
}
.role h3 { font-size: 1.1875rem; }
.role-dates {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-radius: 999px;
  padding: 3px 10px;
  margin: 0;
}
.role-org { color: var(--muted); font-size: 0.96rem; font-weight: 550; margin-bottom: var(--space-3); }
.role ul:last-child { margin-bottom: 0; }

/* ---------- about, skills, education ---------- */

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-12);
  align-items: start;
}

h3.sub { font-size: 1.125rem; margin-bottom: var(--space-3); }

.skill-list { margin: 0; }
.skill-list > div { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.skill-list > div:last-child { border-bottom: 0; }
.skill-list dt { font-weight: 620; font-size: 0.9375rem; margin-bottom: var(--space-2); }
.skill-list dd { margin: 0; color: var(--muted); }
.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.skill-chips li {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.credentials-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}
@media (min-width: 720px) {
  .credentials-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.credential {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.credential:hover {
  border-color: var(--accent-mid);
  box-shadow: 0 8px 22px rgba(29, 35, 75, 0.06);
}
.credential-year {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: var(--space-2);
}
.credential h3 { font-size: 1.03rem; margin-bottom: var(--space-2); }
.credential p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- contact / footer ---------- */

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}
@media (min-width: 900px) {
  .contact-layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
}
.contact-info .section-intro { margin-bottom: var(--space-6); }
.contact-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.contact-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0;
  padding: 11px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.contact-list li:hover {
  border-color: var(--accent-mid);
  box-shadow: 0 4px 14px rgba(29, 35, 75, 0.05);
}
.contact-list .label {
  display: inline-block;
  min-width: 78px;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.contact-list a { font-weight: 560; word-break: break-word; }

.contact-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 3vw, 28px);
  border-radius: 18px;
  color: #f4f5ff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(280px circle at 90% 10%, rgba(121, 106, 255, 0.28), transparent 60%),
    radial-gradient(ellipse at 0% 100%, rgba(13, 148, 136, 0.2), transparent 50%),
    linear-gradient(145deg, #141731 0%, #1d2144 60%, #131833 100%);
  box-shadow: 0 18px 46px rgba(25, 28, 72, 0.16);
}
.contact-panel__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #5eead4;
  margin-bottom: var(--space-3);
}
.contact-panel h3 {
  color: #ffffff;
  font-size: 1.25rem;
  margin-bottom: var(--space-2);
}
.contact-panel > p:not(.contact-panel__status) {
  color: #c5cae3;
  font-size: 0.94rem;
  margin-bottom: var(--space-6);
}
.contact-panel .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.22);
}
.contact-panel .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.42);
  color: #ffffff;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-8) 0 calc(var(--space-8) + 46px);
  color: var(--muted);
  font-size: 0.9375rem;
}
.site-footer p { margin: 0; }

/* ---------- case studies ---------- */

.case-header {
  padding: var(--space-12) 0 var(--space-8);
  background:
    radial-gradient(ellipse at 92% 14%, rgba(114, 98, 255, 0.14), transparent 30rem),
    linear-gradient(135deg, #f3f4fc 0%, #fcfcff 62%, #eef1fb 100%);
}
.case-header h1 { font-size: 1.875rem; margin-bottom: var(--space-3); letter-spacing: -0.03em; }
.breadcrumb { font-size: 0.9375rem; color: var(--muted); margin-bottom: var(--space-6); }

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  font-size: 0.9375rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
  margin: 0;
}
.case-meta dt { display: inline; font-weight: 600; color: var(--text); }
.case-meta dd { display: inline; margin: 0; }

.case section { padding: var(--space-12) 0; }
.case section h2 { font-size: 1.375rem; margin-bottom: var(--space-4); }
.case section h3 { font-size: 1.125rem; margin: var(--space-6) 0 var(--space-2); }
.case p, .case > section > .container > ul, .case .article-body section > ul, .case ol:not(.toc-rail ol) { max-width: var(--reading-width); }
.case .case-toc, .case .case-nav, .case .blog-tags, .case p.actions { max-width: none; }
.case .stat-box p, .case .tip-card p, .case .compare-card p, .case .arch-figure figcaption { max-width: none; }

/* Diagrams: a stepped list that reflows instead of scrolling sideways. */
.figure { margin: 0 0 var(--space-8); max-width: var(--reading-width); }
.figure figcaption {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: var(--space-3);
}

.flow { list-style: none; margin: 0; padding: 0; }
.flow > li {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  margin: 0;
  font-size: 0.9375rem;
  max-width: none;
}
.flow > li + li { margin-top: 26px; }
.flow > li + li::before {
  content: "";
  position: absolute;
  left: var(--space-6);
  top: -26px;
  height: 26px;
  border-left: 2px solid #aeb6c1;
}
.flow--layers > li + li { margin-top: var(--space-2); }
.flow--layers > li + li::before { content: none; }

.flow-actor { display: block; font-weight: 650; color: var(--text); }
.flow ul {
  margin: var(--space-2) 0 0;
  padding-left: 1.15em;
  max-width: none;
}
.flow ul li { margin-bottom: var(--space-1); font-size: 0.9375rem; }
.flow-note {
  margin: var(--space-4) 0 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.decision {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: var(--space-4);
  max-width: var(--reading-width);
}
.decision h3 { margin-top: 0; }
.decision p:last-child { margin-bottom: 0; }

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4) 20px;
  max-width: var(--reading-width);
}
.callout p:last-child { margin-bottom: 0; }

.case-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-6);
  max-width: none;
}
.case-nav li { margin: 0; }

/* ---------- 600 px and up ---------- */

@media (min-width: 600px) {
  :root { --gutter: 32px; }
  .hero-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- 768 px and up ---------- */

@media (min-width: 768px) {
  :root { --section-y: var(--space-20); }
  body { font-size: 1.0625rem; }

  .project-entry { padding: var(--space-8); }
  .project-entry__identity h3 { font-size: 1.4rem; }

  .hero { padding: var(--space-16) 0 var(--space-16); }
  .hero h1 { font-size: clamp(3rem, 4.8vw, 4.15rem); }
  .hero-lede { font-size: 1.1rem; }
  .hero-visual { margin-top: var(--space-8); }
  .section-title { font-size: 1.875rem; }
  .case-header { padding: var(--space-16) 0 var(--space-8); }
  .case-header h1 { font-size: 2.5rem; }
  .case section h2 { font-size: 1.625rem; }
  .case section h3 { font-size: 1.1875rem; }
  .role h3 { font-size: 1.25rem; }
  .credential h3 { font-size: 1.125rem; }
}

/* ---------- 900 px and up ---------- */

/* Side-by-side columns start here: at 768 px they leave a text measure too
   narrow to read comfortably and a dead gap beside the project identity. */
@media (min-width: 900px) {
  :root { --header-h: 72px; }
  .hero h1 { font-size: clamp(3.1rem, 4.4vw, 4.05rem); }
  .hero .container { display: grid; grid-template-columns: minmax(0, 1.34fr) minmax(320px, .74fr); align-items: center; gap: clamp(28px, 4vw, 56px); }
  .hero-visual { margin: 0; }
  .hero-visual__node { padding: 11px 12px; }
  .project-entry:hover { transform: translateY(-3px); }

  .project-entry {
    grid-template-columns: minmax(0, 290px) minmax(0, 1fr);
    gap: var(--space-8);
  }
  .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ---------- 1200 px and up ---------- */

@media (min-width: 1200px) {
  :root { --gutter: 40px; }
}

/* ---------- mobile navigation disclosure ---------- */

/* Base state, and the state without JavaScript: ordinary wrapped links. */
@media (max-width: 899px) {
  .site-header .container { flex-wrap: wrap; padding-bottom: var(--space-3); }
  .site-nav { flex-basis: 100%; }
  .site-nav ul { gap: var(--space-2) var(--space-4); }
  .site-nav a { padding: var(--space-1) 0; }
  .site-nav a.nav-resume { padding: var(--space-1) var(--space-3); }

  /* Collapsed only once the script has taken control of the disclosure. */
  .has-js .site-header .container { flex-wrap: nowrap; padding-bottom: 0; }
  .has-js .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 44px;
    min-width: 44px;
    padding: var(--space-2) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    font-size: 0.9375rem;
    cursor: pointer;
  }
  .has-js .nav-toggle:hover { border-color: var(--accent); }
  .has-js .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-basis: auto;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 16px rgba(32, 37, 43, 0.08);
  }
  .has-js .site-nav.is-open { display: block; }
  .has-js .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-2) var(--gutter) var(--space-4);
  }
  .has-js .site-nav li { border-bottom: 1px solid var(--border); }
  .has-js .site-nav li:last-child { border-bottom: 0; }
  .has-js .site-nav a { display: block; padding: var(--space-3) 0; min-height: 44px; }
  .has-js .site-nav a.nav-resume {
    display: inline-block;
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-4);
  }
}

@media (max-width: 599px) {
  .actions .btn { flex: 1 1 100%; }
  .hero::after { display: none; }
  .hero h1 { font-size: clamp(1.9rem, 8vw, 2.45rem); }
  .arch-figure {
    padding: var(--space-3);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .arch-svg { min-width: 580px; }
  .hero-visual { border-radius: 18px; }
  .hero-visual__foot { flex-wrap: wrap; }
}

/* ---------- motion: scroll reveals (classes applied by script.js only) ---------- */

.mo {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease;
}
.mo.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.mo-d1 { transition-delay: 0.05s; }
.mo-d2 { transition-delay: 0.1s; }
.mo-d3 { transition-delay: 0.15s; }
.mo-d4 { transition-delay: 0.2s; }
.mo-d5 { transition-delay: 0.25s; }

.project-entry:hover {
  box-shadow: 0 14px 34px rgba(50, 48, 110, 0.12);
  border-color: rgba(81, 66, 197, 0.28);
}

/* ---------- about: creative web and motion ---------- */

.creative-block {
  position: relative;
  overflow: hidden;
  margin-top: var(--space-12);
  padding: clamp(22px, 3vw, 32px);
  border-radius: 20px;
  color: #f4f5ff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(320px circle at var(--mx, 85%) var(--my, 15%), rgba(121, 106, 255, 0.25), transparent 62%),
    radial-gradient(ellipse at 0% 100%, rgba(13, 148, 136, 0.18), transparent 45%),
    linear-gradient(145deg, #141731 0%, #1d2144 58%, #131833 100%);
  box-shadow: 0 20px 52px rgba(25, 28, 72, 0.18);
}
.creative-block::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background-image: radial-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(135deg, #000, transparent 78%);
}
.creative-block__head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: var(--space-3);
}
.creative-kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: #5eead4;
  margin-bottom: 4px;
}
.creative-block h3.sub {
  color: #ffffff;
  font-size: 1.3rem;
  margin: 0;
}
.creative-block .section-intro {
  position: relative;
  color: #c5cae3;
  margin-bottom: var(--space-6);
}
.creative-list {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px 24px;
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: none;
}
@media (min-width: 720px) {
  .creative-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.creative-list li {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: #d6dbf2;
  font-size: 0.9375rem;
}
.creative-list strong { color: #ffffff; }
.creative-list code {
  background: rgba(255, 255, 255, 0.12);
  color: #b8afff;
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------- graphical AI context, architecture diagrams, blog & readability ---------- */

.section-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-3);
}
.section-head-row .section-title { margin-bottom: 0; }
.section-more { font-size: 0.9375rem; font-weight: 550; white-space: nowrap; }

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.pillars-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-6);
}
.pillar-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}
.pillar-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.pillar-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-mid);
  box-shadow: 0 10px 26px rgba(29, 35, 75, 0.08);
}
.pillar-card:hover::before { opacity: 1; }
.pillar-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.pillar-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-mid);
}
.pillar-card h3 { font-size: 1.0625rem; }
.pillar-card p { margin: 0; color: var(--muted); font-size: 0.9375rem; }
.pillar-link { margin-top: auto; padding-top: var(--space-2); font-size: 0.875rem; font-weight: 600; }

/* Architectural SVG figure container */
.arch-figure {
  margin: var(--space-6) 0 var(--space-8);
  background-color: var(--diagram-bg);
  background-image: radial-gradient(rgba(116, 128, 148, 0.22) 1px, transparent 1px);
  background-size: 18px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--space-4);
  box-shadow: 0 8px 24px rgba(19, 22, 40, 0.04);
  max-width: 100%;
}
.case .arch-figure { max-width: 860px; }
.arch-figure__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.arch-figure__title {
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--text);
}
.arch-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}
.arch-svg {
  width: 100%;
  height: auto;
  display: block;
}
.arch-figure figcaption {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}

/* SVG semantic helper classes (adapt automatically to swarm-dark) */
.svg-zone { fill: var(--surface); stroke: var(--border); stroke-width: 1.4; }
.svg-zone-dashed { fill: var(--diagram-bg); stroke: var(--diagram-stroke); stroke-width: 1.4; stroke-dasharray: 6 4; }
.svg-node { fill: var(--diagram-node); stroke: var(--border); stroke-width: 1.5; }
.svg-node-accent { fill: var(--diagram-accent-fill); stroke: var(--accent); stroke-width: 1.8; }
.svg-node-ok { fill: var(--ok-bg); stroke: var(--ok-border); stroke-width: 1.6; }
.svg-node-warn { fill: var(--warn-bg); stroke: var(--warn-border); stroke-width: 1.6; }
.svg-pill-accent { fill: var(--pill-accent); }
.svg-pill-ok { fill: var(--pill-ok); }
.svg-pill-warn { fill: var(--pill-warn); }
.svg-title { fill: var(--text); font-family: var(--font); font-weight: 650; }
.svg-sub { fill: var(--muted); font-family: var(--font); }
.svg-mono { fill: var(--accent); font-family: var(--mono); font-weight: 600; }
.svg-ok-text { fill: var(--ok); font-family: var(--font); font-weight: 650; }
.svg-warn-text { fill: var(--warn); font-family: var(--font); font-weight: 650; }
.svg-inv { fill: #ffffff; font-family: var(--font); font-weight: 650; }
.svg-arrow { stroke: var(--diagram-stroke); stroke-width: 1.8; fill: none; }
.svg-arrow-accent { stroke: var(--accent); stroke-width: 2; fill: none; }
.svg-arrow-ok { stroke: var(--ok); stroke-width: 2; fill: none; }
.svg-arrow-warn { stroke: var(--warn); stroke-width: 1.8; stroke-dasharray: 4 3; fill: none; }
.svg-head { fill: var(--diagram-stroke); }
.svg-head-accent { fill: var(--accent); }
.svg-head-ok { fill: var(--ok); }

/* Compact visual pipeline strip inside project cards */
.mini-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: var(--space-3) 0 var(--space-4);
  padding: 10px 12px;
  background: var(--diagram-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.mini-node {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.mini-node--guard {
  background: var(--diagram-accent-fill);
  border-color: var(--accent-mid);
  color: var(--accent);
  font-weight: 600;
}
.mini-node--ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok);
  font-weight: 600;
}
.mini-sep {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  user-select: none;
}

/* Visual evaluation & verified facts meter */
.eval-meter {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 15px;
  margin: 0 0 var(--space-4);
}
.eval-meter__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  margin-bottom: var(--space-2);
}
.eval-delta {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ok);
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  padding: 2px 8px;
  border-radius: 999px;
}
.eval-meter__bar {
  position: relative;
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: var(--space-2);
}
.eval-meter__base {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--diagram-stroke);
  opacity: 0.45;
  border-radius: 999px;
}
.eval-meter__fill {
  position: relative;
  height: 100%;
  background: linear-gradient(90deg, #10b981, var(--ok));
  border-radius: 999px;
}
.eval-meter__note {
  margin: 0;
  font-size: 0.825rem;
  color: var(--muted);
}

.project-links-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  align-items: center;
  margin: 0;
}

/* Badges / metric strips inside case studies & blog posts */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-3);
  margin: var(--space-6) 0;
  max-width: 860px;
}
.stat-box {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 3px 12px rgba(19, 22, 40, 0.035);
}
.stat-box::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2.5px;
  background: linear-gradient(90deg, var(--accent), var(--teal));
}
.stat-box__val {
  display: block;
  font-size: 1.3125rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  margin-bottom: 4px;
}
.stat-box__lbl {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Side-by-side Naive vs Production comparison */
.compare-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin: var(--space-6) 0;
  max-width: 860px;
}
.compare-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.compare-card--bad {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  border-left: 4px solid var(--warn);
}
.compare-card--good {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  border-left: 4px solid var(--ok);
}
.compare-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}
.compare-card--bad .compare-tag { color: var(--warn); }
.compare-card--good .compare-tag { color: var(--ok); }
.compare-card h4 { font-size: 1.05rem; margin-bottom: var(--space-2); }
.compare-card p:last-child, .compare-card ul:last-child { margin-bottom: 0; }

/* Engineering Tips & Tricks cards */
.tips-heading {
  font-size: 1.1875rem;
  margin: var(--space-12) 0 var(--space-4);
}
.tips-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.case .tips-grid { max-width: 860px; }
.tip-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.tip-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-mid);
  box-shadow: 0 8px 22px rgba(29, 35, 75, 0.065);
}
.tip-num {
  display: inline-block;
  width: fit-content;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-radius: 5px;
  padding: 2px 8px;
  margin-bottom: var(--space-2);
}
.tip-card h3, .tip-card h4 { font-size: 1.03rem; margin-bottom: var(--space-2); }
.tip-card p { font-size: 0.92rem; color: var(--muted); margin: 0 0 var(--space-3); }
.tip-card p:last-child { margin-bottom: 0; }
.tip-rule {
  margin-top: auto !important;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--page);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text) !important;
  font-size: 0.875rem !important;
  font-weight: 500;
}

/* Engineering Blog cards */
.blog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
}
.blog-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.blog-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  opacity: 0.7;
  transition: opacity 0.25s ease;
}
.blog-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-mid);
  box-shadow: 0 12px 30px rgba(29, 35, 75, 0.09);
}
.blog-card:hover::before { opacity: 1; }
.blog-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
}
.blog-card h3 { font-size: 1.1875rem; }
.blog-card p { color: var(--muted); margin: 0; font-size: 0.94rem; }
.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.blog-tags li {
  margin: 0;
  font-size: 0.76rem;
  font-family: var(--mono);
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text);
}
.blog-card__foot {
  margin-top: auto;
  padding-top: var(--space-2);
}

/* Industry leader quotes & practical pairings */
.quotes-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}
.quote-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.quote-card:hover {
  border-color: var(--accent-mid);
  box-shadow: 0 8px 24px rgba(29, 35, 75, 0.065);
}
.quote-card::after {
  content: "\201C";
  position: absolute;
  top: 8px;
  right: 16px;
  font-family: Georgia, serif;
  font-size: 3.4rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0.14;
  pointer-events: none;
}
.quote-card blockquote {
  position: relative;
  margin: 0;
  padding-left: var(--space-4);
  border-left: 3px solid var(--accent);
  font-size: 0.98rem;
  color: var(--text);
}
.quote-source {
  font-size: 0.875rem;
  color: var(--muted);
}
.quote-source strong { color: var(--text); }
.quote-apply {
  margin-top: auto;
  padding: 11px 13px;
  border-radius: 8px;
  background: var(--diagram-bg);
  border: 1px solid var(--border);
  font-size: 0.865rem;
  color: var(--text);
}
.quote-apply-lbl {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 3px;
}

/* Inline quote callout inside blog articles */
.quote-inline {
  margin: var(--space-6) 0;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  max-width: var(--reading-width);
}
.quote-inline blockquote {
  margin: 0 0 var(--space-2);
  font-size: 1.03rem;
  color: var(--text);
}
.quote-inline figcaption {
  font-size: 0.875rem;
  color: var(--muted);
}

/* Code & contract blocks */
.code-block {
  margin: var(--space-6) 0;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 860px;
}
.code-block__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--code-header);
  border-bottom: 1px solid var(--code-border);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--code-muted);
}
.code-copy {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #e6edf3;
  font: 600 0.72rem/1.3 var(--mono);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.code-copy:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.34); }
.code-copy.is-copied { border-color: #34d399; color: #6ee7b7; }
.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--code-text);
}

/* Case study & blog jump pills + article layout */
.case-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: var(--space-6) 0 0;
}
.case-toc li { margin: 0; }
.case-toc a {
  display: inline-block;
  font-size: 0.85rem;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.case-toc a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.article-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}
.toc-rail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.toc-rail h2 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 var(--space-3);
}
.toc-rail ol {
  margin: 0;
  padding-left: 1.15em;
  font-size: 0.9rem;
}
.toc-rail li { margin-bottom: var(--space-2); }
.toc-rail a { text-decoration: none; color: var(--text); }
.toc-rail a:hover, .toc-rail a.is-active { color: var(--accent); text-decoration: underline; }
.article-body > section:first-child { padding-top: 0; border-top: 0; }

/* Responsive grid expansions */
@media (min-width: 720px) {
  .pillars-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compare-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tips-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quotes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tips-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .article-grid { grid-template-columns: minmax(0, 1fr) 260px; }
  .toc-rail { position: sticky; top: calc(var(--header-h) + var(--space-4)); order: 2; }
  .article-body { order: 1; }
}
@media (min-width: 1120px) {
  .pillars-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- swarm intro & scroll mouse-arrow engine (driven by swarm.js) ---------- */

.btn-swarm {
  background: #0d0f18;
  color: #fff;
  border-color: #1f2438;
  gap: 9px;
  box-shadow: 0 8px 20px rgba(13, 15, 24, 0.2);
}
.btn-swarm:hover { background: #191d2f; border-color: #313856; color: #fff; box-shadow: 0 10px 24px rgba(13, 15, 24, 0.28); }
.follow-cursor-icon { font-size: 0.95rem; line-height: 1; }
.swarm-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff453a;
  box-shadow: 0 0 8px rgba(255, 69, 58, 0.8);
  animation: swarm-pulse 1.6s ease-in-out infinite;
}
@keyframes swarm-pulse { 50% { opacity: 0.35; transform: scale(0.8); } }

/* ---------- system display theme: automatic dark mode ---------- */

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b0d16;
    --surface: #131625;
    --surface-subtle: #191d30;
    --text: #f2f4fc;
    --muted: #a1a8c2;
    --accent: #958bff;
    --accent-hover: #b4adff;
    --teal: #2dd4bf;
    --accent-soft: rgba(149, 139, 255, 0.14);
    --accent-mid: rgba(149, 139, 255, 0.34);
    --border: #252a40;
    --focus: #a99dff;
    --ok: #6ee7b7;
    --ok-bg: #0f2920;
    --ok-border: #1e523f;
    --warn: #fbbf77;
    --warn-bg: #291c0d;
    --warn-border: #5c3e18;
    --pill-accent: #4c3fc4;
    --pill-ok: #126942;
    --pill-warn: #9a4712;
    --diagram-bg: #0f1220;
    --diagram-node: #181c2e;
    --diagram-node-alt: #21263d;
    --diagram-stroke: #727c9c;
    --diagram-accent-fill: #201c40;
    --code-bg: #090b13;
    --code-header: #111524;
    --code-border: #252b40;
  }

  .site-header {
    background: rgba(11, 13, 22, 0.84);
  }
  .site-nav a.nav-resume {
    background: var(--surface-subtle);
    box-shadow: none;
  }
  .hero,
  .case-header {
    background:
      radial-gradient(ellipse at 92% 14%, rgba(114, 98, 255, 0.2), transparent 34rem),
      radial-gradient(ellipse at 6% 96%, rgba(13, 148, 136, 0.14), transparent 28rem),
      linear-gradient(135deg, #0b0d16 0%, #121526 54%, #0d101c 100%);
  }
  .hero::before {
    background-image: radial-gradient(rgba(149, 139, 255, 0.18) 1px, transparent 1px);
  }
  .hero::after {
    border-color: rgba(149, 139, 255, 0.18);
    box-shadow: 0 0 0 40px rgba(149, 139, 255, 0.03), 0 0 0 84px rgba(45, 212, 191, 0.025);
  }
  .hero-role,
  .hero-metric {
    background: rgba(19, 22, 37, 0.88);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  }
  .btn-primary {
    background: linear-gradient(135deg, #5647d4, #6c5ef2);
    border-color: #6c5ef2;
    color: #ffffff;
    box-shadow: 0 8px 22px rgba(86, 71, 212, 0.34);
  }
  .btn-primary:hover {
    background: linear-gradient(135deg, #6455e6, #7a6cff);
    border-color: #7a6cff;
    color: #ffffff;
  }
  .btn-secondary {
    background: var(--surface);
    color: var(--accent);
    border-color: var(--border);
  }
  .btn-secondary:hover {
    background: var(--surface-subtle);
    border-color: var(--accent-mid);
    color: var(--accent-hover);
  }
  .btn-swarm {
    background: #171a2b;
    border-color: rgba(255, 255, 255, 0.2);
  }
  .btn-swarm:hover {
    background: #20253b;
    border-color: rgba(255, 255, 255, 0.34);
  }
  .inline-link-btn[aria-pressed="false"] {
    background: var(--surface);
    border-color: var(--border);
    color: var(--muted);
  }
  .project-entry,
  .pillar-card:hover,
  .blog-card:hover,
  .tip-card:hover,
  .quote-card:hover,
  .role:hover,
  .credential:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  }
  .arch-figure {
    background-image: radial-gradient(rgba(149, 139, 255, 0.16) 1px, transparent 1px);
  }
  .eval-meter__fill {
    background: linear-gradient(90deg, #10b981, #34d399);
  }
  .flow > li + li::before {
    border-left-color: #464f70;
  }
  @media (max-width: 899px) {
    .has-js .site-nav {
      background: var(--surface);
      box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
    }
  }
}

/* The whole site flips to a dark design-tool canvas by retargeting tokens. */
body.swarm-dark {
  --page: #08090d;
  --surface: #12141b;
  --surface-subtle: #171923;
  --text: #f5f6fa;
  --muted: #98a0b2;
  --accent: #ff453a;
  --accent-hover: #ff6961;
  --teal: #2dd4bf;
  --accent-soft: rgba(255, 69, 58, 0.14);
  --accent-mid: rgba(255, 69, 58, 0.32);
  --border: #262936;
  --ok: #6ee7a8;
  --ok-bg: #10261b;
  --ok-border: #1e4d33;
  --warn: #fbbf77;
  --warn-bg: #271b0c;
  --warn-border: #5a3c16;
  --pill-accent: #d9382f;
  --pill-ok: #137044;
  --pill-warn: #9a4712;
  --diagram-bg: #0e1017;
  --diagram-node: #161924;
  --diagram-node-alt: #1e2230;
  --diagram-stroke: #636e82;
  --diagram-accent-fill: #2c1518;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
}
body.swarm-dark .site-header { background: rgba(8, 9, 13, 0.84); }
body.swarm-dark .hero,
body.swarm-dark .case-header {
  background: radial-gradient(ellipse at 92% 16%, rgba(255, 69, 58, 0.14), transparent 34rem), linear-gradient(135deg, #08090d, #101219);
}
body.swarm-dark .hero::before {
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
}
body.swarm-dark .hero::after { border-color: rgba(255, 69, 58, 0.14); box-shadow: 0 0 0 38px rgba(255, 69, 58, 0.025), 0 0 0 78px rgba(255, 69, 58, 0.02); }
body.swarm-dark .hero-role,
body.swarm-dark .hero-metric,
body.swarm-dark .stack-chips li,
body.swarm-dark .skill-chips li,
body.swarm-dark .project-scale,
body.swarm-dark .tip-rule,
body.swarm-dark .credential,
body.swarm-dark .contact-list li {
  background: #141720;
  border-color: #262936;
}
body.swarm-dark .btn-secondary:hover { background: #1c1f2b; }
body.swarm-dark .btn-primary { background: #ff453a; border-color: #ff453a; color: #fff; box-shadow: none; }
body.swarm-dark .mo { transition: none !important; }

.swarm-hide {
  opacity: 0 !important;
  transition: none !important;
  pointer-events: none !important;
}
.swarm-pop { animation: swarm-pop 0.45s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes swarm-pop { from { opacity: 0; transform: scale(0.985); } }

.swarm-canvas { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.swarm-follow-canvas { z-index: 80; }

/* Floating scroll-swarm dock (compact glass pill, bottom-right on desktop, centered on small phones) */
.swarm-dock {
  position: fixed;
  z-index: 88;
  right: 16px;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 24px);
  padding: 6px 8px 6px 12px;
  color: #f4f5ff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(18, 21, 38, 0.88);
  box-shadow: 0 12px 32px rgba(15, 18, 42, 0.24);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  font: 600 0.72rem/1.2 var(--mono);
}
.swarm-dock__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-right: 4px;
  white-space: nowrap;
}
.swarm-dock__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5eead4;
  box-shadow: 0 0 8px rgba(94, 234, 212, 0.85);
}
.swarm-dock.is-paused .swarm-dock__dot {
  background: #64748b;
  box-shadow: none;
}
.swarm-dock button {
  min-height: 28px;
  padding: 4px 10px;
  color: #e8eaf8;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font: 600 0.71rem/1.1 var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.swarm-dock button:hover { border-color: #a99dff; background: rgba(169, 157, 255, 0.2); }
.swarm-dock button[data-action="rebuild"] {
  background: rgba(255, 69, 58, 0.2);
  border-color: rgba(255, 69, 58, 0.52);
  color: #ffd5d2;
}
.swarm-dock button[data-action="rebuild"]:hover {
  background: rgba(255, 69, 58, 0.34);
  border-color: #ff6961;
}

@media (max-width: 599px) {
  .actions .btn { white-space: normal; }
  .swarm-dock {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    flex-wrap: nowrap;
    justify-content: center;
    padding: 5px 8px;
    gap: 5px;
    font-size: 0.67rem;
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .swarm-dock.is-dormant {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 16px);
  }
  .swarm-dock__status { gap: 5px; padding-right: 2px; }
  .swarm-dock button { padding: 6px 10px; font-size: 0.72rem; min-height: 44px; min-width: 44px; }
  .hero-visual__foot { white-space: normal; }
}

/* Rebuild mode controls toolbar (1x/2x/3x speed, Tour/Scroll mode, Sound, Go live) */
.swarm-controls {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 95;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border-radius: 999px;
  background: rgba(16, 17, 24, 0.9);
  border: 1px solid #303443;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}
.swarm-controls button {
  min-height: 36px;
  padding: 6px 13px;
  background: rgba(255, 255, 255, 0.06);
  color: #f5f5f7;
  border: 1px solid #343846;
  border-radius: 999px;
  font: 600 0.78rem/1.1 var(--mono);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.swarm-controls button:hover { border-color: #ff453a; background: rgba(255, 69, 58, 0.14); }
.swarm-controls button.is-active {
  background: #ff453a;
  border-color: #ff453a;
  color: #fff;
}

/* Finale: ease the dark theme back out instead of snapping. */
body.swarm-exit,
body.swarm-exit .site-header,
body.swarm-exit .site-footer,
body.swarm-exit main * {
  transition: background-color 0.9s ease, color 0.9s ease, border-color 0.9s ease;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .mo { opacity: 1; transform: none; filter: none; }
}

@media print {
  :root {
    color-scheme: light;
    --page: #ffffff;
    --surface: #ffffff;
    --surface-subtle: #ffffff;
    --text: #000000;
    --muted: #444444;
    --border: #bbbbbb;
    --diagram-bg: #ffffff;
  }
  .site-header, .skip-link, .actions, .case-nav, .case-toc, .toc-rail, .site-footer, .nav-toggle, .swarm-dock, .swarm-controls, .code-copy { display: none !important; }
  .mo { opacity: 1 !important; transform: none !important; filter: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; line-height: 1.45; }
  section { padding: 10pt 0; border-top: 1px solid #bbb; }
  .hero, .case-header { padding: 0 0 10pt; }
  .container { max-width: none; padding: 0; }
  .project-entry, .decision, .callout, .flow > li, .pillar-card, .blog-card, .tip-card, .quote-card, .compare-card, .arch-figure, .stat-box {
    background: #fff;
    border: 1px solid #bbb;
    break-inside: avoid;
    padding: 6pt 8pt;
  }
  .project-entry { display: block; }
  .project-entry__identity { margin-bottom: 6pt; }
  .flow > li + li { margin-top: 4pt; }
  .flow > li + li::before { content: none; }
  h1, h2, h3 { break-after: avoid; }
  a { color: #000; }
  a[href^="http"]::after,
  a[href^="mailto"]::after {
    content: " (" attr(href) ")";
    font-size: 8.5pt;
    color: #444;
    word-break: break-all;
  }
}
