/* ==========================================================================
   Luchhen Lama — Portfolio
   Design system: "infra-ops console"
   Author: hand-written, no framework, no build step.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Fonts — self-hosted variable subsets, no third-party CDN
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Surfaces — near-black with a cool cast */
  --bg:            #07090D;
  --bg-alt:        #0A0D13;
  --surface:       #0E1219;
  --surface-2:     #141922;
  --surface-3:     #1A202B;

  /* Lines */
  --line:          #1E242F;
  --line-strong:   #2A3240;

  /* Text */
  --fg:            #E8ECF3;
  --fg-muted:      #99A3B5;
  --fg-dim:        #6B7688;

  /* Accents */
  --acc:           #38E0A5;   /* signal green — primary */
  --acc-2:         #55C7F2;   /* link blue */
  --acc-3:         #A78BFA;   /* violet, tertiary */
  --warn:          #F5A524;
  --acc-soft:      rgba(56, 224, 165, 0.12);
  --acc-line:      rgba(56, 224, 165, 0.30);

  /* Type */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Metrics */
  --nav-h: 66px;
  --maxw: 1180px;
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 12px 32px -12px rgba(0,0,0,.7);
  --shadow-3: 0 30px 70px -25px rgba(0,0,0,.85);

  --ease: cubic-bezier(.22,.61,.36,1);
}

/* Light theme — an actual second design, not an inversion hack */
[data-theme="light"] {
  color-scheme: light;
  --bg:            #FBFBF9;
  --bg-alt:        #F3F4F1;
  --surface:       #FFFFFF;
  --surface-2:     #F6F7F5;
  --surface-3:     #EDEFEC;
  --line:          #E2E5E0;
  --line-strong:   #CFD4CC;
  --fg:            #12161C;
  --fg-muted:      #545E6E;
  --fg-dim:        #7A8494;
  --acc:           #07845C;
  --acc-2:         #0B6FA8;
  --acc-3:         #6D4AC7;
  --warn:          #A96A00;
  --acc-soft:      rgba(7, 132, 92, 0.10);
  --acc-line:      rgba(7, 132, 92, 0.26);
  --shadow-2: 0 12px 30px -14px rgba(20,30,40,.22);
  --shadow-3: 0 26px 60px -26px rgba(20,30,40,.28);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  font-feature-settings: "cv11", "ss01";
}

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
ul, ol { list-style: none; padding: 0; }

::selection { background: var(--acc); color: #04120C; }

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; top: -60px; left: 16px; z-index: 200;
  background: var(--acc); color: #04120C; padding: 10px 18px;
  border-radius: 0 0 10px 10px; font-weight: 600; font-size: 14px;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 0; }

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }

section { position: relative; }
.section { padding-block: clamp(72px, 9vw, 118px); }
.section--alt { background: var(--bg-alt); }
.section + .section--alt, .section--alt + .section { border-top: 1px solid var(--line); }

.grid { display: grid; gap: 20px; }
@media (min-width: 720px)  { .g-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .g-3 { grid-template-columns: repeat(3, 1fr); } }

/* --------------------------------------------------------------------------
   4. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 { line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--acc); margin-bottom: 16px;
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: var(--acc); opacity: .7;
}

.section-head { max-width: 660px; margin-bottom: clamp(36px, 5vw, 56px); }
.section-head h2 { font-size: clamp(28px, 4.2vw, 42px); margin-bottom: 14px; }
.section-head p { color: var(--fg-muted); font-size: clamp(15px, 1.6vw, 17px); }

.mono { font-family: var(--font-mono); }
.dim  { color: var(--fg-muted); }

/* --------------------------------------------------------------------------
   5. Buttons & chips
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 22px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em;
  cursor: pointer; white-space: nowrap;
  transition: transform .18s var(--ease), background .18s var(--ease),
              border-color .18s var(--ease), box-shadow .18s var(--ease), color .18s var(--ease);
}
.btn:hover  { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 17px; height: 17px; flex: none; }

.btn--primary {
  background: var(--acc); color: #04120C;
  box-shadow: 0 8px 22px -10px var(--acc);
}
.btn--primary:hover { box-shadow: 0 14px 30px -10px var(--acc); }

.btn--ghost {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border-color: var(--line-strong); color: var(--fg);
}
.btn--ghost:hover { border-color: var(--acc-line); background: var(--surface-2); color: var(--acc); }

.btn--sm { padding: 9px 15px; font-size: 13px; border-radius: 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .02em;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--fg-muted);
}
.chip--live { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }

.pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--acc); flex: none;
  box-shadow: 0 0 0 0 var(--acc); animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--acc) 60%, transparent); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* --------------------------------------------------------------------------
   6. Navigation
   -------------------------------------------------------------------------- */
