/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-alt: #f4f6f8;
  --surface: #ffffff;
  --ink: #0f1419;
  --ink-2: #3a434d;
  --muted: #6a7480;
  --line: #e1e5ea;
  --line-strong: #c3cad3;
  --blue: #1d5bd8;
  --blue-ink: #1647ad;
  --blue-soft: rgba(29, 91, 216, 0.08);
  --bot-body: #1b2027;
  --bot-plate: #3b4450;
  --bot-edge: #0a0c0f;
  --shadow: 0 1px 2px rgba(15, 20, 25, 0.04), 0 8px 24px -12px rgba(15, 20, 25, 0.12);

  --sans: "IBM Plex Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --max: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e12;
    --bg-alt: #11161c;
    --surface: #121820;
    --ink: #e8ecf0;
    --ink-2: #b8c0ca;
    --muted: #87919d;
    --line: #232b35;
    --line-strong: #37414d;
    --blue: #5b8ff0;
    --blue-ink: #86abf5;
    --blue-soft: rgba(91, 143, 240, 0.1);
    --bot-body: #2a313b;
    --bot-plate: #4a5563;
    --bot-edge: #6b7686;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; font-weight: 600; }
p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-ink); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

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

.kicker {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.kicker .accent { color: var(--blue); }

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; z-index: 100;
}
.skip:focus { left: 8px; }

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

.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.3s var(--ease);
}
.brand:hover .brand-mark { background: var(--blue); transform: rotate(-90deg); }
.brand-name { font-size: 15px; }

