:root {
  --bg: #0b1020; --surface: #151b2e; --text: #e6e8ef;
  --muted: #9aa3b2; --accent: #6ea8fe; --border: #232a44;
  --highlight: rgba(110, 168, 254, 0.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd { font: inherit; font-size: 11px; padding: 1px 5px; border: 1px solid var(--border);
  border-radius: 3px; color: var(--text); background: var(--surface); }

.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--accent); z-index: 100; transition: width 80ms linear; }

header.site {
  position: sticky; top: 3px; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.92); backdrop-filter: blur(8px);
}
header.site .brand { font-size: 16px; font-weight: 600; }
header.site .actions { display: flex; gap: 8px; align-items: center; }
.icon-link { color: var(--muted); font-size: 13px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 6px; }
.icon-link:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.kbd-hint { color: var(--muted); font-size: 12px; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 4px; }
@media (max-width: 860px) { .kbd-hint, .icon-link { display: none; } }
.btn { color: var(--text); padding: 8px 16px; border-radius: 6px; cursor: pointer;
  font-weight: 600; font-size: 14px; border: 1px solid var(--border); background: transparent;
  text-decoration: none; transition: background 150ms ease, opacity 150ms ease; }
.btn:hover { background: var(--surface); text-decoration: none; }

.page { max-width: 1100px; margin: 0 auto; padding: 48px 28px 96px;
  display: grid; grid-template-columns: 1fr; }
@media (min-width: 1024px) {
  .page { grid-template-columns: 180px 1fr; gap: 48px; padding-top: 60px; }
}
.side-nav { display: none; }
@media (min-width: 1024px) {
  .side-nav { display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 90px; align-self: start;
    font-size: 12px; letter-spacing: 0.8px; text-transform: uppercase; }
  .side-nav a { color: var(--muted); padding: 6px 10px; border-left: 2px solid transparent;
    transition: color 150ms ease, border-color 150ms ease, background 150ms ease; }
  .side-nav a:hover { color: var(--text); text-decoration: none; background: var(--surface); }
  .side-nav a.active { color: var(--accent); border-left-color: var(--accent); }
}
main { min-width: 0; }

.reveal { opacity: 0; transform: translateY(16px); transition: opacity 350ms ease, transform 350ms ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

.hero { margin-bottom: 24px; }
.hero h1 { font-size: 36px; margin: 0 0 6px; letter-spacing: -0.2px; }
.hero .tagline { color: var(--text); font-size: 16px; margin: 0 0 10px; min-height: 1.6em; }
.hero .tagline .caret { display: inline-block; width: 2px; background: var(--accent);
  height: 1em; margin-left: 2px; vertical-align: text-bottom; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero .tagline.done .caret { display: none; }
.hero .contact { color: var(--muted); font-size: 14px; }
.hero .contact .copy { background: none; border: 0; color: var(--accent); cursor: pointer;
  font: inherit; padding: 0; }
.hero .contact .copy:hover { text-decoration: underline; }
.hero .contact span + span::before { content: "·"; margin: 0 8px; color: var(--border); }

.now-callout {
  margin-top: 18px; padding: 14px 18px; border-radius: 10px;
  border: 1px solid var(--border); background: linear-gradient(180deg, rgba(110,168,254,0.06), transparent);
  font-size: 14px;
}
.now-callout .badge { display: inline-block; background: var(--accent); color: #0b1020;
  font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px; margin-right: 10px; vertical-align: middle; }
.now-callout .topics span { color: var(--muted); }

section { margin-top: 36px; scroll-margin-top: 80px; }
section > h2 { font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--accent); margin: 0 0 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border); }
section > h2 .h2-hint { color: var(--muted); text-transform: none; letter-spacing: 0;
  font-weight: 400; font-size: 12px; }
section p { margin: 0 0 12px; }
section ul { padding-left: 20px; margin: 8px 0; }
section li { margin: 6px 0; transition: opacity 150ms ease, background 150ms ease;
  padding: 2px 6px; border-radius: 4px; margin-left: -6px; }

