@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ===== Tech/Space Design tokens ===== */
:root {
  --bg: #030613;
  --bg-2: #060a1f;
  --text: #e0f2fe;
  --muted: #7dd3fc;
  --line: rgba(0, 243, 255, 0.2);
  --panel: rgba(0, 243, 255, 0.05);
  --panel-hover: rgba(0, 243, 255, 0.1);
  --accent: #00f3ff;       /* Neon Cyan */
  --accent-glow: rgba(0, 243, 255, 0.6);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Space Grotesk', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
  cursor: crosshair; /* Tech vibe */
}
::selection { background: var(--accent); color: #000; }
a { color: inherit; text-decoration: none; }

@media (hover: none) and (pointer: coarse) {
  .cursor, .cursor-ring { display: none !important; }
  body { cursor: auto; }
}

/* ===== HUD Overlays ===== */
.scanline {
  position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.2));
  background-size: 100% 4px;
  opacity: 0.3;
}
.grid-overlay {
  position: fixed; inset: 0; z-index: 9997; pointer-events: none;
  background-image: 
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.15;
  animation: grid-pan 20s linear infinite;
  mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
}
@keyframes grid-pan {
  0% { transform: translateY(0); }
  100% { transform: translateY(40px); }
}
.corners i {
  position: fixed; width: 30px; height: 30px; border: 2px solid var(--accent); z-index: 9998; pointer-events: none; opacity: 0.6;
}
.corners i:nth-child(1) { top: 20px; left: 20px; border-right: none; border-bottom: none; }
.corners i:nth-child(2) { top: 20px; right: 20px; border-left: none; border-bottom: none; }
.corners i:nth-child(3) { bottom: 20px; left: 20px; border-right: none; border-top: none; }
.corners i:nth-child(4) { bottom: 20px; right: 20px; border-left: none; border-top: none; }
.vignette {
  position: fixed; inset: 0; z-index: 9996; pointer-events: none;
  box-shadow: inset 0 0 150px rgba(0,0,0,0.9);
}

/* 3D canvas */
#bg-canvas { position: fixed; inset: 0; z-index: -1; }

/* ===== Layout ===== */
.wrap { width: min(1200px, 90%); margin: 0 auto; position: relative; z-index: 10; }
section { padding: clamp(60px, 10vw, 120px) 0; position: relative; }

/* ===== Typography ===== */
.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.2em;
  font-size: 0.75rem; color: var(--accent); margin-bottom: 20px;
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: "["; color: var(--muted); }
.eyebrow::after { content: "]"; color: var(--muted); }

h2.title {
  font-family: var(--font-sans);
  font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700;
  text-transform: uppercase;
  text-shadow: 0 0 10px var(--accent-glow);
  margin-bottom: 40px;
}

/* ===== HUD Panels ===== */
.hud-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 30px;
  position: relative;
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
  transition: all 0.3s var(--ease);
}
.hud-panel::before {
  content: ""; position: absolute; top: 0; left: 0; width: 10px; height: 10px; border-top: 2px solid var(--accent); border-left: 2px solid var(--accent);
}
.hud-panel::after {
  content: ""; position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; border-bottom: 2px solid var(--accent); border-right: 2px solid var(--accent);
}
.hud-panel:hover {
  background: var(--panel-hover);
  border-color: var(--accent);
  box-shadow: inset 0 0 20px rgba(0, 243, 255, 0.1);
}

/* ===== Navbar ===== */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 5%; 
  border-bottom: 1px solid var(--line);
  background: rgba(3, 6, 19, 0.8);
  backdrop-filter: blur(5px);
}
nav .brand { font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem; color: var(--accent); }
nav .links { display: flex; gap: 30px; font-size: 0.85rem; font-family: var(--font-mono); text-transform: uppercase;}
nav .links a { color: var(--text); position: relative; transition: color 0.2s; }
nav .links a:hover { color: var(--accent); text-shadow: 0 0 8px var(--accent); }

@media (max-width: 768px) {
  nav { flex-direction: column; padding: 15px 5%; gap: 10px; }
  nav .links { gap: 15px; font-size: 0.75rem; flex-wrap: wrap; justify-content: center; }
  .corners i { width: 15px; height: 15px; }
}