.nav { display: flex; gap: 4px; }
.nav a {
  position: relative;
  color: var(--ink-2);
  font-size: 15px; font-weight: 500;
  padding: 8px 12px; border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.nav a:hover { color: var(--ink); background: var(--bg-alt); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px;
  height: 2px; background: var(--blue); border-radius: 2px;
}

@media (max-width: 560px) {
  .brand-name { display: none; }
  .nav a { padding: 8px 10px; font-size: 14px; }
}

/* ---------- Home: hero ---------- */
.hero {
  position: relative;
  min-height: min(78vh, 720px);
  display: flex; align-items: center;
  padding: 72px 0 96px;
  overflow: hidden;
}
.hero-grid {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 60% 45%, #000 40%, transparent 100%);
          mask-image: radial-gradient(ellipse 80% 70% at 60% 45%, #000 40%, transparent 100%);
}
.hero .wrap { position: relative; width: 100%; }

.prompt { min-height: 1.6em; margin-bottom: 28px; white-space: nowrap; font-size: min(13px, 2.8vw); }
.prompt .caret {
  display: inline-block; width: 0.55em; height: 1.05em; margin-left: 2px;
  background: var(--blue); vertical-align: -0.18em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero h1 {
  font-size: clamp(44px, 8.4vw, 96px);
  letter-spacing: -0.035em;
  line-height: 0.98;
  font-weight: 600;
}
.hero h1 .dot { color: var(--blue); }

.subtitle {
  margin-top: 22px;
  font-size: clamp(18px, 2.1vw, 22px);
  color: var(--ink-2);
  max-width: 34em;
  line-height: 1.45;
}
@media (min-width: 561px) { .subtitle .part { white-space: nowrap; } }
.subtitle .sep { color: var(--line-strong); margin: 0 0.35em; }

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

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 8px;
  font-size: 15px; font-weight: 500;
  border: 1px solid var(--line-strong); color: var(--ink); background: var(--surface);
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s;
}
.btn:hover { color: var(--ink); border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--blue); }
.btn-ghost:hover { color: var(--blue-ink); border-color: var(--blue); background: var(--blue-soft); }
.btn-ghost:hover svg { animation: nudge 1s var(--ease) infinite; }
.btn .arrow { transition: transform 0.2s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Home: blurbs ---------- */
.section { padding: 88px 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(26px, 3vw, 34px); }

.blurbs {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 56px;
}
.blurb h3 {
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 16px;
}
.blurb p + p { margin-top: 1em; }
.blurb p { color: var(--ink-2); font-size: 18px; line-height: 1.65; max-width: 38em; }

.now-list { list-style: none; margin: 0; padding: 0; }
.now-list li {
  position: relative; padding: 14px 0 14px 22px; border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}
.now-list li:first-child { padding-top: 0; }
.now-list li:first-child::before { top: 9px; }
.now-list li::before {
  content: ""; position: absolute; left: 0; top: 23px;
  width: 8px; height: 8px; border-radius: 2px; background: var(--blue);
}
.now-list strong { color: var(--ink); font-weight: 600; }

.toolbox { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.toolbox h3 { font-size: 16px; margin-bottom: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.chip {
  font-family: var(--mono); font-size: 12.5px;
  padding: 4px 9px; border-radius: 5px;
  background: var(--bg-alt); color: var(--ink-2); border: 1px solid var(--line);
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.toolbox .chip:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-1px); }

@media (max-width: 860px) {
  .blurbs { grid-template-columns: 1fr; gap: 48px; }
  .toolbox { grid-template-columns: 1fr; gap: 28px; }
}

/* ---------- Contact / footer ---------- */
.contact { padding: 96px 0 72px; border-top: 1px solid var(--line); background: var(--bg-alt); }
.contact h2 { font-size: clamp(30px, 4.4vw, 48px); letter-spacing: -0.03em; }
.contact .lede { margin-top: 14px; color: var(--ink-2); font-size: 18px; max-width: 32em; }

.contact-links {
  list-style: none; margin: 40px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
}
.contact-links a {
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 20px 20px 0;
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
}
.contact-links li + li a { padding-left: 20px; border-left: 1px solid var(--line-strong); }
.contact-links .label { font-family: var(--mono); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.contact-links .value { font-size: 17px; font-weight: 500; overflow-wrap: anywhere; display: flex; justify-content: space-between; gap: 8px; }
.contact-links .value .arrow { color: var(--muted); transition: transform 0.2s var(--ease), color 0.2s; }
.contact-links a:hover .value { color: var(--blue); }
.contact-links a:hover .arrow { color: var(--blue); transform: translate(3px, -3px); }

@media (max-width: 960px) {
  .contact-links { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .contact-links li + li a { padding-left: 0; border-left: 0; }
}
@media (max-width: 560px) {
  .contact-links { grid-template-columns: 1fr; }
}

.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--blue); }
.site-footer .links { display: flex; gap: 18px; }

/* ---------- Timeline pages ---------- */
.page-intro { padding: 72px 0 40px; }
.page-intro h1 { font-size: clamp(40px, 6vw, 68px); letter-spacing: -0.03em; margin-top: 14px; }
.page-intro .lede { margin-top: 16px; font-size: 19px; color: var(--ink-2); max-width: 36em; }
.page-intro .hint { margin-top: 28px; display: inline-flex; align-items: center; gap: 10px; }
.page-intro .hint svg { animation: nudge 1.8s var(--ease) infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

.timeline { position: relative; padding: 48px 0 160px; overflow-x: clip; }

.tl-grid {
  --lane: 200px;
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--lane) minmax(0, 1fr);
  row-gap: 64px;
}
.lane { grid-column: 2; pointer-events: none; }

/* alternating cards overlap vertically on desktop so the page stays compact */
.tl-item { position: relative; margin-bottom: -110px; }
.tl-item:last-child { margin-bottom: 0; }
.tl-item.left { grid-column: 1; }
.tl-item.right { grid-column: 3; }

.track {
  position: absolute; left: 0; top: 0;
  pointer-events: none; z-index: 0; overflow: visible;
}
.track-plan { fill: none; stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 3 6; }
.track-done { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }

.dock { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; transition: fill 0.3s, stroke 0.3s; }
.dock.reached { fill: var(--blue); stroke: var(--blue); }
.dock-ping { fill: none; stroke: var(--blue); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
.dock-ping.go { animation: ping 0.9s var(--ease) forwards; }
@keyframes ping {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(4.5); }
}

.goal { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.goal.reached { stroke: var(--blue); }
.goal-label {
  position: absolute; z-index: 1; transform: translateX(-50%);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; white-space: nowrap;
  color: var(--muted);
  transition: color 0.4s;
}
.goal-label.reached {
  color: var(--blue);
  animation: glow 2.4s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { text-shadow: 0 0 4px color-mix(in srgb, var(--blue) 50%, transparent), 0 0 14px color-mix(in srgb, var(--blue) 30%, transparent); }
  50% { text-shadow: 0 0 6px color-mix(in srgb, var(--blue) 80%, transparent), 0 0 24px color-mix(in srgb, var(--blue) 55%, transparent), 0 0 40px color-mix(in srgb, var(--blue) 25%, transparent); }
}

/* Cards */
.tl-card {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 24px 22px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, transform 0.25s var(--ease), box-shadow 0.25s;
}
.tl-item.left .tl-card { margin-right: 0; }
.tl-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }

/* edge tick that lines up with the dock */
.tl-card::before {
  content: ""; position: absolute; top: 28px; width: 3px; height: 16px; border-radius: 2px;
  background: var(--blue); transform: scaleY(0); transition: transform 0.4s 0.25s var(--ease);
}
.tl-item.left .tl-card::before { right: -1px; }
.tl-item.right .tl-card::before { left: -1px; }
.tl-item.visited .tl-card::before { transform: scaleY(1); }
.tl-item.current .tl-card { border-color: color-mix(in srgb, var(--blue) 45%, var(--line)); }

/* lidar-ish scan sweep on reveal */
.tl-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, var(--blue-soft) 45%, rgba(29, 91, 216, 0.16) 50%, var(--blue-soft) 55%, transparent 100%);
  opacity: 0;
}
.tl-item.visited .tl-card::after { animation: sweep-l 1.1s 0.1s var(--ease) forwards; }
.tl-item.left.visited .tl-card::after { animation-name: sweep-r; }
@keyframes sweep-l { 0% { opacity: 1; transform: translateX(-100%); } 100% { opacity: 1; transform: translateX(100%); } }
@keyframes sweep-r { 0% { opacity: 1; transform: translateX(100%); } 100% { opacity: 1; transform: translateX(-100%); } }

.tl-period { font-family: var(--mono); font-size: 13px; color: var(--blue); letter-spacing: 0.01em; }
.tl-title { margin-top: 8px; font-size: 21px; }
.tl-org { margin-top: 4px; color: var(--ink-2); font-weight: 500; font-size: 15.5px; }
.tl-org .loc { color: var(--muted); font-weight: 400; }
.tl-org .loc::before { content: "·"; margin: 0 0.45em; color: var(--line-strong); }
.tl-summary { margin-top: 12px; color: var(--ink-2); font-size: 16px; }
.tl-bullets { margin: 10px 0 0; padding: 0; list-style: none; color: var(--ink-2); font-size: 15.5px; }
.tl-bullets li { position: relative; padding-left: 18px; margin-top: 6px; }
.tl-bullets li::before { content: ""; position: absolute; left: 2px; top: 0.72em; width: 8px; height: 1.5px; background: var(--line-strong); }
.tl-card .chips { margin-top: 16px; }
.tl-links { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 15px; font-weight: 500; }
.tl-links a::after { content: " ↗"; font-size: 0.9em; }

.ph {
  color: var(--muted);
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 4px, transparent 4px 7px) bottom / 100% 1px no-repeat;
  font-style: italic;
}

