/* ============================================================
   achalkansal.com — terminal-flavoured portfolio
   ============================================================ */

:root {
  --bg: #07090d;
  --bg-2: #0c1017;
  --panel: rgba(16, 21, 30, 0.72);
  --line: rgba(120, 255, 190, 0.12);
  --text: #c9d3e0;
  --muted: #7d8899;
  --white: #eef3f9;
  --accent: #39ff9f;      /* phosphor green */
  --accent-2: #5ec8ff;    /* cyan */
  --accent-3: #c792ff;    /* violet */
  --warn: #ffcc66;
  --danger: #ff6b81;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Space Grotesk", system-ui, -apple-system, Segoe UI, sans-serif;
  --radius: 14px;
  --maxw: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.booting { overflow: hidden; }
::selection { background: var(--accent); color: var(--bg); }
a { color: var(--accent); text-decoration: none; }
strong, b { color: var(--white); font-weight: 600; }
code, .mono { font-family: var(--mono); }
code { color: var(--accent); font-size: 0.9em; }
.accent { color: var(--accent); }

/* ---------- background layers ---------- */
#bg { position: fixed; inset: 0; z-index: -2; width: 100%; height: 100%; }
.cursor-glow {
  position: fixed; z-index: -1; pointer-events: none;
  width: 600px; height: 600px; border-radius: 50%;
  left: 0; top: 0; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(57,255,159,0.07), transparent 60%);
  transition: opacity .3s;
}
.scanlines {
  position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.018) 0 1px, transparent 1px 3px);
}
.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%; z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transform-origin: 0 50%; transform: scaleX(0);
  box-shadow: 0 0 12px var(--accent);
}

/* ---------- boot screen ---------- */
#boot {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; align-items: flex-end;
  padding: 24px;
  transition: opacity .6s ease, visibility .6s;
}
#boot.done { opacity: 0; visibility: hidden; }
#boot-log {
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  margin: 0; white-space: pre-wrap; line-height: 1.55;
  text-shadow: 0 0 6px rgba(57,255,159,.5);
}
#boot-log .ok { color: var(--accent); }
#boot-log .dim { color: var(--muted); }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 48px);
  transition: background .3s, padding .3s, border-color .3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(7, 9, 13, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: var(--line);
  padding-top: 12px; padding-bottom: 12px;
}
.logo { font-family: var(--mono); font-weight: 700; color: var(--white); font-size: 18px; }
.blink { animation: blink 1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.links { display: flex; gap: 28px; }
.links a {
  font-family: var(--mono); font-size: 13.5px; color: var(--text);
  position: relative; padding: 4px 0;
}
.links a i { font-style: normal; color: var(--accent); margin-right: 4px; }
.links a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .3s;
}
.links a:hover::after, .links a.active::after { transform: scaleX(1); transform-origin: left; }
.links a.active { color: var(--white); }
.menu-btn { display: none; }

/* ---------- layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.section { padding: 120px 0 40px; }
.section-title {
  font-family: var(--mono); font-size: clamp(22px, 3vw, 30px); color: var(--white);
  display: flex; align-items: center; gap: 14px; margin: 0 0 12px; white-space: nowrap;
}
.section-title .num { color: var(--accent); font-size: .75em; }
.section-title::after {
  content: ""; height: 1px; flex: 1; max-width: 320px;
  background: linear-gradient(90deg, var(--line), transparent);
}
.section-title.center { justify-content: center; }
.section-title.center::after { display: none; }
.section-sub { color: var(--muted); margin: 0 0 32px; }

/* ---------- hero ---------- */
.hero {
  min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center;
  padding-top: 90px; position: relative;
}
.eyebrow { color: var(--accent); margin: 0 0 8px; font-size: 15px; }
h1 {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(48px, 8vw, 96px); line-height: 1; margin: 0 0 18px;
  color: var(--white); letter-spacing: -0.03em;
}
.role { font-size: clamp(20px, 2.6vw, 30px); color: var(--muted); margin: 0 0 22px; font-weight: 500; min-height: 1.4em; }
.caret { color: var(--accent); animation: blink 1s steps(1) infinite; margin-left: 2px; }
.lede { max-width: 540px; color: var(--text); margin: 0 0 34px; }
.cta { display: flex; gap: 14px; flex-wrap: wrap; }