.progress {
  position: fixed; inset: 0 auto auto 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--acc), var(--acc-2));
  z-index: 120; transition: width .1s linear;
}

.nav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 100;
  display: flex; align-items: center;
  border-bottom: 1px solid transparent;
  transition: background .3s var(--ease), border-color .3s var(--ease), backdrop-filter .3s;
}
.nav.is-stuck {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom-color: var(--line);
}
.nav__inner {
  width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px;
  display: flex; align-items: center; gap: 18px;
}

.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: -0.02em; }
.brand__mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(140deg, var(--acc), var(--acc-2));
  color: #04120C; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
}
.brand__txt { font-size: 15px; }
.brand__txt span { color: var(--fg-dim); font-weight: 500; }

.nav__links { display: none; gap: 4px; margin-left: auto; }
@media (min-width: 980px) { .nav__links { display: flex; } }
.nav__links a {
  padding: 8px 13px; border-radius: 8px; font-size: 14px; color: var(--fg-muted);
  transition: color .18s, background .18s; position: relative;
}
.nav__links a:hover { color: var(--fg); background: var(--surface-2); }
.nav__links a.is-active { color: var(--acc); }
.nav__links a.is-active::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 2px;
  height: 1.5px; background: var(--acc); border-radius: 2px;
}

.nav__tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
@media (min-width: 980px) { .nav__tools { margin-left: 14px; } }

.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); cursor: pointer;
  color: var(--fg-muted); transition: all .18s var(--ease);
}
.icon-btn:hover { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }
.icon-btn svg { width: 17px; height: 17px; }

.kbd-btn {
  display: none; align-items: center; gap: 9px; height: 36px; padding: 0 12px;
  border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--fg-dim); font-size: 13px; cursor: pointer; transition: all .18s var(--ease);
}
@media (min-width: 760px) { .kbd-btn { display: flex; } }
.kbd-btn:hover { border-color: var(--acc-line); color: var(--fg); }
.kbd-btn svg { width: 16px; height: 16px; flex: none; }
kbd {
  font-family: var(--font-mono); font-size: 10.5px; padding: 2px 6px; border-radius: 5px;
  background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--fg-muted);
  line-height: 1.5;
}

/* Mobile drawer */
.burger { display: grid; }
@media (min-width: 980px) { .burger { display: none; } }
.drawer {
  position: fixed; inset: var(--nav-h) 0 0 0; z-index: 99;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  padding: 26px 24px; display: flex; flex-direction: column; gap: 4px;
  transform: translateY(-8px); opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.drawer.is-open { opacity: 1; transform: none; pointer-events: auto; }
.drawer a {
  padding: 14px 8px; border-bottom: 1px solid var(--line);
  font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 14px;
}
.drawer a span { font-family: var(--font-mono); font-size: 12px; color: var(--acc); opacity: .7; }

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative; min-height: 100svh; display: flex; align-items: center;
  padding-top: calc(var(--nav-h) + 40px); padding-bottom: 70px; overflow: hidden;
}
#net-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0;
  opacity: .85; pointer-events: none;
}
[data-theme="light"] #net-canvas { opacity: .5; }
.hero__veil {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(900px 620px at 78% 22%, color-mix(in srgb, var(--acc) 9%, transparent), transparent 70%),
    radial-gradient(700px 500px at 12% 78%, color-mix(in srgb, var(--acc-2) 7%, transparent), transparent 70%),
    linear-gradient(to bottom, transparent 55%, var(--bg) 99%);
}
.hero__grid {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 62px 62px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 20%, transparent 78%);
}
.hero .wrap { position: relative; z-index: 2; }

.hero__layout { display: grid; gap: clamp(40px, 6vw, 64px); align-items: center; }
@media (min-width: 1000px) { .hero__layout { grid-template-columns: 1.08fr .92fr; } }

