/* Shubham Ubhe — research site.
   Layout mirrors a quiet, paper-like academic homepage:
   one narrow column, a dated timeline, and long-form write-ups. */

:root {
  /* Day — "Sahyadri paper": warm off-white with a glacier-teal accent */
  --bg: #f7f5f0;
  --bg-deep: #ece9e1;
  --surface: #fcfbf7;
  --ink: #18191a;
  --ink-soft: #4a5552;
  --muted: #4b4a45;
  --muted-light: #9b998f;
  --rule: #c8c4b8;
  --rule-soft: #ddd9ce;
  --accent: #1f5f5b;
  --accent-deep: #174a47;
  --accent-soft: #1f5f5b17;
  --hlight: #1f5f5b;
  --hover-hlight: #7f948f;
  --code-bg: #eceae2;

  --step--2: .8rem;
  --step--1: .95rem;
  --step-0: 1.0325rem;
  --step-1: 1.1rem;
  --step-2: 1.375rem;
  --step-3: 1.625rem;
  --step-4: 2rem;
  --step-4-5: clamp(2rem, 5vw, 2.8rem);
  --step-5: clamp(2rem, 5vw, 3.4rem);
  --measure: 680px;
  --wide: 800px;

  --font-display: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

/* Night — "Ladakh sky": deep blue-black with snow-white ink and a lamp-glow accent */
:root[data-theme="night"] {
  --bg: #12161c;
  --bg-deep: #0c0f13;
  --surface: #1a2028;
  --ink: #e6e8e3;
  --ink-soft: #c3cbc6;
  --muted: #a3aca8;
  --muted-light: #6c7873;
  --rule: #3a4550;
  --rule-soft: #27313a;
  --accent: #e0a34a;
  --accent-deep: #f2b862;
  --accent-soft: #e0a34a21;
  --hlight: #f2b862;
  --hover-hlight: #f7d9a4;
  --code-bg: #222a33;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.68;
  letter-spacing: -.006em;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .2s, color .2s;
}

h1, h2, h3, h4 { font-family: var(--font-display); }

::selection { background: var(--accent); color: var(--bg); }

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

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: absolute; top: 14px; right: 14px; z-index: 60;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  appearance: none; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 2px;
  background: var(--surface); color: var(--accent-deep);
  transition: background .16s, color .16s, border-color .16s, transform .16s;
}
.theme-toggle:hover { background: var(--accent-soft); border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle svg { width: 16px; height: 16px; display: none; }
:root[data-theme="night"] .theme-toggle .icon-day,
:root:not([data-theme="night"]) .theme-toggle .icon-night { display: block; }

/* ---------- Header ---------- */
.site-header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: .75rem 2rem;
  max-width: 70rem; margin: 0 auto;
  padding: 1.4rem calc(1.6rem + 50px) 0 1.6rem;
}
.site-brand { font: 600 1.1rem/1 var(--font-display); color: var(--ink); letter-spacing: -.01em; text-decoration: none; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  font: 500 .95rem/1 var(--font-body); color: var(--muted); text-decoration: none;
  padding-bottom: .2rem; border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav li.current a { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- Shell ---------- */
.shell { max-width: var(--wide); margin: 0 auto; padding: 56px 32px 120px; }

.shell p a,
.shell li:not(.timeline-row) a:not(.chip) {
  color: var(--hlight); font-weight: 600;
  text-decoration: underline 1px; text-underline-offset: 2px;
  transition: color .15s;
}
.shell p a:hover,
.shell li:not(.timeline-row) a:not(.chip):hover { color: var(--hover-hlight); }

/* ---------- Home hero ---------- */
.hero { max-width: var(--wide); margin: 3rem auto 2.5rem; }
.kicker {
  font: 500 .78rem/1.4 var(--mono); color: var(--accent-deep);
  text-transform: uppercase; letter-spacing: .12em; margin: 0 0 1.2rem;
}
.hero h1 { font: 300 var(--step-5)/1.1 var(--font-display); margin: 0 0 .5em; }
.hero .lede { font: 430 var(--step-1)/1.6 var(--font-body); letter-spacing: .01em; max-width: 39rem; }

.hero-links, .chips { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  font: 500 .8rem/1 var(--mono); letter-spacing: .04em;
  color: var(--accent-deep); text-decoration: none;
  border: 1px solid var(--accent); border-radius: 3px;
  padding: .45rem .75rem;
  transition: background .16s, color .16s;
}
.chip svg { flex: none; width: 1.05em; height: 1.05em; }
.chip:hover { background: var(--accent); color: var(--bg); }
.chip-back { color: var(--muted); border-color: var(--rule); }
.chip-back:hover { background: var(--bg-deep); color: var(--ink); }

.interests {
  max-width: var(--measure); margin: 3rem 0 0; padding-top: 1.4rem;
  border-top: 1px solid var(--rule-soft);
}
.interests h2 {
  font: 500 .78rem/1 var(--mono); color: var(--muted); text-transform: uppercase;
  letter-spacing: .12em; margin: 0 0 1rem;
}
.interests ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .7rem; }
.interests li { display: grid; grid-template-columns: 1.6rem 1fr; gap: .2rem; line-height: 1.55; }
.interests li .n { font: 500 .8rem/1.9 var(--mono); color: var(--accent); }
.interests li b { font-weight: 600; }
.interests li span.d { color: var(--muted); }

/* ---------- Page headers ---------- */
.page-header { margin: 2.5rem 0 1.4rem; }
.page-header h1 { font: 300 var(--step-5)/1.1 var(--font-display); margin: 0 0 .5em; }
.page-lede { font: 400 var(--step-1)/1.55 var(--font-body); max-width: 38rem; margin: 0; }

.legend {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .9rem;
  font: 400 var(--step--1)/1.4 var(--font-body); color: var(--muted); margin: 1rem 0 0;
}
.legend-item { display: inline-flex; align-items: baseline; gap: .35rem; }
.legend-sample { font: 600 var(--step--1)/1.2 var(--font-display); color: var(--ink-soft); white-space: nowrap; }
.legend-label { font-style: italic; }
.legend-sep { color: var(--rule); }

/* ---------- Timeline ---------- */
.timeline-group {
  font: 500 .74rem/1 var(--mono); color: var(--muted-light); text-transform: uppercase;
  letter-spacing: .14em; margin: 2.6rem 0 .8rem;
}
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.timeline-row { border-bottom: 1px solid var(--rule-soft); }
.timeline-row > a,
.timeline-row > .static {
  display: grid; grid-template-columns: 8rem 1fr; align-items: baseline; gap: 1.2rem;
  padding: 1.1rem .4rem; color: inherit; text-decoration: none; transition: background .16s;
}
.timeline-row > a:hover { background: var(--bg-deep); }
.timeline-row > a:hover .tl-title { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.tl-date { font: 500 .78rem/1 var(--mono); color: var(--muted); letter-spacing: .06em; }
.tl-body { display: flex; flex-direction: column; gap: .3rem; }
.tl-title { font: 560 var(--step-0)/1.3 var(--font-display); color: var(--ink); }
.tl-sub { font: 400 var(--step--1)/1.45 var(--font-body); color: var(--muted); font-style: italic; }
.tl-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .25rem; }
.tl-tags span {
  font: 500 .68rem/1 var(--mono); letter-spacing: .04em; color: var(--ink-soft);
  background: var(--bg-deep); border: 1px solid var(--rule-soft); border-radius: 2px; padding: .28rem .45rem;
}
.tl-ext {
  display: inline-block; margin-left: .35em; font: 600 .9em var(--mono); color: var(--accent);
  transform: translateY(-.05em); transition: color .16s, transform .16s;
}
.timeline-row > a:hover .tl-ext { color: var(--accent-deep); transform: translate(.1em, -.15em); }
.tl-badge {
  font: 500 .66rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-deep); border: 1px solid var(--accent); border-radius: 2px;
  padding: .2rem .35rem; margin-left: .5em; vertical-align: .15em; white-space: nowrap;
}

