:root {
  --bg: #0b0a10;
  --bg-2: #13111c;
  --line: #262236;
  --text: #e9e6f2;
  --muted: #9a94ad;
  --dim: #6b6580;
  --violet: #a371ff;
  --magenta: #e04fd0;
  --acid: #b6ff5c;
  --warn: #ffb547;
  --display: "Chakra Petch", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--body);
  overflow-x: hidden;
}
::selection { background: var(--violet); color: var(--bg); }
a { color: inherit; }
em { font-style: normal; color: var(--acid); }
code { font-family: var(--mono); font-size: .85em; color: var(--violet); }
kbd {
  font: 600 .75em var(--mono);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 .4em;
  color: var(--text);
}

#creep {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.nav, main, .foot { position: relative; z-index: 1; }

/* nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px clamp(16px, 5vw, 64px);
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { text-decoration: none; font: 700 1.25rem var(--display); letter-spacing: .02em; }
.brand-mark { color: var(--text); }
.brand-dot { color: var(--violet); }
.nav nav { display: flex; gap: clamp(10px, 3vw, 28px); align-items: center; font: 500 .85rem var(--mono); }
.nav nav a { text-decoration: none; color: var(--muted); transition: color .2s; }
.nav nav a:hover { color: var(--acid); }
.shell-btn {
  font: inherit;
  color: var(--acid);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--acid) 40%, transparent);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}
.shell-btn:hover { background: color-mix(in srgb, var(--acid) 12%, transparent); }

main { padding: 0 clamp(16px, 5vw, 64px); max-width: 1200px; margin: 0 auto; }
section { padding: clamp(56px, 10vw, 110px) 0; }

/* hero */
.hero { min-height: min(calc(100svh - 60px), 920px); display: flex; flex-direction: column; justify-content: center; padding-top: 40px; }
.eyebrow { font: 500 .8rem var(--mono); color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 18px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 0 0 var(--acid); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
h1 {
  font: 700 clamp(3.4rem, 13vw, 9.5rem)/.88 var(--display);
  letter-spacing: -.02em;
  margin: 0 0 28px;
  text-transform: uppercase;
}
.grad {
  background: linear-gradient(100deg, var(--violet), var(--magenta) 55%, var(--acid));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede { font-size: clamp(1.05rem, 2.2vw, 1.35rem); max-width: 40ch; color: var(--muted); margin: 0 0 34px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  font: 600 .9rem var(--mono);
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 80%, transparent);
  transition: transform .15s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--violet); }
.btn.primary { background: var(--violet); color: var(--bg); border-color: var(--violet); }
.btn.primary:hover { background: var(--acid); border-color: var(--acid); }
.hint { margin-top: 48px; font: .75rem var(--mono); color: var(--dim); }

/* section heads */
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 36px; flex-wrap: wrap; }
.idx { font: 500 .8rem var(--mono); color: var(--violet); }
h2 { font: 700 clamp(1.8rem, 4.5vw, 3rem)/1.05 var(--display); margin: 0; text-transform: uppercase; }
h3 { font: 700 1.35rem var(--display); margin: 0; }

/* language switcher */
.langs { display: flex; gap: 2px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
.langs button {
  font: 500 .72rem var(--mono);
  color: var(--dim);
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 3px 7px;
  cursor: pointer;
}
.langs button:hover { color: var(--text); }
.langs button.on { color: var(--bg); background: var(--violet); }

/* flagship */
.flag > *, .lab > *, .grid > * { min-width: 0; }
.flag {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: clamp(20px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--violet) 10%, var(--bg-2)), var(--bg-2) 60%);
}
.flag h3 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 10px 0 12px; }
.flag p { color: var(--muted); margin: 0 0 20px; }
.links { display: flex; flex-direction: column; gap: 6px; font: 500 .85rem var(--mono); }
.links a { color: var(--acid); text-decoration: none; }
.links a:hover { text-decoration: underline; }
.code {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  font: .8rem/1.6 var(--mono);
  overflow-x: auto;
  color: var(--text);
}
.code .c { color: var(--dim); }
.code .t { color: var(--magenta); }
.code .a { color: var(--violet); }
.code .s { color: var(--acid); }