.hero h1 {
  font-size: clamp(37px, 5.6vw, 58px); letter-spacing: -0.035em; margin-bottom: 10px;
  text-wrap: balance; max-width: 16ch;
}
.hero h1 .grad {
  background: linear-gradient(100deg, var(--fg) 8%, var(--acc) 58%, var(--acc-2) 96%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__role {
  font-family: var(--font-mono); font-size: clamp(15px, 2.1vw, 20px); font-weight: 500;
  color: var(--acc-2); min-height: 1.6em; margin-bottom: 20px; letter-spacing: -0.01em;
}
.hero__role .caret {
  display: inline-block; width: 9px; height: 1.05em; vertical-align: -0.16em;
  background: var(--acc); margin-left: 3px; animation: blink 1.05s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero__lede {
  font-size: clamp(15.5px, 1.9vw, 18px); color: var(--fg-muted);
  max-width: 54ch; margin-bottom: 30px;
}
.hero__lede strong { color: var(--fg); font-weight: 600; }

.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 32px; }

.hero__meta { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 13.5px; color: var(--fg-dim); }
.hero__meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero__meta svg { width: 15px; height: 15px; color: var(--acc); }

/* Terminal-window photo frame */
.termcard {
  border-radius: var(--r); overflow: hidden; background: var(--surface);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-3);
  transform: perspective(1400px) rotateY(-5deg) rotateX(2deg);
  transition: transform .6s var(--ease);
}
.termcard:hover { transform: perspective(1400px) rotateY(0deg) rotateX(0deg); }
@media (max-width: 999px) { .termcard { transform: none; } }

.termcard__bar {
  display: flex; align-items: center; gap: 8px; padding: 11px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.termcard__dots { display: flex; gap: 6px; }
.termcard__dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.termcard__dots i:nth-child(1) { background: #FF5F57; }
.termcard__dots i:nth-child(2) { background: #FEBC2E; }
.termcard__dots i:nth-child(3) { background: #28C840; }
.termcard__title {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-dim);
  margin-inline: auto; padding-right: 30px;
}
.termcard__img { position: relative; }
.termcard__img img { width: 100%; aspect-ratio: 3/2; object-fit: cover; }
.termcard__img::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to top, color-mix(in srgb, var(--surface) 92%, transparent) 0%, transparent 46%),
    repeating-linear-gradient(to bottom, rgba(0,0,0,.14) 0 1px, transparent 1px 3px);
  mix-blend-mode: normal;
}
[data-theme="light"] .termcard__img::after {
  background: linear-gradient(to top, color-mix(in srgb, var(--surface) 88%, transparent) 0%, transparent 50%);
}
.termcard__foot {
  padding: 13px 16px 15px; font-family: var(--font-mono); font-size: 11.5px;
  color: var(--fg-dim); border-top: 1px solid var(--line); background: var(--surface);
  display: flex; flex-wrap: wrap; gap: 6px 16px;
}
.termcard__foot b { color: var(--acc); font-weight: 500; }

/* --------------------------------------------------------------------------
   8. Stats strip
   -------------------------------------------------------------------------- */
.stats {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
}
.stats__row {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 1px; background: var(--line);
}
@media (min-width: 800px) { .stats__row { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--bg-alt); padding: 30px 22px; text-align: center; }
.stat__n {
  font-family: var(--font-mono); font-size: clamp(28px, 4vw, 40px); font-weight: 700;
  color: var(--acc); letter-spacing: -0.03em; line-height: 1.1;
}
.stat__n sup { font-size: .48em; vertical-align: super; opacity: .8; }
.stat__l {
  font-size: 12.5px; color: var(--fg-dim); margin-top: 7px;
  letter-spacing: .08em; text-transform: uppercase; font-weight: 500;
}

/* --------------------------------------------------------------------------
   9. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 26px; position: relative; transition: border-color .25s var(--ease),
    transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}
.card:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: var(--shadow-2); }

.card__icon {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  background: var(--acc-soft); border: 1px solid var(--acc-line); color: var(--acc);
  margin-bottom: 16px;
}
.card__icon svg { width: 20px; height: 20px; }
.card h3 { font-size: 17.5px; margin-bottom: 8px; }
.card p  { color: var(--fg-muted); font-size: 14.5px; }

/* Info tiles (contact details in About) */
.tile {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color .2s, background .2s;
}
.tile:hover { border-color: var(--acc-line); background: var(--surface-2); }
.tile__ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--acc-soft); color: var(--acc); flex: none; }
.tile__ic svg { width: 18px; height: 18px; }
.tile__k {
  display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .11em;
  text-transform: uppercase; color: var(--fg-dim); margin-bottom: 2px;
}
.tile__v { display: block; font-size: 14.5px; font-weight: 600; word-break: break-word; line-height: 1.4; }
a.tile:hover .tile__v { color: var(--acc); }

