/* ------------------------------------------------------------------
   Rohit Mukherjee — site styles
   Palette, type and spacing are set in :root; change them there.
   ------------------------------------------------------------------ */
:root {
  --paper: #f7f4ee;          /* page background */
  --paper-2: #efeae1;        /* subtle panels */
  --ink: #1d2124;            /* body text */
  --ink-soft: #4a5257;
  --muted: #868d91;          /* dates, author lists */
  --rule: #e2dcd1;           /* hairlines */
  --accent: #1f5c63;         /* links, headings accents (deep teal) */
  --accent-ink: #163f44;
  --brass: #a8834a;          /* small details */
  --night: #10191c;          /* dark surfaces */

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;

  --wide: 1160px;
  --text: 720px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.7;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(31, 92, 99, 0.28);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--accent-ink); text-decoration-color: currentColor; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
b, strong { font-weight: 600; }

/* ---------------- header ---------------- */
.topbar { position: relative; z-index: 30; }
.has-hero .topbar { position: absolute; top: 0; left: 0; right: 0; }
.plain .topbar { background: var(--night); }

.topbar-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 32px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.01em;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: #fff; }

.topnav { display: flex; gap: 30px; align-items: center; }
.topnav a {
  position: relative;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 6px 0;
  white-space: nowrap;
}
.topnav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.topnav a:hover { color: #fff; }
.topnav a:hover::after, .topnav a[aria-current="page"]::after { transform: scaleX(1); }
.topnav a[aria-current="page"] { color: #fff; }

.nav-toggle, .nav-toggle-label { display: none; }

/* ---------------- hero banner ---------------- */
.banner {
  position: relative;
  min-height: 46vh;
  display: flex;
  align-items: flex-end;
  background-color: var(--night);
  background-size: cover;
  background-position: center;
  color: #fff;
  isolation: isolate;
}
.banner-home { min-height: 72vh; }
.banner::before {               /* legibility: dark at top (nav) and bottom (title) */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 16, 18, 0.62) 0%, rgba(10, 16, 18, 0.12) 32%, rgba(10, 16, 18, 0.18) 55%, rgba(10, 16, 18, 0.78) 100%);
}
.banner-inner {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 140px 32px 56px;
}
.banner h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(40px, 6vw, 76px);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.02;
}
.banner-home h1 { font-size: clamp(48px, 8vw, 104px); }
.banner-sub {
  margin: 18px 0 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}
.banner-sub::before {
  content: "";
  display: inline-block;
  width: 36px;
  height: 1px;
  margin-right: 14px;
  vertical-align: middle;
  background: var(--brass);
}

/* ---------------- page body ---------------- */
.page {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 88px 32px 120px;
}
.page > *:not(.home-grid) { max-width: 880px; }

.page-intro {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 64px;
  max-width: var(--text);
}
.prose { max-width: var(--text); }
.prose p { margin: 0 0 1.15em; }
.prose b { color: var(--ink); }

.section { margin: 0 0 88px; }
.section > h2, .year-heading {
  display: flex;
  align-items: baseline;
  gap: 18px;
  font-size: 34px;
  margin: 0 0 28px;
}
.section > h2::after, .year-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
  transform: translateY(-8px);
}
.section > h3 {
  font-size: 22px;
  font-style: italic;
  margin: 36px 0 10px;
  color: var(--ink-soft);
}
.year-heading { margin-top: 64px; font-size: 30px; color: var(--accent); }

/* home */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 72px;
  align-items: start;
  margin-bottom: 104px;
}
.home-grid .prose { font-size: 17.5px; }
.home-grid .prose p:first-child {
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.45;
  color: var(--ink);
}
.photo-card { margin: 0; }
.photo-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
}

.icon-row { display: flex; gap: 12px; margin-top: 36px; flex-wrap: wrap; }
.icon-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink-soft);
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: all 0.2s;
}
.icon-row a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.icon-row svg { width: 18px; height: 18px; }

