/* ============================================================
   VARUN GIDWANI — MATRIX PORTFOLIO — STYLES
   Palette: phosphor green on void black. The only two foreign
   hues on the whole site are the red/blue pills in the boot gate.
   ============================================================ */

:root {
  --bg: #020703;
  --panel: rgba(0, 255, 65, 0.035);
  --panel-deep: rgba(0, 255, 65, 0.015);
  --line: rgba(0, 255, 65, 0.22);
  --line-dim: rgba(0, 255, 65, 0.12);
  --matrix: #00ff41;
  --matrix-bright: #b4ffc8;
  --text: #a9d9b4;
  --text-dim: rgba(169, 217, 180, 0.55);
  --red: #ff4d4d;
  --blue: #5a95ff;
  --glow: 0 0 8px rgba(0, 255, 65, 0.55), 0 0 24px rgba(0, 255, 65, 0.25);
  --font-display: "VT323", monospace;
  --font-body: "Share Tech Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;
}

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

html { scroll-behavior: smooth; }
html.has-custom-cursor,
html.has-custom-cursor * { cursor: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  overflow-x: hidden;
}

::selection { background: var(--matrix); color: #000; }

a { color: var(--matrix); text-decoration: none; }
a:hover { color: var(--matrix-bright); text-shadow: var(--glow); }

:focus-visible {
  outline: 2px solid var(--matrix);
  outline-offset: 3px;
}

/* ---------- ambient layers ---------- */
#rain {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

/* content sits above the rain */
#topbar, main, footer { position: relative; z-index: 10; }

/* pre-boot: hide the site until the gate is passed */
body.pre-boot #topbar,
body.pre-boot main,
body.pre-boot footer { opacity: 0; }

body.booted #topbar,
body.booted main,
body.booted footer {
  opacity: 1;
  transition: opacity 900ms ease;
}

/* ============================================================
   BOOT GATE
   ============================================================ */
#boot {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1.5rem;
  background: rgba(2, 7, 3, 0.42);
  transition: opacity 700ms ease;
}
#boot.closing { opacity: 0; pointer-events: none; }
#boot.gone { display: none; }

#boot-log {
  font-family: var(--font-body);
  font-size: clamp(0.8rem, 2.2vw, 1rem);
  color: var(--matrix);
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.6);
  white-space: pre-wrap;
  min-height: 9.5em;
  width: min(640px, 92vw);
}

#pill-choice { text-align: center; }
#pill-choice.hidden { display: none; }

.pill-question {
  color: var(--text);
  margin-bottom: 1.4rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.pill-row {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.pill {
  font-family: var(--font-body);
  background: transparent;
  border-radius: 999px;
  padding: 0.9rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 230px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.pill-cap { font-size: 1.15rem; letter-spacing: 0.18em; }
.pill-sub { font-size: 0.72rem; opacity: 0.75; }

.pill--red { border: 1px solid var(--red); color: var(--red); }
.pill--red:hover, .pill--red:focus-visible {
  background: var(--red);
  color: #0a0000;
  box-shadow: 0 0 18px rgba(255, 77, 77, 0.55);
  transform: translateY(-2px);
}
.pill--blue { border: 1px solid var(--blue); color: var(--blue); }
.pill--blue:hover, .pill--blue:focus-visible {
  background: var(--blue);
  color: #000210;
  box-shadow: 0 0 18px rgba(90, 149, 255, 0.55);
  transform: translateY(-2px);
}

#boot-skip {
  position: absolute;
  bottom: 1.2rem;
  right: 1.4rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}
#boot-skip:hover { color: var(--matrix); text-shadow: var(--glow); }

/* ============================================================
   TOP BAR
   ============================================================ */
#topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.65rem 1.25rem;
  background: rgba(2, 7, 3, 0.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line-dim);
  font-size: 0.85rem;
}

.prompt { display: flex; align-items: center; white-space: nowrap; }
.prompt-user { color: var(--matrix); }
.prompt-path { color: var(--text-dim); }

#topbar nav {
  display: flex;
  gap: 1.1rem;
  overflow-x: auto;
  scrollbar-width: none;
}
#topbar nav::-webkit-scrollbar { display: none; }
#topbar nav a { color: var(--text-dim); white-space: nowrap; }
#topbar nav a:hover { color: var(--matrix-bright); }

