/* ============================================================
   Vraj Patel — Portfolio v1.1
   Minimal. Arc-reactor lit: deep navy, cyan-white light, gold accent.
   ============================================================ */

:root {
  --bg: #04070d;
  --panel: rgba(10, 22, 36, 0.62);
  --line: rgba(77, 232, 255, 0.16);
  --line-strong: rgba(77, 232, 255, 0.42);
  --cyan: #4de8ff;
  --cyan-deep: #14a3c2;
  --gold: #ffb454;
  --text: #e8f7fb;
  --muted: #7f98a6;
  --glow: 0 0 24px rgba(77, 232, 255, 0.35);
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --gutter: clamp(20px, 5vw, 64px);
  --max: 1100px;
  --bar: 42px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 17px; line-height: 1.65;
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
.mono { font-family: var(--mono); letter-spacing: 0.1em; font-size: 0.74rem; text-transform: uppercase; }
::selection { background: var(--cyan); color: #04141a; }

/* ---------- Background ---------- */
#embers { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
  background:
    radial-gradient(ellipse 70% 55% at 78% 22%, rgba(20, 163, 194, 0.2), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, #000 20%, transparent 85%);
          mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, #000 20%, transparent 85%);
}
.cursor-glow {
  position: fixed; top: 0; left: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px;
  z-index: 0; pointer-events: none; border-radius: 50%; will-change: transform;
  background: radial-gradient(circle, rgba(77, 232, 255, 0.09), transparent 65%);
}
main, .footer, .nav { position: relative; z-index: 1; }

/* ---------- Nav ---------- */
/* ---------- Top bar: LinkedIn ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: var(--bar);
  display: flex; align-items: center; justify-content: center; gap: 14px; padding: 0 var(--gutter);
  background: linear-gradient(90deg, rgba(20, 163, 194, 0.28), rgba(77, 232, 255, 0.16), rgba(20, 163, 194, 0.28));
  border-bottom: 1px solid var(--line-strong);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font-size: 0.86rem; color: #d6f4fa; transition: background 0.25s;
}
.topbar:hover { background: linear-gradient(90deg, rgba(20, 163, 194, 0.42), rgba(77, 232, 255, 0.28), rgba(20, 163, 194, 0.42)); }
.topbar-cta { flex: none; padding: 3px 12px; border-radius: 999px; background: var(--cyan); color: #03151b; font-weight: 600; white-space: nowrap; box-shadow: 0 0 14px rgba(77, 232, 255, 0.5); }
.topbar-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav {
  position: fixed; top: var(--bar); left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px var(--gutter); border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}
.nav.scrolled {
  background: rgba(4, 7, 13, 0.75); border-color: var(--line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.brand { font-weight: 700; letter-spacing: 0.14em; font-size: 0.95rem; }
.brand b { color: var(--cyan); }
.nav-links { display: flex; gap: 4px; }
.nav-links a { padding: 8px 14px; font-size: 0.92rem; color: var(--muted); transition: color 0.25s; }
.nav-links a:hover { color: var(--cyan); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh; max-width: var(--max); margin: 0 auto;
  padding: 150px var(--gutter) 60px;
  display: grid; grid-template-columns: 1.05fr 0.95fr; align-items: center; gap: 40px;
}
.eyebrow { color: var(--cyan); display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.pulse-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan);
  animation: ping 2s infinite;
}
.hero h1 {
  font-size: clamp(3.8rem, 10vw, 7.6rem); font-weight: 700; line-height: 0.92; letter-spacing: -0.045em;
  background: linear-gradient(180deg, #fff 30%, #9fefff 70%, var(--cyan-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 28px rgba(77, 232, 255, 0.28));
}
.hero h1 em { font-style: normal; -webkit-text-fill-color: var(--cyan); }
.role { margin-top: 24px; font-size: clamp(1.05rem, 2vw, 1.3rem); color: #e1eef2; line-height: 1.5; }
.role span { color: var(--muted); font-size: 0.9em; }

.interests { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.interests .label { color: var(--muted); }
.interests ul { display: flex; flex-wrap: wrap; gap: 8px; }
.interests li {
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 0.88rem; color: #cfe5ec; background: rgba(77, 232, 255, 0.04);
}

.hero-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.btn {
  display: inline-flex; align-items: center; padding: 13px 24px; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s;
}
.btn-primary { background: var(--cyan); color: #03151b; box-shadow: var(--glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 36px rgba(77, 232, 255, 0.6); }
.btn-ghost { border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: rgba(77, 232, 255, 0.08); transform: translateY(-2px); box-shadow: var(--glow); }

/* ---------- Arc reactor ---------- */
.hero-reactor { position: relative; aspect-ratio: 1; width: min(100%, 500px); justify-self: center; }
.reactor-halo {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(70, 190, 255, 0.55), rgba(40, 130, 230, 0.16) 52%, transparent 72%);
  filter: blur(34px); /* opacity driven by flicker() in main.js */
}
.reactor { position: relative; width: 100%; height: 100%; overflow: visible; transition: transform 0.25s ease-out; }
.reactor .lit { animation: powerOn 2.2s ease-out both; }

/* ---------- Sections ---------- */
.section { max-width: var(--max); margin: 0 auto; padding: clamp(64px, 10vw, 110px) var(--gutter) 0; }
.section-head { margin-bottom: 28px; }
.tag { color: var(--cyan); display: inline-flex; align-items: center; gap: 12px; }
.tag::after { content: ""; width: 60px; height: 1px; background: var(--line-strong); }

.hl, .project, .stack, .find-card {
  position: relative; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.tilt::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(77, 232, 255, 0.14), transparent 60%);
}
.tilt:hover { border-color: var(--line-strong); box-shadow: 0 0 40px rgba(77, 232, 255, 0.08); }
.tilt:hover::before { opacity: 1; }

