/* ===== Design tokens ===== */
:root {
  --bg: #0D0D12;
  --bg-raised: #14141B;
  --bg-panel: #17171F;
  --border: #26262F;
  --text: #E8E8ED;
  --text-dim: #9494A0;
  --text-faint: #5B5B66;

  --orange: #FF8C3B;
  --orange-soft: #FFC670;
  --purple: #7B6EF6;
  --green: #5EDC9C;

  --font-display: 'Press Start 2P', monospace;
  --font-mono: 'Press Start 2P', monospace;
  --font-body: 'VT323', monospace;

  --container: 1140px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

/* ===== Ambient texture ===== */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image: radial-gradient(circle at 20% 20%, rgba(123,110,246,0.08), transparent 45%),
                     radial-gradient(circle at 80% 70%, rgba(255,140,59,0.07), transparent 45%);
}

.scanline {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(255,255,255,0.008) 3px,
    rgba(255,255,255,0.008) 4px
  );
  opacity: 0.5;
}

/* ===== Floating pixel sprites ===== */
.sprite-field {
  position: absolute; top: 70px; left: 0; right: 0; height: 820px;
  z-index: 1; pointer-events: none; overflow: hidden;
}

.pixel-sprite {
  position: absolute;
  image-rendering: pixelated;
  opacity: 0.5;
}

.sprite-star { width: 18px; height: 18px; color: var(--orange-soft); animation: twinkle 3.2s ease-in-out infinite; }
.sprite-coin { width: 22px; height: 22px; color: var(--purple); animation: float-y 5s ease-in-out infinite; }
.sprite-cloud { width: 64px; height: 32px; color: var(--text-faint); opacity: 0.25; animation: drift-x 26s linear infinite; }

.s1 { top: 14%; left: 6%; animation-delay: 0s; }
.s2 { top: 62%; left: 3%; animation-delay: 0.6s; }
.s3 { top: 8%; left: 46%; animation-delay: 1.4s; }
.s4 { top: 20%; left: 60%; animation-delay: 0s; }
.s5 { top: 70%; left: 88%; animation-delay: 1.9s; }

@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.9); }
  50% { opacity: 0.7; transform: scale(1.15); }
}
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
@keyframes drift-x {
  0% { transform: translateX(-10vw); }
  100% { transform: translateX(110vw); }
}

/* ===== Nav ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(13,13,18,0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex; justify-content: space-between; align-items: center;
}

.nav-logo {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.65rem;
  letter-spacing: 0.02em;
}
.nav-logo-dot { color: var(--orange); }

.nav-links { display: flex; gap: 28px; }
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--orange-soft); }

/* ===== Hero ===== */
.hero {
  position: relative; z-index: 3;
  max-width: var(--container);
  margin: 0 auto;
  padding: 160px 24px 100px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 60px;
  align-items: start;
  isolation: isolate;
}

.hero-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--orange-soft);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
  line-height: 1.8;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.4vw, 2.2rem);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0;
  margin-bottom: 24px;
}

.hl-orange { color: var(--orange); }
.hl-purple { color: var(--purple); }

.hero-sub {
  font-size: 1.35rem;
  color: var(--text-dim);
  max-width: 480px;
  margin-bottom: 36px;
}

.hero-cta { display: flex; gap: 14px; }

.btn {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 15px 24px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: inline-block;
  line-height: 1;
}
.btn-primary {
  background: var(--orange);
  color: #14100A;
  font-weight: 400;
}
.btn-primary:hover { background: var(--orange-soft); transform: translateY(-1px); }

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--orange); color: var(--orange-soft); }

/* ===== HUD Panel (signature element) ===== */
.hud-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  font-family: var(--font-body);
  font-size: 1.15rem;
  box-shadow: 0 0 0 1px rgba(255,140,59,0.04), 0 20px 60px -20px rgba(0,0,0,0.6);
  position: relative;
  overflow: hidden;
}

.hud-panel::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  animation: sweep 3s ease-in-out infinite;
}
@keyframes sweep { 0%,100% { opacity: 0.2; } 50% { opacity: 1; } }

.hud-head {
  color: var(--text-faint);
  letter-spacing: 0.04em;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.hud-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.4; } }