/* ---- Architecture carousel ---- */
.carousel { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); overflow: hidden; }
.carousel-toolbar { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.18); }
.nav-btn { background: transparent; color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease; }
.nav-btn:hover { background: var(--bg); border-color: var(--accent); }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.slide-meta { display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 13px; color: var(--muted); }
.slide-meta .slide-name { color: var(--accent); font-weight: 600; font-family: monospace; }
.slides { position: relative; padding: 18px; }
.slide { display: none; }
.slide.active { display: block; }
.slide-header { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.slide-header h3 { margin: 0 0 4px; font-size: 19px; font-family: monospace; color: var(--accent); }
.slide-header h3 .slide-company { color: var(--muted); font-family: inherit; font-size: 13px;
  font-weight: 400; margin-left: 6px; }
.slide-header .slide-tag { margin: 0; color: var(--text); font-size: 14px; max-width: 480px; }
.signature-panel { position: relative; padding: 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg); }
.signature-panel svg { width: 100%; height: auto; display: block; max-height: 420px; }
/* Mermaid flowchart output: node fill/stroke, edge color, and cluster (subgraph) colors
   are themed to match the site palette via mermaid.initialize's themeVariables in
   arch-diagrams.js, so only the interactive hover affordance needs overriding here.
   Mermaid injects its own <style id=...> block after this stylesheet with an ID+class
   selector for `.node rect`, so `!important` is needed to reliably win that tie. */
.signature-panel .node.arch-node { cursor: help; }
.signature-panel .node.arch-node rect { transition: stroke 150ms ease, fill 150ms ease; }
.signature-panel .node.arch-node:hover rect {
  stroke: var(--accent) !important; fill: rgba(110, 168, 254, 0.10) !important;
}
.arch-tooltip { position: absolute; background: var(--bg); border: 1px solid var(--accent);
  color: var(--text); padding: 8px 12px; border-radius: 6px; font-size: 13px;
  pointer-events: none; opacity: 0; transition: opacity 150ms ease;
  max-width: 280px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.arch-tooltip.show { opacity: 1; }
.dots { display: flex; justify-content: center; gap: 8px; padding: 0 0 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); border: 0;
  padding: 0; cursor: pointer; transition: background 150ms ease, transform 150ms ease; }
.dot:hover { background: var(--muted); }
.dot.active { background: var(--accent); transform: scale(1.3); }

/* ---- Featured projects ---- */
.project { margin-bottom: 18px; padding: 16px; border: 1px solid var(--border);
  border-radius: 10px; transition: border-color 150ms ease; }
.project:hover { border-color: var(--accent); }
.project-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; }
.project-head h3 { font-size: 17px; margin: 0 0 4px; }
.project-head h3 .product-name { color: var(--accent); font-family: monospace; }
.project-head .live { color: var(--accent); font-size: 13px; }
.project p { margin: 6px 0 8px; font-size: 14.5px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { background: var(--bg); color: var(--muted); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 4px; font-size: 12px; }

/* ---- Skill chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.chip { background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 999px; cursor: pointer; font-size: 13px;
  font-family: inherit; transition: background 120ms ease, border-color 120ms ease; }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #0b1020; font-weight: 600; }
.filter-status { color: var(--muted); font-size: 13px; margin: 6px 0; min-height: 20px; }
.filter-status .clear { color: var(--accent); cursor: pointer; background: none; border: 0;
  font: inherit; padding: 0; margin-left: 8px; }
body.filtering li.bullet { opacity: 0.28; }
body.filtering li.bullet.match { opacity: 1; background: var(--highlight); }

.skills dl { display: grid; grid-template-columns: 200px 1fr; gap: 8px 18px; margin: 0; }
.skills dt { color: var(--accent); font-weight: 600; font-size: 14px; }
.skills dd { margin: 0; }
@media (max-width: 640px) {
  .skills dl { grid-template-columns: 1fr; gap: 2px 0; }
  .skills dt { margin-top: 10px; }
}

.job { margin-bottom: 22px; }
.job-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; }
.job-head h3 { font-size: 17px; margin: 0; }
.job-head .dates { color: var(--muted); font-size: 14px; white-space: nowrap; }
.codename { font-family: monospace; color: var(--accent); font-weight: 700; }

.toast { position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 200ms ease, transform 200ms ease;
  z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Command palette */
.palette-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: none; align-items: flex-start; justify-content: center; padding-top: 14vh; z-index: 300; }
.palette-overlay.open { display: flex; }
.palette { width: min(520px, 92vw); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 24px 60px rgba(0,0,0,0.5); overflow: hidden; }
.palette input { width: 100%; background: transparent; border: 0; outline: 0;
  color: var(--text); font: inherit; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette li { padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.palette li.active { background: var(--accent); color: #0b1020; }
.palette li .hint { color: var(--muted); font-size: 12px; margin-left: 8px; }
.palette li.active .hint { color: rgba(11,16,32,0.7); }

footer.site { color: var(--muted); font-size: 13px; text-align: center;
  padding: 24px; border-top: 1px solid var(--border); margin-top: 32px; }
