/* ============================================================
   Sagar Thakur - Portfolio
   Dark premium theme · Space Grotesk + Inter · vanilla CSS
   ============================================================ */

:root {
  /* color tokens */
  --bg: #0b1120;
  --bg-elev: #111a2e;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.3);
  --text: #e8eefb;
  --text-muted: #a5b4cd;
  --accent: #34d399;
  --accent-2: #22d3ee;
  --accent-ink: #052e22;
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));

  /* type scale */
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;

  /* rhythm */
  --radius: 16px;
  --radius-lg: 24px;
  --section-gap: clamp(4.5rem, 9vw, 8rem);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* z-scale */
  --z-nav: 100;
  --z-totop: 90;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

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

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

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.02em;
}

p { margin: 0 0 1em; }

a { color: var(--accent); }

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.container {
  width: min(100% - 2.5rem, 72rem);
  margin-inline: auto;
}

/* ---------- accessibility ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border-radius: 0 0 var(--radius) var(--radius);
  text-decoration: none;
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 0; }

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

/* ---------- aurora background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  will-change: transform;
}
.orb-1 {
  width: 42vw; height: 42vw;
  min-width: 320px; min-height: 320px;
  top: -12%; left: -8%;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.5), transparent 65%);
  animation: drift-1 26s ease-in-out infinite alternate;
}
.orb-2 {
  width: 36vw; height: 36vw;
  min-width: 280px; min-height: 280px;
  top: 30%; right: -12%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.4), transparent 65%);
  animation: drift-2 32s ease-in-out infinite alternate;
}
.orb-3 {
  width: 30vw; height: 30vw;
  min-width: 240px; min-height: 240px;
  bottom: -15%; left: 25%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35), transparent 65%);
  animation: drift-3 38s ease-in-out infinite alternate;
}
@keyframes drift-1 { to { transform: translate(8vw, 6vh) scale(1.1); } }
@keyframes drift-2 { to { transform: translate(-6vw, -8vh) scale(1.15); } }
@keyframes drift-3 { to { transform: translate(5vw, -5vh) scale(0.95); } }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(11, 17, 32, 0.72);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
.site-header.scrolled {
  border-bottom-color: var(--border);
  background: rgba(11, 17, 32, 0.88);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  padding: 0.5rem 0;
}
.brand span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-link {
  display: inline-block;
  padding: 0.65rem 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s var(--ease-out), opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.6rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s, background 0.2s, border-color 0.2s;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gradient);
  color: var(--accent-ink);
  box-shadow: 0 8px 24px rgba(52, 211, 153, 0.25);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(52, 211, 153, 0.35);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.btn-sm { min-height: 44px; padding: 0.5rem 1.2rem; font-size: 0.9rem; }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-block: clamp(3.5rem, 8vw, 7rem);
  min-height: min(88svh, 56rem);
}

.eyebrow,
.section-eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2.75rem, 7vw, 4.75rem);
  font-weight: 700;
  margin-bottom: 0.35em;
}

.hero-rotator {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}
.rotator-window {
  display: inline-block;
  position: relative;
  vertical-align: bottom;
}
.rotator {
  display: inline-block;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  border-bottom: 2px solid rgba(52, 211, 153, 0.5);
  padding-bottom: 2px;
}
.rotator.swap-out {
  animation: swap-out 0.3s var(--ease-out) forwards;
}
.rotator.swap-in {
  animation: swap-in 0.35s var(--ease-out);
}
@keyframes swap-out {
  to { opacity: 0; transform: translateY(-0.6em); }
}
@keyframes swap-in {
  from { opacity: 0; transform: translateY(0.6em); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-summary {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 34rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.75rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.hero-meta li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hero-meta .icon { color: var(--accent); }

/* photo card */
.hero-visual { display: flex; justify-content: center; }

.photo-card {
  position: relative;
  width: min(100%, 22rem);
  border-radius: var(--radius-lg);
  padding: 10px;
  background:
    linear-gradient(var(--bg-elev), var(--bg-elev)) padding-box,
    var(--gradient) border-box;
  border: 2px solid transparent;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  transition: transform 0.4s var(--ease-out);
  will-change: transform;
}
.photo-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: calc(var(--radius-lg) - 8px);
}

.photo-badge {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(17, 26, 46, 0.9);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
.badge-role { top: 1rem; left: -1.25rem; color: var(--accent); }
.badge-exp { bottom: 1.5rem; right: -1rem; color: var(--text); }

/* ---------- stats ---------- */
.stats {
  border-block: 1px solid var(--border);
  background: rgba(17, 26, 46, 0.4);
  padding-block: clamp(2rem, 4vw, 3rem);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
.stat { text-align: center; }
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4.5vw, 3.25rem);
  font-weight: 700;
  margin: 0;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0.35rem 0 0;
}

/* ---------- sections ---------- */
.section { padding-block: var(--section-gap) 0; }
.section:last-of-type { padding-bottom: var(--section-gap); }

.section-title {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 700;
  margin-bottom: clamp(1.75rem, 4vw, 3rem);
}

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.about-copy p {
  color: var(--text-muted);
  font-size: 1.05rem;
}
.about-copy p:first-child { color: var(--text); }

