/* ============================================================
   "Signal path" — the story drawn as a circuit.
   ============================================================ */
:root {
  --bg: #08090b;
  --bg-2: #0f1114;
  --text: #eceae6;
  --muted: #8d9199;
  --dim: #2b2f36;
  --current: #f5b545;          /* the "live" amber */
  --current-hot: #ffe2a3;
  --glow: rgba(245, 181, 69, .45);
  --sym: 64px;                 /* symbol column width */
  --sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.06rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  /* faint engineering-paper grid */
  background-image:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 32px 32px;
}
a { color: inherit; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--current); outline-offset: 4px; border-radius: 6px; }
::selection { background: var(--current); color: #1a1205; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px clamp(16px, 4vw, 40px);
  background: linear-gradient(var(--bg) 40%, transparent);
  font-family: var(--mono); font-size: .85rem;
}
.brand { text-decoration: none; font-weight: 600; }
.brand span { color: var(--current); }
.topbar nav { display: flex; gap: 22px; }
.topbar nav a { color: var(--muted); text-decoration: none; }
.topbar nav a:hover { color: var(--current); }

main { width: min(760px, 100% - 32px); margin: 0 auto; }

/* ---------- hero ---------- */
.hero { min-height: 92vh; display: flex; flex-direction: column; justify-content: center; padding: 110px 0 40px; }
.portrait {
  width: 132px; height: 132px; border-radius: 50%; overflow: hidden; margin-bottom: 28px;
  border: 1px solid var(--dim);
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--dim);
  transition: box-shadow .6s ease, border-color .6s ease;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; display: block; }
.powered .portrait { border-color: var(--current); box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--current), 0 0 40px var(--glow); }

.kicker { color: var(--muted); font-size: .8rem; letter-spacing: .02em; margin: 0 0 10px; }
h1 { font-size: clamp(2.8rem, 9vw, 5.2rem); line-height: 1; letter-spacing: -.045em; margin: 0 0 22px; font-weight: 700; }
.intro { font-size: clamp(1.1rem, 2.6vw, 1.35rem); color: var(--muted); max-width: 34ch; margin: 0 0 40px; line-height: 1.5; }

/* power switch */
.power { display: inline-flex; align-items: center; gap: 14px; background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; font: inherit; align-self: flex-start; }
.power-track { width: 58px; height: 30px; border-radius: 999px; border: 1px solid var(--dim); background: var(--bg-2); position: relative; transition: background .3s ease, border-color .3s ease, box-shadow .3s ease; }
.power-knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .35s cubic-bezier(.5,1.6,.4,1), background .3s ease; }
.power-label { font-size: .82rem; color: var(--muted); }
.power-label .on { display: none; color: var(--current); }
.powered .power-track { background: rgba(245,181,69,.14); border-color: var(--current); box-shadow: 0 0 22px var(--glow); }
.powered .power-knob { transform: translateX(28px); background: var(--current-hot); }
.powered .power-label .off { display: none; }
.powered .power-label .on { display: inline; }
.power:hover .power-track { border-color: var(--current); }
.skip-to-work { margin-top: 18px; align-self: flex-start; font-size: .8rem; color: var(--muted); text-decoration: none; border-bottom: 1px dashed var(--dim); transition: color .2s ease, border-color .2s ease; }
.skip-to-work:hover { color: var(--current); border-color: var(--current); }
#output { scroll-margin-top: 40px; }

/* ---------- the circuit ---------- */
.story { position: relative; padding: 40px 0 20px; --flow: 0px; }
.wire { position: absolute; top: 0; bottom: 120px; left: calc(var(--sym) / 2 - 1px); width: 2px; background: var(--dim); }
.wire-fill {
  position: absolute; top: 0; left: 0; width: 100%; height: var(--flow);
  background: linear-gradient(var(--current), var(--current-hot));
  box-shadow: 0 0 10px var(--glow), 0 0 24px var(--glow);
  opacity: 0; transition: opacity .5s ease;
}
.wire-head {
  position: absolute; left: 50%; top: var(--flow); width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 8px #fff, 0 0 18px var(--current), 0 0 36px var(--current);
  opacity: 0; transition: opacity .5s ease;
}
.powered .wire-fill, .powered .wire-head { opacity: 1; }

.node { display: grid; grid-template-columns: var(--sym) minmax(0, 1fr); gap: clamp(16px, 4vw, 36px); padding: 9vh 0; position: relative; }
.symbol {
  width: var(--sym); height: var(--sym); position: relative; z-index: 1;
  display: grid; place-items: center; background: var(--bg);
  border-radius: 14px; border: 1px solid var(--dim);
  transition: border-color .4s ease, box-shadow .4s ease;
}
.symbol svg { width: 72%; height: 72%; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: stroke .4s ease, filter .4s ease; }
.symbol .tiny { stroke-width: 1.5; }

