/* === Base === */
:root {
  --bg: #07080c;
  --panel: #0f1218;
  --panel-2: #0b0d12;
  --text: #e6e6e6;
  --muted: #9aa4ac;
  --radius: 16px;
  --grid-size: 44px;
  --card-shadow: 0 0 0.5rem rgba(0,0,0,.6), 0 0 2.4rem rgba(0,0,0,.6);
  --ring: 0 0 0 2px rgba(255,255,255,.08);
  --mx: 0px; /* Parallax offsets (set by JS) */
  --my: 0px;
  --progress: 0%; /* scroll progress */
}

/* Accent packs (default: blue) */
html[data-accent="blue"]   { --accent: #3b82f6; --accent-rgb: 59,130,246; }
html[data-accent="gray"]   { --accent: #9ca3af; --accent-rgb: 156,163,175; }
html[data-accent="pink"]   { --accent: #ec4899; --accent-rgb: 236,72,153; }
html[data-accent="purple"] { --accent: #a855f7; --accent-rgb: 168,85,247; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Accessibility */
.skip-link {
  position: absolute; left: -999px; top: -999px;
}
.skip-link:focus {
  left: 1rem; top: 1rem;
  background: rgb(var(--accent-rgb)/.2);
  padding: .5rem .75rem; border-radius: .5rem; outline: none;
}

/* Progress bar */
.progress { position: fixed; inset: 0 0 auto 0; height: 9px; z-index: 50; }
.progress .bar {
  display: block; height: 100%; width: var(--progress);
  background: linear-gradient(90deg, rgba(var(--accent-rgb),.0), rgba(var(--accent-rgb),1));
  box-shadow: 0 0 18px rgba(var(--accent-rgb), .6);
}

/* Containers */
.container { width: min(1100px, 92vw); margin: 0 auto; }

/* ====== BACKGROUND LAYERS ====== */
.bg-grid, .bg-noise, .bg-stars {
  position: fixed; inset: 0; pointer-events: none;
}
.bg-grid { z-index: -3; transform: translate3d(var(--mx), var(--my), 0); will-change: transform; transition: transform 120ms ease-out; }
.bg-grid::before {
  content: ""; position: absolute; inset: -6%;
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), .12) 1px, transparent 1px) 0 0 / var(--grid-size) var(--grid-size),
    linear-gradient(0deg, rgba(var(--accent-rgb), .08) 1px, transparent 1px) 0 0 / var(--grid-size) var(--grid-size),
    radial-gradient(1200px 600px at 70% 10%, rgba(var(--accent-rgb), .06), transparent 60%),
    radial-gradient(800px 400px at 20% 90%, rgba(255,255,255,.05), transparent 60%),
    #050609;
  animation: grid-pan 32s linear infinite;
  will-change: background-position;
}
@keyframes grid-pan {
  0%   { background-position:   0px   0px,   0px   0px, 0 0, 0 0, 0 0; }
  100% { background-position: 200px 100px, 200px 100px, 0 0, 0 0, 0 0; }
}
.bg-noise { z-index: -2; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: cover; mix-blend-mode: soft-light;
}
.bg-stars { z-index: -1; }

/* Header + Nav */
.site-header { position: relative; padding-top: 10px; }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; }
.brand {
  font-family: "Orbitron", system-ui, sans-serif;
  font-weight: 700; letter-spacing: .08em; text-transform: lowercase;
  font-size: 1.3rem; color: var(--text); text-decoration: none; position: relative;
}
.glitch { position: relative; display: inline-block; }
.glitch span { position: absolute; left: 0; top: 0; clip-path: inset(0 0 0 0); }
.glitch span:first-child { transform: translate(0,0); animation: glitch 3.5s infinite linear alternate-reverse; color: rgb(var(--accent-rgb)); opacity: .7; }
@keyframes glitch {
  0% { transform: translate(0,0); } 20% { transform: translate(1px,-1px); }
  40% { transform: translate(-1px,1px); } 60% { transform: translate(1px,1px); }
  80% { transform: translate(-1px,-1px); } 100% { transform: translate(0,0); }
}

.nav-actions { display: flex; gap: .5rem; align-items: center; }

/* Accent chips */
.chip {
  width: 18px; height: 18px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb),.6);
}
html[data-accent="blue"]   .chip[data-set-accent="blue"],
html[data-accent="gray"]   .chip[data-set-accent="gray"],
html[data-accent="pink"]   .chip[data-set-accent="pink"],
html[data-accent="purple"] .chip[data-set-accent="purple"] { outline: 2px solid rgba(255,255,255,.15); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1rem; border-radius: .75rem; text-decoration: none; cursor: pointer;
  font-weight: 600; color: var(--text); border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.00));
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
  will-change: transform;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(var(--accent-rgb),.6); box-shadow: 0 0 18px rgba(var(--accent-rgb), .25); }
.btn.ghost { background: transparent; }
.btn.primary { border-color: rgba(var(--accent-rgb), .65); background: linear-gradient(180deg, rgba(var(--accent-rgb), .18), rgba(var(--accent-rgb), .08)); box-shadow: 0 0 22px rgba(var(--accent-rgb), .22); }
.btn.outline { border-color: rgba(255,255,255,.18); }