.hud-line {
  display: flex; justify-content: space-between;
  padding: 3px 0;
  color: var(--text-dim);
}
.hud-line span:first-child { color: var(--text); }
.hud-ok { color: var(--green); }
.hud-warn { color: var(--orange-soft); }

.hud-bar {
  margin-top: 16px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.hud-bar-fill {
  height: 100%;
  width: 78%;
  background: linear-gradient(90deg, var(--purple), var(--orange));
  border-radius: 2px;
}

/* ===== Sections ===== */
.section { position: relative; z-index: 3; padding: 100px 0; }
.section-inner { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

.section-head { margin-bottom: 56px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--orange-soft);
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 18px;
  line-height: 1.8;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
  font-weight: 400;
  max-width: 640px;
  line-height: 1.7;
}

/* ===== Projects ===== */
.project-feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
  padding: 48px 0;
  border-top: 1px solid var(--border);
}
.project-feature:last-child { border-bottom: 1px solid var(--border); }

.project-reverse { direction: rtl; }
.project-reverse > * { direction: ltr; }

.media-frame {
  aspect-ratio: 16/10;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
.media-frame::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,140,59,0.1), transparent 60%);
  pointer-events: none;
}

.demo-canvas {
  width: 100%; height: 100%; display: block;
}

.media-caption {
  position: absolute; left: 14px; bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  line-height: 1.6;
  color: var(--text-dim);
  background: rgba(13,13,18,0.65);
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
}

.project-kicker {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--purple);
  letter-spacing: 0.04em;
  line-height: 1.8;
}

.project-body h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.6;
  margin: 12px 0 18px;
}

.project-desc {
  color: var(--text-dim);
  font-size: 1.2rem;
  margin-bottom: 28px;
  max-width: 480px;
}

.project-highlights {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
}

.highlight {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.highlight:last-child { border-bottom: none; padding-bottom: 0; }

.highlight-tag {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--orange-soft);
  letter-spacing: 0.03em;
  line-height: 1.6;
  padding-top: 2px;
}

.highlight p { font-size: 1.1rem; color: var(--text-dim); line-height: 1.4; }

.project-tech {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.project-tech span {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
}

.project-download {
  margin-top: 24px;
}

/* ===== Stack ===== */
.section-stack { background: var(--bg-raised); }

.stack-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.stack-grid-3 { grid-template-columns: repeat(3, 1fr); }

.stack-group {
  background: var(--bg-panel);
  padding: 28px 24px;
}

.stack-group h4 {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--purple);
  letter-spacing: 0.03em;
  line-height: 1.7;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.stack-group li {
  font-size: 1.15rem;
  color: var(--text-dim);
  padding: 6px 0;
  position: relative;
  padding-left: 16px;
}
.stack-group li::before {
  content: '▸';
  position: absolute; left: 0;
  color: var(--orange);
}

/* ===== Contact ===== */
.section-contact { padding-bottom: 140px; }
.contact-inner { text-align: left; }

.section-contact h2 {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.8vw, 1.9rem);
  font-weight: 400;
  line-height: 1.7;
  margin: 16px 0 18px;
}

.contact-sub { color: var(--text-dim); font-size: 1.2rem; max-width: 460px; margin-bottom: 40px; }

.contact-links {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--border);
}

.contact-link {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 4px;
  border-bottom: 1px solid var(--border);
  transition: padding-left 0.25s ease, color 0.25s ease;
}
.contact-link:hover { padding-left: 14px; color: var(--orange-soft); }

.contact-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-faint);
}
.contact-value {
  font-family: var(--font-body);
  font-size: 1.5rem;
}

/* ===== Footer ===== */
.footer {
  position: relative; z-index: 3;
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  line-height: 1.8;
  color: var(--text-faint);
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 130px; }
  .nav-links { gap: 18px; }
  .project-feature { grid-template-columns: 1fr; }
  .project-reverse { direction: ltr; }
  .stack-grid, .stack-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .highlight { grid-template-columns: 70px 1fr; }
}

@media (max-width: 480px) {
  .nav-links { display: none; }
  .stack-grid, .stack-grid-3 { grid-template-columns: 1fr; }
  .contact-value { font-size: 1rem; }
}