/* ============================================
   Ashish Srivastava — Portfolio
   Design tokens
   ============================================ */
:root {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --bg-card: #111111;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f5f5;
  --text-dim: rgba(245, 245, 245, 0.55);
  --text-faint: rgba(245, 245, 245, 0.35);
  --accent: #c8ff4d;
  --accent-2: #ffffff;
  --accent-dim: #8fbf2f;
  --accent-ink: #0a0a0a;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --radius: 14px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg: #f7f6f2;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --border: rgba(10, 10, 15, 0.09);
  --border-strong: rgba(10, 10, 15, 0.18);
  --text: #14151a;
  --text-dim: rgba(20, 21, 26, 0.6);
  --text-faint: rgba(20, 21, 26, 0.4);
  --accent: #4f7a10;
  --accent-2: #14151a;
  --accent-dim: #3d5f0c;
  --accent-ink: #f2ffdc;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 600; letter-spacing: -0.02em; }
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.grad-text {
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-style: normal;
}

/* ---------- Custom cursor ---------- */
@media (hover: hover) and (pointer: fine) {
  body.cursor-ready, body.cursor-ready a, body.cursor-ready button { cursor: none; }
}
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  pointer-events: none;
  border-radius: 50%;
  transform: translate3d(-50%, -50%, 0);
  opacity: 0;
  transition: opacity 0.25s var(--ease), width 0.25s var(--ease), height 0.25s var(--ease), background 0.25s var(--ease);
}
.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
}
.cursor-ring {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-strong);
}
body.cursor-ready .cursor-dot, body.cursor-ready .cursor-ring { opacity: 1; }
.cursor-ring.is-hovering {
  width: 64px;
  height: 64px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: var(--accent);
}
.cursor-dot.is-hovering { opacity: 0; }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 22px 0;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), padding 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
  padding: 16px 0;
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; }
.nav-logo {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: -0.01em;
}
.nav-logo span { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
}
.nav-links a {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  transition: color 0.2s var(--ease);
  position: relative;
}
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 18px; }

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(20deg); }
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon, :root:not([data-theme]) .icon-moon { display: none; }
[data-theme="dark"] .icon-sun, :root:not([data-theme]) .icon-sun { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 9px 16px; font-size: 12px; }

.nav-cta { display: none; }
@media (min-width: 860px) { .nav-cta { display: inline-flex; } }
.nav-links { display: none; }
@media (min-width: 860px) { .nav-links { display: flex; } }
.nav-burger {
  display: flex;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  align-items: center; justify-content: center;
  background: var(--bg-card);
  cursor: pointer;
}
@media (min-width: 860px) { .nav-burger { display: none; } }
.nav-burger span, .nav-burger::before, .nav-burger::after { display: none; }
.nav-burger svg { width: 16px; height: 16px; }

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  padding: 32px;
  transform: translateY(-100%);
  transition: transform 0.4s var(--ease);
}
.mobile-menu.open { transform: translateY(0); }
.mobile-menu a { font-family: var(--sans); font-weight: 600; font-size: 32px; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 140px 0 80px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, transparent) 0%, transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: end;
}
.hero-eyebrow { margin-bottom: 24px; }
.hero h1 {
  font-size: clamp(40px, 7vw, 84px);
  font-weight: 700;
  line-height: 1.02;
  max-width: 16ch;
}
.hero-sub {
  margin-top: 28px;
  font-size: clamp(16px, 2vw, 19px);
  color: var(--text-dim);
  max-width: 54ch;
  line-height: 1.65;
}
.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 88px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.stat strong {
  display: block;
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 44px);
  color: var(--accent);
  line-height: 1;
}
.stat span {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
}
@media (max-width: 640px) {
  .stat-row { grid-template-columns: 1fr; gap: 28px; }
}

/* ---------- Section shell ---------- */
.section { padding: 120px 0; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 64px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: clamp(30px, 4vw, 48px); font-weight: 700; }
.section-head p { color: var(--text-dim); max-width: 46ch; font-size: 15px; }

