/* ------------------------------------------------------------------
   Abhay Kumar · personal site
   Plain CSS, no build step. Colours are tokens at the top of the file.
   ------------------------------------------------------------------ */

:root {
  --bg: #ffffff;
  --bg-raised: #ffffff;
  --ink: #1b1a17;
  --ink-soft: #3b3933;
  --muted: #625d53;
  --rule: #e3ded3;
  --rule-strong: #cfc8b9;
  --accent: #b4390a;
  --accent-soft: rgba(180, 57, 10, 0.09);
  --focus: #b4390a;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1080px;
  --gutter: clamp(20px, 5vw, 48px);
}

:root[data-theme="dark"] {
  --bg: #121311;
  --bg-raised: #191a18;
  --ink: #edebe5;
  --ink-soft: #d3d0c7;
  --muted: #a5a195;
  --rule: #2a2b27;
  --rule-strong: #3d3e38;
  --accent: #ff9159;
  --accent-soft: rgba(255, 145, 89, 0.12);
  --focus: #ff9159;
}

/* ---------- base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

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

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
}
.skip:focus { top: 12px; color: var(--bg); }

/* ---------- top bar ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}

.top-in {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
  margin-right: auto;
}
.brand:hover { color: var(--ink); }

.mono-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.nav { display: flex; gap: 26px; }
.nav a {
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
}
.nav a:hover { color: var(--ink); }

.theme {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme:hover { border-color: var(--accent); color: var(--accent); }

/* Show the icon for the theme you would switch TO. */
.theme .i-sun { display: none; }
:root[data-theme="dark"] .theme .i-sun { display: block; }
:root[data-theme="dark"] .theme .i-moon { display: none; }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: end;
  padding-top: clamp(56px, 10vw, 128px);
  padding-bottom: clamp(56px, 8vw, 104px);
}

.portrait {
  display: block;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 20%;
  background: #ffffff;
  border: 1px solid var(--rule-strong);
  margin-bottom: 28px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 22px;
}

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 8.4vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: -0.028em;
}

.lede {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.7vw, 1.9rem);
  line-height: 1.28;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-top: 28px;
  max-width: 21em;
  text-wrap: balance;
}
.lede em { font-style: italic; color: var(--accent); }

.role {
  margin-top: 20px;
  color: var(--muted);
  max-width: 34em;
}
.role strong { color: var(--ink); font-weight: 600; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}
.links a {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.links a:hover { border-color: var(--accent); background: var(--accent-soft); }

/* hero figure */

.fig { min-width: 0; }
.fig-plot {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 4px;
}
.fig svg { display: block; width: 100%; height: auto; overflow: visible; }

.c-axis { stroke: var(--rule-strong); stroke-width: 1; }
.c-raw {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.1;
  stroke-linejoin: round;
  opacity: 0.55;
}
.c-thr {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.3;
  stroke-dasharray: 3 5;
  stroke-linecap: round;
}
.c-clip {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.c-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }

/* The clipped trace draws itself once on load. The resting state is the
   fully drawn line, so nothing is hidden if animations do not run. */
@media (prefers-reduced-motion: no-preference) {
  .c-clip {
    stroke-dasharray: 1400;
    animation: draw 1.8s 0.15s cubic-bezier(0.4, 0, 0.2, 1) backwards;
  }
  .c-dot { animation: appear 0.4s 1.7s ease backwards; }
}
@keyframes draw { from { stroke-dashoffset: 1400; } to { stroke-dashoffset: 0; } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }

figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.key { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.k { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--ink); }
.k-raw { border-top: 1px solid var(--muted); opacity: 0.7; }
.k-thr { border-top: 2px dotted var(--accent); }
.fig-note { flex-basis: 100%; }

/* ---------- sections ---------- */

.sec {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  column-gap: clamp(28px, 5vw, 72px);
  padding-block: clamp(48px, 7vw, 88px);
  position: relative;
}
.sec::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  border-top: 1px solid var(--rule);
}

.sec-label { position: sticky; top: 92px; align-self: start; }
.num {
  display: block;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
}
h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.7rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.sec-aside { margin-top: 14px; font-size: 0.86rem; color: var(--muted); }

.sec-body { min-width: 0; }

