/* ==========================================================
   Nitin Yadav — personal website
   Colours and fonts are set in :root; change them there.
   ========================================================== */

:root {
  --bg: #fbfbf9;
  --bg-alt: #f2f4f3;
  --surface: #ffffff;
  --text: #16202a;
  --text-soft: #4a5663;
  --muted: #6f7b87;
  --border: #e3e7ea;
  --accent: #0f6e6e;        /* deep teal */
  --accent-soft: #e3f1f0;
  --accent-strong: #0b5454;
  --ink: #0f2a3a;           /* dark navy for contact band */
  --shadow: 0 1px 2px rgba(16, 32, 42, .04), 0 4px 16px rgba(16, 32, 42, .05);
  --radius: 14px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 1080px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0e1418;
  --bg-alt: #121a1f;
  --surface: #162027;
  --text: #e7ecef;
  --text-soft: #b4bfc7;
  --muted: #8a97a1;
  --border: #24313a;
  --accent: #5cc4bd;
  --accent-soft: #173a3a;
  --accent-strong: #7fd6d0;
  --ink: #0a2230;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
strong, b { font-weight: 600; color: var(--text); }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 24px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; color: var(--text); letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: var(--text-soft); font-size: .92rem; font-weight: 500;
  padding: 6px 12px; border-radius: 8px; transition: color .15s, background .15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--accent); background: var(--accent-soft); }