/* ---------- Work list (hover-preview) ---------- */
.work-list {
  border-top: 1px solid var(--border);
  position: relative;
}
.work-row {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  align-items: center;
  gap: 20px;
  padding: 30px 4px;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: padding 0.35s var(--ease);
}
.work-row:hover { padding-left: 14px; }
.work-row .index {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-faint);
}
.work-row .title-block h3 {
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: color 0.3s var(--ease);
}
.work-row:hover .title-block h3 { color: var(--accent); }
.work-row .title-block p {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 13.5px;
  max-width: 56ch;
}
.work-row .work-tags {
  display: none;
  gap: 8px;
}
@media (min-width: 780px) { .work-row .work-tags { display: flex; } }
.work-row .arrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-faint);
  transition: transform 0.3s var(--ease), color 0.3s var(--ease);
}
.work-row:hover .arrow { color: var(--accent); transform: translate(4px, -4px); }
.work-row-link { position: absolute; inset: 0; z-index: 2; }

.work-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: 340px;
  aspect-ratio: 16/10;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-50%, -50%, 0) scale(0.94);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.5);
}
.work-preview.is-visible { opacity: 1; }
.work-preview img { width: 100%; height: 100%; object-fit: cover; }
@media (hover: none), (max-width: 780px) { .work-preview { display: none; } }

.tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
}

/* ---------- Lab / AI Efficiencies grid ---------- */
.lab-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 720px) { .lab-grid { grid-template-columns: repeat(3, 1fr); } }
.lab-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.lab-card:hover { border-color: var(--border-strong); transform: translateY(-4px); }
.lab-card-link { position: absolute; inset: 0; z-index: 2; }
.lab-card h3 .arrow { display: inline-block; font-size: 15px; color: var(--accent); margin-left: 6px; transition: transform 0.25s var(--ease); }
.lab-card:hover h3 .arrow { transform: translate(3px, -3px); }
.lab-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--accent);
}
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  width: fit-content;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
}
.status-live { color: var(--accent); }
.status-live .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.lab-card h3 { font-size: 20px; font-weight: 600; margin-top: 2px; }
.lab-card p { color: var(--text-dim); font-size: 14.5px; line-height: 1.65; }

/* ---------- Impact strip ---------- */
.impact-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 56px 0;
}
.impact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}
@media (min-width: 720px) { .impact-grid { grid-template-columns: repeat(4, 1fr); } }
.impact-item strong {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(26px, 3.4vw, 38px);
  display: block;
}
.impact-item span { color: var(--text-dim); font-size: 13px; }

/* ---------- About / skills ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 56px;
}
@media (min-width: 860px) { .about-grid { grid-template-columns: 1fr 1fr; } }
.about-copy p { color: var(--text-dim); font-size: 17px; line-height: 1.75; margin-bottom: 20px; }
.about-copy p:first-child { font-size: 20px; color: var(--text); font-weight: 500; }

.about-portrait {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  margin-bottom: 24px;
}
.about-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 40% 20%; filter: grayscale(1); }

.skill-list { display: flex; flex-direction: column; gap: 28px; }
.skill-item { border-top: 1px solid var(--border); padding-top: 20px; }
.skill-item h4 { font-size: 17px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 10px;}
.skill-item h4::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.skill-item p { color: var(--text-dim); font-size: 14px; }

/* ---------- Contact ---------- */
.contact-section {
  text-align: center;
  padding: 140px 0 100px;
}
.contact-section h2 {
  font-size: clamp(36px, 6vw, 68px);
  font-weight: 700;
  max-width: 18ch;
  margin: 0 auto 28px;
}
.contact-section .eyebrow { justify-content: center; margin-bottom: 24px; }
.contact-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 36px;
  flex-wrap: wrap;
}

footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12.5px;
  flex-wrap: wrap;
  gap: 12px;
}
footer a:hover { color: var(--accent); }

