/* Bhargav D Sanketi. One stylesheet. */

@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-opsz.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-opsz-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Colour. Greyscale is the foreground at fixed opacities. */
  --bg: #08090b;
  --fg: #f2f0ec;
  --fg-rgb: 242 240 236;
  --fg-2: rgb(var(--fg-rgb) / 0.76);   /* secondary prose, 11.5:1 */
  --fg-3: rgb(var(--fg-rgb) / 0.6);    /* meta, captions, labels, 6.6:1 */
  --fg-rule: rgb(var(--fg-rgb) / 0.12);
  --accent: #8fa79e;                   /* 7.8:1 on --bg */
  --accent-rule: rgb(143 167 158 / 0.35);

  /* Type */
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  --step--2: 0.75rem;
  --step--1: clamp(0.875rem, 0.84rem + 0.15vw, 0.9375rem);
  --step-0: clamp(1.0625rem, 1.02rem + 0.25vw, 1.1875rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --step-3: clamp(2.125rem, 1.6rem + 2.6vw, 3.5rem);
  --step-4: clamp(2.875rem, 1.9rem + 5vw, 5.5rem);

  /* Space */
  --column: 40rem;
  --measure: 66ch;
  --gutter: clamp(1.25rem, 0.8rem + 2.2vw, 2.5rem);
  --space-s: clamp(0.75rem, 0.6rem + 0.6vw, 1rem);
  --space-m: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem);
  --space-l: clamp(2.5rem, 1.8rem + 3.4vw, 4.5rem);
  --space-xl: clamp(4rem, 2.6rem + 7vw, 9rem);

  --nav-h: 3.25rem;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 1.5rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--step-0);
  font-weight: 380;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
}

h1, h2, h3, p, ol, ul, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, video, svg { display: block; max-width: 100%; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}
a:hover { color: var(--fg); text-decoration-color: currentColor; }

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

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

.tnum { font-variant-numeric: tabular-nums lining-nums; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Skip link */
.skip {
  position: absolute;
  left: var(--gutter);
  top: 0.5rem;
  z-index: 20;
  padding: 0.5rem 0.75rem;
  background: var(--fg);
  color: var(--bg);
  font-size: var(--step--1);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--fg-rule);
}
.nav__inner {
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav a {
  color: var(--fg-3);
  text-decoration: none;
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); }
.nav__home { letter-spacing: 0.08em; }
.nav ul { display: flex; gap: clamp(1.25rem, 3vw, 2rem); }

/* Column */
.wrap {
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Header */
.masthead {
  padding: var(--space-l) 0 var(--space-l);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name photo"
    "tag tag"
    "icons icons";
  column-gap: clamp(1rem, 3vw, 2.5rem);
  align-items: center;
}
.masthead picture { grid-area: photo; width: clamp(6.25rem, 2rem + 12vw, 12rem); }
.masthead .name { grid-area: name; }
.masthead .tagline { grid-area: tag; }
.masthead .contact { grid-area: icons; }
.portrait {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  background: rgb(var(--fg-rgb) / 0.06);
}
@media (min-width: 48rem) {
  .masthead {
    grid-template-areas:
      "name photo"
      "tag photo"
      "icons photo";
    grid-template-rows: auto auto 1fr;
    align-items: start;
  }
  .masthead picture { align-self: center; }
}
.name {
  font-family: var(--serif);
  font-size: var(--step-4);
  font-weight: 380;
  font-variation-settings: "opsz" 72;
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.name__suffix { color: var(--fg-3); }
.nowrap { white-space: nowrap; }
.masthead .name { font-size: clamp(2.125rem, 1.2rem + 5.4vw, 4.75rem); }
.tagline {
  margin-top: var(--space-s);
  font-family: var(--serif);
  font-size: var(--step-1);
  font-weight: 360;
  font-variation-settings: "opsz" 24;
  line-height: 1.4;
  color: var(--fg-2);
  max-width: 34ch;
}
.contact {
  display: flex;
  gap: 1.5rem;
  margin-top: var(--space-m);
}
.contact a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: -0.6rem;
  color: rgb(var(--fg-rgb) / 0.6);
  text-decoration: none;
}
.contact a:hover { color: var(--accent); }
.contact svg { width: 22px; height: 22px; }
.contact a[aria-label^="LinkedIn"] svg,
.contact a[aria-label^="X"] svg { width: 20px; height: 20px; }

/* Prose */
.prose { max-width: var(--measure); }
.prose p + p { margin-top: 1.1em; }
.lede {
  font-family: var(--serif);
  font-size: var(--step-2);
  font-weight: 360;
  font-variation-settings: "opsz" 36;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin-bottom: 1.2em;
}
.opening { padding-bottom: var(--space-xl); }
.opening .prose p:not(.lede):not(.coda) { color: var(--fg-2); }
.coda {
  margin-top: 1.6em !important;
  font-family: var(--serif);
  font-size: var(--step-1);
  font-weight: 380;
  font-variation-settings: "opsz" 24;
  line-height: 1.4;
}

/* Chapters */
.chapter {
  border-top: 1px solid var(--fg-rule);
  padding: var(--space-l) 0 var(--space-xl);
}
.label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums lining-nums;
}
.chapter__mark {
  height: 3.25rem;
  display: flex;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}
