/* =========================================================
   Shaurya Mahajan — Portfolio
   Theme tokens live in :root. Edit colours/spacing there.
   ========================================================= */

:root {
  /* Colour */
  --bg: #0a1120;
  --bg-alt: #0d162a;
  --surface: #111c33;
  --surface-2: #15223d;
  --line: rgba(232, 226, 212, 0.09);
  --line-strong: rgba(232, 226, 212, 0.18);
  --text: #f1ece2;          /* warm white */
  --text-muted: #b4b0a7;    /* ≥ 7:1 on --bg */
  --text-dim: #8d8a84;      /* ≥ 4.5:1 on --bg */
  --accent: #7fa8e0;        /* restrained blue */
  --accent-strong: #a9c6ee;
  --accent-soft: rgba(127, 168, 224, 0.12);

  /* Type */
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  /* Layout */
  --container: 1160px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-y: clamp(5rem, 11vw, 9rem);
  --radius: 14px;
  --header-h: 68px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
[hidden] { display: none !important; }

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

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  padding: 0.7rem 1rem; border-radius: 8px;
  background: var(--text); color: var(--bg); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }

.dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(10, 17, 32, 0.72);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--line); background: rgba(10, 17, 32, 0.9); }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.brand { display: inline-flex; align-items: center; gap: 0.7rem; text-decoration: none; font-weight: 500; letter-spacing: 0.01em; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.04em; color: var(--accent-strong);
}

.site-nav ul { display: flex; gap: 0.25rem; }
.site-nav a {
  display: block; padding: 0.5rem 0.85rem; border-radius: 8px;
  color: var(--text-muted); text-decoration: none; font-size: 0.95rem;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.site-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.site-nav a[aria-current="true"] { color: var(--text); }
.site-nav a[aria-current="true"]::after {
  content: ""; display: block; height: 1px; margin-top: 2px; background: var(--accent);
}

.nav-toggle {
  display: none; position: relative; width: 44px; height: 44px;
  background: transparent; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer;
}
.nav-toggle-bar {
  position: absolute; left: 12px; right: 12px; height: 1.5px; background: var(--text);
  transition: transform 0.25s var(--ease), top 0.25s var(--ease);
}
.nav-toggle-bar:nth-of-type(2) { top: 17px; }
.nav-toggle-bar:nth-of-type(3) { top: 25px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-of-type(2) { top: 21px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-of-type(3) { top: 21px; transform: rotate(-45deg); }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 0.75rem var(--gutter) 1.5rem;
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0s linear 0.2s;
  }
  .site-nav.is-open { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a { padding: 0.95rem 0.25rem; font-size: 1.1rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .site-nav a[aria-current="true"]::after { display: none; }
  .site-nav a[aria-current="true"] { color: var(--accent-strong); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-height: 48px; padding: 0.75rem 1.35rem;
  border-radius: 999px; border: 1px solid transparent;
  font: 500 0.98rem/1 var(--font-sans); text-decoration: none; cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn svg { flex: none; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: #ffffff; transform: translateY(-1px); }
.btn-ghost { border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); transform: translateY(-1px); }
.btn-sm { min-height: 42px; padding: 0.6rem 1.1rem; font-size: 0.92rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(5rem, 13vw, 9.5rem) 0 clamp(4rem, 9vw, 6.5rem);
  border-bottom: 1px solid var(--line);
}
.hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: -1px -1px;
  mask-image: radial-gradient(ellipse 75% 70% at 70% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 70% 30%, #000 20%, transparent 75%);
}
.hero::after {
  content: ""; position: absolute; pointer-events: none;
  width: 620px; height: 620px; right: -160px; top: -200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(127, 168, 224, 0.13), transparent 65%);
}
.hero-inner { position: relative; z-index: 1; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.75rem;
  font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted);
}
.hero-title {
  margin-top: 1.6rem; max-width: 16ch;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.6rem, 7.2vw, 5.4rem); line-height: 1.04; letter-spacing: -0.02em;
}
.hero-title-sub { display: block; color: var(--text-muted); }
.hero-lede { margin-top: 1.75rem; max-width: 58ch; font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--text-muted); }

.hero-highlight {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.75rem;
  margin-top: 2rem; padding: 0.6rem 1rem 0.6rem 0.6rem;
  border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(17, 28, 51, 0.6);
  font-size: 0.98rem;
}
.hero-highlight-tag {
  padding: 0.2rem 0.55rem; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong);
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 2.25rem; }