/* ===== Hero ===== */
.hero { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding-top: 80px; }
.hero h1 {
  font-family: var(--font-sans);
  font-size: clamp(2.5rem, 7vw, 6rem);
  font-weight: 700; line-height: 1; text-transform: uppercase;
  text-shadow: 0 0 20px rgba(0,243,255,0.4);
}
.hero h1 .glitch { position: relative; color: #fff; }
.hero h1 .glitch::before, .hero h1 .glitch::after {
  content: attr(data-text); position: absolute; top: 0; left: 0; opacity: 0.8;
}
.hero h1 .glitch::before { left: 2px; text-shadow: -2px 0 red; animation: glitch-anim 2s infinite linear alternate-reverse; }
.hero h1 .glitch::after { left: -2px; text-shadow: -2px 0 blue; animation: glitch-anim 3s infinite linear alternate-reverse; }

@keyframes glitch-anim {
  0% { clip-path: inset(20% 0 80% 0); }
  20% { clip-path: inset(60% 0 10% 0); }
  40% { clip-path: inset(40% 0 50% 0); }
  60% { clip-path: inset(80% 0 5% 0); }
  80% { clip-path: inset(10% 0 70% 0); }
  100% { clip-path: inset(30% 0 20% 0); }
}

.hero .lead { margin-top: 30px; max-width: 600px; font-size: 1.1rem; color: var(--muted); font-family: var(--font-mono); }
.hero .cta { margin-top: 40px; display: flex; gap: 20px; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  font-family: var(--font-mono); font-weight: 600; font-size: 0.85rem; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 24px; border: 1px solid var(--accent);
  background: rgba(0, 243, 255, 0.1); color: var(--accent);
  transition: all 0.2s; position: relative; overflow: hidden;
}
.btn::before {
  content: ""; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.4), transparent);
  transition: left 0.5s;
}
.btn:hover::before { left: 100%; }
.btn:hover { background: var(--accent); color: #000; box-shadow: 0 0 15px var(--accent-glow); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: rgba(0,243,255,0.05); }

/* ===== Data Track (Marquee) ===== */
.data-track { overflow: hidden; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); padding: 15px 0; background: rgba(0,243,255,0.02); }
.data-track-inner { display: inline-flex; animation: scroll 20s linear infinite; font-family: var(--font-mono); }
.data-track-inner span { font-size: 1rem; padding: 0 30px; color: var(--muted); text-transform: uppercase; }
.data-track-inner .dot { color: var(--accent); }

/* ===== About & Stats ===== */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
@media (max-width: 800px) { .about-grid { grid-template-columns: 1fr; } }
.stat-row { display: flex; gap: 15px; margin-top: 30px; }
.stat { border-left: 2px solid var(--accent); padding-left: 15px; }
.stat b { font-family: var(--font-mono); font-size: 1.8rem; color: var(--accent); display: block; }
.stat span { font-size: 0.75rem; text-transform: uppercase; color: var(--muted); }

/* ===== Skills ===== */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.skill-card {
  padding: 20px; border: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; gap: 10px;
  position: relative; transition: all 0.3s;
}
.skill-card:hover { border-color: var(--accent); background: var(--panel-hover); transform: translateY(-5px); }
.skill-card .bar { height: 4px; background: rgba(255,255,255,0.1); width: 100%; margin-top: auto; position: relative; }
.skill-card .bar::after { content: ""; position: absolute; top: 0; left: 0; height: 100%; background: var(--accent); width: var(--lvl); }
.skill-card h4 { font-family: var(--font-mono); font-size: 1rem; color: var(--text); }
.skill-card small { color: var(--muted); font-size: 0.8rem; }

/* ===== Projects ===== */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.proj-card { min-height: 280px; display: flex; flex-direction: column; justify-content: space-between; }
.proj-card .num { font-family: var(--font-mono); color: var(--accent); font-size: 0.8rem; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 15px; }
.proj-card h3 { font-size: 1.5rem; margin-bottom: 10px; }
.proj-card .tags { display: flex; gap: 10px; margin-top: 20px; }
.proj-card .tag { font-family: var(--font-mono); font-size: 0.65rem; border: 1px solid var(--accent); color: var(--accent); padding: 3px 8px; text-transform: uppercase; }
.proj-card .go { margin-top: 20px; font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.proj-card:hover .go { color: var(--accent); text-shadow: 0 0 5px var(--accent); }

/* ===== Footer ===== */
footer { padding: 40px 0; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
footer .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; text-align: center; }

@media (max-width: 600px) {
  footer .wrap { flex-direction: column; justify-content: center; }
}

/* ===== Scroll reveal ===== */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.8s, transform 0.8s; }
.reveal.in { opacity: 1; transform: none; }

/* ============================================================
   ROVER SIMULATION — interactive 3D mode HUD
   ============================================================ */

/* When the simulation is live, the canvas becomes the foreground
   interactive surface and the page underneath is frozen. */
