/* ==========================================================
   Rupanshu Shah, academic website
   One stylesheet for every page. Fonts are hosted in fonts/
   (Spectral and Spectral SC, SIL Open Font License).
   ========================================================== */

/* ---------- Fonts ---------- */

@font-face {
  font-family: "Spectral";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/spectral-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: "Spectral";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/spectral-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+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: "Spectral";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/spectral-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: "Spectral";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/spectral-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+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: "Spectral";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/spectral-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: "Spectral";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/spectral-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+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: "Spectral SC";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/spectral-sc-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: "Spectral SC";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/spectral-sc-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+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Colours: paper and ink ---------- */

:root {
  --paper:   #ffffff;
  --ink:     #1e2024;
  --muted:   #5a5f67;
  --faint:   #868b93;
  --rule:    #dde0e4;
  --link:    #1f4f8f;   /* ink blue, from the CV's navy family */
  --visited: #5b4488;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper:   #17191d;
  --ink:     #e3e3df;
  --muted:   #a5a9b0;
  --faint:   #7d828a;
  --rule:    #30343a;
  --link:    #94b5ea;
  --visited: #bea9e6;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:   #17191d;
    --ink:     #e3e3df;
    --muted:   #a5a9b0;
    --faint:   #7d828a;
    --rule:    #30343a;
    --link:    #94b5ea;
    --visited: #bea9e6;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

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

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Spectral", Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.125rem;
  line-height: 1.68;
  font-variant-numeric: oldstyle-nums proportional-nums;
  font-kerning: normal;
}

.wrap {
  max-width: 43rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

p { margin: 0 0 1rem; }

a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .17em;
}
a:visited { color: var(--visited); }
a:hover { text-decoration-thickness: 2px; }

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

em { font-style: italic; }
strong { font-weight: 600; }
sup, sub { line-height: 0; }

/* Arrows and other symbols Spectral does not include */
.sym { font-family: "Cambria Math", "Segoe UI Symbol", "STIX Two Math", "DejaVu Sans", serif; font-size: .92em; }

.muted { color: var(--muted); }
.small { font-size: .94rem; }
.lede { font-size: 1.06rem; }

/* ---------- Top line: navigation and light/dark switch ---------- */

.topline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .4rem 1.5rem;
  padding-top: 1.6rem;
  font-size: 1rem;
}
.topline nav {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 1.15rem;
  align-items: baseline;
}
.topline nav a {
  color: var(--muted);
  text-decoration: none;
}
.topline nav a:hover { color: var(--ink); text-decoration: underline; }
.topline nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--faint);
}
.theme-switch {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.theme-switch:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Headings ---------- */

main { padding: 3rem 0 2.75rem; }

h1 {
  font-weight: 400;
  font-size: 2.15rem;
  line-height: 1.15;
  letter-spacing: -.005em;
  margin: 0 0 1.1rem;
}

h2 {
  font-family: "Spectral SC", "Spectral", Georgia, serif;
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: .025em;
  line-height: 1.3;
  margin: 2.9rem 0 .9rem;
}

h3 {
  font-size: 1em;
  font-weight: 600;
  line-height: 1.45;
  margin: 0;
}

/* ---------- Home: introduction with portrait ---------- */

.intro {
  display: grid;
  grid-template-columns: 1fr 10rem;
  column-gap: 2.25rem;
  align-items: start;
}
.intro .photo {
  order: 2;
  width: 10rem;
  aspect-ratio: 4 / 5;
  position: relative;
  background: var(--rule);
  margin-top: .45rem;
}
.intro .photo img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.intro .photo-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
}
.intro h1 {
  font-size: 2.6rem;
  margin: 0 0 .5rem;
}
.role {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 1.4rem;
}
.contact-links {
  list-style: none;
  margin: 1.3rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 1.4rem;
}

/* ---------- Research interests (home) ---------- */

.tags {
  margin: 0;
  padding-left: 1.15rem;
  columns: 2;
  column-gap: 2.5rem;
}
.tags li { margin-bottom: .2rem; break-inside: avoid; }
.tags li::marker { color: var(--faint); }

/* ---------- Dated entries: education, experience, teaching, talks ---------- */

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}
.entry {
  display: grid;
  grid-template-columns: 8.9rem 1fr;
  column-gap: 1.1rem;
  margin-bottom: 1.35rem;
}
.entry:last-child { margin-bottom: 0; }
.entry > div:only-child { grid-column: 1 / -1; }  /* entries without a date column */
.entry .when {
  order: -1;
  color: var(--muted);
  font-size: .9rem;
  padding-top: .16rem;
  font-variant-numeric: oldstyle-nums tabular-nums;
}
.entry .where {
  color: var(--muted);
  margin: 0 0 .35rem;
}
.entry > div > :last-child { margin-bottom: 0; }
.entry ul {
  margin: .35rem 0 0;
  padding-left: 1.15rem;
  list-style-type: disc;
}
.entry ul li { margin-bottom: .25rem; }
.entry ul li::marker { color: var(--faint); }

/* ---------- Write-ups ---------- */

