/* One mid-tone "dim" theme: soft slate-blue background, panels a small step lighter,
   softened off-white text and a muted green accent. Low contrast on purpose: easy on
   the eyes without going grey. */
:root {
  color-scheme: dark;
  --bg: #161d27;
  --surface: #232e3b;
  --surface-2: #2a3646;
  --text: #c8d2dc;
  --muted: #91a1b2;
  --border: #33414f;
  --accent: #5cc09c;
  --accent-soft: rgba(92, 192, 156, .14);
  --accent-contrast: #12201b;
  --warn: #dcb04a;
  --dot: rgba(210, 219, 229, .05);
  --radius: 12px;
  --max: 66rem;
  --shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 10px 28px rgba(0, 0, 0, .10);
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Code/terminal windows (the 404 page) */
  --code-bg: #1a232e;
  --code-bar: #202a37;
  --code-border: #33414f;
  --code-text: #c9d3de;

  /* Home page terminal background: muted so it reads as texture behind the content */
  --term-bg: #141b24;
  --term-fg: rgba(210, 219, 229, .26);
  --term-cmd: rgba(210, 219, 229, .45);
  --term-dim: rgba(154, 170, 187, .30);
  --term-prompt: rgba(92, 192, 156, .52);
  --term-ok: rgba(92, 192, 156, .45);
  --term-warn: rgba(220, 176, 74, .45);
  --glass: rgba(35, 46, 59, .82);

  /* Home Lab data center background */
  --dc-grid: rgba(92, 192, 156, .07);
  --dc-wall: #131a23;
  --dc-rack: #222d3a;
  --dc-edge: rgba(92, 192, 156, .16);
  --dc-unit: rgba(210, 219, 229, .06);
  --dc-tray: #25303e;
  --dc-light: rgba(225, 236, 245, .26);
  --dc-led-g: #5cc09c;
  --dc-led-a: #dcb04a;
  --dc-led-b: #74b4f0;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* Faint dot grid behind the top of every page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 70%);
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
}

a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; display: block; }
code, .mono { font-family: var(--mono); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--surface); padding: .5rem 1rem; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4rem;
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.brand .prompt { color: var(--accent); margin-right: .35rem; }

.cursor {
  display: inline-block;
  width: .55em;
  height: 1.05em;
  margin-left: .15em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav { display: flex; align-items: center; gap: .15rem; }
.nav a {
  padding: .35rem .7rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 500;
  font-size: .88rem;
  transition: color .15s, background-color .15s;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }


/* ---------- Type & layout ---------- */

main { flex: 1; }

h1, h2, h3 { font-family: var(--mono); }
h1 { font-size: clamp(2.1rem, 6vw, 3.5rem); line-height: 1.1; letter-spacing: -.035em; margin: 0 0 1rem; font-weight: 700; }
h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); letter-spacing: -.02em; margin: 0 0 1.25rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 0 0 .35rem; font-weight: 600; letter-spacing: -.01em; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 40rem; margin: 0; }

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: .85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: .9rem;
}
.eyebrow .p { color: var(--accent); }

.page-head { padding: 4.5rem 0 1.5rem; }

section.block { padding: 2.5rem 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-head a { font-family: var(--mono); font-size: .9rem; font-weight: 500; text-decoration: none; }
h2 .hash { color: var(--accent); margin-right: .4rem; }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: center;
  padding: 4.5rem 0 2.5rem;
}
@media (min-width: 56rem) {
  .hero { grid-template-columns: 1fr 1.05fr; }
}
.hero .role {
  font-family: var(--mono);
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: var(--accent);
  margin: -.25rem 0 1.25rem;
  font-weight: 500;
}
.hero .lede { margin-bottom: 2rem; }

