/* ============================================================
   Vivek Raj SR — portfolio
   Systems / terminal aesthetic · dark-first · lime accent
   Restrained: mono labels, blueprint grid, sharp panels.
   ============================================================ */

:root {
  /* dark (default) */
  --bg:      #0a0b0d;
  --bg-2:    #0d0f12;
  --panel:   #101317;
  --panel-2: #14181d;
  --ink:     #e7eaed;
  --muted:   #7b838c;
  --faint:   #565d65;
  --line:    rgba(255, 255, 255, 0.09);
  --line-2:  rgba(255, 255, 255, 0.045);
  --accent:  #ff5a1f;
  --accent-ink: #160a04;
  --accent-soft: rgba(255, 90, 31, 0.13);
  --live:    #46e08a;
  --grid:    rgba(255, 255, 255, 0.03);

  --font-body: "Chivo", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 10px;
  --radius-sm: 7px;
  --maxw: 1160px;
}

html[data-theme="light"] {
  --bg:      #f4f4ef;
  --bg-2:    #efefe8;
  --panel:   #ffffff;
  --panel-2: #f7f7f1;
  --ink:     #0e1013;
  --muted:   #5a616a;
  --faint:   #8b9099;
  --line:    rgba(0, 0, 0, 0.12);
  --line-2:  rgba(0, 0, 0, 0.06);
  --accent:  #d8430f;
  --accent-ink: #ffffff;
  --accent-soft: rgba(216, 67, 15, 0.10);
  --live:    #1f9e5a;
  --grid:    rgba(0, 0, 0, 0.028);
}

/* ---------- reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .35s ease, color .35s ease;
  /* blueprint grid */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-weight: 700; line-height: 1.08; letter-spacing: -0.02em; }
.accent { color: var(--accent); }

/* ---------- shared layout ---------- */
main, .nav, .footer { position: relative; z-index: 1; }
.section {
  max-width: var(--maxw); margin: 0 auto;
  padding: 92px 28px;
  border-top: 1px solid var(--line-2);
}
.prompt {
  font-family: var(--font-mono); font-size: .82rem; color: var(--muted);
  margin-bottom: 20px;
}
.prompt .ps1 { color: var(--accent); }
.prompt::after { content: "▋"; color: var(--accent); margin-left: 3px; animation: blink 1.15s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ============ NAV ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .35s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.brand {
  font-family: var(--font-mono); font-weight: 700; font-size: 1rem;
  display: flex; align-items: center; gap: 8px; letter-spacing: -.01em;
}
.brand-mark { color: var(--accent); }
.nav-links { display: flex; gap: 26px; font-family: var(--font-mono); font-size: .85rem; }
.nav-links a { color: var(--muted); display: inline-flex; align-items: baseline; gap: 6px; transition: color .2s; }
.nav-links a .idx { font-size: .64rem; color: var(--faint); }
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover .idx { color: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: transparent; color: var(--ink); cursor: pointer;
  transition: border-color .2s, background .2s;
}
.theme-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.ic-moon { display: none; }
html[data-theme="dark"] .ic-sun { display: none; }
html[data-theme="dark"] .ic-moon { display: block; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-weight: 500; font-size: .85rem;
  padding: 10px 16px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid transparent; white-space: nowrap;
  transition: transform .14s ease, background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn-solid { background: var(--accent); color: var(--accent-ink); }
.btn-solid:hover { box-shadow: 0 0 0 3px var(--accent-soft); transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-lg { padding: 13px 22px; font-size: .92rem; }
.arr { transition: transform .2s; }
.btn:hover .arr { transform: translateX(3px); }

/* ============ HERO ============ */
.hero { max-width: var(--maxw); margin: 0 auto; padding: clamp(44px, 8vw, 88px) 28px 64px; }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: .78rem; color: var(--muted);
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); margin-bottom: 26px;
}
.status .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--live);
  box-shadow: 0 0 8px 1px var(--live); animation: pulse 2.2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.hero-title {
  font-size: clamp(2.3rem, 6vw, 4.3rem);
  max-width: 17ch; margin-bottom: 24px; letter-spacing: -0.03em;
}
.hero-sub { font-size: clamp(1rem, 1.5vw, 1.16rem); color: var(--muted); max-width: 60ch; margin-bottom: 32px; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* ---------- socials ---------- */
.socials { display: flex; gap: 8px; }
.socials a {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted);
  transition: color .2s, border-color .2s, transform .2s, background .2s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); }
