/* ==========================================================
   Chinmoy Bhattacharjee — website stylesheet
   ========================================================== */

/* ---------- Fonts: hosted on this site (folder fonts/), not loaded from Google ----------
   STIX Two Text and IBM Plex Mono, SIL Open Font License; licences in the fonts folder. */
@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'STIX Two Text';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'STIX Two Text';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/stix-two-text-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/stix-two-text-greek-400-normal.woff2") format("woff2");
  unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF;
}

@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/stix-two-text-greek-500-normal.woff2") format("woff2");
  unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF;
}

@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/stix-two-text-greek-600-normal.woff2") format("woff2");
  unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF;
}

@font-face {
  font-family: 'STIX Two Text';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/stix-two-text-greek-400-italic.woff2") format("woff2");
  unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  /* Colours (light) */
  --paper:  #fbfcfd;
  --ink:    #1b2230;
  --muted:  #5b6475;
  --rule:   #dde2ea;
  --accent: #1d4f91;
  --tint:   #eef2f8;

  /* Type */
  --serif: "STIX Two Text", "STIX Two", "Cambria", Georgia, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: 1rem;
  --step-0:  1.1875rem;
  --step-1:  1.4rem;
  --step-2:  1.85rem;
  --step-3:  2.5rem;

  --measure: 62rem;
  --contact-size: 1.125rem;   /* address, email, phone, profile links */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:  #13161c;
    --ink:    #e4e7ed;
    --muted:  #9ca5b4;
    --rule:   #2a303a;
    --accent: #8db4ea;
    --tint:   #1b212b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper:  #13161c;
  --ink:    #e4e7ed;
  --muted:  #9ca5b4;
  --rule:   #2a303a;
  --accent: #8db4ea;
  --tint:   #1b212b;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.6;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums proportional-nums;
}

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 20px;
  padding-block: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.18em; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

img { max-width: 100%; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.6rem 1.1rem;
}
.site-name {
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.005em;
}
.site-name:hover { text-decoration: none; color: var(--accent); }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.4rem;
}
.site-nav a {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-block: 0.2rem;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--ink); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- Main ---------- */
main { padding-block: 2.5rem 3.5rem; }
main > .wrap { display: flex; flex-direction: column; gap: 2.75rem; }

h1, h2, h3 { font-weight: 600; line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: var(--step-3); letter-spacing: -0.005em; }
h2 {
  font-size: var(--step-0);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 500;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--rule);
}
h3 { font-size: var(--step-1); }

section { display: flex; flex-direction: column; gap: 1rem; }
p { margin: 0; }
.prose { display: flex; flex-direction: column; gap: 0.9rem; max-width: 50rem; }

.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.mono  { font-family: var(--mono); font-size: 0.8em; letter-spacing: 0; }

/* ---------- Home: intro ---------- */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14rem;
  gap: 2.5rem;
  align-items: start;
}
.intro-text { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.role { font-size: var(--step-1); color: var(--ink); }
.affil { color: var(--muted); }

.portrait {
  position: relative;
  width: 14rem;
  aspect-ratio: 4 / 5;
  max-width: 100%;
  border-radius: 3px;
  background: var(--tint);
  overflow: hidden;
  display: grid;
  place-items: center;
}
/* The photo covers the whole box; the initials underneath only show if photo.jpg is missing. */
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; display: block; z-index: 1; }
.portrait .initials {
  font-size: 2.6rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.contact {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.2rem 1.25rem;
  margin: 0.9rem 0 0;
  font-size: var(--contact-size);
}
.contact dt { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem; padding-top: 0.2rem; }
.contact dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.profile-links { display: flex; flex-wrap: wrap; gap: 0.35rem 1.75rem; font-size: var(--contact-size); margin-top: 0.7rem; }

/* ---------- Dated lists (news, positions) ---------- */
.dated { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.dated li {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 1.25rem;
}
.dated .when {
  color: var(--muted);
  font-size: var(--step--1);
  padding-top: 0.15rem;
  font-variant-numeric: lining-nums tabular-nums;
}
.dated .what { min-width: 0; }
.tag {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 0 0.35rem;
  margin-left: 0.4rem;
  vertical-align: 0.15em;
  line-height: 1.5;
}

/* ---------- Research interests with MSC codes ---------- */
.interests { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem 2rem; }
.interests li { min-width: 0; }

/* ---------- Bibliography ---------- */
.bib { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.8rem; line-height: 1.45; }
.bib li {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  gap: 0.6rem;
}
.bib .key {
  color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
  text-align: right;
}
.bib .entry { min-width: 0; display: flex; flex-direction: column; gap: 0; }
.bib .title { font-weight: 600; }
.bib .authors { color: var(--ink); }
.bib .venue { color: var(--muted); }
.bib .venue i { color: var(--ink); }
.bib .links { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; font-family: var(--mono); font-size: 0.85rem; margin-top: 0.05rem; }
.status { font-style: italic; }

/* ---------- Supervision list (teaching) ---------- */
.people h3 { font-size: var(--step-0); font-weight: 600; margin-top: 0.4rem; }
.people ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }

/* ---------- Tables (teaching) ---------- */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: var(--contact-size); table-layout: fixed; }
/* Every teaching table uses the same semester column width, so the columns line up down the page. */
th:last-child, td.term { width: 14rem; }
th, td { text-align: left; vertical-align: top; padding: 0.5rem 1rem 0.5rem 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.82rem; }
td.term { color: var(--muted); white-space: nowrap; font-variant-numeric: lining-nums; }
td:last-child, th:last-child { padding-right: 0; }