.prose p { max-width: 40em; color: var(--ink-soft); }
.prose p + p { margin-top: 1.05em; }
.prose p:first-child {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.1vw, 1.5rem);
  line-height: 1.38;
  letter-spacing: -0.008em;
  color: var(--ink);
  margin-bottom: 1.2em;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--rule);
}
.facts dt {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.facts div:last-child dt { font-size: 1.12rem; line-height: 1.6; }
.facts dd { margin-top: 6px; font-size: 0.86rem; line-height: 1.45; color: var(--muted); }

/* ---------- publications ---------- */

.pub { padding-block: 30px; border-top: 1px solid var(--rule); }
.pub:first-child { padding-top: 0; border-top: 0; }
.pub:last-child { padding-bottom: 0; }

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.tag {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.pub h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.3rem, 2.3vw, 1.62rem);
  line-height: 1.22;
  letter-spacing: -0.012em;
  max-width: 28em;
  text-wrap: balance;
}
.pub h3 a { text-decoration: none; }
.pub h3 a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

.authors { margin-top: 10px; font-size: 0.95rem; color: var(--muted); }
.authors b { color: var(--ink); font-weight: 600; }

.gist { margin-top: 10px; max-width: 42em; font-size: 0.98rem; color: var(--ink-soft); }

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.pub-links a { color: var(--accent); text-decoration-color: transparent; }
.pub-links a:hover { text-decoration-color: currentColor; }
.pub-links a::after { content: " ↗"; }

/* ---------- projects ---------- */

.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.proj {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 22px 20px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 12px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.proj:hover { border-color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .proj:hover { transform: translateY(-2px); }
}

.proj-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.stars { white-space: nowrap; }
.stars.new { color: var(--accent); }

.proj h3 {
  margin-top: 14px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.04rem;
  letter-spacing: -0.01em;
}
.proj h3 a { text-decoration: none; }
/* Make the whole card clickable through the title link. */
.proj h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }

.proj p:not(.proj-top):not(.proj-foot) {
  margin-top: 8px;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.proj-foot {
  margin-top: auto;
  padding-top: 16px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.footnote {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---------- experience ---------- */

.job {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 8px 24px;
  padding-block: 26px;
  border-top: 1px solid var(--rule);
}
.job:first-child { padding-top: 0; border-top: 0; }

.when {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  padding-top: 5px;
  white-space: nowrap;
}
.job.now .when { color: var(--accent); }

.job h3 { font-size: 1.12rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
.job .title { font-size: 0.93rem; color: var(--muted); margin-top: 2px; }
.job .what > p:not(.title), .job .what > ul {
  margin-top: 12px;
  max-width: 41em;
  font-size: 0.97rem;
  color: var(--ink-soft);
}
.job .what li { position: relative; padding-left: 18px; }
.job .what li + li { margin-top: 7px; }
.job .what li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 6px;
  height: 1px;
  background: var(--rule-strong);
}

.sub {
  margin-top: 44px;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.earlier li {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 4px 24px;
  padding-block: 12px;
  border-top: 1px solid var(--rule);
  font-size: 0.97rem;
  color: var(--ink-soft);
}
.earlier b { color: var(--ink); font-weight: 600; }

/* ---------- contact + footer ---------- */

.contact-line {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  line-height: 1.34;
  letter-spacing: -0.01em;
  max-width: 26em;
  text-wrap: balance;
}
.contact-line a { color: var(--accent); text-decoration-color: currentColor; }
.contact .links { margin-top: 28px; }

.foot { border-top: 1px solid var(--rule); }
.foot-in {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  padding-block: 26px 34px;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .fig { max-width: 560px; }
  .sec { grid-template-columns: minmax(0, 1fr); row-gap: 28px; }
  .sec-label { position: static; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
  .num { margin-bottom: 0; }
  .sec-aside { margin-top: 0; margin-left: auto; }
}

@media (max-width: 680px) {
  body { font-size: 1rem; }
  .nav { display: none; }
  .projects { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .job, .earlier li { grid-template-columns: minmax(0, 1fr); }
  .when { padding-top: 0; }
}

@media print {
  .top, .theme, .fig { display: none; }
  body { background: #fff; color: #000; }
  .sec { display: block; padding-block: 18px; }
}