/* Load-in: all cards fade in together on page load (short stagger) */
.anim .tl-item .tl-card { opacity: 0; transform: translateY(14px); }
.anim .tl-item.shown .tl-card {
  opacity: 1; transform: none;
  transition: opacity 0.6s var(--ease) var(--d, 0ms), transform 0.7s var(--ease) var(--d, 0ms), border-color 0.3s, box-shadow 0.25s;
}
.anim .tl-item.shown .tl-card:hover { transform: translateY(-2px); transition-delay: 0ms; }

/* TurtleBot */
.bot {
  position: absolute; left: 0; top: 0; z-index: 2;
  width: 48px; height: 48px; margin: -24px 0 0 -24px;
  will-change: transform;
  cursor: pointer;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.18));
}
.bot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bot .body { fill: var(--bot-body); stroke: var(--bot-edge); stroke-width: 1; }
.bot .plate { fill: none; stroke: var(--bot-plate); stroke-width: 1.2; }
.bot .wheel { fill: #0d0f12; }
.bot .standoff { fill: #9aa3ad; }
.bot .lds { fill: #2c333c; stroke: #0d0f12; stroke-width: 0.8; }
.bot .lds-beam { stroke: var(--blue); stroke-width: 1.6; stroke-linecap: round; }
.bot .led { fill: var(--blue); }
.bot .spinner { transform-origin: 0 0; animation: lds 0.7s linear infinite; }
@keyframes lds { to { transform: rotate(360deg); } }
.bot .scan { fill: var(--blue); opacity: 0.08; }
.bot.twirl .chassis { animation: twirl 0.9s var(--ease); transform-origin: 0 0; }
@keyframes twirl { to { transform: rotate(360deg); } }

.bot-bubble {
  position: absolute; z-index: 3; left: 0; top: 0;
  font-family: var(--mono); font-size: 12px; white-space: nowrap;
  padding: 4px 8px; border-radius: 5px;
  background: var(--ink); color: var(--bg);
  pointer-events: none; opacity: 0; transform: translate(-50%, -48px);
  transition: opacity 0.2s;
}
.bot-bubble.show { opacity: 1; }

/* Career status HUD */
.hud {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  width: 280px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s var(--ease);
}
.hud.on { opacity: 1; transform: none; }
.hud .topic { color: var(--blue); margin-bottom: 6px; display: flex; align-items: center; gap: 7px; }
.hud .live { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); animation: live 1.6s ease-in-out infinite; }
@keyframes live { 50% { opacity: 0.25; } }
.hud .row { display: flex; justify-content: space-between; gap: 14px; }
.hud .row span:first-child { flex: none; }
.hud .row span:last-child { color: var(--ink); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud .dim, .dim { color: var(--muted); }

@media (max-width: 820px) {
  .tl-grid { --lane: 56px; grid-template-columns: var(--lane) minmax(0, 1fr); row-gap: 40px; }
  .tl-item { margin-bottom: 0; }
  .lane { grid-column: 1; }
  .tl-item.left, .tl-item.right { grid-column: 2; }
  .anim .tl-item.left { --from: 28px; }
  .tl-item.left .tl-card::before { right: auto; left: -1px; }
  .tl-item.left.visited .tl-card::after { animation-name: sweep-l; }
  .tl-card { padding: 18px 18px; }
  .tl-title { font-size: 19px; }
  .bot { width: 38px; height: 38px; margin: -19px 0 0 -19px; }
  .hud { left: 12px; right: 12px; bottom: 12px; width: auto; padding: 8px 10px; }
  .hud { display: flex; align-items: center; gap: 12px; font-size: 11.5px; }
  .hud .topic { margin: 0; flex: none; }
  .hud .row { display: none; flex: 1; min-width: 0; }
  .hud .row:nth-child(2) { display: flex; }
  .hud .row:nth-child(2) span:first-child, .hud .row:last-child span:first-child { display: none; }
  .hud .row:last-child { display: flex; flex: none; }
}

/* ---------- Projects ---------- */
.proj-summary {
  display: grid; grid-template-columns: minmax(0, 0.55fr) minmax(0, 1.45fr); gap: 40px;
  position: relative;
  padding-top: 8px; padding-bottom: 40px;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.proj-summary.in { opacity: 1; transform: none; }

.stats { display: grid; grid-template-rows: 1fr 1fr; border-top: 1px solid var(--line-strong); }
.stat { padding: 18px 0 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.stat-v { font-size: 52px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat-v small { font-size: 0.5em; color: var(--muted); margin-left: 2px; font-weight: 500; }
.stat-l { font-family: var(--mono); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.bars { margin: 0; border-top: 1px solid var(--line-strong); padding-top: 14px; }
.bars figcaption { margin-bottom: 10px; }
.bars ul { list-style: none; margin: 0; padding: 0; }
.bars li {
  display: grid; grid-template-columns: 136px minmax(0, 1fr) 24px; align-items: center; gap: 12px;
  padding: 5px 6px; margin: 0 -6px; border-radius: 6px; cursor: pointer;
  transition: background 0.15s;
}
.bars li:hover, .bars li:focus-visible, .bars li.on { background: var(--bg-alt); }
.bar-l { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-t { height: 10px; display: block; }
.bar-f {
  display: block; height: 100%; width: 0; background: var(--blue); border-radius: 0 4px 4px 0;
  transition: width 0.9s var(--ease);
}
.proj-summary.in .bar-f { width: var(--w); }
.bars li:not(:hover):not(.on) .bar-f { opacity: 0.85; }
.bar-v { font-family: var(--mono); font-size: 12.5px; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.bar-tip {
  position: absolute; z-index: 5; width: 220px;
  font-size: 13px; line-height: 1.5; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
  box-shadow: var(--shadow); padding: 10px 12px;
  opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s;
}
.bar-tip strong { color: var(--ink); font-weight: 600; }
.bar-tip .dim { font-family: var(--mono); font-size: 11px; margin-top: 6px; }
.bar-tip.show { opacity: 1; transform: none; }

.proj-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.pf {
  font: 500 14px/1 var(--sans); color: var(--ink-2);
  height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-strong);
  display: inline-flex; align-items: center; gap: 8px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pf .n { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pf:hover { border-color: var(--ink); color: var(--ink); }
.pf[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pf[aria-pressed="true"] .n { color: color-mix(in srgb, var(--bg) 65%, transparent); }

.projects { padding-bottom: 120px; }
.proj-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }

.pcard {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(22px) scale(0.985);
  transition: opacity 0.6s var(--ease) var(--d, 0ms), transform 0.7s var(--ease) var(--d, 0ms), border-color 0.2s, box-shadow 0.25s;
}
.pcard[hidden] { display: none; }
.pcard.in { opacity: 1; transform: none; }
.pcard.in:hover { transform: translateY(-3px); border-color: var(--line-strong); transition-delay: 0ms; }
.pcard.gone { opacity: 0 !important; transform: scale(0.96) !important; transition-delay: 0ms; }

.pfig {
  position: relative; aspect-ratio: 2 / 1;
  background-color: var(--bg-alt);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 20px 20px; background-position: -1px -1px;
  border-bottom: 1px solid var(--line);
}
.pfig svg { position: absolute; inset: 10px 14px; width: calc(100% - 28px); height: calc(100% - 20px); overflow: visible; }
.pidx, .pcat {
  position: absolute; top: 10px; z-index: 1;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.04em;
}
.pidx { left: 12px; color: var(--ink); }
.pcat { right: 12px; color: var(--blue); text-transform: uppercase; }

/* figure strokes */
.pfig svg * { vector-effect: non-scaling-stroke; }
.pfig .ln { fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.pfig .ln * { fill: none; }
.pfig .ac { fill: none; stroke: var(--blue); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.pfig .thick { stroke-width: 3; }
.pfig .dash { stroke-dasharray: 4 5; }
.pfig .dot { fill: var(--blue); }
.pfig .pt { fill: var(--muted); }
.pfig .joint { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.pfig .wheel { fill: var(--ink); }
.pfig .body { fill: var(--bot-body); stroke: var(--bot-edge); }
.pfig .tag { fill: var(--ink); }
.pfig .tag-bits rect { fill: var(--bg-alt); }
.pfig .area { fill: var(--blue-soft); stroke: none; }
.pfig .fillac { fill: var(--blue); }
.pfig .hexon { fill: var(--blue-soft); stroke: var(--blue); stroke-width: 2; }
.pfig .puck { fill: var(--ink); }
.pfig .code rect { fill: var(--line-strong); }
.pfig .lbl { font-family: var(--mono); font-size: 10px; fill: var(--muted); stroke: none; }

/* figure motion (runs while the card is in view) */
.pfig .tilt, .pfig .swing, .pfig .steer, .pfig .spin, .pfig .roll, .pfig .slide, .pfig .ride { transform-box: fill-box; transform-origin: center; }
.pfig .swing { transform-box: view-box; transform-origin: 108px 52px; }
.pcard.in .tilt { animation: tilt 4s ease-in-out infinite; }
.pcard.in .roll { animation: roll 4s ease-in-out infinite; }
.pcard.in .swing { animation: swing 3.6s ease-in-out infinite; }
.pcard.in .steer { animation: steer 3.2s ease-in-out infinite; }
.pcard.in .spin { animation: lds 0.8s linear infinite; transform-origin: 0 0; transform-box: view-box; }
.pcard.in .flow { animation: flow 1.2s linear infinite; }
.pcard.in .flow-slow { animation: flow 2.4s linear infinite; }
.pcard.in .blink { animation: blinkfig 1.4s steps(1) infinite; }
.pcard.in .slide { animation: slide 3s ease-in-out infinite; }
.pcard.in .ride { animation: ride 3.4s ease-in-out infinite; }
.pcard.in .ride-ecg { animation: ecg 2.6s linear infinite; }
@keyframes tilt { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes roll { 0%, 100% { transform: translateX(-26px); } 50% { transform: translateX(18px); } }
@keyframes swing { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(18deg); } }
@keyframes steer { 0%, 100% { transform: rotate(-30deg); } 50% { transform: rotate(30deg); } }
@keyframes flow { to { stroke-dashoffset: -18; } }
@keyframes blinkfig { 50% { opacity: 0.2; } }
@keyframes slide { 0%, 100% { transform: translate(-30px, 6px); } 50% { transform: translate(44px, -14px); } }
@keyframes ecg { from { transform: translateX(0); opacity: 0; } 8%, 92% { opacity: 1; } to { transform: translateX(216px); opacity: 0; } }
@keyframes ride { 0% { transform: translate(0, 0); } 25% { transform: translate(42px, -68px); } 70% { transform: translate(128px, -68px); } 100% { transform: translate(170px, 0); } }

.pbody { padding: 18px 20px 0; flex: 1; }
.porg { font-family: var(--mono); font-size: 12px; color: var(--blue); letter-spacing: 0.01em; }
.ptitle { margin-top: 6px; font-size: 19px; }
.psum { margin-top: 10px; color: var(--ink-2); font-size: 15.5px; line-height: 1.55; }
.pbody .tl-bullets { font-size: 14.5px; }
.pfoot { padding: 16px 20px 18px; }
.pcard:not(.all-tags) .chip.extra { display: none; }
.chip-more {
  font: inherit; font-family: var(--mono); font-size: 12.5px; cursor: pointer;
  color: var(--blue); background: transparent; border: 1px dashed var(--line-strong);
}
.chip-more:hover { border-color: var(--blue); }
.pcat .more { color: var(--muted); }
.plinks { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14.5px; font-weight: 500; }

@media (max-width: 1000px) { .proj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .proj-summary { grid-template-columns: 1fr; }
  .stats { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { padding-left: 20px; border-left: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .proj-grid { grid-template-columns: 1fr; }
  .stat-v { font-size: 38px; }
  .bars li { grid-template-columns: 120px minmax(0, 1fr) 20px; }
}

/* ---------- Home: recognition ---------- */
.awards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; list-style: none; margin: 0; padding: 0; }
.award {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 20px 20px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  transition: border-color 0.2s, transform 0.25s var(--ease);
}
.award:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.award-type { font-family: var(--mono); font-size: 11.5px; color: var(--blue); text-transform: uppercase; letter-spacing: 0.06em; }
.award h3 { font-size: 16.5px; line-height: 1.35; letter-spacing: -0.005em; }
.award-ref { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.award-date { margin-top: auto; padding-top: 6px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
@media (max-width: 960px) { .awards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .awards { grid-template-columns: 1fr; } }

/* ---------- 404 ---------- */
.lost { padding: 120px 0; }
.lost h1 { font-size: clamp(40px, 6vw, 64px); letter-spacing: -0.03em; margin: 14px 0 16px; }
.lost p { color: var(--ink-2); font-size: 18px; margin-bottom: 32px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