body.sim-active { overflow: hidden; }
body.sim-active #bg-canvas {
  z-index: 40; pointer-events: auto; cursor: none;
  background: #02040c;
}
/* Hide the page chrome + custom page cursor while piloting */
body.sim-active nav,
body.sim-active .scanline,
body.sim-active .grid-overlay,
body.sim-active .corners,
body.sim-active .cursor,
body.sim-active .cursor-ring { opacity: 0 !important; pointer-events: none; }

/* ---- Launch capsule injected into the hero ---- */
.sim-launch {
  font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.12em;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 14px 26px; cursor: pointer;
  color: #02040c; background: var(--accent);
  border: 1px solid var(--accent);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  box-shadow: 0 0 25px var(--accent-glow);
  animation: sim-pulse 2.4s ease-in-out infinite;
  position: relative; overflow: hidden;
}
.sim-launch:hover { background: #fff; border-color: #fff; box-shadow: 0 0 40px var(--accent); transform: translateY(-2px); }
.sim-launch .blip { width: 9px; height: 9px; border-radius: 50%; background: #02040c; box-shadow: 0 0 8px #02040c; animation: sim-blink 1s steps(2) infinite; }
@keyframes sim-pulse { 0%,100% { box-shadow: 0 0 18px var(--accent-glow); } 50% { box-shadow: 0 0 42px var(--accent); } }
@keyframes sim-blink { 0% { opacity: 1; } 50% { opacity: 0.2; } 100% { opacity: 1; } }

/* ---- HUD root ---- */
#sim-hud {
  position: fixed; inset: 0; z-index: 45; pointer-events: none;
  font-family: var(--font-mono); color: var(--accent);
  opacity: 0; transition: opacity 0.7s var(--ease);
  text-shadow: 0 0 10px rgba(0,243,255,0.5);
}
#sim-hud.show { opacity: 1; }
#sim-hud .hud-box {
  border: 1px solid var(--line); background: rgba(3,8,22,0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 12px 14px; font-size: 0.72rem; line-height: 1.6;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
#sim-hud .hud-box b { color: #fff; }
#sim-hud .hud-box .k { color: var(--muted); }

/* animated HUD framing brackets */
#sim-frame { position: fixed; inset: 0; z-index: 44; pointer-events: none; opacity: 0; transition: opacity 0.7s var(--ease); }
#sim-frame.show { opacity: 0.7; }
#sim-frame i { position: absolute; width: 46px; height: 46px; border: 2px solid var(--accent); }
#sim-frame i:nth-child(1) { top: 18px; left: 18px; border-right: 0; border-bottom: 0; }
#sim-frame i:nth-child(2) { top: 18px; right: 18px; border-left: 0; border-bottom: 0; }
#sim-frame i:nth-child(3) { bottom: 18px; left: 18px; border-right: 0; border-top: 0; }
#sim-frame i:nth-child(4) { bottom: 18px; right: 18px; border-left: 0; border-top: 0; }

/* status — top left */
#sim-status { position: absolute; top: 34px; left: 34px; min-width: 200px; }
#sim-status .row { display: flex; justify-content: space-between; gap: 18px; }
#sim-speedbar { height: 5px; background: rgba(0,243,255,0.12); margin-top: 8px; position: relative; }
#sim-speedbar i { position: absolute; left: 0; top: 0; height: 100%; width: 0%; background: var(--accent); box-shadow: 0 0 10px var(--accent); transition: width 0.1s linear; }

/* objectives — top right */
#sim-objectives { position: absolute; top: 34px; right: 34px; min-width: 210px; text-align: right; }
#sim-objectives .obj { display: flex; justify-content: space-between; gap: 12px; opacity: 0.45; transition: opacity 0.3s, color 0.3s; }
#sim-objectives .obj.done { opacity: 1; color: #00ff88; text-shadow: 0 0 10px rgba(0,255,136,0.6); }
#sim-objectives .obj .mark::before { content: "○ "; }
#sim-objectives .obj.done .mark::before { content: "◉ "; }

/* minimap — bottom right */
#sim-minimap { position: absolute; bottom: 34px; right: 34px; padding: 8px; }
#sim-map { display: block; width: 160px; height: 160px; }
#sim-minimap .cap { font-size: 0.6rem; color: var(--muted); letter-spacing: 0.2em; margin-bottom: 6px; }

/* controls hint + exit — bottom left */
#sim-foot { position: absolute; bottom: 34px; left: 34px; display: flex; flex-direction: column; gap: 10px; }
#sim-foot .keys { font-size: 0.68rem; color: var(--muted); }
#sim-foot .keys kbd {
  font-family: var(--font-mono); color: var(--accent); border: 1px solid var(--line);
  padding: 1px 7px; margin: 0 2px; background: rgba(0,243,255,0.06); border-radius: 3px; font-size: 0.66rem;
}
.sim-btn {
  pointer-events: auto; cursor: pointer; font-family: var(--font-mono); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent);
  border: 1px solid var(--accent); background: rgba(0,243,255,0.08);
  padding: 8px 16px; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
}
.sim-btn:hover { background: var(--accent); color: #02040c; box-shadow: 0 0 16px var(--accent-glow); }

/* center reticle */
#sim-reticle { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 26px; height: 26px; opacity: 0.5; }
#sim-reticle::before, #sim-reticle::after { content: ""; position: absolute; background: var(--accent); box-shadow: 0 0 6px var(--accent); }
#sim-reticle::before { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-50%); }
#sim-reticle::after { top: 50%; left: 0; height: 1px; width: 100%; transform: translateY(-50%); }

/* data panel — slides from right when near a node */
#sim-panel {
  position: absolute; top: 50%; right: 34px; transform: translateY(-50%) translateX(120%);
  width: min(360px, 78vw); pointer-events: auto;
  border: 1px solid var(--accent); background: rgba(3,8,22,0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 26px; transition: transform 0.5s var(--ease), border-color 0.4s;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  box-shadow: 0 0 50px rgba(0,243,255,0.15);
}
#sim-panel.show { transform: translateY(-50%) translateX(0); }
#sim-panel .pcode { font-size: 0.68rem; letter-spacing: 0.25em; color: var(--muted); }
#sim-panel h3 { font-family: var(--font-sans); font-size: 1.5rem; text-transform: uppercase; color: #fff; margin: 6px 0 14px; text-shadow: 0 0 14px var(--accent-glow); }
#sim-panel p { font-size: 0.82rem; color: var(--text); line-height: 1.6; margin-bottom: 10px; }
#sim-panel .pline { font-size: 0.78rem; color: var(--muted); padding-left: 14px; border-left: 2px solid var(--accent); margin: 6px 0; }
#sim-panel .ptags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
#sim-panel .ptags span { font-size: 0.6rem; border: 1px solid var(--accent); color: var(--accent); padding: 3px 8px; text-transform: uppercase; }
#sim-panel .pbtns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
#sim-panel .pbtn { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; padding: 9px 14px; border: 1px solid var(--accent); color: var(--accent); transition: all 0.2s; }
#sim-panel .pbtn:hover { background: var(--accent); color: #02040c; box-shadow: 0 0 16px var(--accent-glow); }
#sim-panel .pbar { height: 4px; background: rgba(0,243,255,0.12); margin: 8px 0 14px; }
#sim-panel .pbar i { display: block; height: 100%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* toast / mission messages */
#sim-toast {
  position: absolute; top: 22%; left: 50%; transform: translateX(-50%) scale(0.9);
  text-align: center; opacity: 0; transition: opacity 0.4s, transform 0.4s;
}
#sim-toast.show { opacity: 1; transform: translateX(-50%) scale(1); }
#sim-toast .big { font-family: var(--font-sans); font-size: clamp(1.6rem, 4vw, 2.8rem); font-weight: 700; text-transform: uppercase; color: #fff; text-shadow: 0 0 24px var(--accent); }
#sim-toast .sub { font-size: 0.78rem; color: var(--accent); letter-spacing: 0.2em; margin-top: 6px; }