.logo { display: block; color: rgb(var(--fg-rgb) / 0.72); width: auto; }
.logo--cornell { height: 3.25rem; }
.logo--altos { height: 1.375rem; }
.chapter__title {
  margin-top: var(--space-s);
  margin-bottom: var(--space-m);
  font-family: var(--serif);
  font-size: var(--step-3);
  font-weight: 380;
  font-variation-settings: "opsz" 60;
  line-height: 1.05;
  letter-spacing: -0.018em;
}
.chapter .prose p { color: var(--fg); }
.chapter .prose p.opener {
  font-family: var(--serif);
  font-size: var(--step-1);
  font-variation-settings: "opsz" 24;
  font-weight: 380;
  line-height: 1.4;
}
.pull {
  max-width: var(--measure);
  margin-top: var(--space-m);
  padding-top: var(--space-m);
  border-top: 1px solid var(--fg-rule);
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--step-1);
  font-weight: 360;
  font-variation-settings: "opsz" 24;
  line-height: 1.45;
  color: var(--fg-2);
}
.pull--lead {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  color: var(--fg);
}

/* Citations */
.papers { margin-top: var(--space-l); }
.papers__head {
  font-family: var(--sans);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 1rem;
}
.papers + .papers { margin-top: var(--space-m); }
.cites { font-size: var(--step--1); line-height: 1.5; }
.cites li + li { margin-top: 1.1rem; }
.cite__title { display: block; color: var(--fg); font-weight: 440; }
.cite__meta { display: block; color: var(--fg-3); }
.cite__meta strong { color: var(--fg-2); font-weight: 560; }
.cite__venue { font-style: italic; }
.cite__doi { white-space: nowrap; }
.cites--prep li + li { margin-top: 0.4rem; }
.cites--prep .cite__title { font-weight: 380; color: var(--fg-2); }

/* Figures */
.figure { margin-top: var(--space-l); }
.figure + .figure { margin-top: var(--space-m); }
.figure__frame {
  position: relative;
  border: 1px solid var(--fg-rule);
  background: var(--bg);
}
.figure img, .figure video { width: 100%; height: auto; }
.figure figcaption {
  margin-top: 0.75rem;
  max-width: var(--measure);
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--fg-3);
}
.figure__credit { color: var(--fg-2); }
.play {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  padding: 0.45rem 0.8rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid rgb(var(--fg-rgb) / 0.3);
  font: 500 var(--step--2) / 1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.play:hover { border-color: var(--accent); color: var(--accent); }
.play[hidden] { display: none; }

@media (max-width: 22.5rem) { .masthead picture { width: 5rem; } .masthead .name { font-size: 1.875rem; } }

/* Recognition */
.closing {
  border-top: 1px solid var(--fg-rule);
  padding: var(--space-l) 0 var(--space-xl);
}
.closing h2 {
  font-family: var(--sans);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: var(--space-m);
}
.honours li { color: var(--fg); }
.honours li + li { margin-top: 0.5rem; }
.honours .tnum { color: var(--fg-3); }
.service { margin-top: var(--space-m); color: var(--fg-2); max-width: var(--measure); }
.service p + p { margin-top: 0.5rem; }

/* Publications page */
.pubs-head { padding: var(--space-l) 0 var(--space-m); }
.pubs-head h1 {
  font-family: var(--serif);
  font-size: var(--step-3);
  font-weight: 380;
  font-variation-settings: "opsz" 60;
  line-height: 1.05;
  letter-spacing: -0.018em;
}
.pubs-head p { margin-top: var(--space-s); color: var(--fg-2); }
.year-group {
  border-top: 1px solid var(--fg-rule);
  padding: var(--space-m) 0;
  display: grid;
  gap: 0.75rem;
}
.year-group__year {
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums lining-nums;
}
.year-group:last-of-type { padding-bottom: var(--space-xl); }
@media (min-width: 52rem) {
  .year-group {
    grid-template-columns: 4.5rem 1fr;
    margin-left: -6rem;
    gap: 1.5rem;
  }
  .year-group__year { padding-top: 0.2rem; }
}

/* 404 */
.lost { padding: var(--space-xl) 0; }
.lost h1 {
  font-family: var(--serif);
  font-size: var(--step-3);
  font-weight: 380;
  font-variation-settings: "opsz" 60;
  line-height: 1.05;
}
.lost p { margin-top: var(--space-s); color: var(--fg-2); }

/* Motion. One fade and rise, only when allowed. */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 360ms ease-out, transform 360ms ease-out;
  }
  .js .reveal.is-in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .nav, .contact, .skip, .play { display: none; }
}