/* --------------------------------------------------------------------------
   10. About
   -------------------------------------------------------------------------- */
.about__layout { display: grid; gap: clamp(32px, 5vw, 56px); }
@media (min-width: 900px) { .about__layout { grid-template-columns: 1.25fr .75fr; } }
.about__body p { color: var(--fg-muted); font-size: 16.5px; margin-bottom: 18px; }
.about__body p strong { color: var(--fg); font-weight: 600; }

.callout {
  border-left: 2px solid var(--acc); padding: 4px 0 4px 20px; margin: 26px 0;
  font-family: var(--font-mono); font-size: 14px; color: var(--fg-muted); line-height: 1.75;
}
.callout b { color: var(--acc); font-weight: 500; }

/* --------------------------------------------------------------------------
   11. Interactive infra diagram
   -------------------------------------------------------------------------- */
.diagram-shell {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-2);
}
.diagram-shell__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-dim);
  flex-wrap: wrap;
}
.diagram-shell__bar b { color: var(--acc); font-weight: 500; }
.diagram-body { display: grid; }
@media (min-width: 940px) { .diagram-body { grid-template-columns: 1fr 300px; } }

.diagram-canvas { padding: 22px 18px; overflow-x: auto; }
.diagram-canvas svg { width: 100%; min-width: 620px; height: auto; }
.diagram-swipe {
  display: none; font-family: var(--font-mono); font-size: 11px; color: var(--acc);
  padding: 0 18px 10px;
}
@media (max-width: 780px) { .diagram-swipe { display: block; } }

.node { cursor: pointer; }
.node rect, .node circle {
  transition: fill .22s var(--ease), stroke .22s var(--ease), filter .22s var(--ease);
}
.node .n-box { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1.2; }
.node .n-label { fill: var(--fg); font: 600 12.5px var(--font-sans); }
.node .n-sub   { fill: var(--fg-dim); font: 400 10.5px var(--font-mono); }
.node:hover .n-box, .node.is-on .n-box { fill: var(--acc-soft); stroke: var(--acc); }
.node:hover .n-label, .node.is-on .n-label { fill: var(--acc); }
.node:focus { outline: none; }
.node:focus-visible .n-box { stroke: var(--acc-2); stroke-width: 2; }

.edge { stroke: var(--line-strong); stroke-width: 1.4; fill: none; }
.edge-flow {
  stroke: var(--acc); stroke-width: 1.6; fill: none;
  stroke-dasharray: 5 9; opacity: .75;
  animation: flow 1.4s linear infinite;
}
@keyframes flow { to { stroke-dashoffset: -28; } }
.zone { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 5; rx: 12; }
.zone-label { fill: var(--fg-dim); font: 500 10px var(--font-mono); letter-spacing: .1em; }

.diagram-panel {
  border-top: 1px solid var(--line); padding: 22px; background: var(--surface-2);
  min-height: 200px;
}
@media (min-width: 940px) { .diagram-panel { border-top: 0; border-left: 1px solid var(--line); } }
.diagram-panel__k {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--acc); margin-bottom: 10px;
}
.diagram-panel h3 { font-size: 17px; margin-bottom: 10px; }
.diagram-panel p { font-size: 14px; color: var(--fg-muted); margin-bottom: 16px; }
.diagram-panel ul { display: flex; flex-wrap: wrap; gap: 7px; }
.diagram-panel li {
  font-family: var(--font-mono); font-size: 11px; padding: 4px 9px; border-radius: 6px;
  background: var(--surface-3); border: 1px solid var(--line); color: var(--fg-muted);
}
.diagram-hint { font-size: 12.5px; color: var(--fg-dim); margin-top: 14px; }

/* --------------------------------------------------------------------------
   12. Experience timeline
   -------------------------------------------------------------------------- */