/* ---------- Research write-up ---------- */
.research-header { margin: 2.5rem 0 2rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--rule); }
.research-header .kicker { margin-bottom: .8em; }
.research-header h1 { font: 400 var(--step-4-5)/1.12 var(--font-display); letter-spacing: -.015em; margin: 0 0 .5em; }
.research-desc { font: 400 var(--step-1)/1.55 var(--font-body); margin: 0 0 1.1em; }
.research-meta { font: 500 var(--step--1)/1.5 var(--font-body); color: var(--muted); margin: 0 0 1.2em; }
.research-meta b { color: var(--ink); font-weight: 600; }

.research-body { max-width: var(--measure); }
.research-body h2 {
  font: 380 var(--step-3)/1.2 var(--font-display); color: var(--accent-deep);
  letter-spacing: -.01em; margin: 2.8rem 0 1rem;
}
.research-body h2::before { content: ""; display: block; width: 48px; height: 2px; background: var(--accent); margin-bottom: 14px; }
.research-body p { margin: 0 0 1.1em; }
.research-body ul, .research-body ol { padding-left: 1.3rem; margin: 0 0 1.2em; }
.research-body li { margin-bottom: .45em; }
.research-body code {
  font: 500 .86em var(--mono); background: var(--code-bg); color: var(--accent-deep);
  padding: .1em .35em; border-radius: 2px;
}
.research-body blockquote {
  margin: 1.6rem 0; padding: .2rem 0 .2rem 1.2rem; border-left: 2px solid var(--accent);
  color: var(--ink-soft); font-style: italic;
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 1.6rem 0 2rem; }
.stat {
  background: var(--surface); border: 1px solid var(--rule-soft); border-top: 3px solid var(--accent);
  border-radius: 2px; padding: 12px 14px 10px;
}
.stat .v { font: 400 var(--step-4)/1.1 var(--font-display); color: var(--ink); letter-spacing: -.02em; }
.stat .k { font: 500 .72rem/1.35 var(--mono); color: var(--muted); letter-spacing: .04em; margin-top: .35rem; }

