:root {
  --bg: #05080a;
  --panel: rgba(8, 16, 12, 0.82);
  --green: #00ff9c;
  --green-dim: #0a8f5a;
  --text: #c8f7dc;
  --muted: #5f8a73;
  --border: rgba(0, 255, 156, 0.25);
  --red: #ff4d6d;
  --cyan: #00e5ff;
  --font: ui-monospace, "Cascadia Code", "Consolas", "SFMono-Regular", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* scanlines */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px);
  z-index: 2;
}

#matrix {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  opacity: .18;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 16px 32px;
}

.dim { color: var(--muted); }

/* ---------- full-screen sections ---------- */
.screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  scroll-snap-align: start;
}

h2 {
  font-size: 1.1rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .15em;
  margin-bottom: 20px;
}

/* ---------- scroll progress bar ---------- */
.progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--green), var(--cyan));
  box-shadow: 0 0 12px var(--green);
  z-index: 5;
}

/* ---------- side dots ---------- */
.dots {
  position: fixed;
  right: 18px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 14px;
  z-index: 4;
}
.dots a {
  position: relative;
  width: 10px; height: 10px;
  border: 1px solid var(--green);
  border-radius: 50%;
  transition: background .3s, box-shadow .3s, transform .3s;
}
.dots a.active { background: var(--green); box-shadow: 0 0 10px var(--green); transform: scale(1.3); }
.dots a::before {
  content: attr(data-label);
  position: absolute; right: 20px; top: 50%;
  transform: translate(6px, -50%);
  font-size: .72rem; color: var(--green);
  opacity: 0; white-space: nowrap;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.dots a:hover::before { opacity: 1; transform: translate(0, -50%); }

/* ---------- hero screen ---------- */
.hero-screen { flex-direction: column; justify-content: center; }
.hero-inner { will-change: transform, opacity; }
.hero-inner .links { margin-top: 18px; }

.hero {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 0 40px rgba(0, 255, 156, .08);
  overflow: hidden;
}
.term-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 255, 156, .04);
}
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--muted); }
.term-bar span:first-child { background: var(--red); }
.term-bar span:nth-child(2) { background: #ffcc4d; }
.term-bar span:nth-child(3) { background: var(--green); }
.term-bar p { margin-left: 10px; color: var(--muted); font-size: .8rem; }

.term-body { padding: 28px 22px 32px; }
.prompt { color: var(--muted); }

.glitch {
  position: relative;
  font-size: clamp(2.6rem, 13vw, 5.5rem);
  line-height: 1.1;
  color: var(--green);
  letter-spacing: .06em;
  text-shadow: 0 0 18px rgba(0, 255, 156, .55);
  margin: 6px 0 10px;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0;
  width: 100%;
  overflow: hidden;
}
.glitch::before { color: var(--cyan); animation: glitch 3s infinite steps(1); clip-path: inset(0 0 60% 0); }
.glitch::after  { color: var(--red); animation: glitch 2.4s infinite reverse steps(1); clip-path: inset(55% 0 0 0); }

@keyframes glitch {
  0%, 88%, 100% { transform: translate(0); opacity: 0; }
  90% { transform: translate(-3px, 1px); opacity: .8; }
  93% { transform: translate(3px, -1px); opacity: .8; }
  96% { transform: translate(-1px, 2px); opacity: .8; }
}

.typed { min-height: 1.6em; font-size: 1.05rem; }
.typed::before { content: "> "; color: var(--green); }
.typed::after {
  content: "█";
  color: var(--green);
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: .75rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  z-index: 1;
  transition: opacity .3s;
}
.scroll-hint:hover { color: var(--green); }
.scroll-hint i {
  width: 22px; height: 36px;
  border: 1px solid var(--green);
  border-radius: 12px;
  position: relative;
}
.scroll-hint i::after {
  content: "";
  position: absolute; left: 50%; top: 7px;
  width: 4px; height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: wheel 1.6s var(--ease) infinite;
}
@keyframes wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}
.scrolled .scroll-hint { opacity: 0; pointer-events: none; }

