/* ==========================================================================
   Nishant Iyer portfolio
   Dark by default; follows the system light theme unless the visitor picks one.
   ========================================================================== */

:root {
  --bg: #0a0e14;
  --surface: #111720;
  --surface-2: #161e29;
  --line: #222c39;
  --text: #e7ecf2;
  --text-soft: #a4b0bd;
  --text-faint: #7c8896;
  --cyan: #2dd4f5;
  --violet: #a87cf7;
  --link: #5fdcf7;
  --on-accent: #041018;
  --gradient: linear-gradient(100deg, #2dd4f5 0%, #8fb8ff 45%, #a87cf7 100%);
  --glow: radial-gradient(760px 520px at 82% 220px, rgba(45, 212, 245, 0.11), transparent),
          radial-gradient(680px 460px at 8% 560px, rgba(168, 124, 247, 0.08), transparent);
  --logo-tile: #ffffff;

  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --max: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f8fa;
    --surface: #ffffff;
    --surface-2: #eef2f6;
    --line: #dbe2ea;
    --text: #0f1722;
    --text-soft: #46525f;
    --text-faint: #66727f;
    --cyan: #0089b0;
    --violet: #7340d8;
    --link: #006f90;
    --on-accent: #ffffff;
    --gradient: linear-gradient(100deg, #0089b0 0%, #3d6fd6 50%, #7340d8 100%);
    --glow: radial-gradient(760px 520px at 82% 220px, rgba(0, 137, 176, 0.09), transparent),
            radial-gradient(680px 460px at 8% 560px, rgba(115, 64, 216, 0.06), transparent);
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --line: #dbe2ea;
  --text: #0f1722;
  --text-soft: #46525f;
  --text-faint: #66727f;
  --cyan: #0089b0;
  --violet: #7340d8;
  --link: #006f90;
  --on-accent: #ffffff;
  --gradient: linear-gradient(100deg, #0089b0 0%, #3d6fd6 50%, #7340d8 100%);
  --glow: radial-gradient(760px 520px at 82% 220px, rgba(0, 137, 176, 0.09), transparent),
          radial-gradient(680px 460px at 8% 560px, rgba(115, 64, 216, 0.06), transparent);
  color-scheme: light;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--glow);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; }

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

.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: 16px; top: -48px; z-index: 100;
  background: var(--cyan); color: var(--on-accent);
  padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }

.nav { display: flex; align-items: center; gap: 24px; height: 64px; }

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

.nav-links { display: flex; gap: 4px; list-style: none; margin: 0 0 0 auto; padding: 0; }
.nav-links a {
  display: block; padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--text-soft); text-decoration: none; font-size: 0.95rem; font-weight: 500;
}
.nav-links a:hover, .nav-links a[aria-current="true"] { color: var(--text); background: var(--surface-2); }

.theme-toggle, .nav-toggle {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 50%;
  background: transparent; color: var(--text-soft); cursor: pointer;
}
.theme-toggle:hover, .nav-toggle:hover { color: var(--text); background: var(--surface-2); }
.nav-toggle { display: none; margin-left: auto; border-radius: var(--radius-sm); }

/* Show the icon for the theme you'd switch TO */
.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .icon-sun { display: none; }
  :root:not([data-theme]) .icon-moon { display: block; }
}

/* ---------- Hero (the one loud moment) ---------- */
.hero {
  display: grid; grid-template-columns: 1fr;
  align-items: center;
  min-height: min(620px, calc(100svh - 64px));
  padding-block: clamp(48px, 8vw, 96px);
}

.hero-hello { color: var(--text-soft); font-size: 1.1rem; margin: 0 0 8px; }

.hero-name {
  font-size: clamp(3rem, 9vw, 6.25rem);
  font-weight: 700; letter-spacing: -0.035em; line-height: 0.98;
  background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: 0.08em;
}

.hero-role {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.15rem, 2.2vw, 1.4rem); color: var(--text);
  margin: 20px 0 12px; max-width: 34ch;
}