.timeline { position: relative; padding-left: 30px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px;
  background: linear-gradient(to bottom, var(--acc), var(--line) 22%, var(--line) 78%, transparent);
}
.tl-item { position: relative; margin-bottom: 22px; }
.tl-item::before {
  content: ""; position: absolute; left: -30px; top: 26px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--acc);
  box-shadow: 0 0 0 4px var(--bg);
}
.tl-item--past::before { border-color: var(--line-strong); }

.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 6px; }
.tl-item h3 { font-size: 19px; }
.tl-co { color: var(--acc); font-weight: 600; font-size: 15px; }
.tl-when {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-dim);
  padding: 3px 9px; border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--line); margin-left: auto; white-space: nowrap;
}
.tl-list { margin-top: 14px; display: grid; gap: 9px; }
.tl-list li {
  display: flex; gap: 11px; font-size: 14.5px; color: var(--fg-muted); line-height: 1.6;
}
.tl-list li::before {
  content: "▸"; color: var(--acc); flex: none; font-size: 12px; line-height: 1.9; opacity: .8;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tag {
  font-family: var(--font-mono); font-size: 11px; padding: 4px 9px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--fg-dim);
}

/* --------------------------------------------------------------------------
   13. Skills
   -------------------------------------------------------------------------- */
.skill-card { padding: 24px; }
.skill-card__top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.skill-card__top h3 { font-size: 16px; }
.skill-card__ic {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--acc-soft); border: 1px solid var(--acc-line); color: var(--acc); flex: none;
}
.skill-card__ic svg { width: 17px; height: 17px; }
.skill-list { display: grid; gap: 10px; }
.skill-list li {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12.8px; color: var(--fg-muted);
}
.skill-list li::before {
  content: ""; width: 5px; height: 5px; border-radius: 1px; background: var(--acc);
  flex: none; opacity: .7;
}
.skill-card:hover .skill-list li::before { opacity: 1; }

/* --------------------------------------------------------------------------
   14. Projects
   -------------------------------------------------------------------------- */
.proj {
  text-align: left; width: 100%; cursor: pointer; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); padding: 26px;
  display: flex; flex-direction: column; gap: 12px; overflow: hidden; position: relative;
  transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.proj::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(420px 220px at var(--mx,50%) var(--my,0%), var(--acc-soft), transparent 65%);
  transition: opacity .3s;
}
.proj:hover { border-color: var(--acc-line); transform: translateY(-4px); box-shadow: var(--shadow-2); }
.proj:hover::after { opacity: 1; }

.proj__no {
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-dim);
  letter-spacing: .1em;
}
.proj__ic {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--acc-soft); border: 1px solid var(--acc-line); color: var(--acc);
}
.proj__ic svg { width: 21px; height: 21px; }
.proj h3 { font-size: 18px; }
.proj p { font-size: 14.5px; color: var(--fg-muted); flex: 1; }
.proj__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line);
}
.proj__stack { display: flex; flex-wrap: wrap; gap: 5px; }
.proj__more {
  font-size: 12.5px; font-weight: 600; color: var(--acc);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.proj__more svg { width: 14px; height: 14px; transition: transform .2s; }
.proj:hover .proj__more svg { transform: translateX(3px); }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 150; display: grid; place-items: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity .24s var(--ease);
}
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal__scrim {
  position: absolute; inset: 0; background: rgba(3,5,8,.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
[data-theme="light"] .modal__scrim { background: rgba(30,40,50,.42); }
.modal__box {
  position: relative; width: min(720px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3); transform: translateY(14px) scale(.985);
  transition: transform .28s var(--ease);
}
.modal.is-open .modal__box { transform: none; }
.modal__bar {
  position: sticky; top: 0; display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0; z-index: 2;
}
.modal__bar .termcard__dots { flex: none; }
.modal__path { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-dim); }
.modal__x {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px; display: grid;
  place-items: center; background: transparent; border: 1px solid var(--line);
  color: var(--fg-muted); cursor: pointer; transition: all .18s;
}
.modal__x:hover { color: var(--warn); border-color: var(--warn); }
.modal__x svg { width: 15px; height: 15px; }
.modal__content { padding: 28px; }
.modal__content h3 { font-size: clamp(21px, 3vw, 27px); margin-bottom: 8px; }
.modal__sum { color: var(--fg-muted); font-size: 15.5px; margin-bottom: 24px; }

.mblock { margin-bottom: 22px; }
.mblock__k {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--acc); margin-bottom: 9px;
  display: flex; align-items: center; gap: 9px;
}
.mblock__k::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.mblock p { color: var(--fg-muted); font-size: 15px; }
.mblock ul { display: grid; gap: 8px; }
.mblock ul li { display: flex; gap: 10px; color: var(--fg-muted); font-size: 15px; }
.mblock ul li::before { content: "▸"; color: var(--acc); flex: none; opacity: .8; font-size: 12px; line-height: 1.8; }

