/* ==========================================================================
   Vipin Singh — Portfolio
   Design system: dark-first, terminal-accent, Inter + JetBrains Mono
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Palette (dark, default) */
  --bg: #0b1120;
  --bg-raised: #111a2e;
  --bg-card: #131d33;
  --border: #22304a;
  --border-strong: #2f3f5e;
  --fg: #f4f6fb;
  --fg-muted: #aab4c8;
  --fg-faint: #7d879c;
  --accent: #22c55e;
  --accent-strong: #4ade80;
  --accent-contrast: #06120a;
  --link: #7dd3fc;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Spacing scale */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  --space-3xl: 8rem;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -16px rgba(0, 0, 0, 0.55);
  --max-width: 1180px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f7f8fb;
  --bg-raised: #ffffff;
  --bg-card: #ffffff;
  --border: #e2e6ee;
  --border-strong: #cbd2e1;
  --fg: #101728;
  --fg-muted: #4a5468;
  --fg-faint: #7a8296;
  --accent: #16a34a;
  --accent-strong: #15803d;
  --accent-contrast: #f4fff8;
  --link: #0369a1;
  --shadow-card: 0 1px 2px rgba(16, 23, 40, 0.06), 0 12px 28px -18px rgba(16, 23, 40, 0.25);
}

/* ---------------------------------- reset -------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a {
  color: inherit;
  text-decoration: none;
}

ul { list-style: none; margin: 0; padding: 0; }

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
}

p { margin: 0; }

button { font-family: inherit; cursor: pointer; }

::selection { background: var(--accent); color: var(--accent-contrast); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-sm);
  top: -60px;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 200;
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: var(--space-sm); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-sm);
}
.eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.section {
  padding-block: var(--space-2xl);
  border-bottom: 1px solid var(--border);
}

.section-head {
  max-width: 640px;
  margin-bottom: var(--space-xl);
}

.section-head h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  margin-bottom: var(--space-sm);
}

.section-head p {
  color: var(--fg-muted);
  font-size: 1.05rem;
}

/* reveal-on-scroll */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------- header -------------------------------- */
.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease-out), border-color 0.3s var(--ease-out);
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-sm);
}

.logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 2px;
}
.logo .dim { color: var(--fg-faint); }
.logo .accent { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-links a {
  font-size: 0.92rem;
  color: var(--fg-muted);
  position: relative;
  padding-block: 4px;
  transition: color 0.2s var(--ease-out);
}
.nav-links a:hover,
.nav-links a.is-active { color: var(--fg); }
.nav-links a.is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--fg-muted);
  transition: border-color 0.2s var(--ease-out), color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.theme-toggle:hover { color: var(--fg); border-color: var(--border-strong); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme='light'] .theme-toggle .icon-moon { display: none; }
:root[data-theme='light'] .theme-toggle .icon-sun { display: block; }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  align-items: center;
  justify-content: center;
}
.nav-toggle svg { width: 20px; height: 20px; color: var(--fg); }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded='true'] .icon-open { display: none; }
.nav-toggle[aria-expanded='true'] .icon-close { display: block; }

/* ---------------------------------- buttons ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease-out), border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), color 0.2s var(--ease-out);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { background: var(--accent-strong); }

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--fg);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn svg { width: 16px; height: 16px; }

/* ---------------------------------- hero --------------------------------- */
.hero {
  padding-top: calc(var(--space-3xl) + var(--space-md));
  padding-bottom: var(--space-2xl);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -220px;
  right: -160px;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--space-xl);
  align-items: center;
}

.hero-kicker {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: var(--space-md);
  display: block;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  margin-bottom: var(--space-md);
}

.hero h1 .highlight { color: var(--accent); }

.hero-role {
  font-size: 1.15rem;
  color: var(--fg-muted);
  max-width: 46ch;
  margin-bottom: var(--space-lg);
}

.hero-role strong { color: var(--fg); font-weight: 600; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: var(--space-lg);
}

.hero-stats .stat-value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  color: var(--fg);
  font-weight: 600;
}
.hero-stats .stat-label {
  font-size: 0.82rem;
  color: var(--fg-faint);
  margin-top: 2px;
}

.hero-portrait {
  position: relative;
  justify-self: center;
}

.portrait-frame {
  width: min(320px, 80vw);
  aspect-ratio: 1 / 1.05;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  box-shadow: var(--shadow-card);
  position: relative;
}
.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  filter: grayscale(0.15);
}

.portrait-badge {
  position: absolute;
  bottom: -18px;
  left: -18px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-sm);
  box-shadow: var(--shadow-card);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
}
.portrait-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* ------------------------------- about ----------------------------------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: start;
}

.about-copy p {
  color: var(--fg-muted);
  margin-bottom: var(--space-md);
  font-size: 1.02rem;
}
.about-copy p:last-child { margin-bottom: 0; }

.about-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.fact {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
.fact dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2xs);
}
.fact dd {
  margin: 0;
  font-size: 0.98rem;
  color: var(--fg);
}

