/* Nitin Shyamkumar — single-page site. Monochrome by design: the only
   color on the page comes from the photograph. */

:root {
  --bg:        #ffffff;
  --ink:       #111111;
  --muted:     #5a5a5a;
  --faint:     #8a8a8a;
  --rule:      #d8d8d8;
  --rule-soft: #ececec;
  --surface:   #f6f6f6;
  --focus:     #111111;
  color-scheme: light;

  --measure: 44rem;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0c0c0c;
    --ink:       #ededed;
    --muted:     #a5a5a5;
    --faint:     #7d7d7d;
    --rule:      #333333;
    --rule-soft: #1f1f1f;
    --surface:   #171717;
    --focus:     #ededed;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:        #0c0c0c;
  --ink:       #ededed;
  --muted:     #a5a5a5;
  --faint:     #7d7d7d;
  --rule:      #333333;
  --rule-soft: #1f1f1f;
  --surface:   #171717;
  --focus:     #ededed;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  position: relative;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  max-width: var(--measure);
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.65 var(--serif);
  text-rendering: optimizeLegibility;
}

/* ---------- links ---------- */

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  text-decoration-color: var(--rule);
  transition: text-decoration-color 120ms ease;
}
a:hover { text-decoration-color: currentColor; }

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

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--ink);
  z-index: 10;
}

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 3.5rem 0 2rem;
}

.portrait {
  flex: 0 0 auto;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--rule);
}

.identity h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.tagline {
  margin: 0.4rem 0 0.9rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.875rem;
}

.links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.links a {
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.links a:hover { color: var(--ink); }

/* ---------- section nav ---------- */

.sections {
  display: flex;
  gap: 1.5rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.sections a { color: var(--muted); text-decoration: none; }
.sections a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.3em; }

/* Top-right corner of the content column. Deliberately quiet: it sits at
   rule contrast until hovered. */
.theme-toggle {
  position: absolute;
  top: 1.4rem;
  right: 1.5rem;
  padding: 0.3rem;
  display: inline-flex;
  background: none;
  border: 0;
  border-radius: 50%;
  color: var(--rule);
  cursor: pointer;
  transition: color 140ms ease;
}
.theme-toggle:hover { color: var(--muted); }
.theme-toggle svg { display: block; }

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

main section { padding: 3rem 0 0; scroll-margin-top: 1.5rem; }

h2 {
  margin: 0 0 1.25rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--faint);
}

h3 { margin: 0 0 0.4rem; font-size: 1.125rem; font-weight: 600; line-height: 1.35; }
h4 { margin: 1.75rem 0 0.5rem; font-size: 1rem; font-weight: 600; }

p { margin: 0 0 1.15rem; }
p:last-child { margin-bottom: 0; }

.intro { margin-bottom: 2.25rem; color: var(--muted); font-size: 0.9375rem; }
.intro p:last-child { margin-bottom: 0; }

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

.pub {
  padding: 1.75rem 0;
  border-top: 1px solid var(--rule-soft);
  scroll-margin-top: 1.5rem;
}
.pub:first-of-type { border-top: 0; padding-top: 0; }

.pub .authors,
.pub .venue {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}
.pub .venue { color: var(--faint); margin-top: 0.15rem; }
.pub .venue .year::before { content: "\00b7\00a0"; }

.abstract {
  margin-top: 0.85rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ---------- generic markdown output ---------- */

ul, ol { margin: 0 0 1.15rem; padding-left: 1.25rem; }
li { margin-bottom: 0.3rem; }
li > ul, li > ol { margin: 0.3rem 0 0; }

blockquote {
  margin: 0 0 1.15rem;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

code {
  font: 0.875em/1.5 var(--mono);
  background: var(--surface);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
pre {
  margin: 0 0 1.15rem;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  border-radius: 4px;
}
pre code { background: none; padding: 0; }

.table-wrap, table { display: block; overflow-x: auto; max-width: 100%; }
table {
  border-collapse: collapse;
  margin: 0 0 1.15rem;
  font-size: 0.9375rem;
}
th, td {
  padding: 0.45rem 0.85rem 0.45rem 0;
  text-align: left;
  border-bottom: 1px solid var(--rule-soft);
}
th { font-family: var(--sans); font-size: 0.8125rem; font-weight: 600; }

hr { margin: 2rem 0; border: 0; border-top: 1px solid var(--rule); }

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

.footnotes { margin-top: 2.5rem; font-size: 0.875rem; color: var(--muted); }
.footnotes hr { margin-bottom: 1rem; }

/* ---------- footer ---------- */

footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--faint);
}

/* ---------- narrow ---------- */

@media (max-width: 34rem) {
  body { padding: 0 1.25rem 3rem; }
  .theme-toggle { top: 1rem; right: 1.25rem; }
  .masthead {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    padding-top: 2.5rem;
  }
  .portrait { width: 92px; height: 92px; }
  .identity h1 { font-size: 1.75rem; }
  .sections { gap: 1.1rem; }
  main section { padding-top: 2.5rem; }
}

/* ---------- print ---------- */

@media print {
  :root { --bg: #fff; --ink: #000; --muted: #333; --faint: #555; --rule: #bbb; --rule-soft: #ddd; }
  body { max-width: none; font-size: 11pt; }
  .skip, .sections { display: none; }
  .pub { break-inside: avoid; }
  a { text-decoration: none; }
}
