/* ==========================================================================
   Shubham Jain — personal site
   Layout echoes the CV: a date gutter on the left, crimson section rules.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-2: #f4f5f6;
  --text: #1b1d20;
  --text-2: #4a4f57;
  --text-3: #6b7079;
  --rule: #e4e6e9;
  --rule-2: #d3d6db;
  --accent: #a51e2e;
  --accent-hover: #7c1521;
  --accent-soft: rgba(165, 30, 46, 0.1);
  --plate: #ffffff;
  --plate-border: #e4e6e9;

  --font: "Fira Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --wrap: 1060px;
  --pad: 32px;
  --gutter: 132px;
  --gap: 36px;
  --indent: calc(var(--gutter) + var(--gap));

  color-scheme: light;
}

/* Dark palette. It follows the system setting unless the visitor has picked
   a theme with the header toggle, which stamps data-theme on <html>. */
:root[data-theme="dark"] {
  --bg: #0f1012;
  --bg-2: #17191c;
  --text: #e8e9eb;
  --text-2: #b4b8be;
  --text-3: #8e939b;
  --rule: #25282d;
  --rule-2: #383c43;
  --accent: #f2848f;
  --accent-hover: #ffadb5;
  --accent-soft: rgba(242, 132, 143, 0.14);
  --plate: #ffffff;
  --plate-border: transparent;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1012;
    --bg-2: #17191c;
    --text: #e8e9eb;
    --text-2: #b4b8be;
    --text-3: #8e939b;
    --rule: #25282d;
    --rule-2: #383c43;
    --accent: #f2848f;
    --accent-hover: #ffadb5;
    --accent-soft: rgba(242, 132, 143, 0.14);
    --plate: #ffffff;
    --plate-border: transparent;
    color-scheme: dark;
  }
}

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3 {
  margin: 0;
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }

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

::selection { background: var(--accent-soft); }

strong { font-weight: 600; }
em, i { font-style: italic; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 20;
  padding: 8px 14px;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip:focus { top: 12px; color: var(--bg); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
  view-transition-name: site-header;
}
.site-header.is-scrolled { border-bottom-color: var(--rule); }

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 66px;
}