/* Highlights */
.highlights { display: grid; grid-template-columns: 1fr; gap: 18px; }
.hl { padding: 30px; }
.hl-gold { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 32px; align-items: center; }

.hl-job { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.job-logo { flex: none; width: clamp(110px, 16vw, 170px); height: auto; border-radius: 4px; box-shadow: 0 0 30px rgba(0, 73, 144, 0.55); }

/* 3D reactor canvas (replaces the SVG once WebGL is up) */
.reactor3d {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.8s ease;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 52%, transparent 71%);
          mask-image: radial-gradient(circle at 50% 50%, #000 52%, transparent 71%);
}
.hero-reactor.gl-ready .reactor3d { opacity: 1; }
/* SVG reactor is only a fallback: hidden by default so it never flashes before the 3D one loads */
.reactor { opacity: 0; }
.hero-reactor.gl-failed .reactor { opacity: 1; transition: opacity 0.6s ease; }
.hero-reactor.gl-ready .reactor { display: none; }

/* SIH photo gallery */
.gallery { display: grid; grid-template-columns: 1fr 1.35fr; grid-template-rows: 1fr 1fr; gap: 10px; aspect-ratio: 1.45; }
.shot { padding: 0; border: 1px solid rgba(255, 180, 84, 0.3); border-radius: 12px; overflow: hidden; cursor: zoom-in; background: #0a1520; transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s ease; }
.shot:hover { border-color: var(--gold); box-shadow: 0 0 24px rgba(255, 180, 84, 0.25); }
.shot:hover img { transform: scale(1.05); }
.s-portrait { grid-row: 1 / 3; }
.s-portrait img { object-position: 50% 30%; }

.lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: rgba(2, 5, 9, 0.9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; cursor: zoom-out; }
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox img { max-width: min(1100px, 94vw); max-height: 88vh; border-radius: 12px; box-shadow: 0 0 60px rgba(77, 232, 255, 0.2); }
.hl .kicker { color: var(--cyan); display: block; margin-bottom: 14px; }
.hl h3 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); letter-spacing: -0.02em; line-height: 1.2; }
.hl p { margin-top: 12px; color: #b8cdd6; font-size: 0.98rem; }
.hl-gold { border-color: rgba(255, 180, 84, 0.4); background: linear-gradient(135deg, rgba(255, 180, 84, 0.1), rgba(10, 22, 36, 0.62) 60%); }
.hl-gold .kicker { color: var(--gold); }
.hl-gold:hover { border-color: rgba(255, 180, 84, 0.7); box-shadow: 0 0 40px rgba(255, 180, 84, 0.1); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chips span {
  padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 0.86rem; color: #cfe5ec; background: rgba(77, 232, 255, 0.04);
  transition: border-color 0.25s, color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.chips span:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 14px rgba(77, 232, 255, 0.3); transform: translateY(-2px); }
.chips.small span { font-size: 0.78rem; padding: 4px 11px; color: var(--muted); }

/* Projects */
.project { padding: clamp(24px, 4vw, 38px); margin-bottom: 18px; }
.project.featured { border-color: rgba(255, 180, 84, 0.35); background: linear-gradient(135deg, rgba(255, 180, 84, 0.07), rgba(10, 22, 36, 0.62) 55%); }
.project.featured:hover { border-color: rgba(255, 180, 84, 0.65); }
.project-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.date { color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; font: 500 0.74rem var(--mono); border: 1px solid var(--line-strong); color: var(--cyan); }
.badge.gold { color: var(--gold); border-color: rgba(255, 180, 84, 0.5); background: rgba(255, 180, 84, 0.08); }
.project h3 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.03em; line-height: 1.1; }
.project .sub { color: var(--cyan); font-weight: 500; margin: 2px 0 12px; }
.project > p:not(.sub) { max-width: 640px; color: #b8cdd6; font-size: 0.98rem; }
.metrics { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.metrics li { padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 0.85rem; background: rgba(4, 7, 13, 0.4); }
.metrics b { color: var(--text); font-weight: 600; font-size: 1rem; margin-right: 4px; }
.project-links { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 22px; }
.project-links a { color: var(--cyan); font-weight: 500; border-bottom: 1px solid transparent; transition: border-color 0.25s; }
.project-links a:hover { border-color: var(--cyan); }

/* Stack */
.stack-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { padding: 24px; }
.stack h3 { color: var(--cyan); font-weight: 500; margin-bottom: 14px; }

/* Find me */
.find-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.find-card { display: flex; flex-direction: column; gap: 6px; padding: 26px; }
.find-card .mono { color: var(--muted); }
.find-card strong { font-size: 1.6rem; letter-spacing: -0.02em; }
.find-card i { position: absolute; right: 22px; top: 20px; font-style: normal; color: var(--cyan); font-size: 1.3rem; transition: transform 0.25s; }
.find-card:hover i { transform: translate(3px, -3px); }
.find { padding-bottom: 0; }

/* Coming soon */
.soon { padding-bottom: 110px; }
.soon-card {
  position: relative; overflow: hidden; text-align: center;
  padding: clamp(36px, 7vw, 72px) clamp(22px, 5vw, 60px);
  border: 1px solid var(--line-strong); border-radius: 24px;
  background: radial-gradient(ellipse 70% 90% at 50% 0%, rgba(20, 163, 194, 0.22), var(--panel) 70%);
}
.soon-card .tag { margin-bottom: 18px; }
.soon-card .tag::after { display: none; }
.soon-card h2 { font-size: clamp(1.9rem, 5vw, 3.2rem); letter-spacing: -0.03em; line-height: 1.1; font-weight: 700; }
.glow-text { color: var(--cyan); text-shadow: 0 0 30px rgba(77, 232, 255, 0.5); }
.soon-card p { max-width: 560px; margin: 20px auto 0; color: #b8cdd6; }
.charge { position: relative; width: min(320px, 70%); height: 6px; margin: 32px auto; border-radius: 99px; background: rgba(77, 232, 255, 0.12); overflow: hidden; }
.charge i { position: absolute; inset: 0 auto 0 0; width: 38%; border-radius: 99px; background: linear-gradient(90deg, var(--cyan-deep), var(--cyan), #e6fdff); box-shadow: 0 0 14px var(--cyan); animation: charge 2.6s ease-in-out infinite; }

.footer { display: flex; justify-content: space-between; gap: 10px; padding: 24px var(--gutter); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.68rem; }

/* ---------- Reveal / tilt ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.8s cubic-bezier(.2,.7,.2,1), transform 0.8s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }
.reveal.in.tilt {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.15s ease-out, border-color 0.3s, box-shadow 0.3s; transition-delay: 0s;
}

/* ---------- Keyframes ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(77, 232, 255, 0.7); } 70%, 100% { box-shadow: 0 0 0 10px rgba(77, 232, 255, 0); } }
@keyframes charge { 0% { transform: translateX(-100%); } 55%, 100% { transform: translateX(270%); } }
@keyframes powerOn {
  0% { opacity: 0; } 8% { opacity: 0.9; } 12% { opacity: 0.15; } 22% { opacity: 1; }
  28% { opacity: 0.35; } 40% { opacity: 1; } 46% { opacity: 0.6; } 55%, 100% { opacity: 1; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 130px; gap: 20px; }
  .hero-reactor { order: -1; width: min(76%, 340px); }
  .stack-grid, .find-grid, .hl-gold { grid-template-columns: 1fr; }
  .cursor-glow { display: none; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .nav-links a:first-child { display: none; }
  .topbar { font-size: 0.78rem; gap: 10px; justify-content: space-between; }
  .topbar .long { display: none; }
  .gallery { aspect-ratio: 1.05; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