.about-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}
.about-points li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.25s, background 0.25s, transform 0.25s var(--ease-out);
}
.about-points li:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateX(4px);
}
.about-points .icon { color: var(--accent); margin-top: 0.2rem; }
.about-points strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.02rem;
  margin-bottom: 0.15rem;
}
.about-points span { color: var(--text-muted); font-size: 0.95rem; }

/* ---------- cards / expertise ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.card {
  position: relative;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.25s, transform 0.3s var(--ease-out), box-shadow 0.3s;
}
.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.card h3 {
  font-size: 1.15rem;
  margin: 1.1rem 0 0.4rem;
}
.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: var(--accent);
}
.card-icon .icon { width: 1.4rem; height: 1.4rem; }

/* mouse spotlight */
.spotlight::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    340px circle at var(--mx, 50%) var(--my, 50%),
    rgba(52, 211, 153, 0.09),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.spotlight:hover::before { opacity: 1; }

/* ---------- experience timeline ---------- */
.timeline {
  position: relative;
  display: grid;
  gap: clamp(2rem, 4vw, 3rem);
  padding-left: clamp(1.5rem, 3vw, 2.25rem);
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2), rgba(148, 163, 184, 0.2));
  border-radius: 2px;
}

.timeline-company { position: relative; }
.timeline-company::before {
  content: "";
  position: absolute;
  left: calc(-1 * clamp(1.5rem, 3vw, 2.25rem) + 1px);
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.18);
}

.company-head h3 {
  font-size: 1.5rem;
  margin-bottom: 0.15rem;
}
.company-meta {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 1.15rem;
}

.role {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: border-color 0.25s;
}
.role[open] { border-color: rgba(52, 211, 153, 0.35); }
.role:hover { border-color: var(--border-strong); }

.role summary {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.05rem 1.25rem;
  cursor: pointer;
  list-style: none;
  min-height: 48px;
  transition: background 0.2s;
  touch-action: manipulation;
}
.role summary::-webkit-details-marker { display: none; }
.role summary:hover { background: var(--surface-hover); }

.role-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  flex: 1;
}
.role-dates {
  color: var(--text-muted);
  font-size: 0.88rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chevron {
  color: var(--text-muted);
  transition: transform 0.25s var(--ease-out);
}
.role[open] .chevron { transform: rotate(180deg); }

.role ul {
  margin: 0;
  padding: 0.25rem 1.5rem 1.25rem 2.5rem;
  color: var(--text-muted);
  font-size: 0.96rem;
  display: grid;
  gap: 0.5rem;
}
.role ul li::marker { color: var(--accent); }

/* ---------- contact ---------- */
.contact-lede {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 36rem;
  margin-top: -1.25rem;
  margin-bottom: 2.25rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}
.contact-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: border-color 0.25s, transform 0.3s var(--ease-out), box-shadow 0.3s;
  min-height: 44px;
}
.contact-card:hover {
  border-color: rgba(52, 211, 153, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.contact-card .icon { color: var(--accent); width: 1.5rem; height: 1.5rem; margin-bottom: 0.6rem; }
.contact-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.contact-value {
  font-weight: 600;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: var(--section-gap);
  border-top: 1px solid var(--border);
  padding-block: 2rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.footer-inner p { margin: 0; }
.back-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 0;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

/* ---------- to-top button ---------- */
.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: var(--z-totop);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  visibility: hidden; /* keeps the hidden button out of the tab order */
  transition: opacity 0.3s, transform 0.3s var(--ease-out), border-color 0.2s, visibility 0s 0.3s;
}
.to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.3s, transform 0.3s var(--ease-out), border-color 0.2s, visibility 0s;
}
.to-top:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- reveal on scroll ----------
   Hiding is gated on html.js-reveal, which only main.js adds:
   if JS is disabled, blocked, or the script 404s, everything stays visible. */
html.js-reveal .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}
html.js-reveal .reveal.visible {
  opacity: 1;
  transform: none;
}
.delay-1 { --reveal-delay: 0.08s; }
.delay-2 { --reveal-delay: 0.16s; }
.delay-3 { --reveal-delay: 0.24s; }
.delay-4 { --reveal-delay: 0.32s; }
.delay-5 { --reveal-delay: 0.4s; }

@media print {
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding-top: 2.5rem;
    min-height: 0;
  }
  .hero-visual { order: -1; }
  .photo-card { width: min(72vw, 18rem); }
  .badge-role { left: -0.5rem; }
  .badge-exp { right: -0.5rem; }
  .hero-summary { margin-inline: auto; }
  .hero-actions, .hero-meta { justify-content: center; }
  .about-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 1rem 1.25rem 1.5rem;
    background: rgba(11, 17, 32, 0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav-menu.open { display: flex; }
  .nav-links { flex-direction: column; gap: 0.25rem; }
  .nav-link { display: block; padding: 0.85rem 1rem; font-size: 1.05rem; }
  .nav-cta { width: 100%; }
}

@media (max-width: 560px) {
  .cards-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .role summary { flex-wrap: wrap; }
  .role-dates { order: 3; width: 100%; padding-left: 0; }
  .role ul { padding-left: 2rem; }
}

/* ---------- reduced motion ---------- */
@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;
  }
  html.js-reveal .reveal { opacity: 1; transform: none; }
  .orb { animation: none; }
}