/* mobile joystick */
#sim-stick { position: absolute; bottom: 30px; left: 30px; width: 130px; height: 130px; border-radius: 50%; border: 1px solid var(--line); background: rgba(0,243,255,0.05); pointer-events: auto; display: none; touch-action: none; }
#sim-stick i { position: absolute; top: 50%; left: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(0,243,255,0.25); border: 1px solid var(--accent); box-shadow: 0 0 16px var(--accent-glow); }
#sim-boost { position: absolute; bottom: 46px; right: 34px; width: 84px; height: 84px; border-radius: 50%; border: 1px solid var(--accent); background: rgba(0,243,255,0.08); color: var(--accent); font-family: var(--font-mono); font-size: 0.7rem; pointer-events: auto; display: none; }
body.sim-touch #sim-stick, body.sim-touch #sim-boost { display: block; }
body.sim-touch #sim-foot .keys, body.sim-touch #sim-reticle { display: none; }

@media (max-width: 768px) {
  #sim-status, #sim-objectives { min-width: 0; font-size: 0.62rem; top: 20px; }
  #sim-status { left: 20px; } #sim-objectives { right: 20px; }
  #sim-minimap { display: none; }
  #sim-panel { right: 50%; transform: translate(50%, -50%) translateY(140%); width: 88vw; top: auto; bottom: 0; }
  #sim-panel.show { transform: translate(50%, 0); bottom: 150px; }
}