.sys-clock {
  margin-left: auto;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* blinking caret */
.caret {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 2px;
  background: var(--matrix);
  animation: blink 1.05s steps(1) infinite;
  vertical-align: text-bottom;
}
.caret--thick { width: 0.6em; height: 1.1em; }
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   HERO
   ============================================================ */
main {
  width: min(1080px, 92vw);
  margin: 0 auto;
}

.hero {
  min-height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.35rem;
  padding: 4rem 0 3rem;
}

.eyebrow {
  color: var(--text-dim);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
}

#hero-name {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 11vw, 7.6rem);
  line-height: 0.92;
  color: var(--matrix);
  text-shadow: 0 0 12px rgba(0, 255, 65, 0.5), 0 0 42px rgba(0, 255, 65, 0.22);
  letter-spacing: 0.015em;
  position: relative;
}

/* occasional RGB-split glitch on the name */
.glitchable::before,
.glitchable::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.glitchable::before { color: #4dffe6; }
.glitchable::after { color: var(--red); }
body.booted .glitchable::before { animation: glitch-a 7s infinite steps(1); }
body.booted .glitchable::after  { animation: glitch-b 7s infinite steps(1); }
@keyframes glitch-a {
  0%, 92.9%, 96%, 100% { opacity: 0; transform: none; clip-path: none; }
  93% { opacity: 0.8; transform: translate(-6px, 2px); clip-path: inset(10% 0 55% 0); }
  94.5% { opacity: 0.8; transform: translate(5px, -2px); clip-path: inset(60% 0 15% 0); }
}
@keyframes glitch-b {
  0%, 93.4%, 96.5%, 100% { opacity: 0; transform: none; clip-path: none; }
  93.8% { opacity: 0.8; transform: translate(6px, 1px); clip-path: inset(45% 0 30% 0); }
  95.2% { opacity: 0.8; transform: translate(-5px, -1px); clip-path: inset(75% 0 2% 0); }
}

.hero-type {
  font-size: clamp(1rem, 2.6vw, 1.35rem);
  color: var(--matrix-bright);
  min-height: 1.6em;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.65rem 2rem;
  border: 1px solid var(--line-dim);
  background: var(--panel-deep);
  padding: 1rem 1.25rem;
  max-width: 720px;
}
.status-grid div { display: flex; gap: 0.7rem; align-items: baseline; }
.status-grid dt {
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  min-width: 92px;
}
.status-grid dd { font-size: 0.88rem; }

.hero-ctas { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.4rem; }

.btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--matrix);
  border: 1px solid var(--matrix);
  background: transparent;
  padding: 0.7rem 1.3rem;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.btn:hover, .btn:focus-visible {
  background: var(--matrix);
  color: #001505;
  box-shadow: var(--glow);
  text-shadow: none;
}
.btn--solid { background: rgba(0, 255, 65, 0.12); }

/* ============================================================
   PANELS (sections as terminal windows)
   ============================================================ */
.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel-deep));
  box-shadow: inset 0 0 40px rgba(0, 255, 65, 0.04);
  margin: 0 0 4.5rem;
  scroll-margin-top: 84px;
}

.panel-head {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.4rem;
  border-bottom: 1px dashed var(--line-dim);
}

.panel-path {
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.cmd {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  color: var(--matrix);
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.35);
}

.sub-cmd {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--matrix);
  margin: 2rem 0 0.9rem;
}

.panel-body { padding: 1.6rem 1.4rem 2rem; }

/* placeholder highlighting — easy to spot, easy to replace */
.ph {
  color: var(--text-dim);
  font-style: italic;
  border: 1px dashed rgba(0, 255, 65, 0.4);
  padding: 0.05em 0.4em;
  background: rgba(0, 255, 65, 0.04);
}

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: start;
}