.status {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .3rem .8rem;
  margin-bottom: 1.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted);
}
.status .dot { width: .5rem; height: .5rem; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* ---------- Terminal window (404 page) ---------- */

.terminal {
  min-width: 0;
  border-radius: 12px;
  border: 1px solid var(--code-border);
  background: var(--code-bg);
  color: var(--code-text);
  font: 500 .84rem/1.7 var(--mono);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .45);
  overflow: hidden;
}
.terminal .bar {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .65rem .9rem;
  background: var(--code-bar);
  border-bottom: 1px solid var(--code-border);
  color: var(--muted);
  font-size: .75rem;
}
.terminal .bar i { width: .7rem; height: .7rem; border-radius: 50%; background: #3a4440; }
.terminal .bar i:nth-child(1) { background: #f87171; }
.terminal .bar i:nth-child(2) { background: var(--warn); }
.terminal .bar i:nth-child(3) { background: var(--accent); }
.terminal .bar span { margin-left: .5rem; }
.t-body { padding: 1rem 1.15rem 1.2rem; overflow-x: auto; }
.t-body > div { white-space: pre; min-height: 1.7em; }
.t-p { color: var(--accent); }
.t-c { color: var(--text); }
.t-d { color: var(--muted); }
.t-ok { color: var(--accent); }
.t-w { color: var(--warn); }
.t-body .cursor { background: var(--accent); }

/* The live terminal keeps a fixed height and scrolls as it prints */
.terminal[data-live] .t-body { height: 26rem; overflow: auto; scrollbar-width: none; }
.terminal[data-live] .t-body::-webkit-scrollbar { display: none; }
.terminal[data-live] .t-body > div { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Full-screen backgrounds (home: terminal, home lab: data center) ---------- */

body.has-bg::before { display: none; } /* the background replaces the dot grid */

.terminal.terminal-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--term-bg);
  color: var(--term-fg);
  font-size: .9rem;
  pointer-events: none;
  transition: background-color .25s;
}
.terminal.terminal-bg[data-live] .t-body {
  height: 100%;
  padding: 5.5rem clamp(1rem, 5vw, 4rem) 2rem;
  overflow: hidden;
}
.terminal-bg .t-p { color: var(--term-prompt); }
.terminal-bg .t-c { color: var(--term-cmd); }
.terminal-bg .t-d { color: var(--term-dim); }
.terminal-bg .t-ok { color: var(--term-ok); }
.terminal-bg .t-w { color: var(--term-warn); }
.terminal-bg .t-body .cursor { background: var(--term-prompt); }

/* Data center aisle behind the Home Lab page, drawn by site.js (drawDatacenter) */
.dc-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  /* The static scene is set as background-image by site.js; "cover" + centre matches the
     live LED layer's preserveAspectRatio="xMidYMid slice" so the two line up. */
  background-color: var(--term-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}
.dc-bg svg { display: block; width: 100%; height: 100%; }
.dc-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, var(--term-bg), transparent 18%, transparent 78%, var(--term-bg)),
    radial-gradient(ellipse at 50% 45%, transparent 40%, var(--term-bg) 105%);
}
/* Live layer: only the blinking LEDs */
.led-g { fill: var(--dc-led-g); }
.led-a { fill: var(--dc-led-a); }
.led-b { fill: var(--dc-led-b); }
.led.blink { animation: led-blink 1.6s steps(1) infinite; }
.dc-bg.paused .led { animation-play-state: paused; }
@keyframes led-blink { 50% { opacity: .12; } }

/* Content floats over the background on translucent "glass" panels */
.hero-panel {
  padding: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 18px;
}
.hero-panel .socials { margin-top: 1.75rem; }
/* The intro panel spans the same width as the section panels below it */
body.home .hero { grid-template-columns: 1fr; padding-bottom: 0; }

/* Each section (and the Home Lab page heading) sits on its own glass panel,
   so no text lands directly on the background */
body.has-bg main > section.block,
body.has-bg main > .page-head {
  margin: 1.5rem 0;
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: 18px;
}
body.has-bg main > .page-head { margin-top: 3rem; }
body.has-bg .hero-panel,
body.has-bg main > section.block,
body.has-bg main > .page-head,
body.has-bg .cta,
body.has-bg .site-footer {
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
}
body.has-bg .site-footer { border-top-color: var(--border); }

/* ---------- Buttons & socials ---------- */

.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

.button {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.2rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-contrast);
  border: 1px solid var(--accent);
  text-decoration: none;
  font-family: var(--mono);
  font-size: .9rem;
  font-weight: 600;
  transition: transform .15s, filter .15s;
}
.button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.button.ghost:hover { border-color: var(--accent); }

.socials { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.socials a {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  transition: color .15s, border-color .15s, transform .15s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.socials svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }

/* ---------- Cards ---------- */

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); }