.brand {
  color: var(--text);
  font-size: 17.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand span { font-weight: 300; color: var(--text-2); }
.brand:hover { color: var(--text); }

.nav { display: flex; align-items: center; gap: 30px; }
.nav a {
  position: relative;
  padding: 6px 0;
  color: var(--text-2);
  font-size: 15.5px;
  text-decoration: none;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.nav a:hover { color: var(--text); }
.nav a:hover::after { transform: scaleX(0.35); }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"]::after { transform: scaleX(1); }

/* Light/dark toggle: shows the moon in light mode and the sun in dark mode. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin: 0 -6px 0 -4px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); background: var(--accent-soft); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

/* ---------- Page structure ---------- */

main { padding-bottom: 104px; }

.page-head { padding: 72px 0 8px; max-width: 760px; }
.page-head h1 {
  font-size: 44px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.page-head .intro { color: var(--text-2); font-size: 18px; }

.section { margin-top: 64px; }

/* Section heading: crimson rule in the gutter, title in the content column. */
.sec-title {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  column-gap: var(--gap);
  align-items: center;
  margin-bottom: 26px;
  font-size: 23px;
  font-weight: 500;
}
.sec-title::before {
  content: "";
  height: 6px;
  background: var(--accent);
}

.indent { margin-left: var(--indent); }

/* Dated rows (news, talks, posters): date in the gutter, content beside it. */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  column-gap: var(--gap);
  padding: 0 0 20px;
}
.row:last-child { padding-bottom: 0; }

.when {
  color: var(--text-3);
  font-size: 15px;
  line-height: 1.75;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.what { min-width: 0; }
.what p { margin: 0; }

.t-title { font-weight: 500; color: var(--text); }
.t-meta { color: var(--text-2); font-size: 15.5px; }
.t-meta .kind { color: var(--text-3); }
.sep { color: var(--rule-2); padding: 0 0.4em; }

.t-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 5px !important;
  font-size: 14.5px;
  font-weight: 500;
}
.t-links a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.t-links a:hover { text-decoration: underline; }

.i-arrow { width: 0.72em; height: 0.72em; flex: none; }

/* Collapsible "earlier" list */
.more {
  margin-top: 22px;
}
.more > summary {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  column-gap: var(--gap);
  cursor: pointer;
  list-style: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary span:last-child::after { content: " +"; }
.more[open] > summary span:last-child::after { content: " −"; }
.more > summary:hover { color: var(--accent-hover); }
.more .rows { margin-top: 20px; }

/* ---------- Home ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 272px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "text photo"
    "text links";
  column-gap: 72px;
  align-items: start;
  padding: 76px 0 8px;
}
.hero-text { grid-area: text; }
.hero .portrait { grid-area: photo; }
.hero .profiles { grid-area: links; }

.hero h1 {
  font-size: 50px;
  font-weight: 300;
  color: var(--text-2);
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin-bottom: 12px;
}
.hero h1 b { font-weight: 500; color: var(--text); }

.role {
  color: var(--text-3);
  font-size: 16.5px;
  margin-bottom: 30px !important;
}

.bio { max-width: 640px; }
.bio p { margin-bottom: 1.05em; }

.portrait {
  margin: 6px 0 0;
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-2);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.profiles {
  display: flex;
  flex-direction: column;
  gap: 11px;
  list-style: none;
  margin: 26px 0 0;
  padding: 0 0 0 2px;
}
.profiles a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 15px;
  text-decoration: none;
}
.profiles a:hover { color: var(--accent); }
.profiles svg { width: 16px; height: 16px; flex: none; }

/* ---------- Papers list ---------- */

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

.pub {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr) 208px;
  column-gap: var(--gap);
  padding: 30px 0;
  border-top: 1px solid var(--rule);
}
.pub:first-child { border-top: 0; padding-top: 0; }
.pubs.compact .pub { grid-template-columns: var(--gutter) minmax(0, 1fr); padding: 22px 0; }
.pubs.compact .pub:first-child { padding-top: 0; }

.pub .when { grid-column: 1; }
.pub-body { grid-column: 2; min-width: 0; }
.pub-body p { margin: 0; }

.pub-title {
  font-size: 19px;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 6px;
}
.pub-title a { color: var(--text); text-decoration: none; }
.pub-title a:hover { color: var(--accent); }

.authors { color: var(--text-2); font-size: 15.5px; }
.authors strong { color: var(--text); font-weight: 500; }
.venue { color: var(--text-3); font-size: 15.5px; }
.venue em { color: var(--text-2); }
.teaser { margin-top: 10px !important; font-size: 16px; color: var(--text-2); max-width: 62ch; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px !important;
}

/* A link row (e.g. a talk video) under a section heading, above its papers. */
.chips.sec-links { margin-top: -8px !important; margin-bottom: 28px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 11px;
  border: 1px solid var(--rule-2);
  border-radius: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip .i-arrow { color: var(--text-3); transition: color 0.15s ease, transform 0.2s ease; }
.chip:hover .i-arrow { color: currentColor; }
.chip:hover .i-arrow.ext { transform: translate(1px, -1px); }
.chip:hover .i-arrow.int { transform: translateX(2px); }

.chip.primary {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}
.chip.primary .i-arrow { color: currentColor; }
.chip.primary:hover {
  background: color-mix(in srgb, var(--accent) 17%, transparent);
  color: var(--accent-hover);
}

.chip.solid {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip.solid .i-arrow { color: rgba(255, 255, 255, 0.8); }
.chip.solid:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
:root[data-theme="dark"] .chip.solid, :root[data-theme="dark"] .chip.solid:hover { color: #1a0b0d; }
:root[data-theme="dark"] .chip.solid .i-arrow { color: rgba(26, 11, 13, 0.75); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip.solid, :root:not([data-theme="light"]) .chip.solid:hover { color: #1a0b0d; }
  :root:not([data-theme="light"]) .chip.solid .i-arrow { color: rgba(26, 11, 13, 0.75); }
}

.pub-thumb {
  grid-column: 3;
  align-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  padding: 12px;
  background: var(--plate);
  border: 1px solid var(--plate-border);
  border-radius: 8px;
  overflow: hidden;
}
.pub-thumb picture, .pub-thumb img { width: 100%; height: 100%; }
.pub-thumb img { object-fit: contain; transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1); }
.pub-thumb:hover img { transform: scale(1.035); }

.see-all { margin-top: 26px; font-weight: 500; font-size: 15.5px; }
.see-all a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.see-all a:hover { text-decoration: underline; }

/* ---------- Project pages ---------- */

.crumbs { padding-top: 56px; font-size: 15px; }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .i-arrow { transform: rotate(180deg); }

.p-head { padding: 18px 0 0; max-width: 860px; }
.p-head h1 {
  font-size: 40px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 18px;
}
.p-head .authors { font-size: 16.5px; }
.p-head .venue { font-size: 16px; margin-top: 2px !important; }
.p-head .note { color: var(--text-3); font-size: 14.5px; margin-top: 4px !important; }

.figure { margin: 44px 0 0; }
.plate {
  display: flex;
  justify-content: center;
  padding: clamp(16px, 3.4vw, 40px);
  background: var(--plate);
  border: 1px solid var(--plate-border);
  border-radius: 10px;
}
.plate picture { display: block; width: 100%; }
.plate img { width: 100%; height: auto; max-height: 460px; object-fit: contain; }
.figure figcaption {
  margin-top: 14px;
  max-width: 76ch;
  color: var(--text-3);
  font-size: 14.5px;
  line-height: 1.6;
}

.lede { font-size: 20px; line-height: 1.6; color: var(--text); max-width: 64ch; }
.prose p { max-width: 68ch; }
.prose p + p { margin-top: 1em; }

.related {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cite { position: relative; max-width: 780px; }
.cite pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--text-2);
  font: 13.5px/1.65 var(--mono);
  tab-size: 2;
}
.copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 11px;
  background: var(--bg);
  border: 1px solid var(--rule-2);
  border-radius: 6px;
  color: var(--text-2);
  font: 500 13px/1.3 var(--font);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.copy:hover { border-color: var(--accent); color: var(--accent); }

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}
.pager a { display: block; text-decoration: none; color: var(--text); }
.pager a:hover .pager-title { color: var(--accent); }
.pager .pager-label { display: block; color: var(--text-3); font-size: 14px; margin-bottom: 4px; }
.pager .pager-title { font-weight: 500; line-height: 1.4; transition: color 0.15s ease; }
.pager .next { text-align: right; grid-column: 2; }

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

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 40px 0 56px;
  color: var(--text-3);
  font-size: 14.5px;
  line-height: 1.6;
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 24px 48px; flex-wrap: wrap; }
.site-footer p { margin: 0; }
.site-footer .f-name { color: var(--text); font-weight: 500; margin-bottom: 4px; }
.site-footer .f-right { text-align: right; }
.site-footer .f-right p + p { margin-top: 4px; }
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--accent); }