.ascii-avatar {
  font-size: 0.55rem;
  line-height: 1.05;
  white-space: pre;
  color: var(--matrix);
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.45);
  border: 1px solid var(--line-dim);
  padding: 0.9rem;
  background: rgba(0, 0, 0, 0.35);
  user-select: none;
}

.bio { max-width: 62ch; margin-bottom: 1.4rem; }

.facts div {
  display: flex;
  gap: 1rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line-dim);
  align-items: baseline;
}
.facts dt {
  min-width: 120px;
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}
.facts dd { font-size: 0.9rem; }

/* ---------- experience ---------- */
.xp {
  position: relative;
  padding: 0 0 2.2rem 1.75rem;
  border-left: 1px solid var(--line);
  margin-left: 0.4rem;
}
.xp:last-child { padding-bottom: 0.4rem; }
.xp::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 6px;
  width: 9px;
  height: 9px;
  background: var(--bg);
  border: 1px solid var(--matrix);
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.7);
}

.xp-head { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: baseline; }
.xp-role { font-size: 1.05rem; color: var(--matrix-bright); }
.xp-org { color: var(--matrix); }
.xp-meta { color: var(--text-dim); font-size: 0.8rem; }

.xp ul { margin: 0.7rem 0 0.8rem 1.1rem; }
.xp li { margin-bottom: 0.35rem; }
.xp li::marker { content: "▸ "; color: var(--matrix); }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tag {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  border: 1px solid var(--line-dim);
  padding: 0.15rem 0.55rem;
}

/* ---------- projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}

.project {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  padding: 1.2rem 1.2rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.project:hover {
  transform: translateY(-4px);
  border-color: var(--matrix);
  box-shadow: 0 0 22px rgba(0, 255, 65, 0.18), inset 0 0 30px rgba(0, 255, 65, 0.05);
}

.project-top { display: flex; justify-content: space-between; gap: 0.8rem; align-items: baseline; }
.project h3 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--matrix);
  letter-spacing: 0.03em;
}
.project-date { color: var(--text-dim); font-size: 0.75rem; white-space: nowrap; }
.project-sub { color: var(--matrix-bright); font-size: 0.85rem; }
.project-desc { font-size: 0.88rem; flex: 1; }

.project-links { display: flex; gap: 1.1rem; font-size: 0.8rem; }

/* ---------- skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
}

.skill-group {
  border: 1px solid var(--line-dim);
  padding: 1rem 1.1rem 1.2rem;
  background: rgba(0, 0, 0, 0.3);
}
.skill-group h3 {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  margin-bottom: 0.85rem;
}
.skill-group h3::before { content: "[ "; color: var(--matrix); }
.skill-group h3::after { content: " ]"; color: var(--matrix); }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  font-size: 0.8rem;
  border: 1px solid var(--line);
  padding: 0.28rem 0.7rem;
  color: var(--text);
  transition: all 140ms ease;
}
.chip:hover {
  color: #001505;
  background: var(--matrix);
  box-shadow: var(--glow);
}

/* ---------- education ---------- */
.edu-line { font-size: 1.02rem; color: var(--matrix-bright); }
.edu-meta { color: var(--text-dim); margin-bottom: 1rem; }

.course-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.cert-list { list-style: none; }
.cert-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line-dim);
  font-size: 0.9rem;
}
.cert-list .cert-date { color: var(--text-dim); white-space: nowrap; }