.nav-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  border-radius: 10px; cursor: pointer; transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: block; }
[data-theme="dark"] .i-moon { display: none; }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 56px; align-items: center; }
.eyebrow {
  font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent); margin-bottom: 14px;
}
.hero h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(2.6rem, 5.5vw, 3.8rem); line-height: 1.05; letter-spacing: -.02em;
  margin-bottom: 20px;
}
.lead { font-size: 1.2rem; color: var(--text-soft); max-width: 620px; line-height: 1.6; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 26px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; transition: transform .15s, background .15s, color .15s, border-color .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
[data-theme="dark"] .btn-primary { color: #0b1a1a; }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { color: var(--ink); background: #eef6f5; }
.btn-outline-light { border-color: rgba(255,255,255,.35); color: #fff; }
.btn-outline-light:hover { border-color: #fff; color: #fff; }

.social { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.social a { display: inline-flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: .92rem; font-weight: 500; }
.social a:hover { color: var(--accent); }

.avatar {
  position: relative; width: 240px; height: 240px; border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-soft), var(--bg-alt));
  border: 1px solid var(--border); box-shadow: var(--shadow);
  display: grid; place-items: center; overflow: hidden;
}
.avatar::after {
  content: ""; position: absolute; inset: 10px; border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, transparent);
  pointer-events: none;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-initials { font-family: var(--serif); font-size: 4.4rem; font-weight: 600; color: var(--accent); letter-spacing: -.03em; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin-top: 56px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stats > div { padding: 22px 24px; border-left: 1px solid var(--border); }
.stats > div:first-child { border-left: 0; }
.stats dt { font-family: var(--serif); font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stats dd { font-size: .9rem; font-weight: 500; color: var(--text); margin-top: 6px; line-height: 1.4; }
.stats small { color: var(--muted); font-weight: 400; font-size: .8rem; }

/* ---------- Sections ---------- */
.section { padding: 84px 0; }
.section.alt { background: var(--bg-alt); }
.section-title {
  font-family: var(--serif); font-size: 2rem; font-weight: 700; letter-spacing: -.015em;
  line-height: 1.2; margin-bottom: 10px;
}
.section-sub { color: var(--muted); margin-bottom: 36px; }
#about p, #news p { color: var(--text-soft); }
#about p + p { margin-top: 16px; }
#about .section-title { margin-bottom: 20px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
  transition: transform .2s, border-color .2s;
}
.card h3 { font-size: 1.08rem; font-weight: 600; line-height: 1.4; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 48px; align-items: start; }
.glance h3 { font-family: var(--serif); font-size: 1.2rem; margin-bottom: 14px; }
.glance dl { display: grid; gap: 12px; }
.glance dt { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.glance dd { font-size: .95rem; color: var(--text); margin-top: -10px; }

/* Research */
.feature:hover, .project:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.feature-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 18px;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--text-soft); font-size: .95rem; }

/* News */
#news .section-title { margin-bottom: 26px; }
.news { list-style: none; border-top: 1px solid var(--border); }
.news li { display: grid; grid-template-columns: 90px 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.news-date { font-weight: 600; font-size: .85rem; color: var(--accent); padding-top: 2px; }

/* Publications */
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.pub-group {
  font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 8px 0 16px;
}
.pubs { list-style: none; display: grid; gap: 14px; margin-bottom: 28px; }
.pub {
  display: grid; grid-template-columns: 140px 1fr; gap: 22px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow);
}
.pub-venue {
  display: inline-block; text-align: center; font-size: .78rem; font-weight: 600;
  background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 6px 10px;
}
.pub-venue.accepted { background: #fff4e0; color: #9a5b00; }
[data-theme="dark"] .pub-venue.accepted { background: #3a2c12; color: #f0c06a; }
.pub-title { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; line-height: 1.4; color: var(--text); }
.pub-authors { font-size: .93rem; color: var(--text-soft); margin-top: 6px; }
.pub-meta { font-size: .88rem; color: var(--muted); font-style: italic; }
.pub-note {
  display: inline-flex; align-items: center; gap: 10px; font-size: .95rem; color: var(--text-soft);
  background: var(--surface); border: 1px dashed var(--border); border-radius: 10px; padding: 12px 16px;
}
.pub-note svg { color: var(--accent); }

/* Timeline */
#experience .section-title { margin-bottom: 30px; }
.timeline { list-style: none; position: relative; }
.timeline::before { content: ""; position: absolute; left: 179px; top: 8px; bottom: 8px; width: 1px; background: var(--border); }
.timeline li { display: grid; grid-template-columns: 160px 1fr; gap: 40px; padding-bottom: 34px; position: relative; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: 174px; top: 8px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.timeline li:first-child::before { background: var(--accent); }
.tl-date { font-size: .88rem; font-weight: 600; color: var(--muted); text-align: right; padding-top: 1px; }
.tl-body h3 { font-size: 1.1rem; font-weight: 600; }
.tl-org { color: var(--accent); font-weight: 500; font-size: .93rem; margin-bottom: 6px; }
.tl-body p:last-child { color: var(--text-soft); font-size: .96rem; }

/* Teaching */
.teach-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.teach-head h3 { font-family: var(--serif); font-size: 1.25rem; }
.tag { font-size: .74rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--bg-alt); color: var(--text-soft); border: 1px solid var(--border); white-space: nowrap; }
.tag-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.teach ul { list-style: none; }
.teach li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--border); font-size: .95rem; }
.teach li em { font-style: normal; color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* Projects */
.project { display: flex; flex-direction: column; gap: 12px; }
.project-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.date { font-size: .8rem; color: var(--muted); font-weight: 500; white-space: nowrap; }
.project > p { color: var(--text-soft); font-size: .95rem; }
.metrics { display: flex; gap: 10px; flex-wrap: wrap; }
.metrics span { font-size: .85rem; color: var(--text-soft); background: var(--accent-soft); padding: 4px 10px; border-radius: 8px; }
.metrics b { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span {
  font-size: .82rem; font-weight: 500; color: var(--text-soft);
  border: 1px solid var(--border); background: var(--surface); padding: 4px 11px; border-radius: 999px;
}
.project .guide { font-size: .83rem; color: var(--muted); margin-top: auto; padding-top: 4px; }
.more-link { margin-top: 26px; font-weight: 600; }

/* Skills & education */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
.two-col .section-title { margin-bottom: 24px; }
.skill-group + .skill-group { margin-top: 22px; }
.skill-group h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.edu { display: grid; gap: 16px; }
.edu-item { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 12px; padding: 20px 22px; box-shadow: var(--shadow); }
.edu-item h3 { font-size: 1.05rem; font-weight: 600; margin: 4px 0 2px; }
.edu-item p { font-size: .95rem; color: var(--text-soft); }
.edu-item .muted { font-size: .88rem; color: var(--muted); }

/* Contact */
.contact-card {
  background: var(--ink); color: #dfe9ee; border-radius: 20px; padding: 48px;
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center;
  background-image: radial-gradient(circle at 100% 0%, rgba(92, 196, 189, .22), transparent 55%);
}
.contact-card h2 { font-family: var(--serif); font-size: 2rem; color: #fff; margin-bottom: 10px; line-height: 1.2; }
.contact-card p { color: #b9cbd4; }
.contact-actions { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.contact-actions .btn { justify-content: center; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 28px 0; font-size: .88rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer a { color: var(--muted); margin-left: 18px; }
.footer a:hover { color: var(--accent); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 2px;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 10px 16px 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 12px; }
  .menu-btn { display: grid; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .about-grid, .two-col { grid-template-columns: 1fr; gap: 36px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .hero { padding: 40px 0 24px; }
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-photo { order: -1; }
  .avatar { width: 128px; height: 128px; }
  .avatar-initials { font-size: 2.6rem; }
  .avatar::after { inset: 6px; }
  .stats { grid-template-columns: 1fr 1fr; margin-top: 36px; }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .section { padding: 60px 0; }
  .section-title { font-size: 1.7rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .pub { grid-template-columns: 1fr; gap: 12px; padding: 20px; }
  .pub-venue { justify-self: start; }
  .timeline::before { left: 5px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; padding-left: 30px; }
  .timeline li::before { left: 0; }
  .tl-date { text-align: left; }
  .news li { grid-template-columns: 1fr; gap: 2px; }
  .contact-card { grid-template-columns: 1fr; padding: 32px 24px; }
  .footer a { margin: 0 16px 0 0; }
}

/* ---------- Playground teaser (home page) ---------- */
.nav-links a.nav-fun { color: var(--accent); }
.fun-teaser { padding-bottom: 0; }
.fun-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 30px 36px; box-shadow: var(--shadow); color: var(--text);
  transition: transform .2s, border-color .2s;
}
.fun-card:hover { transform: translateY(-3px); border-color: var(--accent); color: var(--text); }
.fun-emoji {
  width: 72px; height: 72px; border-radius: 18px; display: grid; place-items: center;
  font-size: 2.2rem; background: linear-gradient(145deg, #fff1d6, #ffe0e6);
}
[data-theme="dark"] .fun-emoji { background: linear-gradient(145deg, #3a2f18, #3a1f27); }
.fun-text h2 { font-family: var(--serif); font-size: 1.5rem; line-height: 1.25; margin-bottom: 6px; }
.fun-text p { color: var(--text-soft); font-size: .97rem; }
.fun-go { font-weight: 600; color: var(--accent); white-space: nowrap; }

/* ---------- Playground page ---------- */
.play-hero { padding: 64px 0 24px; }
.play-hero h1 {
  font-family: var(--serif); font-weight: 700; font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  letter-spacing: -.02em; line-height: 1.1; margin-bottom: 14px;
}
.play-hero .lead { max-width: 640px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; margin-bottom: 26px; }
.play-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.play-card {
  display: flex; flex-direction: column; overflow: hidden; padding: 0; color: var(--text);
}
.play-card:hover { transform: translateY(-4px); border-color: var(--accent); color: var(--text); }
.play-thumb {
  aspect-ratio: 16 / 10; background: var(--bg-alt); border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.play-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .35s; }
.play-card:hover .play-thumb img { transform: scale(1.04); }
.play-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.play-body h3 { font-size: 1.12rem; display: flex; align-items: center; gap: 8px; }
.play-body p { color: var(--text-soft); font-size: .94rem; }
.play-body .chips { margin-top: auto; padding-top: 4px; }
.play-btn {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; color: var(--accent);
}
.play-tip {
  margin-top: 36px; font-size: .92rem; color: var(--muted);
  border: 1px dashed var(--border); border-radius: 12px; padding: 14px 18px; background: var(--surface);
}
.play-tip kbd {
  font-family: ui-monospace, Consolas, monospace; font-size: .8rem; padding: 1px 6px;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--bg-alt); color: var(--text);
}

@media (max-width: 960px) { .play-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) {
  .fun-card { grid-template-columns: 1fr; gap: 16px; padding: 26px 22px; }
  .fun-emoji { width: 58px; height: 58px; font-size: 1.8rem; }
  .play-grid { grid-template-columns: 1fr; }
  .play-hero { padding: 36px 0 12px; }
}

/* When a profile photo is present, drop the dashed ring and use a clean frame */
.avatar:has(img)::after { display: none; }
.avatar:has(img) { border: 4px solid var(--surface); box-shadow: 0 0 0 1px var(--border), var(--shadow); }
