/* ==========================================================================
   Shreyansh Padarha: personal site
   Plain CSS, no build step. Colours live in the variables below;
   dark mode just swaps them.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --fg: #1d2025;
  --muted: #5d6570;
  --link-row: #3e444c;
  --rule: #e7e9ec;
  --panel: #f6f7f9;
  --accent: #1f4e8c;
  --accent-hover: #0f2f5c;
  --venue: #8c2f39;

  --maxw: 52rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Noto Sans Devanagari", "Kohinoor Devanagari", "Nirmala UI", sans-serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --fg: #e5e7eb;
    --muted: #a0a8b3;
    --link-row: #c3c9d1;
    --rule: #262b33;
    --panel: #181b21;
    --accent: #8ab4f8;
    --accent-hover: #b4cffb;
    --venue: #f09aa3;
  }
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

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

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

p {
  margin: 0 0 1rem;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: var(--bg);
  padding: 0.25rem 0.5rem;
}

.skip-link:focus {
  left: 0.5rem;
}

/* ---------- Top navigation ---------- */

.site-nav {
  display: flex;
  justify-content: flex-end;
  padding: 1.5rem 0 0.5rem;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav ul a {
  color: var(--muted);
  font-size: 0.95rem;
}

.site-nav ul a:hover {
  color: var(--fg);
}

/* ---------- Intro ---------- */

/* flow-root contains the floated photo so text wraps around and under it */
.hero {
  display: flow-root;
  padding-top: 2rem;
}

.hero-photo {
  float: right;
  width: 14.5rem;
  margin: 0.4rem 0 1rem 2.25rem;
}

.hero-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 6;
  object-fit: cover;
  border-radius: 12px;
}

.hero h1 {
  font-size: 2.15rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
}

/* English/Hindi name swap: both spans share one grid cell, so the box is as wide
   as the longer version and nothing shifts. First span shows; second shows on hover. */
.swap {
  display: inline-grid;
}

.swap > span {
  grid-area: 1 / 1;
  transition: opacity 0.25s ease;
}

.swap > span:last-child {
  opacity: 0;
}

.swap [aria-hidden="true"] {
  user-select: none;
  -webkit-user-select: none;
}

@media (hover: hover) {
  .swap:hover > span:first-child {
    opacity: 0;
  }

  .swap:hover > span:last-child {
    opacity: 1;
  }
}

.swap:focus-visible > span:first-child {
  opacity: 0;
}

.swap:focus-visible > span:last-child {
  opacity: 1;
}

/* My own asides, written in [square brackets] */
.aside {
  color: var(--muted);
}

.tagline {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0.3rem 0 1rem;
}

/* Profile links: grey, medium weight and slightly tracked so they read as
   navigation rather than body text. All icons are solid glyphs. */
.social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.2rem;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.social a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--link-row);
}

.social a:hover {
  color: var(--fg);
  text-decoration: none;
}

.social svg {
  width: 1.05em;
  height: 1.05em;
  flex: none;
}

.interests {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.interests li {
  margin-bottom: 0.5rem;
}

.interests li::marker {
  color: var(--muted);
}

@media (max-width: 640px) {
  .hero {
    padding-top: 1.25rem;
  }

  .hero-photo {
    float: none;
    width: 9rem;
    margin: 0 0 1rem;
  }

  .hero h1 {
    font-size: 1.85rem;
  }
}

/* ---------- Sections ---------- */

section {
  border-top: 1px solid var(--rule);
  margin-top: 2.5rem;
  padding-top: 2rem;
  scroll-margin-top: 1rem;
}

h2 {
  font-size: 1.4rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
}

h3 {
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.25;
  margin: 2rem 0 0.75rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
}

.section-head a {
  font-size: 0.95rem;
}

.note {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Publications ---------- */

.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Text on the left, the paper's figure on the right */
.pub {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: 0 1.5rem;
  align-items: start;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--rule);
}

.pub:first-child {
  padding-top: 0.5rem;
}

.pub:last-child {
  border-bottom: 0;
}

.pub-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
}

.pub-title a {
  color: var(--fg);
}

.pub-title a:hover {
  color: var(--accent);
}

.pub-authors {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.pub-authors .me {
  color: var(--fg);
  font-weight: 600;
}

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 1rem;
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
}

.venue {
  color: var(--venue);
  font-weight: 650;
}

/* Whole figure at its natural shape: no cropping, no letterboxing. Tall figures are
   capped in height (and so drawn narrower) to keep rows compact. */
.pub-fig {
  margin: 0.2rem 0 0;
}

.pub-fig img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 12.5rem;
  margin-left: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #fff;
}

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

  .pub-fig {
    margin-top: 0.8rem;
  }

  .pub-fig img {
    max-height: 14rem;
    margin-left: 0;
  }
}

/* ---------- Dated lists (experience, education, awards, teaching) ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline > li {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  align-items: baseline;
  gap: 0 1.25rem;
  padding: 0.55rem 0;
}

.timeline .when {
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline .org {
  color: var(--muted);
}

.timeline p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

@media (max-width: 560px) {
  .timeline > li {
    grid-template-columns: 1fr;
  }

  .timeline .when {
    font-size: 0.85rem;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--fg);
  text-decoration: none;
}