.writeups {
  list-style: none;
  margin: 0;
  padding: 0;
}
.writeup { margin-bottom: 1.6rem; }
.writeup:last-child { margin-bottom: 0; }
.writeup .kind {
  color: var(--muted);
  font-size: .94rem;
  margin: 0 0 .1rem;
}
.writeup h3 {
  font-weight: 400;
  font-style: italic;
  font-size: 1.06rem;
  margin: 0 0 .35rem;
}
.writeup p { margin-bottom: .45rem; }
.writeup .links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 1rem;
}
.writeup .links a::before { content: "["; }
.writeup .links a::after { content: "]"; }

/* Short list on the home page */
.writeups.compact .writeup { margin-bottom: 1.05rem; }
.writeups.compact .writeup p { margin: 0; color: var(--muted); }
.writeups.compact .writeup h3 { margin-bottom: .1rem; }

/* ---------- Research directions with illustrations ---------- */

.illustrated {
  list-style: none;
  margin: 0;
  padding: 0;
}
.illustrated > li {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  column-gap: 1.75rem;
  align-items: start;
  margin-bottom: 2.1rem;
}
.illustrated > li:last-child { margin-bottom: 0; }
.illustrated figure { margin: .35rem 0 0; }
.illustrated svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--ink);
}
.illustrated figcaption {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.4;
  text-align: center;
  margin-top: .5rem;
}
.illustrated h3 { margin-bottom: .3rem; }
.illustrated p { margin: 0; }
.svg-accent { color: var(--link); }
.svg-muted { color: var(--faint); }

/* ---------- Toolkit ---------- */

.toolkit { margin: 0; }
.toolkit > div {
  display: grid;
  grid-template-columns: 13rem 1fr;
  column-gap: 1.25rem;
  margin-bottom: .8rem;
}
.toolkit > div:last-child { margin-bottom: 0; }
.toolkit dt { font-weight: 600; }
.toolkit dd { margin: 0; }

/* ---------- Honours and plain lists ---------- */

.plain { margin: 0; padding-left: 1.15rem; }
.plain li { margin-bottom: .35rem; }
.plain li::marker { color: var(--faint); }

.interests p { color: var(--ink); }

/* ---------- Personal page ---------- */

.gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
  gap: 1.1rem;
}
.gallery figure { margin: 0; }
.gallery a { display: block; }
.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}
.gallery figcaption {
  color: var(--muted);
  font-style: italic;
  font-size: .94rem;
  margin-top: .4rem;
}
.gallery figcaption:empty { display: none; }

.shelf {
  display: grid;
  grid-template-columns: 11rem 1fr;
  column-gap: 1.75rem;
  padding: 1.6rem 0;
  border-top: 1px solid var(--rule);
}
.shelf:first-of-type { border-top: 0; padding-top: .2rem; }
.shelf-head h2 { margin: 0 0 .3rem; }
.shelf-head p {
  color: var(--muted);
  font-style: italic;
  font-size: .96rem;
  line-height: 1.45;
  margin: 0;
}
.shelf dl { margin: 0; }
.shelf dl > div { margin-bottom: .8rem; }
.shelf dl > div:last-child { margin-bottom: 0; }
.shelf dt {
  font-family: "Spectral SC", "Spectral", Georgia, serif;
  font-weight: 500;
  font-size: .98rem;
  letter-spacing: .02em;
  color: var(--muted);
}
.shelf dd { margin: 0; }
.dotlist { list-style: none; margin: 0; padding: 0; display: inline; }
.dotlist li { display: inline; }
.dotlist li:not(:last-child)::after { content: " · "; color: var(--faint); }
.note { color: var(--muted); }

/* ---------- Footer ---------- */

.colophon {
  border-top: 1px solid var(--rule);
  padding: 1.2rem 0 2.4rem;
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.6;
}
.colophon a { color: var(--muted); }
.colophon a:hover { color: var(--ink); }

/* ---------- Small screens ---------- */

@media (max-width: 40rem) {
  body { font-size: 1.0625rem; }
  .topline { font-size: .92rem; gap: .3rem .75rem; }
  .topline nav { gap: .2rem .7rem; }
  main { padding-top: 2.2rem; }
  h1 { font-size: 1.9rem; }
  .intro { grid-template-columns: 1fr 6.5rem; column-gap: 1.1rem; }
  .intro .photo { width: 6.5rem; margin-top: .3rem; }
  .intro h1 { font-size: 2rem; }
  .tags { columns: 1; }
  .entry { grid-template-columns: 1fr; }
  .entry .when { padding-top: 0; }
  .illustrated > li { grid-template-columns: 1fr; }
  .illustrated figure { max-width: 12rem; margin-bottom: .8rem; }
  .toolkit > div { grid-template-columns: 1fr; }
  .shelf { grid-template-columns: 1fr; row-gap: .8rem; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
}

@media (max-width: 24rem) {
  .wrap { padding: 0 1rem; }
  .topline { font-size: .86rem; gap: .3rem .6rem; }
  .topline nav { gap: .2rem .6rem; }
}

@media print {
  .topline nav, .theme-switch { display: none; }
  :root { --paper: #fff; --ink: #000; --link: #000; --visited: #000; }
  body { font-size: 11pt; }
}