.callout {
  background: var(--tint);
  border-radius: 3px;
  padding: 1rem 1.2rem;
}

.funding { font-size: var(--step--1); color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); }
.site-footer .wrap {
  padding-block: 1.25rem 2rem;
  font-size: 0.875rem;
  color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 0.3rem 1.5rem; justify-content: space-between;
}

/* ---------- Narrow screens ---------- */
@media (max-width: 640px) {
  :root { --step-0: 1.125rem; --step--1: 0.975rem; --step-1: 1.3rem; --step-3: 2.1rem; --contact-size: 1.0625rem; }
  .intro { grid-template-columns: minmax(0, 1fr); }
  .portrait { width: 8.5rem; order: -1; }
  .dated li { grid-template-columns: minmax(0, 1fr); gap: 0.05rem; }
  .interests { grid-template-columns: minmax(0, 1fr); }
  .bib li { grid-template-columns: 2.1rem minmax(0, 1fr); }
  th:last-child, td.term { width: 8.5rem; white-space: normal; }
  main { padding-block: 1.75rem 2.5rem; }
}

/* ---------- Wide screens: slightly larger text ---------- */
@media (min-width: 1100px) {
  :root { --step-0: 1.14rem; --step--1: 1.06rem; --step-3: 2.4rem; --contact-size: 1.04rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* ---------- Poisson–Voronoi tessellation behind the header (tall on Home, thin band elsewhere) ---------- */
.site-header { position: relative; overflow: hidden; isolation: isolate; }
.tess {
  position: absolute; inset: 0; z-index: -1; display: block;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.35) 0%, #000 50%, #000 62%, transparent 100%);
          mask-image: linear-gradient(to bottom, rgba(0,0,0,.35) 0%, #000 50%, #000 62%, transparent 100%);
}
.site-name, .site-nav a { text-shadow: 0 0 6px var(--paper), 0 0 12px var(--paper); }
/* Other pages: the tessellation shows as a thin band behind the name and menu. */
.site-header:not(.hero) .wrap { padding-block: 1.6rem 1.5rem; }
.hero .tess-note {
  display: flex; justify-content: flex-end;
  padding-block: 6.5rem 0.75rem;
}
.tess-note button {
  font: italic var(--step--1)/1.4 var(--serif);
  color: var(--muted);
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  border: 0; border-radius: 2px;
  padding: 0.15rem 0.5rem; margin-right: -0.5rem;
  cursor: pointer; text-align: right;
}
.tess-note button:hover .resample { text-decoration: underline; text-underline-offset: 0.18em; }
.tess-note button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tess-note .resample { font-style: normal; color: var(--accent); margin-left: 0.35rem; }
.tess-note .n { font-style: normal; font-variant-numeric: lining-nums; }
@media (max-width: 640px) {
  .hero .tess-note { padding-block: 4.5rem 0.6rem; }
}


/* ---------- Paper summaries (click to open) ---------- */
.bib details { margin-top: 0.15rem; }
.bib summary {
  cursor: pointer; list-style: none;
  display: inline-flex; align-items: baseline; gap: 0.35rem;
  font-family: var(--mono); font-size: 0.85rem; color: var(--accent);
}
.bib summary::-webkit-details-marker { display: none; }
.bib summary::before { content: "\25B8"; display: inline-block; transition: transform 0.15s; }
.bib details[open] summary::before { transform: rotate(90deg); }
.bib summary:hover { text-decoration: underline; text-underline-offset: 0.18em; }
.bib summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.bib details p { margin: 0.35rem 0 0.25rem; max-width: 46rem; color: var(--muted); line-height: 1.5; }
.bib.plain li { grid-template-columns: minmax(0, 1fr); }

/* ---------- Coauthor links: quiet until hovered ---------- */
.bib .authors a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 0.18em; }
.bib .authors a:hover { color: var(--accent); text-decoration-color: currentColor; }

/* ---------- Home: medium-height header, no caption ---------- */
.site-header.medium .wrap { padding-block: 1.6rem 5rem; }
@media (max-width: 640px) {
  .site-header.medium .wrap { padding-block: 1.6rem 3.5rem; }
}

/* ---------- Link icons (Academicons and Font Awesome, loaded in the page head) ---------- */
.links span[aria-hidden], .profile-links span[aria-hidden], .dated span[aria-hidden], .cv-link span[aria-hidden] { margin-right: 0.35em; font-size: 1.05em; }.links { row-gap: 0.25rem; }

/* ---------- Phones: small photo beside the name ---------- */
@media (max-width: 640px) {
  .intro { position: relative; }
  .portrait { position: absolute; top: 0; right: 0; width: 6rem; order: 0; }
  .intro h1, .intro .role { padding-right: 7rem; }
}

/* ---------- Research: overview strands ---------- */
.overview { gap: 0.6rem; }

/* ---------- Video link after a talk ---------- */
.video-link { margin-left: 0.75em; white-space: nowrap; }

/* Justified text in the research paragraphs (Home and Research pages), larger screens only */
@media (min-width: 641px) {
  .prose p { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
}