.hero-pitch { color: var(--text-soft); max-width: 60ch; margin: 0 0 28px; font-size: 1.12rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }


/* Page-load entrance: the only automatic motion on the page */
@media (prefers-reduced-motion: no-preference) {
  .hero-text > * { animation: rise 0.7s cubic-bezier(.2,.7,.2,1) both; }
  .hero-text > :nth-child(2) { animation-delay: 0.06s; }
  .hero-text > :nth-child(3) { animation-delay: 0.14s; }
  .hero-text > :nth-child(4) { animation-delay: 0.2s; }
  .hero-text > :nth-child(5) { animation-delay: 0.26s; }
  .hero-text > :nth-child(6) { animation-delay: 0.32s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Buttons and small lists ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 22px; border-radius: 999px;
  font: 600 0.98rem var(--font-body); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--cyan); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--cyan) 85%, var(--text)); }
.btn-ghost { color: var(--text); border-color: var(--line); background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--text-faint); }

.social { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 0; padding: 0; }
.social a { color: var(--text-soft); font-weight: 500; font-size: 0.95rem; }
.social a:hover { color: var(--text); }

/* ---------- Sections ---------- */
.section { padding-block: clamp(64px, 9vw, 112px); border-top: 1px solid var(--line); }

.section-title {
  font-size: clamp(2rem, 4.5vw, 2.75rem); font-weight: 700; letter-spacing: -0.025em;
  margin-bottom: clamp(28px, 4vw, 44px);
}

.sub-title { font-size: 1.35rem; font-weight: 600; margin: clamp(48px, 7vw, 72px) 0 20px; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(32px, 6vw, 72px); align-items: start; }
.about-text p { margin: 0 0 1.1em; max-width: 64ch; color: var(--text-soft); }
.about-text p:first-child { color: var(--text); font-size: 1.15rem; }

.facts { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.facts div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--text-faint); font-size: 0.9rem; }
.facts dd { margin: 2px 0 0; font-weight: 500; }

/* Skills: one row per category */
.skills { margin: 0; border-top: 1px solid var(--line); }
.skill-row {
  display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: 8px 32px;
  align-items: baseline; padding: 16px 0; border-bottom: 1px solid var(--line);
}
.skill-row dt { font-weight: 600; color: var(--text); }
.skill-row dd { margin: 0; min-width: 0; }
.skill-row ul, .tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.skill-row li {
  padding: 4px 12px; border-radius: 999px; font-size: 0.92rem; color: var(--text-soft);
  background: var(--surface); border: 1px solid var(--line);
}

/* Experience timeline: a real sequence, so a line connects it */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 27px; top: 28px; bottom: 28px; width: 2px;
  background: linear-gradient(var(--cyan), var(--violet) 60%, var(--line));
}
.job { display: grid; grid-template-columns: 56px 1fr; gap: 24px; padding-bottom: 40px; position: relative; }
.job:last-child { padding-bottom: 0; }

.job-logo {
  width: 56px; height: 56px; border-radius: 14px; object-fit: contain; padding: 6px;
  background: var(--logo-tile); box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--line);
}
.job-logo-dark { background: #11161d; }
.job-logo-wide { padding: 3px; }

.job-role { font-size: 1.3rem; font-weight: 600; }
.job-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 12px; }
.job-company { font-weight: 600; color: var(--cyan); }
.job-dates { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.job ul { margin: 0; padding-left: 1.1em; color: var(--text-soft); max-width: 72ch; }
.job li { margin-bottom: 6px; }
.job li::marker { color: var(--text-faint); }

/* Projects */
.project {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden;
}
.project-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); }
.project-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.project:hover .project-media img { transform: scale(1.03); }