.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin-top: clamp(3.5rem, 8vw, 5.5rem);
  border-top: 1px solid var(--line);
}
.hero-stats > div { padding: 1.4rem 1.25rem 0 0; display: flex; flex-direction: column-reverse; gap: 0.35rem; }
.hero-stats > div + div { padding-left: 1.25rem; border-left: 1px solid var(--line); }
.hero-stats dd { font-family: var(--font-display); font-size: clamp(1.9rem, 3.6vw, 2.6rem); line-height: 1; }
.hero-stats dt { font-size: 0.85rem; color: var(--text-dim); line-height: 1.4; }

@media (max-width: 760px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-stats > div { padding: 1.25rem 1rem 1.25rem 0; }
  .hero-stats > div + div { padding-left: 0; border-left: 0; }
  .hero-stats > div:nth-child(even) { padding-left: 1rem; border-left: 1px solid var(--line); }
  .hero-stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ---------- Sections ---------- */
.section { padding: var(--section-y) 0; border-bottom: 1px solid var(--line); }
.section-alt { background: var(--bg-alt); }

.section-head { margin-bottom: clamp(2.5rem, 6vw, 4rem); max-width: 760px; }
.section-index {
  font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.14em; color: var(--accent);
  display: flex; align-items: center; gap: 0.8rem;
}
.section-index::after { content: ""; width: 48px; height: 1px; background: var(--line-strong); }
.section h2 {
  margin-top: 0.9rem;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2rem, 4.4vw, 3.1rem); line-height: 1.1; letter-spacing: -0.015em;
}
.section-intro { margin-top: 1.1rem; color: var(--text-muted); max-width: 62ch; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(2.5rem, 6vw, 5rem); align-items: start; }
.about-copy p + p { margin-top: 1.25rem; }
.about-copy .lead { font-size: clamp(1.15rem, 1.9vw, 1.35rem); line-height: 1.55; }
.about-copy p:not(.lead) { color: var(--text-muted); }
.about-copy .btn { margin-top: 2rem; }

.highlights { border-top: 1px solid var(--line); }
.highlights li {
  display: grid; grid-template-columns: 5.5rem 1fr; gap: 1.25rem; align-items: baseline;
  padding: 1.35rem 0; border-bottom: 1px solid var(--line);
}
.hl-figure { font-family: var(--font-display); font-size: 1.75rem; line-height: 1; color: var(--accent-strong); }
.hl-text { color: var(--text-muted); }

@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- Projects ---------- */
.project {
  display: grid; grid-template-columns: minmax(220px, 0.42fr) 1fr; gap: clamp(1.75rem, 5vw, 4rem);
  padding: clamp(2rem, 4.5vw, 3rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  position: relative;
}
.project + .project { margin-top: 1.5rem; }
.project::before {
  /* corner registration mark */
  content: ""; position: absolute; top: 14px; right: 14px; width: 12px; height: 12px;
  border-top: 1px solid var(--line-strong); border-right: 1px solid var(--line-strong);
}
.project-meta { align-self: start; position: sticky; top: calc(var(--header-h) + 2rem); }
.project-num { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.14em; color: var(--accent); }
.project h3 {
  margin-top: 0.8rem;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.55rem, 2.6vw, 2rem); line-height: 1.15; letter-spacing: -0.01em;
}
.project-role { margin-top: 1.1rem; font-size: 0.95rem; color: var(--text-muted); }
.project-role span, .project-block h4 {
  display: block; margin-bottom: 0.35rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim);
}
.project-status {
  display: inline-flex; align-items: center; gap: 0.6rem; margin-top: 1.25rem;
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted);
}

.project-body { display: flex; flex-direction: column; gap: 1.9rem; min-width: 0; }
.project-block h4 { margin-bottom: 0.7rem; }
.project-block p { color: var(--text-muted); max-width: 66ch; }

.ticks li {
  position: relative; padding-left: 1.6rem; color: var(--text-muted);
}
.ticks li + li { margin-top: 0.7rem; }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: 0.72em; width: 0.8rem; height: 1px; background: var(--accent);
}

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags li {
  padding: 0.35rem 0.75rem; border: 1px solid var(--line-strong); border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--text);
}