.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 !important; }
.tag {
  font: 500 .7rem var(--mono);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.tag.live { color: var(--acid); border-color: color-mix(in srgb, var(--acid) 45%, transparent); }
.tag.lab { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

/* projects */
.filters { margin-left: auto; display: flex; gap: 4px; }
.filters button {
  font: 500 .78rem var(--mono);
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}
.filters button.on { color: var(--text); border-color: var(--line); background: var(--bg-2); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  position: relative;
  overflow: hidden;
  transition: border-color .25s, transform .25s, opacity .3s;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--violet) 16%, transparent), transparent 45%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.card:hover { border-color: color-mix(in srgb, var(--violet) 60%, var(--line)); transform: translateY(-3px); }
.card:hover::before { opacity: 1; }
.card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card p { margin: 0; color: var(--muted); font-size: .94rem; flex: 1; }
.card footer { font: .78rem var(--mono); }
.card footer a { color: var(--acid); text-decoration: none; }
.card.hide { display: none; }
.muted { color: var(--dim); }

/* lab */
.lab { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; }
.lab-copy { color: var(--muted); margin: 0; font-size: 1.05rem; }
.rack { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--bg-2); display: grid; gap: 6px; }
.unit {
  display: grid;
  grid-template-columns: 10px 110px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: .8rem var(--mono);
}
.unit b { color: var(--text); font-weight: 600; }
.unit span:last-child { color: var(--dim); }
.led { width: 8px; height: 8px; border-radius: 50%; }
.led.ok { background: var(--acid); box-shadow: 0 0 8px var(--acid); animation: blink 3s infinite; }
.led.warn { background: var(--violet); box-shadow: 0 0 8px var(--violet); animation: blink 1.3s infinite; }
.unit:nth-child(2) .led { animation-delay: .4s; }
.unit:nth-child(3) .led { animation-delay: 1.1s; }
.unit:nth-child(4) .led { animation-delay: .7s; }
@keyframes blink { 50% { opacity: .35; } }
.stack { list-style: none; padding: 0; margin: 36px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stack li { font: 500 .8rem var(--mono); padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: color-mix(in srgb, var(--bg-2) 80%, transparent); }

/* about */
.about { max-width: 62ch; }
.about p { color: var(--muted); font-size: 1.08rem; margin: 0 0 18px; }
.about p:first-child { color: var(--text); font-size: 1.25rem; }

.contact { text-align: center; }
.contact h2 { font-size: clamp(2.2rem, 7vw, 5rem); margin-bottom: 18px; }
.mail { display: inline-block; font: 500 clamp(.95rem, 2.4vw, 1.25rem) var(--mono); color: var(--acid); text-decoration: none; margin-bottom: 32px; word-break: break-all; }
.mail:hover { text-decoration: underline; }
.contact .cta { justify-content: center; }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 24px clamp(16px, 5vw, 64px);
  border-top: 1px solid var(--line);
  font: .72rem var(--mono);
  color: var(--dim);
}

/* shell */
.shell {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(5, 4, 9, .6);
  backdrop-filter: blur(4px);
  padding: 16px;
}
.shell[hidden] { display: none; }
.shell-win {
  width: min(760px, 100%);
  height: min(480px, 80svh);
  display: flex;
  flex-direction: column;
  background: #08070c;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px color-mix(in srgb, var(--violet) 25%, transparent);
  overflow: hidden;
  font: .85rem/1.55 var(--mono);
}
.shell-bar { display: flex; align-items: center; gap: 7px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.shell-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--line); }
.shell-bar span:nth-child(1) { background: #ff5f57; }
.shell-bar span:nth-child(2) { background: #febc2e; }
.shell-bar span:nth-child(3) { background: #28c840; }
.shell-bar b { flex: 1; text-align: center; font-weight: 500; color: var(--dim); font-size: .75rem; }
.shell-bar button { background: none; border: 0; color: var(--muted); font-size: 1.2rem; cursor: pointer; line-height: 1; }
.shell-out { flex: 1; overflow-y: auto; padding: 14px 16px 4px; white-space: pre-wrap; word-break: break-word; }
.shell-out .p { color: var(--acid); }
.shell-out .e { color: var(--magenta); }
.shell-out .v { color: var(--violet); }
.shell-out .d { color: var(--dim); }
.shell-out a { color: var(--acid); }
.shell-in { display: flex; gap: 8px; padding: 4px 16px 14px; }
.shell-in label { color: var(--acid); }
.shell-in input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; caret-color: var(--acid); }

@media (max-width: 820px) {
  .flag, .lab { grid-template-columns: 1fr; }
  .filters { margin-left: 0; width: 100%; }
  .nav nav a { display: none; }
  .shell-btn kbd { display: none; }
  .nav nav { gap: 8px; }
  .langs button { padding: 3px 5px; }
  .hint { display: none; }
  .unit { grid-template-columns: 10px 90px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before { animation: none !important; transition: none !important; }
}
