/* ==========================================================================
   Rajna Fani personal site
   One stylesheet, no build step.
   ========================================================================== */

:root {
  --bg: #fdfdfc;
  --text: #1f2933;
  --muted: #667085;
  --faint: #98a2b3;
  --rule: #e6e3dd;
  --rule-soft: #efedea;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --tint: #f3f2ff;

  --serif: 'Source Serif 4', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  --measure: 44rem;
  --gap: 2.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --text: #e4e2de;
    --muted: #9aa3ad;
    --faint: #6f7883;
    --rule: #2b2f36;
    --rule-soft: #23262c;
    --accent: #a6a4f7;
    --accent-hover: #c6c4fb;
    --tint: #1d1f2b;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  font-feature-settings: 'kern', 'liga';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }
}

/* --- Shell ---------------------------------------------------------------- */

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Links ---------------------------------------------------------------- */

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
}

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

/* --- Header --------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  margin-bottom: 3.5rem;
}

.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  padding-top: 1.6rem;
  padding-bottom: 1.35rem;
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.16rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--text);
}

.wordmark:hover {
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.94rem;
}

.site-nav a {
  color: var(--muted);
}

.site-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-nav a[aria-current='page'] {
  color: var(--text);
  font-weight: 500;
  box-shadow: inset 0 -1px 0 0 var(--accent);
}

/* --- Typography ----------------------------------------------------------- */

h1,
h2,
h3 {
  font-family: var(--serif);
  color: var(--text);
  line-height: 1.25;
  font-weight: 600;
  margin: 0;
}

.page-title {
  font-size: 2rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.page-intro {
  color: var(--muted);
  margin: 0 0 var(--gap);
  max-width: 36rem;
}

h2 {
  font-size: 1.22rem;
  letter-spacing: 0.002em;
}

p {
  margin: 0 0 1.1rem;
}

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

em {
  font-style: italic;
}

/* --- Sections ------------------------------------------------------------- */

section {
  margin-bottom: var(--gap);
}

section:last-of-type {
  margin-bottom: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.55rem;
  margin-bottom: 1.35rem;
  border-bottom: 1px solid var(--rule);
}

.section-head .more {
  font-size: 0.88rem;
  color: var(--muted);
  white-space: nowrap;
}

.section-head .more:hover {
  color: var(--accent);
}

/* --- Hero ----------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 2.25rem;
  align-items: start;
  margin-bottom: calc(var(--gap) - 0.25rem);
}

.portrait {
  width: 100%;
  /* height:auto is required. The img's height attribute is a presentational
     hint, and a set height would make the aspect-ratio below a no-op. */
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center;
  border-radius: 3px;
  background: var(--rule-soft);
  filter: saturate(0.97);
}

.hero h1 {
  font-size: 2.35rem;
  letter-spacing: -0.018em;
  margin-bottom: 0.55rem;
}

.role {
  margin: 0;
  color: var(--text);
  font-size: 1.02rem;
}

.affiliation {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.place {
  margin: 0.1rem 0 0;
  color: var(--faint);
  font-size: 0.93rem;
}

/* Address is written as "name [at] domain" on purpose, to keep it out of
   reach of naive address harvesters. Do not turn it back into a mailto. */
.email {
  margin: 0.75rem 0 0;
  font-size: 0.97rem;
  color: var(--text);
}

.footer-mail {
  color: var(--muted);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
  margin-top: 0.35rem;
  font-size: 0.93rem;
}

.hero-links .sep {
  color: var(--rule);
  user-select: none;
}

@media (max-width: 640px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .portrait {
    width: 150px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-position: center top;
  }

  .hero h1 {
    font-size: 2rem;
  }
}

/* --- Prose ---------------------------------------------------------------- */

.prose p {
  color: var(--text);
}

.prose p + p {
  margin-top: -0.1rem;
}

/* --- Keyword row (research interests) ------------------------------------- */

.keywords {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.keywords li {
  font-size: 0.87rem;
  line-height: 1.4;
  color: var(--muted);
  background: var(--tint);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: 0.3rem 0.6rem;
}

/* --- Dated list (news, honors, experience, education) --------------------- */

.dated {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dated > li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0 1.25rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule-soft);
}

.dated > li:last-child {
  border-bottom: 0;
}

.dated .when {
  color: var(--faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding-top: 0.22rem;
  white-space: nowrap;
}

.dated .what {
  min-width: 0;
}

.dated .what strong {
  font-weight: 600;
  color: var(--text);
}

.dated .what .sub {
  display: block;
  color: var(--muted);
  font-size: 0.94rem;
}

.dated.tight > li {
  border-bottom: 0;
  padding: 0.3rem 0;
}

@media (max-width: 640px) {
  .dated > li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
    padding: 0.7rem 0;
  }

  .dated .when {
    padding-top: 0;
    order: -1;
  }
}

/* --- Plain bulleted list -------------------------------------------------- */

.bullets {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bullets > li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.45rem;
  color: var(--text);
}

.bullets > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--faint);
}

.bullets > li:last-child {
  margin-bottom: 0;
}

/* --- Publications --------------------------------------------------------- */

.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: pub;
}

.pubs > li {
  position: relative;
  padding: 0 0 1.4rem 2.5rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--rule-soft);
}

.pubs > li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}

.pubs > li::before {
  counter-increment: pub;
  content: counter(pub);
  position: absolute;
  left: 0;
  top: 0.22rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}

.pub-title {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 0.25rem;
}

.pub-venue {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.pub-venue em {
  color: var(--text);
  font-style: italic;
}

.pub-note {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 0.05rem 0.4rem;
  opacity: 0.9;
}

.pub-note.award {
  color: #b4802a;
}

@media (prefers-color-scheme: dark) {
  .pub-note.award {
    color: #d6a44f;
  }
}

/* --- Entries (mentoring) -------------------------------------------------- */

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entries > li {
  padding-bottom: 1.3rem;
  margin-bottom: 1.3rem;
  border-bottom: 1px solid var(--rule-soft);
}

.entries > li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}

.entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}

.entry-title {
  font-family: var(--serif);
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
}

.entry-meta {
  color: var(--faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.entry-body {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

/* Lead block at the top of the mentoring page */
.lead {
  border-left: 2px solid var(--accent);
  padding: 0.1rem 0 0.1rem 1.15rem;
  margin-bottom: var(--gap);
}

.lead .entry-title {
  margin-bottom: 0.15rem;
}

.lead-meta {
  margin: 0 0 0.45rem;
  color: var(--faint);
  font-size: 0.85rem;
}

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

.site-footer {
  margin-top: 4.5rem;
  border-top: 1px solid var(--rule);
  padding: 1.75rem 0 3rem;
  font-size: 0.89rem;
  color: var(--faint);
}

.site-footer .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--accent);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
}

/* --- Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}

/* --- Print ---------------------------------------------------------------- */

@media print {
  .site-header,
  .site-footer {
    border-color: #ddd;
  }

  .site-nav,
  .hero-links {
    display: none;
  }

  a {
    color: #000;
  }
}