/* --------------------------------------------------------------------------
   15. Certifications & education
   -------------------------------------------------------------------------- */
.cert {
  display: flex; align-items: flex-start; gap: 15px; padding: 20px 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: all .25s var(--ease);
}
.cert:hover { border-color: var(--acc-line); transform: translateY(-3px); box-shadow: var(--shadow-2); }
.cert__seal {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--acc-soft); border: 1px dashed var(--acc-line); color: var(--acc);
}
.cert__seal svg { width: 19px; height: 19px; }
.cert h3 { font-size: 15px; margin-bottom: 5px; line-height: 1.35; }
.cert p { font-size: 12.5px; color: var(--fg-dim); font-family: var(--font-mono); }

.edu {
  display: flex; gap: 18px; padding: 24px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); transition: all .25s var(--ease);
}
.edu:hover { border-color: var(--acc-line); }
.edu__y {
  font-family: var(--font-mono); font-size: 12px; color: var(--acc); flex: none;
  writing-mode: horizontal-tb; padding-top: 4px; min-width: 92px;
}
.edu h3 { font-size: 17px; margin-bottom: 6px; }
.edu .inst { color: var(--fg); font-weight: 600; font-size: 14.5px; }
.edu .place { color: var(--fg-muted); font-size: 14px; }

/* --------------------------------------------------------------------------
   16. Contact
   -------------------------------------------------------------------------- */
.contact__layout { display: grid; gap: 28px; }
@media (min-width: 940px) { .contact__layout { grid-template-columns: 1fr 1fr; } }

.form-shell {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-2);
}
.form-shell__bar {
  padding: 13px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-dim);
}
form { padding: 24px; display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--fg-dim);
}
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: var(--bg-alt); border: 1px solid var(--line); color: var(--fg);
  font-size: 15px; transition: border-color .18s, background .18s, box-shadow .18s;
}
.field textarea { resize: vertical; min-height: 118px; font-family: inherit; }
.field input::placeholder, .field textarea::placeholder { color: var(--fg-dim); opacity: .7; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-soft); background: var(--surface);
}
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; }
.form-note { font-size: 12.5px; color: var(--fg-dim); }
.form-ok {
  display: none; align-items: flex-start; gap: 11px; padding: 14px 16px; border-radius: 10px;
  background: var(--acc-soft); border: 1px solid var(--acc-line); color: var(--acc); font-size: 14px;
}
.form-ok.is-on { display: flex; }
.form-ok svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }

.reference {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px; margin-top: 20px;
}
.reference__k {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--fg-dim); margin-bottom: 12px;
}
.reference h4 { font-size: 16px; margin-bottom: 3px; }
.reference .role { color: var(--fg-muted); font-size: 14px; }
.reference a { color: var(--acc); font-size: 14px; font-family: var(--font-mono); }
.reference a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   17. Footer
   -------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--line); background: var(--bg-alt);
  padding: 46px 0 34px;
}
.footer__top {
  display: flex; flex-wrap: wrap; gap: 24px; align-items: center;
  justify-content: space-between; padding-bottom: 26px; border-bottom: 1px solid var(--line);
}
.footer__links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer__links a { font-size: 14px; color: var(--fg-muted); transition: color .18s; }
.footer__links a:hover { color: var(--acc); }
.footer__bot {
  display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between;
  align-items: center; padding-top: 24px;
  font-family: var(--font-mono); font-size: 12px; color: var(--fg-dim);
}
.footer__bot b { color: var(--acc); font-weight: 500; }