.socials-inline { margin-left: 4px; padding-left: 14px; border-left: 1px solid var(--line-2); }

/* ---------- stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin-top: 60px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.stat { padding: 24px 22px; border-right: 1px solid var(--line); background: var(--panel); }
.stat:last-child { border-right: none; }
.stat b { display: block; font-size: clamp(1.7rem, 3vw, 2.2rem); letter-spacing: -.03em; font-family: var(--font-mono); font-weight: 700; }
.stat span { font-size: .82rem; color: var(--muted); }

/* ============ SECTION HEAD ============ */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 22px; margin-bottom: 42px; flex-wrap: wrap;
}
.section-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.kicker {
  display: flex; width: fit-content; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 16px; font-weight: 500;
}
.kicker i {
  font-style: normal; color: var(--accent-ink); background: var(--accent);
  border-radius: 5px; padding: 3px 7px; font-size: .66rem; line-height: 1; font-weight: 700;
}
.section-link, .section-note { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); }
.section-link { color: var(--accent); transition: opacity .2s; }
.section-link:hover { opacity: .7; }

/* ============ WORK ============ */
.work-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .28s cubic-bezier(.2,.7,.2,1), border-color .28s, box-shadow .28s;
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 20px 44px -26px #000, 0 0 0 1px var(--accent-soft); }

.card-shot {
  aspect-ratio: 16 / 10; position: relative; overflow: hidden;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.card-shot img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-shot img { transform: scale(1.04); }
.card-shot::after {
  content: attr(data-label); position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: .78rem; color: var(--faint); opacity: 0;
}
.card-shot:has(.shot-missing)::before,
.xp-shot:has(.shot-missing)::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 20px 20px;
}
.card-shot:has(.shot-missing)::after { opacity: 1; }

.card-body { padding: 20px; display: flex; flex-direction: column; gap: 11px; flex: 1; }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-top h3 { font-size: 1.3rem; }
.card-body p { font-size: .9rem; color: var(--muted); flex: 1; }

.tag {
  font-family: var(--font-mono); font-size: .66rem; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.tag-live { color: var(--live); border-color: color-mix(in srgb, var(--live) 45%, transparent); }
.tag-live::before { content: "● "; font-size: .6em; vertical-align: middle; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  font-family: var(--font-mono); font-size: .7rem; color: var(--muted);
  padding: 4px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line-2);
}
.card-link { font-family: var(--font-mono); font-size: .82rem; color: var(--accent); width: fit-content; }
.card-link:hover { opacity: .75; }
.muted-link { color: var(--faint); }