/* glitch */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none;
  opacity: 0;
}
.glitch::before { color: var(--accent-2); }
.glitch::after { color: var(--danger); }
.glitch.on::before { animation: g1 .35s steps(2); }
.glitch.on::after  { animation: g2 .35s steps(2); }
@keyframes g1 {
  0% { opacity: .8; clip-path: inset(10% 0 70% 0); transform: translate(-4px, -2px); }
  50% { clip-path: inset(55% 0 20% 0); transform: translate(4px, 1px); }
  100% { opacity: .8; clip-path: inset(30% 0 50% 0); transform: translate(-2px, 2px); }
}
@keyframes g2 {
  0% { opacity: .8; clip-path: inset(65% 0 10% 0); transform: translate(4px, 2px); }
  50% { clip-path: inset(15% 0 60% 0); transform: translate(-4px, -1px); }
  100% { opacity: .8; clip-path: inset(45% 0 35% 0); transform: translate(2px, -2px); }
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 14.5px; padding: 13px 22px; border-radius: 10px;
  border: 1px solid var(--accent); transition: background .25s, color .25s, box-shadow .25s, transform .2s;
  will-change: transform;
}
.btn.primary { background: var(--accent); color: var(--bg); font-weight: 700; }
.btn.primary:hover { box-shadow: 0 0 0 4px rgba(57,255,159,.15), 0 0 30px rgba(57,255,159,.45); }
.btn.ghost { color: var(--accent); background: rgba(57,255,159,.04); }
.btn.ghost:hover { background: rgba(57,255,159,.12); }

.scroll-hint {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  color: var(--muted); font-size: 12px; animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translate(-50%, 6px); } }

/* ---------- windows (terminal / code cards) ---------- */
.window {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.02) inset;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform .2s ease-out, box-shadow .3s;
}
.window-bar {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); background: rgba(255,255,255,.02);
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.r { background: #ff5f57; } .dot.y { background: #febc2e; } .dot.g { background: #28c840; }
.window-title { margin-left: 10px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.window-body { margin: 0; padding: 20px 22px; font-size: 13.5px; line-height: 1.7; color: var(--text); overflow-x: auto; }

.hero-term .window-body { min-height: 300px; white-space: pre-wrap; }
.hero-term .p { color: var(--accent); }
.hero-term .c { color: var(--white); }
.hero-term .o { color: var(--muted); }
.hero-term .k { color: var(--accent-2); }

/* syntax colours */
.kw { color: var(--accent-3); }
.ty { color: var(--accent-2); }
.st { color: var(--accent); }
.fn { color: var(--warn); }
.an { color: var(--danger); }
.cm { color: var(--muted); font-style: italic; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.about-text p { margin: 0 0 18px; }
.stats { display: flex; gap: 34px; margin-top: 28px; flex-wrap: wrap; }
.stat b { display: block; font-family: var(--mono); font-size: 36px; color: var(--accent); line-height: 1.1; text-shadow: 0 0 18px rgba(57,255,159,.35); }
.stat span { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.code .window-body { font-size: 13px; }

.skills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 56px; }
.skill-group {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  background: rgba(255,255,255,.015); transition: border-color .3s, transform .3s;
}
.skill-group:hover { border-color: rgba(57,255,159,.4); transform: translateY(-3px); }
.skill-group h3 { margin: 0 0 10px; font-size: 13px; color: var(--accent); font-weight: 500; }
.skill-group h3::before { content: "./"; color: var(--muted); }
.skill-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.skill-group li {
  font-family: var(--mono); font-size: 12px; padding: 4px 9px; border-radius: 6px;
  background: rgba(94,200,255,.07); color: var(--text); border: 1px solid rgba(94,200,255,.12);
}

/* ---------- git log ---------- */
.gitlog { list-style: none; margin: 32px 0 0; padding: 0; }
.commit { display: grid; grid-template-columns: 34px 1fr; gap: 18px; position: relative; }
.graph { position: relative; display: flex; justify-content: center; }
.graph::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(var(--accent), var(--accent-2));
  opacity: .5;
}
.commit:last-child .graph::before { bottom: auto; height: 22px; }
.node {
  position: relative; z-index: 1; margin-top: 8px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent-2);
}
.node.head { border-color: var(--accent); box-shadow: 0 0 0 5px rgba(57,255,159,.15), 0 0 20px var(--accent); animation: pulse 2s infinite; }
.node.tag { border-color: var(--accent-3); border-radius: 4px; transform: rotate(45deg); }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(57,255,159,0), 0 0 30px var(--accent); } }
.commit-body {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 20px 24px; margin-bottom: 22px; transition: border-color .3s, transform .3s;
}
.commit-body:hover { border-color: rgba(57,255,159,.35); transform: translateX(4px); }
.meta { margin: 0 0 4px; font-size: 13px; }
.hash { color: var(--warn); }
.ref { color: var(--accent); font-weight: 700; }
.date { color: var(--muted); }
.commit h3 { margin: 0 0 10px; color: var(--white); font-size: 21px; font-weight: 600; }
.commit h3 .at { color: var(--accent); font-weight: 500; }
.commit ul { margin: 0; padding-left: 0; list-style: none; }
.commit li { position: relative; padding-left: 22px; margin-bottom: 8px; font-size: 15.5px; }
.commit li::before { content: "+"; position: absolute; left: 2px; color: var(--accent); font-family: var(--mono); font-weight: 700; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; font-size: 12px; }
.tags span { color: var(--accent-2); }
.tags span::before { content: "#"; color: var(--muted); }