.card {
  position: relative;
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color .2s, transform .2s;
}
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--accent); transform: translateY(-3px); }
.card p { margin: 0; color: var(--muted); font-size: .97rem; }
.card-icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.card-icon svg { width: 1.3rem; height: 1.3rem; fill: currentColor; }
.card .arrow { position: absolute; top: 1.3rem; right: 1.3rem; color: var(--muted); font-family: var(--mono); transition: transform .2s, color .2s; }
a.card:hover .arrow { color: var(--accent); transform: translate(2px, -2px); }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 0; padding: 0; }
.tags li {
  font-family: var(--mono);
  font-size: .74rem;
  font-weight: 500;
  padding: .12rem .5rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- About ---------- */

.prose { max-width: 42rem; }
.prose p { margin: 0 0 1.1rem; font-size: 1.08rem; }

/* Career path styled as a traceroute: each job is a hop */
.trace-cmd { font-family: var(--mono); font-size: .85rem; color: var(--muted); margin: -.5rem 0 1.5rem; }
.trace-cmd .p { color: var(--accent); }
.hops { list-style: none; margin: 0 0 0 .8rem; padding: 0; border-left: 2px dashed var(--border); }
.hops li { position: relative; padding: 0 0 2rem 2rem; }
.hops li:last-child { padding-bottom: 0; }
.hops .hop {
  position: absolute;
  left: -.85rem;
  top: 0;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 6px;
  background: var(--bg);
  border: 2px solid var(--accent);
  color: var(--accent);
  font: 700 .75rem var(--mono);
}
.hops li.here .hop { background: var(--accent); color: var(--accent-contrast); }
.hops .when { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.hops p { margin: .25rem 0 0; color: var(--muted); }
.more-link { margin: 2rem 0 0; font-family: var(--mono); font-size: .9rem; font-weight: 500; }
.more-link a { text-decoration: none; }
.more-link a:hover { text-decoration: underline; }

/* "How I work": two columns of numbered principles */
.principles { grid-template-columns: repeat(auto-fill, minmax(min(24rem, 100%), 1fr)); }
.principles .num { display: block; margin-bottom: .6rem; font: 700 .8rem var(--mono); color: var(--accent); letter-spacing: .08em; }

.skill-groups { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); }
.skill-groups .tags { margin-top: .75rem; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .6rem; margin: 0; padding: 0; }
.chips li {
  padding: .45rem .95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 500;
}

/* ---------- Lab ---------- */

.topology {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.topology svg { width: 100%; height: auto; display: block; }
.topology .link { stroke: var(--muted); stroke-width: 1.5; opacity: .5; }
.topology .flow { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 10; animation: flow 1.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -14; } }
.topology .node rect { fill: var(--surface-2); stroke: var(--accent); stroke-width: 1.5; }
.topology .node.edge rect { stroke-dasharray: 4 3; }
.topology text { fill: var(--text); font: 600 13px var(--mono); }
.topology .sub { fill: var(--muted); font-weight: 400; font-size: 11px; }
.topology figcaption { margin-top: .75rem; font-family: var(--mono); font-size: .8rem; color: var(--muted); }
/* SAN / iSCSI links are drawn in amber to tell them apart from LAN */
.topology .link.san { stroke: var(--warn); }
.topology .flow.san { stroke: var(--warn); }
.topology .key-lan { color: var(--accent); }
.topology .key-san { color: var(--warn); }

.gear-item { display: flex; gap: 1rem; align-items: center; }
.gear-item .thumb {
  flex: none;
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 .8rem var(--mono);
  letter-spacing: .04em;
}
.gear-item .kind { font-family: var(--mono); font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.gear-item h3 { margin: 0; font-family: var(--sans); font-size: 1.02rem; }

/* ---------- CTA ---------- */

.cta {
  margin: 2rem 0 4rem;
  padding: 2.5rem 1.5rem;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}
.cta h2 { margin-bottom: .5rem; }
.cta p { color: var(--muted); margin: 0 0 1.5rem; }
.cta .actions { justify-content: center; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; }
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1.75rem;
  padding-bottom: 2rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .8rem;
}
.site-footer p { margin: 0; }
.site-footer .socials a { width: 2.2rem; height: 2.2rem; }
.site-footer .socials svg { width: 1rem; height: 1rem; }

/* ---------- Phones ---------- */

@media (max-width: 34rem) {
  .site-header .wrap { flex-wrap: wrap; height: auto; padding-top: .75rem; padding-bottom: .75rem; row-gap: .5rem; }
  .nav { width: 100%; justify-content: space-between; }
  .nav a { padding: .3rem .5rem; font-size: .82rem; white-space: nowrap; }
  .hero { padding-top: 2.5rem; }
  .terminal { font-size: .74rem; }
  .terminal[data-live] .t-body { height: 21rem; }
  .terminal.terminal-bg { font-size: .72rem; }
  .terminal.terminal-bg[data-live] .t-body { padding-top: 7rem; }
  .hero-panel { padding: 1.5rem; }
}

/* Very narrow phones: tighten the nav so "Home Lab" stays on one line */
@media (max-width: 24rem) {
  .nav a { padding: .3rem .35rem; font-size: .78rem; }
}

/* ---------- Reveal-on-scroll ---------- */

.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