.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--fg-muted);
  cursor: pointer; opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: all .28s var(--ease); box-shadow: var(--shadow-2);
}
.to-top.is-on { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { color: var(--acc); border-color: var(--acc); }
.to-top svg { width: 18px; height: 18px; }

/* --------------------------------------------------------------------------
   18. Command palette
   -------------------------------------------------------------------------- */
.cmdk {
  position: fixed; inset: 0; z-index: 180; padding: 12vh 20px 20px;
  display: flex; justify-content: center; align-items: flex-start;
  opacity: 0; pointer-events: none; transition: opacity .18s var(--ease);
}
.cmdk.is-open { opacity: 1; pointer-events: auto; }
.cmdk__scrim { position: absolute; inset: 0; background: rgba(3,5,8,.7); backdrop-filter: blur(6px); }
[data-theme="light"] .cmdk__scrim { background: rgba(30,40,50,.4); }
.cmdk__box {
  position: relative; width: min(560px, 100%); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  box-shadow: var(--shadow-3); overflow: hidden;
  transform: translateY(-10px) scale(.98); transition: transform .2s var(--ease);
}
.cmdk.is-open .cmdk__box { transform: none; }
.cmdk__in {
  display: flex; align-items: center; gap: 11px; padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.cmdk__in svg { width: 17px; height: 17px; color: var(--fg-dim); flex: none; }
.cmdk__in input {
  flex: 1; background: none; border: 0; outline: none; font-size: 15.5px;
  font-family: var(--font-mono);
}
.cmdk__in input::placeholder { color: var(--fg-dim); }
.cmdk__list { max-height: 46vh; overflow-y: auto; padding: 8px; }
.cmdk__grp {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-dim); padding: 10px 12px 6px;
}
.cmdk__it {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 9px; background: none; border: 0; cursor: pointer;
  color: var(--fg-muted); font-size: 14.5px;
}
.cmdk__it svg { width: 16px; height: 16px; color: var(--fg-dim); flex: none; }
.cmdk__it .sub { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--fg-dim); }
.cmdk__it[aria-selected="true"] { background: var(--acc-soft); color: var(--acc); }
.cmdk__it[aria-selected="true"] svg { color: var(--acc); }
.cmdk__empty { padding: 26px; text-align: center; color: var(--fg-dim); font-size: 14px; }
.cmdk__foot {
  display: flex; gap: 16px; padding: 11px 18px; border-top: 1px solid var(--line);
  background: var(--surface-2); font-size: 11.5px; color: var(--fg-dim); flex-wrap: wrap;
}
.cmdk__foot span { display: inline-flex; align-items: center; gap: 6px; }

/* --------------------------------------------------------------------------
   19. Terminal easter egg
   -------------------------------------------------------------------------- */
.term {
  position: fixed; right: 20px; bottom: 20px; z-index: 170;
  width: min(520px, calc(100vw - 40px)); height: min(400px, 62vh);
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  box-shadow: var(--shadow-3); display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none;
  transition: all .24s var(--ease); backdrop-filter: blur(12px);
}
.term.is-open { opacity: 1; transform: none; pointer-events: auto; }
.term__bar {
  display: flex; align-items: center; gap: 9px; padding: 10px 13px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-dim); flex: none;
}
.term__body {
  flex: 1; overflow-y: auto; padding: 14px; font-family: var(--font-mono);
  font-size: 12.5px; line-height: 1.7; color: var(--fg-muted);
}
.term__body .ok  { color: var(--acc); }
.term__body .er  { color: #FF6B6B; }
.term__body .ac2 { color: var(--acc-2); }
.term__body pre  { white-space: pre-wrap; word-break: break-word; margin: 0; font: inherit; }
.term__in { display: flex; align-items: center; gap: 8px; padding: 11px 14px;
  border-top: 1px solid var(--line); flex: none; }
.term__in span { color: var(--acc); font-family: var(--font-mono); font-size: 12.5px; }
.term__in input {
  flex: 1; background: none; border: 0; outline: none;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--fg);
}

/* --------------------------------------------------------------------------
   20. Scroll reveal
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0; transform: translateY(22px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

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

/* Print — makes the page usable as a resume handout */
@media print {
  .nav, .drawer, .to-top, .cmdk, .term, #net-canvas, .hero__grid, .hero__veil,
  .progress, .hero__cta, .form-shell { display: none !important; }
  body { background: #fff; color: #000; }
  .section { padding-block: 18px; }
  .card, .cert, .edu, .proj { break-inside: avoid; border-color: #ccc; }
}