/* CV-style lists: date column | (marker) | title + place + note */
.facts { list-style: none; margin: 0; padding: 0; }
.facts li {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 48px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
}
.facts li:last-child { border-bottom: 1px solid var(--rule); }
.fact-when {
  color: var(--brass);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-top: 5px;
}
.fact-text { font-family: var(--serif); font-size: 19px; line-height: 1.35; color: var(--ink); }
.fact-place { display: block; font-family: var(--sans); font-size: 14.5px; color: var(--ink-soft); margin-top: 3px; }
.fact-sub { display: block; font-family: var(--sans); font-size: 13.5px; color: var(--muted); margin-top: 1px; }
.fact-link { color: var(--ink); text-decoration: none; background-image: linear-gradient(var(--brass), var(--brass));
  background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .3s, color .2s; }
.fact-link::after { content: "\2197"; font-family: var(--sans); font-size: 12px; color: var(--brass); margin-left: 6px; vertical-align: 3px; }
.fact-link:hover { color: var(--accent); background-size: 100% 1px; }

/* Timeline variant: vertical line with markers, no row rules */
.timeline { position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 147px;
  width: 1px;
  background: linear-gradient(180deg, var(--brass), var(--rule));
}
.timeline li {
  grid-template-columns: 132px 30px minmax(0, 1fr);
  gap: 0 0;
  border: 0 !important;
  padding: 0 0 34px;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline .fact-when { padding-right: 16px; }
.tl-dot {
  justify-self: center;
  margin-top: 7px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--brass);
  position: relative;
  z-index: 1;
}
.timeline .fact-text { padding-left: 18px; }
.timeline li.is-current .tl-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px rgba(31, 92, 99, 0.14); }
.timeline li.is-current .fact-when { color: var(--accent); }

