/* ==========================================================================
   Sharanya Vats — Portfolio Stylesheet
   Token system: see comments below for the two theme palettes.
   ========================================================================== */

:root {
  /* ---- Light theme (default) ---- */
  --bg: #f6f4ef;              /* paper */
  --bg-elevated: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.72);
  --text: #1d1b2e;            /* graphite */
  --text-muted: #55516b;
  --accent: #5b4b8a;          /* nebula violet */
  --accent-soft: rgba(91, 75, 138, 0.12);
  --accent-2: #9c7a2e;        /* muted gold, tuned for light bg */
  --line: rgba(29, 27, 46, 0.14);
  --star: rgba(29, 27, 46, 0.35);
  --shadow: 0 1px 2px rgba(29, 27, 46, 0.06), 0 8px 24px rgba(29, 27, 46, 0.06);

  --font-display: "Source Serif 4", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --maxw: 880px;
  --radius: 14px;
}

[data-theme="dark"] {
  --bg: #0b0d1f;
  --bg-elevated: #12142a;
  --card-bg: rgba(255, 255, 255, 0.045);
  --text: #e8e6f0;
  --text-muted: #a6a2c4;
  --accent: #b3a6e6;
  --accent-soft: rgba(179, 166, 230, 0.14);
  --accent-2: #d4a857;
  --line: rgba(232, 230, 240, 0.14);
  --star: rgba(232, 230, 240, 0.9);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.35s ease;
}

#starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100%;
}

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

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

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Top nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-mark {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.nav-mark span { color: var(--accent-2); }

.nav-links {
  display: flex;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.nav-links a:hover { color: var(--accent); }

.nav-right { display: flex; align-items: center; gap: 10px; }

.nav-toggle-btn {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

#theme-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 42px;
  height: 42px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}
#theme-toggle:hover { transform: scale(1.06) rotate(-8deg); }

/* ---------- Hero ---------- */
.hero {
  padding: 88px 0 56px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 14px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 60px);
  line-height: 1.05;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}

.hero .role {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(18px, 2.4vw, 22px);
  color: var(--text-muted);
  margin: 0 0 28px;
}

.abstract {
  border-left: 2px solid var(--accent-soft);
  padding-left: 20px;
  max-width: 62ch;
}

.abstract p {
  color: var(--text-muted);
  font-size: 16.5px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.btn-primary:hover { background: var(--accent-2); color: #1d1b2e; }

.btn-ghost {
  background: transparent;
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Section scaffolding ---------- */
.section {
  padding: 64px 0;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 34px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0;
}

.section-note {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: right;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in-view { opacity: 1; transform: none; }

/* ---------- About / education ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 44px;
}

.about-grid p { color: var(--text-muted); }

.edu-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.edu-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 4px;
}

.edu-card .meta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent-2);
  margin-bottom: 14px;
}

.edu-card ul { margin: 0; padding-left: 18px; color: var(--text-muted); font-size: 14.5px; }
.edu-card li { margin-bottom: 6px; }

.gpa-row {
  display: flex;
  gap: 22px;
  margin: 10px 0 16px;
}
.gpa-row div { font-family: var(--font-mono); font-size: 13px; }
.gpa-row b { display: block; font-size: 20px; font-family: var(--font-display); color: var(--text); }

/* ---------- Research cards ---------- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.paper {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paper .tag {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

.paper h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17.5px;
  margin: 0;
  line-height: 1.35;
}

.paper .metric {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent-2);
  word-break: break-word;
}

.paper p {
  color: var(--text-muted);
  font-size: 14.5px;
  margin: 0;
}

.paper.wide { grid-column: 1 / -1; }

/* ---------- Timeline (experience) ---------- */
.timeline {
  position: relative;
  padding-left: 26px;
  border-left: 1px solid var(--line);
}

.tl-item {
  position: relative;
  padding-bottom: 30px;
}
.tl-item:last-child { padding-bottom: 0; }

.tl-item::before {
  content: "";
  position: absolute;
  left: -31px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px var(--bg);
}

.tl-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-2);
  margin-bottom: 4px;
  display: block;
}

.tl-item h3 { font-family: var(--font-display); font-size: 17px; margin: 0 0 6px; }
.tl-item .org { color: var(--text-muted); font-size: 13.5px; margin-bottom: 6px; font-style: italic; }
.tl-item ul { margin: 0; padding-left: 18px; color: var(--text-muted); font-size: 14px; }
.tl-item li { margin-bottom: 4px; }

.subhead {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 40px 0 18px;
}
.subhead:first-child { margin-top: 0; }

/* ---------- Awards ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card-bg);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13.5px;
  color: var(--text);
}

/* ---------- AI Lab (chatbot embed inside CarbonLens card) ---------- */
.ai-lab-frame {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elevated);
  margin-top: 6px;
}

.ai-lab-frame iframe {
  width: 100%;
  height: 380px;
  border: none;
  display: block;
}

/* ---------- Footer / contact ---------- */
footer {
  border-top: 1px solid var(--line);
  padding: 48px 0 60px;
}

.contact-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 14px;
}

footer h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 4px;
}

footer .tagline { color: var(--text-muted); max-width: 46ch; }

.credit {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12.5px;
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Portrait ---------- */
.portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--card-bg);
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-toggle-btn { display: inline-flex; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--line);
    padding: 16px 24px 22px;
    gap: 14px;
  }
  .about-grid { grid-template-columns: 1fr; }
  .about-grid .portrait-col { order: -1; max-width: 220px; }
  .research-grid { grid-template-columns: 1fr; }
  .paper.wide { grid-column: auto; }
}
