:root {
  --bg: #0f172a;
  --text: #94a3b8;
  --bright: #e2e8f0;
  --accent: #fb923c;
  --accent-soft: rgba(251, 146, 60, 0.1);
  --line: rgba(148, 163, 184, 0.15);
  --card-hover: rgba(30, 41, 59, 0.5);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--bg); }
a { color: var(--bright); text-decoration: none; }
a:hover, a:focus-visible { color: var(--accent); }
.spotlight {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  transition: background 0.3s;
}
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 24px;
}
@media (min-width: 1024px) {
  .wrap { display: flex; gap: 64px; padding: 0 96px; }
  .side {
    position: sticky; top: 0; height: 100vh; width: 48%;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 96px 0;
  }
  main { width: 52%; padding: 96px 0; }
}

/* Left column */
.photo { width: 88px; height: 88px; border-radius: 50%; display: block; margin-bottom: 20px; border: 2px solid var(--line); }
h1 { color: var(--bright); font-size: 2.6rem; line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
.role { color: var(--bright); font-size: 1.2rem; margin: 12px 0 0; font-weight: 500; }
.tag { max-width: 320px; margin: 16px 0 0; }
nav.toc { display: none; margin-top: 56px; }
@media (min-width: 1024px) { nav.toc { display: block; } }
nav.toc a {
  display: flex; align-items: center; gap: 16px; padding: 10px 0;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text);
}
nav.toc a::before { content: ""; height: 1px; width: 32px; background: var(--text); transition: all 0.2s; }
nav.toc a:hover, nav.toc a.active { color: var(--bright); }
nav.toc a:hover::before, nav.toc a.active::before { width: 64px; background: var(--bright); }
.social { display: flex; gap: 20px; margin: 32px 0 0; padding: 0; list-style: none; }
.social a { color: var(--text); display: block; }
.social a:hover { color: var(--bright); }
.social svg { width: 24px; height: 24px; fill: currentColor; }