.pipeline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 1.4rem 0 1.8rem;
  font: 500 .78rem/1 var(--mono);
}
.pipeline .step {
  background: var(--surface); border: 1px solid var(--rule-soft); color: var(--ink-soft);
  border-radius: 2px; padding: .55rem .7rem;
}
.pipeline .step.terminal { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); font-weight: 600; }
.pipeline .arrow { color: var(--muted-light); }

.next-prev {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-top: 3.2rem; padding-top: 1.2rem; border-top: 1px solid var(--rule);
  font: 500 var(--step--1)/1.4 var(--font-body);
}
.next-prev a { color: var(--accent-deep); text-decoration: none; }
.next-prev a:hover { text-decoration: underline; }

/* ---------- About ---------- */
.about-portrait {
  float: right; width: clamp(160px, 28vw, 210px); height: clamp(160px, 28vw, 210px);
  object-fit: cover; object-position: 50% 22%;
  border-radius: 50%; border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--rule), 0 6px 20px -8px #1c1a1430;
  shape-outside: circle(50%); margin: .4rem 0 1rem 2rem;
}
.about-body { max-width: var(--measure); }
.about-body h2 {
  font: 500 .78rem/1 var(--mono); color: var(--muted); text-transform: uppercase;
  letter-spacing: .12em; margin: 2.6rem 0 1rem; clear: both;
}

.fn { position: relative; cursor: help; }
.fn-mark { color: var(--accent); font-weight: 700; }
.fn-body {
  position: absolute; left: 50%; bottom: 1.8em; transform: translateX(-50%);
  width: max-content; max-width: 16rem; padding: .5rem .7rem;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 2px;
  font: 400 .85rem/1.4 var(--font-body); font-style: italic;
  box-shadow: 0 10px 24px -14px #00000055; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.fn:hover .fn-body, .fn:focus .fn-body { opacity: 1; }

.life-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 1.6rem 0 .6rem; }
.life-strip figure { margin: 0; }
.life-strip img {
  display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: 2px; border: 1px solid var(--rule-soft);
  filter: saturate(.9); transition: filter .25s, transform .25s;
}
.life-strip img:hover { filter: saturate(1.05); transform: translateY(-2px); }
.life-strip figcaption { font: 400 .74rem/1.35 var(--mono); color: var(--muted); margin-top: .45rem; letter-spacing: .02em; }

.updated {
  clear: both; margin-top: 2.4rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  font-size: var(--step--1); color: var(--muted); font-style: italic;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .shell { padding: 40px 16px 80px; }
  .site-header { padding: 1.2rem calc(16px + 46px) 0 16px; }
  .timeline-row > a, .timeline-row > .static { grid-template-columns: 1fr; gap: .45rem; }
  .about-portrait { float: none; display: block; width: 160px; height: 160px; margin: 1rem auto 1.6rem; }
  .legend { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .5rem; }
  .legend > b { grid-column: 1 / -1; }
  .legend-item { display: contents; }
  .legend-sep { display: none; }
}
@media (max-width: 480px) {
  .life-strip { grid-template-columns: 1fr 1fr; }
  .life-strip figure:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