.copy { opacity: .72; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.ref { color: var(--muted); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; margin: 6px 0 6px; transition: color .4s ease; }
h2 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.1; letter-spacing: -.035em; margin: 0 0 18px; font-weight: 700; }
.copy > p { color: #c5c4c0; margin: 0 0 14px; max-width: 58ch; }

/* lit state (also the default when JS is off) */
.node.lit .symbol, html:not(.js) .symbol { border-color: var(--current); box-shadow: 0 0 0 4px var(--bg), 0 0 28px var(--glow); }
.node.lit .symbol svg, html:not(.js) .symbol svg { stroke: var(--current-hot); filter: drop-shadow(0 0 4px var(--current)); }
.node.lit .copy, html:not(.js) .copy { opacity: 1; transform: none; }
.node.lit .ref, html:not(.js) .ref { color: var(--current); }
.led.lit-hot { animation: led 2.4s ease-in-out infinite; }
@keyframes led { 50% { box-shadow: 0 0 0 4px var(--bg), 0 0 48px var(--current); } }

/* text you still need to write yourself */
.fill {
  color: var(--current-hot); background: rgba(245,181,69,.08);
  border-bottom: 1px dashed var(--current); padding: 1px 4px; border-radius: 3px; font-style: italic;
}

/* ---------- output: probe points ---------- */
.probes { display: grid; gap: 14px; margin-top: 26px; }
.probe {
  position: relative; padding: 20px 22px; border: 1px solid var(--dim); border-radius: 14px;
  background: linear-gradient(140deg, var(--bg-2), rgba(15,17,20,.4));
  transition: border-color .3s ease, transform .3s ease;
}
.probe:hover { border-color: var(--current); transform: translateX(4px); }
.tp { color: var(--current); font-size: .72rem; margin: 0 0 4px; }
.probe h3 { margin: 0 0 6px; font-size: 1.2rem; letter-spacing: -.02em; }
.probe p:not(.tp) { margin: 0; color: var(--muted); font-size: .97rem; }
.probe-link { display: inline-block; margin-top: 10px; font-size: .8rem; color: var(--current); text-decoration: none; }
.probe-link:hover { text-decoration: underline; }

/* ---------- ground: contact ---------- */
.say-hello {
  display: inline-block; margin: 14px 0 22px; font-size: clamp(1.25rem, 4.4vw, 2rem); font-weight: 700; letter-spacing: -.03em;
  text-decoration: none; border-bottom: 2px solid var(--current); overflow-wrap: anywhere; transition: color .2s ease, text-shadow .2s ease;
}
.say-hello:hover { color: var(--current-hot); text-shadow: 0 0 18px var(--glow); }
.links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 26px; font-size: .85rem; }
.links a { color: var(--muted); text-decoration: none; }
.links a:hover { color: var(--current); }

footer { text-align: center; color: var(--muted); font-size: .72rem; padding: 60px 16px 40px; opacity: .7; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  :root { --sym: 46px; }
  .portrait { width: 104px; height: 104px; }
  body { font-size: 1rem; }
  .symbol { border-radius: 11px; }
  .node { padding: 7vh 0; }
  .probe { padding: 16px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- the Hanoi rain quote ---------- */
.rain {
  margin: 22px 0 6px; padding: 4px 0 4px 20px;
  border-left: 2px solid var(--current);
  max-width: 52ch;
}
.rain p { margin: 0; font-size: 1.12rem; line-height: 1.55; color: var(--text); font-style: italic; }

/* ---------- story photos ---------- */
.photo { margin: 28px 0 24px; max-width: 340px; }
.photo img {
  display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--dim);
  filter: grayscale(.85) brightness(.7); transition: filter 1.2s ease, border-color .6s ease;
}
.photo .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo .pair img { aspect-ratio: 4 / 5; object-fit: cover; }
.node.lit .photo img, html:not(.js) .photo img { filter: none; border-color: color-mix(in srgb, var(--current) 35%, var(--dim)); }
.photo figcaption { margin-top: 10px; font-size: .76rem; color: var(--muted); }

/* ---------- photos inside project cards ---------- */
.probe-photos { margin: 16px 0 4px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 340px)); gap: 10px; }
.probe-photos img {
  display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--dim);
  filter: grayscale(.85) brightness(.7); transition: filter 1.2s ease;
}
.node.lit .probe-photos img, html:not(.js) .probe-photos img { filter: none; }
.probe-photos figcaption { grid-column: 1 / -1; font-size: .74rem; color: var(--muted); }