.figures {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.figures > div { padding: 1rem 1.1rem; display: flex; flex-direction: column-reverse; gap: 0.25rem; background: var(--surface-2); }
.figures > div + div { border-left: 1px solid var(--line); }
.figures dd { font-family: var(--font-display); font-size: 1.7rem; line-height: 1; }
.figures dt { font-size: 0.8rem; color: var(--text-dim); }
.project-body > .btn { align-self: flex-start; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.media-grid figure { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.media-grid img, .media-grid video { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.media-grid video { aspect-ratio: 16 / 9; }
.media-grid figcaption { padding: 0.7rem 0.9rem; font-size: 0.85rem; color: var(--text-dim); }

@media (max-width: 900px) {
  .project { grid-template-columns: 1fr; }
  .project-meta { position: static; }
}
@media (max-width: 560px) {
  .figures { grid-template-columns: repeat(2, 1fr); }
  .figures > div:nth-child(3) { border-left: 0; }
  .figures > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.skill-group { padding: clamp(1.5rem, 3vw, 2.1rem); background: var(--bg); transition: background-color 0.3s var(--ease); }
.skill-group:hover { background: var(--surface); }
.skill-group + .skill-group { border-left: 1px solid var(--line); }
.skill-code { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.14em; color: var(--accent); }
.skill-group h3 { margin-top: 0.75rem; font-size: 1.1rem; font-weight: 600; }
.skill-group ul { margin-top: 1.25rem; border-top: 1px solid var(--line); }
.skill-group li { padding: 0.6rem 0; border-bottom: 1px solid var(--line); color: var(--text-muted); font-size: 0.97rem; }
.skill-group li:last-child { border-bottom: 0; }

@media (max-width: 1000px) {
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .skill-group:nth-child(3) { border-left: 0; }
  .skill-group:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .skills-grid { grid-template-columns: 1fr; }
  .skill-group + .skill-group { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- Timeline ---------- */
.timeline { position: relative; max-width: 900px; }
.timeline::before {
  content: ""; position: absolute; left: 10.5rem; top: 0.5rem; bottom: 0.5rem; width: 1px;
  background: linear-gradient(var(--line-strong), var(--line-strong) 85%, transparent);
}
.tl-item { position: relative; display: grid; grid-template-columns: 10.5rem 1fr; }
.tl-item + .tl-item { margin-top: 1.25rem; }
.tl-item::before {
  content: ""; position: absolute; left: calc(10.5rem - 5px); top: 1.85rem;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg-alt); border: 1.5px solid var(--accent);
}
.tl-date {
  padding: 1.45rem 1.75rem 0 0;
  font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.06em; color: var(--text-muted);
}
.tl-card {
  margin-left: 2rem; padding: 1.35rem 1.6rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.tl-card:hover { border-color: var(--line-strong); transform: translateX(3px); }
.tl-award { font-family: var(--font-display); font-size: clamp(1.2rem, 2vw, 1.4rem); line-height: 1.3; }
.tl-event { margin-top: 0.4rem; color: var(--text-muted); }
.tl-place { margin-top: 0.15rem; font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }

@media (max-width: 640px) {
  .timeline::before { left: 5px; }
  .tl-item { grid-template-columns: 1fr; padding-left: 1.75rem; }
  .tl-item::before { left: 0; top: 0.45rem; }
  .tl-date { padding: 0 0 0.6rem; }
  .tl-card { margin-left: 0; }
}

/* ---------- Contact ---------- */
.contact { position: relative; overflow: hidden; }
.contact::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 60% 70% at 50% 100%, #000 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 100%, #000 10%, transparent 70%);
}
.contact-inner { position: relative; text-align: center; max-width: 820px; }
.contact .section-index { justify-content: center; }
.contact .section-index::before { content: ""; width: 48px; height: 1px; background: var(--line-strong); }
.contact h2 { font-size: clamp(2.2rem, 5.6vw, 3.9rem); }
.contact-copy { margin: 1.5rem auto 0; max-width: 58ch; color: var(--text-muted); font-size: 1.1rem; }
.contact-actions { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer { padding: 2rem 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: 0.9rem; color: var(--text-dim); }
.to-top { color: var(--text-muted); text-decoration: none; }
.to-top:hover { color: var(--text); }

/* ---------- Motion ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

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