/* ---------- links ---------- */
.links { display: grid; gap: 12px; }
.link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .15s, background .15s;
}
/* light sweep on hover */
.link::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 156, .18), transparent);
  transform: skewX(-20deg);
  transition: left .5s var(--ease);
}
.link:hover::after, .link:focus-visible::after { left: 120%; }
.link:hover, .link:focus-visible {
  border-color: var(--green);
  background: rgba(0, 255, 156, .08);
  box-shadow: 0 0 18px rgba(0, 255, 156, .25);
  transform: translateX(4px);
  outline: none;
}
.tag { color: var(--green); font-weight: 700; }
.handle { margin-left: auto; color: var(--muted); font-size: .85rem; }

/* ---------- cards ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 20px;
}
.about { padding: 26px 24px; font-size: 1.05rem; }
.about p + p { margin-top: 10px; }
.key { color: var(--green); }
.ok { color: var(--green); display: inline-flex; align-items: center; gap: 8px; }
.pulse {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(0, 255, 156, .6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 10px rgba(0, 255, 156, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 255, 156, 0); }
}

.projects {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  perspective: 900px;
}
.project {
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s, box-shadow .15s;
  transform-style: preserve-3d;
}
.project:hover { border-color: var(--green); box-shadow: 0 0 22px rgba(0, 255, 156, .22); }
.project h3 { color: var(--green); font-size: 1.05rem; }
.project p { color: var(--text); font-size: .92rem; flex: 1; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; }
.meta span {
  font-size: .72rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
}
.btn {
  align-self: flex-start;
  color: var(--bg);
  background: var(--green);
  text-decoration: none;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: .9rem;
  transition: box-shadow .15s;
}
.btn:hover, .btn:focus-visible { box-shadow: 0 0 16px var(--green); outline: none; }

/* ---------- footer ---------- */
footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
  text-align: center;
  font-size: .8rem;
}
footer p + p { margin-top: 6px; }
.to-top {
  display: inline-block;
  margin-top: 14px;
  color: var(--green);
  text-decoration: none;
}
.to-top:hover { text-shadow: 0 0 10px var(--green); }

/* =========================================================
   SCROLL ANIMATIONS (only active when JavaScript runs)
   ========================================================= */

/* boot-up on page load */
.js .boot {
  opacity: 0;
  transform: translateY(24px) scale(.98);
  filter: blur(6px);
  transition: opacity .7s var(--ease), transform .7s var(--ease), filter .7s var(--ease);
  transition-delay: var(--d, 0s);
}
.js.loaded .boot { opacity: 1; transform: none; filter: none; }

/* generic reveal: fade + slide up + un-blur */
.js .reveal {
  opacity: 0;
  transform: translateY(50px);
  filter: blur(8px);
  transition: opacity .8s var(--ease), transform .8s var(--ease), filter .8s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; filter: none; }

/* heading: slide in from the left */
.js h2.reveal { transform: translateX(-40px); }
.js h2.reveal.in { transform: none; }

/* about card: border draws itself, then lines appear one by one */
.js .about.reveal { transform: translateY(50px) scale(.96); }
.js .about.reveal.in { transform: none; }
.js .about .line {
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .about.in .line { opacity: 1; transform: none; }

/* program cards: flip up in 3D */
.js .project.reveal {
  transform: translateY(70px) rotateX(35deg);
  transform-origin: 50% 100%;
}
.js .project.reveal.in { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition-delay: var(--d, 0s); }
.js .project.reveal.in.tilting { transition: transform .1s linear, border-color .15s, box-shadow .15s; }

/* hero fades / shrinks as you scroll away */
.hero-inner {
  transform: translateY(var(--hy, 0px)) scale(var(--hs, 1));
  opacity: var(--ho, 1);
}

/* 404 page */
.center { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 16px; }

@media (max-width: 600px) {
  .dots { display: none; }
  .dots a::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .glitch::before, .glitch::after, .typed::after, .pulse, .scroll-hint i::after { animation: none; }
  #matrix { display: none; }
  .link:hover { transform: none; }
  .js .boot, .js .reveal, .js .about .line {
    opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important;
  }
  .hero-inner { transform: none; opacity: 1; }
}