/* ---------- contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.4rem;
}

#contact-form { display: flex; flex-direction: column; gap: 0.45rem; }
#contact-form label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  margin-top: 0.7rem;
}
#contact-form input,
#contact-form textarea {
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--matrix-bright);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line);
  padding: 0.65rem 0.8rem;
  resize: vertical;
}
#contact-form input::placeholder,
#contact-form textarea::placeholder { color: rgba(169, 217, 180, 0.3); }
#contact-form input:focus,
#contact-form textarea:focus {
  outline: none;
  border-color: var(--matrix);
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.25);
}
#contact-form button { margin-top: 1.1rem; align-self: flex-start; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

#form-status { font-size: 0.82rem; min-height: 1.4em; color: var(--matrix); }
#form-status.err { color: var(--red); }

.direct-lines ul { list-style: none; }
.direct-lines li {
  padding: 0.55rem 0;
  border-top: 1px solid var(--line-dim);
  font-size: 0.9rem;
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
}
.direct-lines .dl-label {
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  min-width: 82px;
}
.direct-lines .hint { margin-top: 1.2rem; font-size: 0.78rem; color: var(--text-dim); }
.direct-lines code { color: var(--matrix); }

/* ---------- footer ---------- */
footer {
  width: min(1080px, 92vw);
  margin: 0 auto;
  padding: 2.2rem 0 2.8rem;
  border-top: 1px solid var(--line-dim);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-dim);
}
#visitor-line { color: var(--matrix); text-shadow: 0 0 8px rgba(0, 255, 65, 0.35); }

/* ============================================================
   CUSTOM CURSOR — phosphor crosshair
   ============================================================ */
#cursor-dot, #cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
}
html.has-custom-cursor #cursor-dot,
html.has-custom-cursor #cursor-ring { opacity: 1; }

#cursor-dot {
  width: 5px; height: 5px;
  background: var(--matrix-bright);
  box-shadow: 0 0 8px var(--matrix), 0 0 20px rgba(0, 255, 65, 0.6);
  transform: translate(-50%, -50%);
}

#cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid rgba(0, 255, 65, 0.7);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 180ms ease, height 180ms ease, border-radius 180ms ease,
              border-color 180ms ease, background 180ms ease;
}
/* crosshair ticks on the ring */
#cursor-ring::before, #cursor-ring::after {
  content: "";
  position: absolute;
  background: rgba(0, 255, 65, 0.7);
  transition: opacity 180ms ease;
}
#cursor-ring::before { /* horizontal ticks */
  top: 50%; left: -7px; right: -7px; height: 1px;
  transform: translateY(-50%);
  clip-path: polygon(0 0, 22% 0, 22% 100%, 0 100%, 0 0, 78% 0, 100% 0, 100% 100%, 78% 100%);
}
#cursor-ring::after { /* vertical ticks */
  left: 50%; top: -7px; bottom: -7px; width: 1px;
  transform: translateX(-50%);
  clip-path: polygon(0 0, 100% 0, 100% 22%, 0 22%, 0 78%, 100% 78%, 100% 100%, 0 100%);
}

/* hover state: ring becomes target brackets */
#cursor-ring.hover {
  width: 46px; height: 46px;
  border-radius: 4px;
  border-color: var(--matrix);
  background: rgba(0, 255, 65, 0.07);
  box-shadow: 0 0 16px rgba(0, 255, 65, 0.35);
}
#cursor-ring.clicking { transform: translate(-50%, -50%) scale(0.82); }

/* fading glyph trail */
.cursor-glyph {
  position: fixed;
  z-index: 9998;
  pointer-events: none;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--matrix);
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.8);
  animation: glyph-fade 700ms ease-out forwards;
}
@keyframes glyph-fade {
  to { opacity: 0; transform: translateY(14px); }
}

/* click ripple */
.cursor-ripple {
  position: fixed;
  z-index: 9998;
  pointer-events: none;
  width: 8px; height: 8px;
  border: 1px solid var(--matrix);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ripple 500ms ease-out forwards;
}
@keyframes ripple {
  to { width: 64px; height: 64px; opacity: 0; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; }
  .ascii-avatar { justify-self: center; }
  .contact-grid { grid-template-columns: 1fr; }
  .panel-head { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  .sys-clock { display: none; }
  footer { flex-direction: column; }
}

/* ============================================================
   REDUCED MOTION — calm everything down
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caret, .glitchable::before, .glitchable::after { animation: none !important; }
  .glitchable::before, .glitchable::after { opacity: 0 !important; }
  .project, .pill, .btn, .chip { transition: none; }
}