/* entries (publications, talks, conferences, notes) */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { padding: 26px 0; border-top: 1px solid var(--rule); }
.entry:last-child { border-bottom: 1px solid var(--rule); }
.section > h2 + .entries > .entry:first-child,
.section > h2 + .facts > li:first-child,
.year-heading + .entries > .entry:first-child { border-top: 0; padding-top: 8px; }
.entry-title {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
}
.entry-title a { color: var(--ink); text-decoration: none; }
.entry-title a:hover { color: var(--accent); }
.entry-meta { color: var(--muted); font-size: 14.5px; margin: 8px 0 0; }
.entry-meta b { color: var(--ink-soft); }
.entry-meta a { color: var(--accent); }
.entry-text { margin: 10px 0 0; color: var(--ink-soft); }
.entry-links {
  margin: 12px 0 0;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.entry-links a { text-decoration: none; }
.entry-links a::after { content: " \2192"; }

.pill {
  display: inline-block;
  margin-right: 12px;
  padding: 3px 10px 2px;
  border: 1px solid var(--brass);
  border-radius: 2px;
  color: var(--brass);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  vertical-align: 4px;
}

.tag-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.tag { font-size: 13px; color: var(--muted); }
.tag::before { content: "#"; color: var(--brass); margin-right: 1px; }

.empty { color: var(--muted); font-style: italic; }

/* embedded videos (Links page) */
.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.video { margin: 0; }
.video-frame { position: relative; aspect-ratio: 16 / 9; max-width: 100%; background: var(--night); border-radius: 3px; overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video figcaption { font-family: var(--serif); font-size: 19px; margin-top: 12px; }
.feature-photo { margin: 0; max-width: 560px; }
.feature-photo img { display: block; width: 100%; height: auto; border-radius: 3px; }
.feature-photo figcaption { font-family: var(--sans); font-size: 14px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
@media (max-width: 760px) { .video-grid { grid-template-columns: 1fr; } }
.video-links { margin-top: 28px; }
.resource-list { list-style: none; margin: 0 0 8px; padding: 0; }
.resource-list li { padding: 10px 0 10px 22px; border-top: 1px solid var(--rule); position: relative; }
.resource-list li:last-child { border-bottom: 1px solid var(--rule); }
.resource-list li::before { content: "\2192"; position: absolute; left: 0; color: var(--brass); }

/* ---------------- footer ---------------- */
.footer { background: var(--night); color: rgba(255, 255, 255, 0.6); font-size: 13px; }
.footer-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 36px 32px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  letter-spacing: 0.04em;
}

/* ---------------- note (post) pages ---------------- */
.post-shell {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 80px 32px 120px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 72px;
  align-items: start;
}
.article-header { margin-bottom: 40px; padding-bottom: 32px; border-bottom: 1px solid var(--rule); }
.article-header h1 { font-size: clamp(34px, 4.5vw, 52px); margin: 10px 0 16px; }
.article-meta {
  color: var(--brass);
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.article-lede { font-family: var(--serif); color: var(--ink-soft); font-size: 21px; line-height: 1.5; margin: 0; }
.post-tags { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 16px; }

.article-body { max-width: 740px; font-size: 17px; }
.article-body h2 { font-size: 32px; margin: 56px 0 14px; }
.article-body h3 { font-size: 23px; font-style: italic; margin: 36px 0 10px; }
.article-body p, .article-body li { line-height: 1.8; }
.article-body blockquote {
  margin: 28px 0;
  padding: 18px 24px;
  border-left: 2px solid var(--brass);
  background: var(--paper-2);
  font-family: var(--serif);
  font-size: 19px;
}
.article-body code { font-family: var(--mono); font-size: 0.86em; background: var(--paper-2); padding: 1px 5px; border-radius: 3px; }
.article-body pre { overflow-x: auto; background: var(--paper-2); padding: 16px 18px; border-radius: 4px; }
.article-body pre code { background: none; padding: 0; }
.article-body mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
.article-body table { border-collapse: collapse; margin: 18px 0; }
.article-body th, .article-body td { border-bottom: 1px solid var(--rule); padding: 8px 14px; }
.article-body img { max-width: 100%; }

.toc-card { position: sticky; top: 40px; font-size: 14px; }
.toc-label {
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--brass);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
}
.toc-list { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 1px solid var(--rule); }
.toc-item { margin: 8px 0; line-height: 1.4; }
.toc-item a { color: var(--muted); text-decoration: none; }
.toc-item a:hover { color: var(--accent); }
.toc-item-sub { padding-left: 14px; font-size: 13px; }
.toc-empty { color: var(--muted); }
.error-panel { padding: 20px; border: 1px solid var(--rule); background: #fff; }

/* ---------------- small screens ---------------- */
@media (max-width: 1000px) {
  .nav-toggle-label {
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    padding: 8px;
  }
  .nav-toggle-label span { width: 24px; height: 1.5px; background: #fff; display: block; }
  .topnav {
    display: none;
    position: absolute;
    top: 84px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px 32px 20px;
    background: var(--night);
  }
  .topnav a { padding: 12px 0; }
  .nav-toggle:checked ~ .topnav { display: flex; }
}

@media (max-width: 860px) {
  body { font-size: 16px; }
  .home-grid { grid-template-columns: 1fr; gap: 56px; }
  .photo-card { max-width: 100%; order: -1; }
  .post-shell { grid-template-columns: 1fr; }
  .toc-card { display: none; }
  .banner { min-height: 38vh; }
  .banner-home { min-height: 56vh; }
  .page { padding: 56px 20px 88px; }
  .topbar-inner, .footer-inner, .post-shell, .banner-inner { padding-left: 20px; padding-right: 20px; }
  .banner-inner { padding-top: 120px; padding-bottom: 36px; }
  .section > h2 { font-size: 28px; }
  .home-grid .prose p:first-child { font-size: 21px; }
}

@media (max-width: 600px) {
  .facts li { grid-template-columns: 1fr; gap: 2px; }
  .timeline::before { left: 5px; }
  .timeline li { grid-template-columns: 30px minmax(0, 1fr); padding-bottom: 28px; }
  .timeline .fact-when { grid-column: 2; grid-row: 1; padding-left: 18px; }
  .timeline .tl-dot { grid-column: 1; grid-row: 1; justify-self: start; }
  .timeline .fact-text { grid-column: 2; }
}