.project-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.project-body > p { margin: 0; color: var(--text-soft); }
.project-metric { color: var(--text-soft); font-size: 0.95rem; }
.project-metric strong {
  display: block;
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; line-height: 1.2; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.project-title { font-size: 1.25rem; font-weight: 600; }
.project-title a { color: var(--text); text-decoration: none; }
.project-title a:hover { text-decoration: underline; }

.tags li { font-size: 0.82rem; color: var(--text-soft); padding: 3px 10px; border-radius: 6px; background: var(--surface-2); }
.project-body > .project-links { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.project-links a { font-weight: 600; font-size: 0.95rem; }

.project-featured {
  display: grid; grid-template-columns: 1.1fr 1fr; margin-bottom: 24px;
  border-color: color-mix(in srgb, var(--cyan) 35%, var(--line));
}
.project-featured .project-media { aspect-ratio: auto; height: 100%; min-height: 320px; }
.project-featured .project-body { padding: clamp(24px, 3.5vw, 40px); justify-content: center; }
.project-featured .project-title { font-size: 1.6rem; }
.project-featured .project-metric strong { font-size: 2rem; }

.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
/* An odd card out at the end spans the row, laid out side by side */
@media (min-width: 761px) {
  .project-grid > .project:last-child:nth-child(odd) { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .project-grid > .project:last-child:nth-child(odd) .project-media { aspect-ratio: auto; height: 100%; min-height: 260px; }
}

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 28px; color: var(--text-faint); font-size: 0.95rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.footer-inner p { margin: 0; }

/* ---------- Case study pages ---------- */
.case { max-width: 760px; padding-block: clamp(40px, 7vw, 80px); }
.case-back { display: inline-block; margin-bottom: 28px; font-weight: 500; }
.case h1 { font-size: clamp(2.2rem, 5.5vw, 3.4rem); letter-spacing: -0.03em; margin-bottom: 16px; }
.case-lede { font-size: 1.2rem; color: var(--text-soft); margin: 0 0 28px; }
.case-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 1px; margin: 0 0 40px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.case-stats div { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 96px; padding: 16px 18px; background: var(--surface); }
.case-stats dt { font-size: 0.88rem; line-height: 1.35; color: var(--text-faint); }
.case-stats dd { margin: 0; font: 700 1.5rem/1.15 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 720px) { .case-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .case-stats dd { font-size: 1.35rem; } }
.case h2 { font-size: 1.55rem; letter-spacing: -0.015em; margin: 48px 0 14px; }
.case p, .case li { color: var(--text-soft); }
.case p strong, .case li strong { color: var(--text); }
.case ul, .case ol { padding-left: 1.2em; }
.case li { margin-bottom: 8px; }
.case figure { margin: 28px 0; }
.case figure img { border-radius: var(--radius-md); border: 1px solid var(--line); background: #fff; }
.case figcaption { font-size: 0.92rem; color: var(--text-faint); margin-top: 10px; }
.case table { width: 100%; border-collapse: collapse; margin: 20px 0; font-variant-numeric: tabular-nums; }
.case th, .case td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.case th { color: var(--text-faint); font-weight: 500; font-size: 0.92rem; }
.case td:not(:first-child), .case th:not(:first-child) { text-align: right; }
.case-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.callout { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--cyan); border-radius: var(--radius-sm); padding: 14px 18px; margin: 24px 0; }
.callout p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .project-featured { grid-template-columns: 1fr; }
  .project-featured .project-media { aspect-ratio: 16 / 10; min-height: 0; }
}

@media (max-width: 760px) {
  .nav { gap: 10px; }
  .nav-toggle { display: grid; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; margin: 0; padding: 8px var(--gutter) 16px;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .nav-links.open { display: flex; }
  .nav-links.nav-links-static {
    display: flex; position: static; flex-direction: row; margin-left: auto;
    padding: 0; background: none; border: 0;
  }
  .nav-links.nav-links-static a { padding: 8px 10px; font-size: 0.95rem; }
  .nav-links a { padding: 12px 8px; font-size: 1.05rem; }

  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 32px; text-align: left; }
  .project-grid { grid-template-columns: 1fr; }
  .timeline::before { left: 21px; }
  .job { grid-template-columns: 44px 1fr; gap: 16px; }
  .job-logo { width: 44px; height: 44px; border-radius: 11px; padding: 4px; }
}

@media (max-width: 480px) {
  .skill-row { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1 1 auto; }
}

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