/* Hero */
.hero { padding: 72px 0 40px; text-align: center; position: relative; }
.title {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: clamp(2rem, 3.2vw + 1rem, 4rem);
  margin: 24px 0 8px; letter-spacing: .06em; position: relative; display: inline-block;
  padding: .25rem 1rem; border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02), 0 0 36px rgba(var(--accent-rgb), .18);
}
.spark-left, .spark-right {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); filter: blur(6px); top: 50%; transform: translateY(-50%);
  box-shadow: 0 0 22px rgba(var(--accent-rgb), .8), 0 0 44px rgba(var(--accent-rgb), .6);
}
.spark-left  { left: -12px; }
.spark-right { right: -12px; }

.subtitle { color: var(--muted); margin: 4px 0 16px; }
.mono { font-weight: 600; }
.small { font-size: .92rem; }
.dim { opacity: .8; }
.good { color: rgb(var(--accent-rgb)); }
.divider { opacity: .4; margin: 0 .45rem; }
.cta-row { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }

.scroll-cue {
  margin-top: 28px; font-size: .85rem; letter-spacing: .3em; color: rgba(255,255,255,.6);
  position: relative; padding-top: 22px;
}
.scroll-cue::before {
  content: ""; position: absolute; left: 50%; top: 0; width: 1px; height: 18px; background: rgba(255,255,255,.25);
  transform: translateX(-50%); animation: scroll-down 1.2s ease-in-out infinite;
}
@keyframes scroll-down {
  0% { opacity: .2; transform: translate(-50%, 0); }
  100% { opacity: 1; transform: translate(-50%, 10px); }
}

/* Main */
.main { padding: 24px 0 72px; display: grid; gap: 16px; }

/* Card base */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.008));
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--card-shadow);
  position: relative; overflow: hidden;
  transform-style: preserve-3d;
}
.card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit;
  background: radial-gradient(1200px 320px at 10% -10%, rgba(var(--accent-rgb),.15), transparent 40%),
              radial-gradient(800px 200px at 110% 110%, rgba(var(--accent-rgb),.09), transparent 40%);
  pointer-events: none;
}
.card-title {
  font-family: "Orbitron", system-ui, sans-serif;
  margin: 0 0 8px; letter-spacing: .04em; font-size: 1.25rem;
}
.card-text { margin: 8px 0 16px; }

/* Lists */
.meta { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.meta a { color: rgb(var(--accent-rgb)); text-decoration: none; }
.meta a:hover { text-decoration: underline; }

/* Chips list */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.chips li {
  padding: .45rem .6rem; border-radius: 10px; font-size: .95rem;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.12);
}

/* Projects */
.project-list { display: grid; grid-template-columns: 1fr; gap: 14px; }
.project { display: block; text-decoration: none; color: inherit; }
.project-inner {
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.006));
  border: 1px solid rgba(255,255,255,.12); border-radius: 14px; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  transform-style: preserve-3d;
}
.project-header {
  display: flex; gap: 6px; padding: 10px 12px; background: rgba(255,255,255,.02);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.project-header .dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: rgba(var(--accent-rgb), .8);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), .6);
}
.project-body { padding: 16px 14px; position: relative; }
.project-body h3 { margin: 0 0 6px; font-size: 1.05rem; }
.project-body p { margin: 0 0 8px; color: var(--muted); }
.project .arrow { position: absolute; right: 12px; bottom: 12px; transition: transform .18s ease; }
.project-inner:hover { transform: translateY(-2px); box-shadow: 0 0 24px rgba(var(--accent-rgb), .22); border-color: rgba(var(--accent-rgb), .55); }
.project-inner:hover .arrow { transform: translateX(4px); }

/* Socials */
.socials { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.social {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12); color: var(--text); text-decoration: none;
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.006));
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  transform-style: preserve-3d;
}
.social:hover { transform: translateY(-2px); border-color: rgba(var(--accent-rgb), .6); box-shadow: 0 0 20px rgba(var(--accent-rgb), .22); }
.social svg { fill: currentColor; opacity: .9; }

/* Footer */
.site-footer { border-top: 1px solid rgba(255,255,255,.08); padding: 22px 0 36px; text-align: center; color: #a9b0b6; }

/* Reveal on scroll */
.reveal-on-scroll { opacity: 0; transform: translateY(12px) scale(.98); }
.reveal-on-scroll.reveal { opacity: 1; transform: none; transition: 700ms cubic-bezier(.2,.8,.2,1); }

/* Links */
a { color: rgb(var(--accent-rgb)); }
a:hover { text-decoration: underline; }

/* Focus styles */
:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .75); outline-offset: 2px; }

/* Motion reduction */
@media (prefers-reduced-motion: reduce) {
  .bg-grid { transition: none; }
  .bg-grid::before { animation: none; }
  .glitch span:first-child { animation: none; }
  .reveal-on-scroll { opacity: 1; transform: none; }
  .project-inner, .btn, .social { transition: none; }
}

/* Tilt shadow effect */
.tilt { position: relative; will-change: transform; }
.tilt::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(600px 300px at var(--px,50%) var(--py,50%), rgba(var(--accent-rgb),.18), transparent 40%);
  opacity: var(--glow, 0); transition: opacity .2s ease;
}
.tilt:hover::after { opacity: 1; }