/* ------------------------------ experience -------------------------------- */
.timeline {
  position: relative;
  padding-left: var(--space-lg);
  border-left: 1px solid var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-xl);
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-lg) - 5px);
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-2xs);
}

.timeline-head h3 { font-size: 1.2rem; }
.timeline-role { color: var(--fg-muted); font-size: 0.95rem; }
.timeline-period {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-faint);
  white-space: nowrap;
}

.timeline-sub {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: var(--space-sm);
  display: inline-block;
}

.timeline-item ul {
  display: grid;
  gap: var(--space-2xs);
}
.timeline-item li {
  color: var(--fg-muted);
  font-size: 0.96rem;
  padding-left: 1.2em;
  position: relative;
}
.timeline-item li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* -------------------------------- projects -------------------------------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-lg);
}

.project-card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}
.project-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
}

.project-visual {
  height: 128px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.project-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--bg-card) 0%, transparent), var(--bg-card));
}
.project-visual .glyph {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: -0.03em;
  z-index: 1;
}
.visual-1 { background: linear-gradient(135deg, #14532d, #22c55e 130%); }
.visual-2 { background: linear-gradient(135deg, #1e293b, #7dd3fc 150%); }
.visual-3 { background: linear-gradient(135deg, #3b0764, #c084fc 150%); }
.visual-4 { background: linear-gradient(135deg, #7c2d12, #fb923c 150%); }

.project-body {
  padding: var(--space-md) var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1;
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.project-body h3 { font-size: 1.25rem; }
.project-body > p { color: var(--fg-muted); font-size: 0.95rem; }

.project-body ul {
  display: grid;
  gap: var(--space-2xs);
  margin-top: var(--space-2xs);
}
.project-body li {
  color: var(--fg-muted);
  font-size: 0.9rem;
  padding-left: 1.15em;
  position: relative;
}
.project-body li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs) var(--space-2xs);
  margin-top: auto;
  padding-top: var(--space-sm);
}
.tech-tags span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  margin-top: var(--space-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  width: fit-content;
  transition: gap 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.project-link:hover { gap: var(--space-xs); color: var(--accent-strong); }
.project-link svg { width: 15px; height: 15px; }

/* --------------------------------- skills ---------------------------------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-md);
}

.skill-group {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.skill-group h3 {
  font-size: 0.95rem;
  color: var(--fg);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
}
.skill-group h3::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.skill-group ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs) var(--space-2xs);
}
.skill-group li {
  font-size: 0.82rem;
  color: var(--fg-muted);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
}

/* -------------------------------- education -------------------------------- */
.education-card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
  flex-wrap: wrap;
}
.education-card h3 { font-size: 1.1rem; margin-bottom: var(--space-3xs); }
.education-card p { color: var(--fg-muted); font-size: 0.95rem; }
.education-period {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg-faint);
}

/* --------------------------------- contact ---------------------------------- */
.contact-section { border-bottom: none; }

.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-2xl);
  align-items: center;
}

.contact-copy h2 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); margin-bottom: var(--space-sm); }
.contact-copy p { color: var(--fg-muted); font-size: 1.05rem; max-width: 48ch; margin-bottom: var(--space-lg); }

.contact-list { display: grid; gap: var(--space-sm); }

.contact-list li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  transition: border-color 0.2s var(--ease-out);
}
.contact-list li:hover { border-color: var(--border-strong); }

.contact-list .icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.contact-list .icon svg { width: 18px; height: 18px; }

.contact-list a,
.contact-list span.label { color: var(--fg); font-weight: 500; }
.contact-list .meta { display: block; font-size: 0.78rem; color: var(--fg-faint); font-family: var(--font-mono); }

/* --------------------------------- footer ----------------------------------- */
.site-footer {
  padding-block: var(--space-lg);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  justify-content: space-between;
}
.footer-note { color: var(--fg-faint); font-size: 0.85rem; }
.footer-socials { display: flex; gap: var(--space-sm); }
.footer-socials a {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.footer-socials a:hover { color: var(--accent); border-color: var(--accent); }
.footer-socials svg { width: 16px; height: 16px; }

/* --------------------------------- back to top ------------------------------ */
.to-top {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out), border-color 0.2s var(--ease-out);
  z-index: 90;
  box-shadow: var(--shadow-card);
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { border-color: var(--accent); color: var(--accent); }
.to-top svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* ------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-portrait { order: -1; }
  .about-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .nav-links, .nav-actions .btn-ghost { display: none; }
  .nav-toggle { display: inline-flex; }

  .nav-links.is-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 64px;
    left: var(--space-md);
    right: var(--space-md);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    gap: var(--space-sm);
    box-shadow: var(--shadow-card);
  }

  .hero-stats { grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
  .timeline-period { margin-left: 0; }
  .education-card { flex-direction: column; }
}

@media (max-width: 520px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { justify-content: center; }
  .about-facts { grid-template-columns: 1fr; }
}