/* ---------- 404 ---------- */

.lost { padding: 120px 0 40px; max-width: 560px; }
.lost h1 { font-size: 44px; font-weight: 400; margin-bottom: 14px; }
.lost p { color: var(--text-2); }

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.22s; }
  main { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 920px) {
  :root { --gutter: 104px; --gap: 28px; }
  .hero { grid-template-columns: minmax(0, 1fr) 220px; column-gap: 48px; }
  .pub { grid-template-columns: var(--gutter) minmax(0, 1fr) 168px; }
}

@media (max-width: 720px) {
  :root { --pad: 20px; --gutter: 0px; --gap: 0px; }
  body { font-size: 16.5px; }

  .site-header .wrap { height: 58px; }
  .nav { gap: 22px; }
  .nav a { font-size: 15px; }

  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas: "photo" "text" "links";
    padding-top: 36px;
  }
  .hero .portrait { width: 156px; margin: 0 0 26px; }
  .hero h1 { font-size: 40px; }
  .hero .profiles {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px 22px;
    margin-top: 28px;
    padding: 22px 0 0;
    border-top: 1px solid var(--rule);
  }

  .page-head { padding-top: 44px; }
  .page-head h1 { font-size: 36px; }

  .section { margin-top: 52px; }
  .sec-title { grid-template-columns: 28px minmax(0, 1fr); column-gap: 14px; font-size: 21px; margin-bottom: 20px; }
  .sec-title::before { height: 5px; }

  .row { grid-template-columns: 1fr; padding-bottom: 22px; }
  .when { text-align: left; font-size: 13.5px; line-height: 1.5; margin-bottom: 2px; }
  .when:empty { display: none; }

  .more > summary { grid-template-columns: 1fr; }
  .more > summary span:first-child { display: none; }

  .pub, .pubs.compact .pub { grid-template-columns: 1fr; padding: 26px 0; }
  .pub .when, .pub-body, .pub-thumb { grid-column: 1; }
  .pub-thumb { display: none; }

  .crumbs { padding-top: 32px; }
  .p-head h1 { font-size: 30px; }
  .figure { margin-top: 32px; }
  .plate img { max-height: 320px; }
  .lede { font-size: 18.5px; }

  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; text-align: left; }

  .site-footer .f-right { text-align: left; }
}

@media print {
  .site-header, .skip, .copy, .pager { display: none; }
  main { animation: none; }
  a { color: inherit; }
}