/* Sections */
section { margin-bottom: 96px; scroll-margin-top: 96px; }
.label {
  display: block; position: sticky; top: 0; z-index: 2; margin: 0 -24px 24px; padding: 18px 24px;
  background: rgba(15, 23, 42, 0.75); backdrop-filter: blur(8px);
  color: var(--bright); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
@media (min-width: 1024px) { .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
section p { margin: 0 0 16px; }
strong { color: var(--bright); font-weight: 500; }

/* Cards */
.cards { list-style: none; margin: 0; padding: 0; }
.card {
  position: relative; display: grid; gap: 8px; padding: 20px; margin: 0 -20px 16px; border-radius: 8px;
  transition: background 0.2s, box-shadow 0.2s;
}
@media (min-width: 640px) { .card { grid-template-columns: 1fr 3fr; gap: 24px; } }
.card:hover { background: var(--card-hover); box-shadow: inset 0 1px 0 0 rgba(148, 163, 184, 0.1); }
.cards:hover .card:not(:hover) { opacity: 0.5; }
.when { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; padding-top: 4px; }
.card h3 { margin: 0; color: var(--bright); font-size: 1rem; font-weight: 500; line-height: 1.4; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 8px; }
.card h3 .arrow { display: inline-block; transition: transform 0.2s; margin-left: 4px; }
.card:hover h3 a { color: var(--accent); }
.card:hover h3 .arrow { transform: translate(3px, -3px); }
.card p { margin: 8px 0 0; font-size: 0.9rem; }
.sub { color: var(--text); font-size: 0.9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.chips li {
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  padding: 4px 12px; font-size: 0.75rem; font-weight: 500; line-height: 1.4;
}
.more { display: inline-block; margin-top: 8px; font-weight: 600; color: var(--bright); }
footer { font-size: 0.85rem; max-width: 420px; }

/* Doc pages */
.doc { max-width: 760px; margin: 0 auto; padding: 64px 24px 96px; position: relative; z-index: 1; }
.doc .back { font-weight: 600; color: var(--accent); display: inline-block; margin-bottom: 32px; }
.doc h1 { font-size: 2.2rem; }
.doc .lede { color: var(--bright); font-size: 1.1rem; margin: 12px 0 32px; }
.doc h2 { color: var(--bright); font-size: 1.1rem; margin: 48px 0 12px; letter-spacing: 0.02em; }
.doc ol, .doc ul { padding-left: 20px; }
.doc li { margin-bottom: 8px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 8px 0; }
.doc th, .doc td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--bright); font-weight: 600; }
.doc code { color: var(--accent); font-size: 0.88em; }
.doc pre {
  background: rgba(30, 41, 59, 0.6); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px; overflow-x: auto; font-size: 0.85rem; color: var(--bright);
}
.tablewrap { overflow-x: auto; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Architecture map */
.wide { width: min(1180px, calc(100vw - 32px)); position: relative; left: 50%; transform: translateX(-50%); margin: 24px 0 8px; }
.am-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.am-lens, .am-flows { display: flex; flex-wrap: wrap; gap: 8px; }
.am-bar button, .am-nav button {
  font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; border-radius: 999px; padding: 6px 14px;
  background: transparent; color: var(--text); border: 1px solid var(--line);
}
.am-bar button:hover, .am-nav button:hover:not(:disabled) { color: var(--bright); border-color: var(--text); }
.am-bar button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.am-nav button:disabled { opacity: 0.35; cursor: default; }
.am-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .am-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.am-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: rgba(15, 23, 42, 0.6); }
.am-svg { display: block; min-width: 720px; width: 100%; height: auto; }
.am-band { fill: rgba(148, 163, 184, 0.035); }
.am-layer { fill: var(--text); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.am-edge { fill: none; stroke: rgba(148, 163, 184, 0.28); stroke-width: 1.4; transition: stroke 0.2s, opacity 0.2s; }
.am-edge.dashed { stroke-dasharray: 5 4; }
.am-edge.on { stroke: var(--accent); stroke-width: 2.2; }
.am-edge.dim { opacity: 0.12; }
.am-arrowhead { fill: rgba(148, 163, 184, 0.6); }
.am-node { cursor: pointer; outline: none; transition: opacity 0.2s; }
.am-node rect { fill: #1e293b; stroke: rgba(148, 163, 184, 0.35); stroke-width: 1.2; transition: stroke 0.2s, fill 0.2s; }
.am-node text { fill: var(--bright); font-size: 13px; font-weight: 500; pointer-events: none; }
.am-node.kind-ai rect { fill: rgba(251, 146, 60, 0.12); stroke: rgba(251, 146, 60, 0.6); }
.am-node.kind-store rect { fill: rgba(45, 212, 191, 0.08); stroke: rgba(45, 212, 191, 0.45); }
.am-node.kind-queue rect { fill: rgba(167, 139, 250, 0.1); stroke: rgba(167, 139, 250, 0.5); }
.am-node.kind-external rect { fill: transparent; stroke-dasharray: 4 3; }
.am-node.kind-gate rect { fill: rgba(250, 204, 21, 0.08); stroke: rgba(250, 204, 21, 0.5); }
.am-node:hover rect, .am-node:focus-visible rect { stroke: var(--bright); }
.am-node.sel rect { stroke: var(--accent); stroke-width: 2.5; }
.am-node.dim { opacity: 0.22; }
.am-panel {
  border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; background: rgba(30, 41, 59, 0.45);
  font-size: 0.9rem; min-height: 120px;
}
@media (min-width: 1000px) { .am-panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; } }
.am-panel h3 { margin: 0 0 6px; color: var(--bright); font-size: 1.05rem; }
.am-panel h4 { margin: 14px 0 4px; color: var(--accent); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; }
.am-panel p { margin: 0; }
.am-lenses { display: flex; gap: 6px; flex-wrap: wrap; }
.am-lenses span { font-size: 0.7rem; color: var(--bright); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.am-step { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.am-steptext { color: var(--bright); margin: 6px 0 10px !important; }
.am-nav { display: flex; gap: 8px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.am-hint { color: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 0.78rem; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid; }
.legend .l-svc::before { background: #1e293b; border-color: rgba(148, 163, 184, 0.5); }
.legend .l-ai::before { background: rgba(251, 146, 60, 0.2); border-color: #fb923c; }
.legend .l-store::before { background: rgba(45, 212, 191, 0.15); border-color: #2dd4bf; }
.legend .l-queue::before { background: rgba(167, 139, 250, 0.15); border-color: #a78bfa; }
.legend .l-gate::before { background: rgba(250, 204, 21, 0.12); border-color: #facc15; }
.legend .l-ext::before { border-style: dashed; border-color: rgba(148, 163, 184, 0.6); }
.lensgrid { display: grid; gap: 12px; margin: 8px 0 0; }
@media (min-width: 700px) { .lensgrid { grid-template-columns: repeat(3, 1fr); } }
.lensgrid div { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-size: 0.88rem; }
.lensgrid strong { display: block; color: var(--accent); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }

/* Project tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 8px 0 28px; }
.tabs [role="tab"] {
  font: inherit; font-size: 0.85rem; font-weight: 600; background: none; border: 0; cursor: pointer;
  color: var(--text); padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs [role="tab"]:hover { color: var(--bright); }
.tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
[role="tabpanel"] h2:first-child { margin-top: 0; }
.doc { max-width: 820px; }
.am-node rect.am-base, .am-node.kind-ai rect.am-base, .am-node.kind-store rect.am-base, .am-node.kind-queue rect.am-base,
.am-node.kind-external rect.am-base, .am-node.kind-gate rect.am-base { fill: #0f172a; stroke: none; stroke-dasharray: none; }
.am-swipe { display: none; font-size: 0.78rem; margin: -6px 0 0 !important; order: 2; }
@media (max-width: 760px) { .am-grid { display: flex; flex-direction: column; } .am-scroll { order: 1; } .am-panel { order: 3; } .am-swipe { display: block; } }

/* Project call to action */
.cta { display: inline-block; margin-top: 14px; color: var(--accent); font-weight: 600; font-size: 0.92rem; }
.cta .arrow { display: inline-block; transition: transform 0.2s; }
.card:hover .cta .arrow { transform: translateX(4px); }

/* Resume download */
.btn-resume {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; padding: 10px 18px;
  border: 1px solid var(--accent); border-radius: 8px; color: var(--accent); font-weight: 600; font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}
.btn-resume:hover, .btn-resume:focus-visible { background: var(--accent); color: var(--bg); }

/* Narrow-screen spacing */
@media (max-width: 1023px) {
  .side { margin-bottom: 56px; }
  .tag { max-width: 440px; }
  section { margin-bottom: 72px; }
  .label { padding: 12px 24px; margin-bottom: 12px; }
}