/* ============ EXPERIENCE (LinkedIn-style) ============ */
.xp { display: flex; flex-direction: column; }
.xp-co {
  display: grid; grid-template-columns: 48px 1fr; gap: 20px;
  padding: 30px 0; border-top: 1px solid var(--line);
}
.xp-co:first-child { border-top: none; padding-top: 0; }
.xp-logo {
  width: 48px; height: 48px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-2);
  display: grid; place-items: center;
}
.xp-logo img { width: 100%; height: 100%; object-fit: cover; }
.xp-logo.mono {
  font-family: var(--font-mono); font-weight: 700; font-size: .95rem;
  color: var(--accent); background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.xp-logo.glyph { background: var(--panel-2); }
.xp-logo.glyph span {
  display: block; width: 100%; height: 100%; background: var(--ink);
  -webkit-mask: var(--i) center / var(--sz, 74%) no-repeat; mask: var(--i) center / var(--sz, 74%) no-repeat;
}
.xp-co-head { margin-bottom: 14px; }
.xp-co-head h3 { font-size: 1.3rem; display: inline-flex; align-items: center; gap: 10px; }
.xp-co-head h3 a { transition: color .2s; }
.xp-co-head h3 a::after { content: "↗"; font-size: .62em; color: var(--muted); vertical-align: super; margin-left: 2px; transition: color .2s; }
.xp-co-head h3 a:hover, .xp-co-head h3 a:hover::after { color: var(--accent); }
.xp-co-meta { display: block; font-family: var(--font-mono); font-size: .74rem; color: var(--muted); margin-top: 5px; }
.xp-badge {
  font-family: var(--font-mono); font-size: .6rem; font-weight: 700;
  background: var(--accent); color: var(--accent-ink); padding: 3px 6px; border-radius: 5px;
  letter-spacing: .04em; vertical-align: middle;
}

.xp-roles { display: flex; flex-direction: column; }
.role { position: relative; padding-left: 22px; padding-bottom: 20px; }
.role:last-child { padding-bottom: 0; }
.role::before { content: ""; position: absolute; left: 4px; top: 7px; bottom: -6px; width: 1px; background: var(--line); }
.role:last-child::before { display: none; }
.role::after {
  content: ""; position: absolute; left: 0; top: 4px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--bg);
}
.role-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 9px; }
.role-title { font-family: var(--font-mono); font-weight: 600; font-size: .95rem; color: var(--ink); }
.role-date { font-family: var(--font-mono); font-size: .74rem; color: var(--accent); white-space: nowrap; }
.bullets { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.bullets li { position: relative; padding-left: 17px; font-size: .9rem; color: var(--muted); max-width: 70ch; }
.bullets li::before { content: "▸"; position: absolute; left: 0; top: .05em; color: var(--accent); font-size: .82em; }

/* ============ STACK ============ */
.stack-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.st {
  background: var(--panel); padding: 18px 20px; display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-weight: 500; font-size: .9rem;
  border-right: 1px solid var(--line); border-top: 1px solid var(--line);
  transition: background .2s, color .2s;
}
/* remove top border on first row, right border on last col */
.st:nth-child(-n+4) { border-top: none; }
.st:nth-child(4n) { border-right: none; }
.st:hover { background: var(--panel-2); color: var(--accent); }
.st-i {
  position: relative; flex: none; width: 30px; height: 30px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--line);
  transition: border-color .2s, background .2s;
}
.st-i::before {
  content: ""; position: absolute; inset: 7px; background: var(--ink);
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat;
  transition: background .2s;
}
.st:hover .st-i { border-color: var(--accent); background: var(--accent-soft); }
.st:hover .st-i::before { background: var(--accent); }

/* ============ CTA ============ */
.cta { max-width: var(--maxw); margin: 40px auto 0; padding: 0 28px; }
.cta-inner {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(34px, 6vw, 60px); position: relative; overflow: hidden;
}
.cta-inner::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background:
    radial-gradient(600px 200px at 90% -10%, var(--accent-soft), transparent 70%);
}
.cta-inner h2 { font-size: clamp(2rem, 4.2vw, 3rem); position: relative; }
.cta-sub { color: var(--muted); margin-top: 14px; max-width: 46ch; position: relative; }
.cta-actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; position: relative; }

/* ============ FOOTER ============ */
.footer {
  max-width: var(--maxw); margin: 84px auto 0; padding: 30px 28px;
  border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; font-family: var(--font-mono); font-size: .8rem; color: var(--muted);
}

/* ============ REVEAL ============ */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .status .dot, .prompt::after { animation: none; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .work-grid { grid-template-columns: repeat(2, 1fr); }
  .stack-grid { grid-template-columns: repeat(3, 1fr); }
  .st:nth-child(-n+4) { border-top: 1px solid var(--line); }
  .st:nth-child(-n+3) { border-top: none; }
  .st:nth-child(4n) { border-right: 1px solid var(--line); }
  .st:nth-child(3n) { border-right: none; }
}
@media (max-width: 720px) {
  .nav-links { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .section { padding: 64px 20px; }
  .hero { padding: 36px 20px 52px; }
  .work-grid { grid-template-columns: 1fr; }
  .stack-grid { grid-template-columns: repeat(2, 1fr); }
  .st:nth-child(-n+3) { border-top: 1px solid var(--line); }
  .st:nth-child(-n+2) { border-top: none; }
  .st:nth-child(3n) { border-right: 1px solid var(--line); }
  .st:nth-child(2n) { border-right: none; }
  .socials-inline { border-left: none; padding-left: 0; margin-left: 0; }
}