/* ---------- projects ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.filters button {
  font-family: var(--mono); font-size: 13px; cursor: pointer;
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 8px; transition: all .2s;
}
.filters button::before { content: "--"; opacity: .5; }
.filters button:hover { color: var(--white); border-color: rgba(57,255,159,.4); }
.filters button.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.filters button.active::before { opacity: .7; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.project {
  position: relative; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 24px; min-height: 230px; overflow: hidden;
  transition: border-color .3s, transform .25s ease-out, opacity .35s, box-shadow .3s;
  transform-style: preserve-3d;
}
.project::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(57,255,159,.12), transparent 40%);
}
.project:hover { border-color: rgba(57,255,159,.45); box-shadow: 0 20px 50px -20px rgba(57,255,159,.25); }
.project:hover::before { opacity: 1; }
.project.hide { display: none; }
.project.enter { animation: cardIn .45s ease both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.project-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.project-icon {
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  border: 1px solid rgba(57,255,159,.3); border-radius: 8px; padding: 3px 9px;
}
.project-links { display: flex; gap: 12px; }
.project-links a { color: var(--muted); transition: color .2s; display: inline-flex; }
.project-links a:hover { color: var(--accent); }
.project-links svg { width: 20px; height: 20px; fill: currentColor; }
.project h3 { margin: 0 0 8px; color: var(--white); font-size: 20px; font-weight: 600; }
.project p { margin: 0 0 16px; font-size: 15px; color: var(--text); flex: 1; }
.project .tags { margin-top: auto; font-size: 11.5px; }
.badge { font-family: var(--mono); font-size: 11px; color: var(--warn); }
.more { margin-top: 30px; text-align: center; }

/* ---------- interactive terminal ---------- */
.term { max-width: 860px; cursor: text; }
.term .window-body { height: 380px; overflow-y: auto; padding-bottom: 6px; white-space: pre-wrap; word-break: break-word; }
.term-input { display: flex; align-items: center; gap: 10px; padding: 0 22px 18px; font-size: 13.5px; }
.prompt { color: var(--accent); white-space: nowrap; }
.term-input input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0;
  color: var(--white); font: inherit; caret-color: var(--accent);
}
#term-out .cmd { color: var(--white); }
#term-out .cmd::before { content: "guest@achalkansal:~$ "; color: var(--accent); }
#term-out .err { color: var(--danger); }
#term-out .ok { color: var(--accent); }
#term-out .dim { color: var(--muted); }
#term-out .hl { color: var(--accent-2); }
#term-out a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- contact ---------- */
.contact { text-align: center; padding-bottom: 80px; }
.contact .big { font-size: clamp(40px, 6vw, 64px); color: var(--white); margin: 8px 0 14px; line-height: 1.05; letter-spacing: -0.02em; }
.contact p { max-width: 560px; margin: 0 auto 34px; color: var(--text); }
.big-btn { font-size: 16px; padding: 16px 28px; }
.socials { display: flex; justify-content: center; gap: 22px; margin-top: 40px; }
.socials a { color: var(--muted); transition: color .2s, transform .2s; display: inline-flex; }
.socials a:hover { color: var(--accent); transform: translateY(-3px); }
.socials svg { width: 24px; height: 24px; fill: currentColor; }

footer { text-align: center; padding: 30px 16px 40px; color: var(--muted); font-size: 12.5px; }
footer p { margin: 4px 0; }
footer .hint { opacity: .45; }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- matrix easter egg ---------- */
#matrix { position: fixed; inset: 0; z-index: 150; pointer-events: none; opacity: 0; transition: opacity .6s; width: 100%; height: 100%; }
#matrix.on { opacity: .9; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding-top: 110px; padding-bottom: 80px; }
  .hero-term .window-body { min-height: 240px; }
  .about-grid { grid-template-columns: 1fr; }
  .skills { grid-template-columns: repeat(2, 1fr); }
  .scroll-hint { display: none; }

  .menu-btn {
    display: flex; flex-direction: column; gap: 6px; z-index: 70;
    background: none; border: 0; padding: 8px; cursor: pointer;
  }
  .menu-btn span { width: 26px; height: 2px; background: var(--accent); transition: transform .3s; }
  .menu-btn[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] span:last-child  { transform: translateY(-4px) rotate(-45deg); }
  .links {
    position: fixed; inset: 0; z-index: 60; flex-direction: column; justify-content: center; align-items: center; gap: 30px;
    background: rgba(7,9,13,.97); backdrop-filter: blur(10px);
    opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
  }
  .links.open { opacity: 1; visibility: visible; }
  .links a { font-size: 18px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  #boot-log { font-size: 10.5px; }
  .section { padding-top: 90px; }
  .skills { grid-template-columns: 1fr; }
  .section-title { white-space: normal; }
  .section-title::after { display: none; }
  .project-grid { grid-template-columns: 1fr; }
  .window-body { padding: 16px; font-size: 12.5px; }
  .term .window-body { height: 320px; }
  .term-input { padding: 0 16px 16px; font-size: 12.5px; }
  .prompt { display: none; }
  .term-input label::before { content: "$"; color: var(--accent); }
  .stats { gap: 22px; }
}

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