/* ---------- Reveal animation ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
[data-reveal].in { opacity: 1; transform: translateY(0); }

/* ============================================
   Case study page
   ============================================ */
.cs-hero {
  padding: 150px 0 70px;
  border-bottom: 1px solid var(--border);
}
.cs-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 40px;
}
.cs-back:hover { color: var(--accent); }
.cs-hero h1 {
  font-size: clamp(34px, 6vw, 60px);
  font-weight: 700;
  max-width: 20ch;
  margin: 20px 0 24px;
}
.cs-hero .hero-sub { margin-top: 0; }
.cs-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
@media (min-width: 720px) { .cs-meta { grid-template-columns: repeat(4, 1fr); } }
.cs-meta div span { display: block; font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; font-family: var(--mono); }
.cs-meta div strong { font-family: var(--sans); font-size: 18px; font-weight: 600; }

.cs-cover {
  padding-top: 56px;
}
.cs-cover img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}

.cs-body {
  padding: 90px 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 64px;
}
@media (min-width: 900px) { .cs-body { grid-template-columns: 200px 1fr; } }

.cs-toc {
  display: none;
}
@media (min-width: 900px) {
  .cs-toc { display: block; position: sticky; top: 120px; align-self: start; }
  .cs-toc a { display: block; font-family: var(--mono); padding: 8px 0 8px 16px; border-left: 2px solid var(--border); color: var(--text-faint); font-size: 12.5px; transition: all 0.2s var(--ease); }
  .cs-toc a:hover, .cs-toc a.active { color: var(--accent); border-left-color: var(--accent); }
}

.cs-content > section { margin-bottom: 72px; scroll-margin-top: 110px; }
.cs-content h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 700; margin-bottom: 20px; }
.cs-content h3 { font-size: 18px; font-weight: 600; margin: 28px 0 12px; color: var(--text); }
.cs-content p { color: var(--text-dim); font-size: 16px; line-height: 1.8; margin-bottom: 16px; max-width: 68ch; }
.cs-content ul { margin: 0 0 20px; display: flex; flex-direction: column; gap: 10px; }
.cs-content ul li {
  color: var(--text-dim);
  font-size: 15px;
  padding-left: 22px;
  position: relative;
  max-width: 64ch;
}
.cs-content ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.pull-quote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 24px;
  margin: 32px 0;
  font-family: var(--sans);
  font-weight: 500;
  font-style: italic;
  font-size: 22px;
  line-height: 1.5;
  color: var(--text);
  max-width: 56ch;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 28px 0;
}
@media (min-width: 640px) { .metric-grid { grid-template-columns: repeat(4, 1fr); } }
.metric-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 18px;
  background: var(--bg-card);
}
.metric-card strong { display: block; font-family: var(--sans); font-weight: 700; font-size: 26px; color: var(--accent); margin-bottom: 6px; }
.metric-card span { font-size: 12.5px; color: var(--text-dim); }

.process-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.process-step {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 20px;
  padding: 22px 0;
  border-top: 1px solid var(--border);
}
.process-step .num { font-family: var(--mono); color: var(--accent); font-size: 13px; padding-top: 3px; }
.process-step h3 { margin: 0 0 8px; }

.cs-footer-nav {
  border-top: 1px solid var(--border);
  padding: 56px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

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

/* ---------- Preloader ---------- */
body.is-loading { overflow: hidden; }
.loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}
.loader-word {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(22px, 3.2vw, 40px);
  letter-spacing: -0.01em;
  color: var(--text);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.loader-word.show { opacity: 1; transform: translateY(0); }
.loader-word.is-last { color: var(--accent); }

.loader-bar {
  width: 200px;
  height: 1px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}
.loader-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--accent);
  transition: width var(--loader-duration, 3s) linear;
}
.loader-bar.fill::after { width: 100%; }
.loader-percent {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.loader.is-done {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

[data-intro] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
[data-intro].in { opacity: 1; transform: translateY(0); }
