/* Mohsen Bayati - stanford homepage
   Single stylesheet. No build step, no framework. */

:root {
  --ink:        #14161a;
  --ink-soft:   #4a5058;
  --ink-faint:  #767d86;
  --rule:       #e2ded7;
  --rule-soft:  #efece7;
  --paper:      #fdfcfa;
  --panel:      #f6f3ee;
  --accent:     #8c1515;   /* Stanford cardinal */
  --accent-lit: #a83232;
  --link:       #1f4f8f;
  --measure:    72ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:       #e8e6e2;
    --ink-soft:  #b0aca6;
    --ink-faint: #8b8680;
    --rule:      #33312e;
    --rule-soft: #262421;
    --paper:     #16150f;
    --panel:     #1e1c19;
    --accent:    #e0736e;
    --accent-lit:#f0918c;
    --link:      #8fb6e8;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
}

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

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: 1060px; margin: 0 auto; padding: 0 1.4rem;
  display: flex; align-items: baseline; gap: 1.5rem; flex-wrap: wrap;
  min-height: 3.4rem;
}
.wordmark {
  font-weight: 600; font-size: 1.02rem; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
  padding: 0.85rem 0;
}
.wordmark:hover { color: var(--accent); }
.navlinks { display: flex; gap: 1.15rem; flex-wrap: wrap; margin-left: auto; padding: 0.85rem 0; }
.navlinks a {
  color: var(--ink-soft); text-decoration: none; font-size: 0.93rem;
  border-bottom: 1.5px solid transparent; padding-bottom: 1px;
}
.navlinks a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.navlinks a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- layout ---------- */

main { max-width: 1060px; margin: 0 auto; padding: 2.6rem 1.4rem 5rem; }
.prose { max-width: var(--measure); }

section { margin: 0 0 3.2rem; }
section > h2 {
  font-size: 0.79rem; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 1.1rem;
  padding-bottom: 0.55rem; border-bottom: 1px solid var(--rule);
}

h1 { font-size: 2.05rem; line-height: 1.15; letter-spacing: -0.022em; font-weight: 650; margin: 0 0 0.5rem; }
h3 { font-size: 1.17rem; line-height: 1.3; font-weight: 620; letter-spacing: -0.012em; margin: 0 0 0.4rem; }
h4 { font-size: 1rem; font-weight: 620; margin: 0 0 0.3rem; }
p  { margin: 0 0 1rem; }

a { color: var(--link); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--link) 32%, transparent); }
a:hover { color: var(--accent); border-bottom-color: var(--accent); }
a.plain, .navlinks a, .wordmark { border-bottom: none; }

/* ---------- hero ---------- */

.hero { display: grid; grid-template-columns: 168px 1fr; gap: 2.2rem; align-items: start; margin-bottom: 3rem; }
.hero img { width: 168px; height: 168px; border-radius: 4px; object-fit: cover; display: block; }
.titles { color: var(--ink-soft); font-size: 0.97rem; line-height: 1.55; margin: 0.55rem 0 0; }
.titles .primary { color: var(--ink); font-size: 1.06rem; }
.titles .secondary { margin-top: 0.5rem; font-size: 0.92rem; color: var(--ink-faint); }
.lede { font-size: 1.09rem; line-height: 1.62; margin-top: 1.25rem; max-width: 64ch; }

.quicklinks { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.3rem; }
.quicklinks a {
  font-size: 0.87rem; color: var(--ink-soft); border: 1px solid var(--rule);
  border-radius: 999px; padding: 0.28rem 0.8rem; background: var(--panel);
}
.quicklinks a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- news ---------- */

.news { list-style: none; margin: 0; padding: 0; }
.news li {
  display: grid; grid-template-columns: 6.2rem 1fr; gap: 1.1rem;
  padding: 0.62rem 0; border-bottom: 1px solid var(--rule-soft); align-items: baseline;
}
.news li:last-child { border-bottom: none; }
.news time { color: var(--ink-faint); font-size: 0.82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.news .body { font-size: 0.97rem; }

/* ---------- theme cards (research page + home highlights) ---------- */

.themes { display: grid; gap: 1.15rem; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.theme {
  border: 1px solid var(--rule); border-radius: 7px; padding: 1.15rem 1.25rem;
  background: var(--panel);
}
.theme h3 { margin-bottom: 0.35rem; }
.theme h3 a { color: var(--ink); border-bottom: none; }
.theme h3 a:hover { color: var(--accent); }
.theme p { font-size: 0.94rem; color: var(--ink-soft); margin-bottom: 0.6rem; }
.theme .count { font-size: 0.8rem; color: var(--ink-faint); }

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

.viewswitch {
  display: inline-flex; border: 1px solid var(--rule); border-radius: 999px;
  overflow: hidden; margin-bottom: 1.8rem; background: var(--panel);
}
.viewswitch a {
  padding: 0.34rem 0.95rem; font-size: 0.88rem; color: var(--ink-soft);
  border-bottom: none; border-right: 1px solid var(--rule);
}
.viewswitch a:last-child { border-right: none; }
.viewswitch a[aria-current="page"] { background: var(--accent); color: #fff; }
.viewswitch a:not([aria-current]):hover { background: var(--rule-soft); color: var(--accent); }

.topic { margin: 0 0 3rem; scroll-margin-top: 5rem; }
.topic > h2 {
  font-size: 1.32rem; font-weight: 640; letter-spacing: -0.015em; text-transform: none;
  color: var(--ink); border-bottom: 2px solid var(--accent); padding-bottom: 0.45rem;
  margin-bottom: 0.85rem;
}
.topic .blurb { max-width: var(--measure); color: var(--ink-soft); font-size: 0.98rem; margin-bottom: 1.4rem; }

.yearhead {
  font-size: 0.79rem; font-weight: 650; letter-spacing: 0.1em; color: var(--ink-faint);
  margin: 2.2rem 0 0.8rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--rule);
}

ol.pubs, ul.pubs { list-style: none; margin: 0; padding: 0; }
.pub { padding: 0.85rem 0; border-bottom: 1px solid var(--rule-soft); }
.pub:last-child { border-bottom: none; }
.pub .t { font-weight: 570; display: block; margin-bottom: 0.12rem; }
.pub .t a { color: var(--ink); border-bottom: 1px solid color-mix(in srgb, var(--ink) 22%, transparent); }
.pub .t a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.pub .a { color: var(--ink-soft); font-size: 0.9rem; }
.pub .v { color: var(--ink-faint); font-size: 0.9rem; font-style: italic; }
.pub .gloss { font-size: 0.92rem; color: var(--ink-soft); margin-top: 0.3rem; max-width: var(--measure); }
.pub .meta { margin-top: 0.35rem; display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; align-items: center; }

.tag {
  font-size: 0.74rem; letter-spacing: 0.02em; padding: 0.1rem 0.48rem; border-radius: 3px;
  border: 1px solid var(--rule); color: var(--ink-faint); background: var(--paper);
  white-space: normal; max-width: 100%;
}
.tag.award { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); color: var(--accent); }
a.tag { border-bottom: 1px solid var(--rule); }
a.tag:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- people ---------- */

.people { list-style: none; margin: 0; padding: 0; }
.people li { padding: 0.5rem 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.97rem; }
.people li:last-child { border-bottom: none; }
.people .who { font-weight: 570; }
.people .where { color: var(--ink-soft); }

/* ---------- media ---------- */

.mediagrid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.mediacard { border: 1px solid var(--rule); border-radius: 7px; padding: 1rem 1.1rem; background: var(--panel); }
.mediacard .kind { font-size: 0.73rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-faint); }
.mediacard h4 { margin: 0.3rem 0 0.35rem; font-size: 1.01rem; line-height: 1.3; }
.mediacard h4 a { color: var(--ink); border-bottom: none; }
.mediacard h4 a:hover { color: var(--accent); }
.mediacard p { font-size: 0.9rem; color: var(--ink-soft); margin: 0; }

.embed { position: relative; padding-top: 56.25%; border-radius: 7px; overflow: hidden; border: 1px solid var(--rule); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

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

.cols { display: grid; gap: 1.6rem 3rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.cols h4 { color: var(--ink-faint); font-size: 0.79rem; letter-spacing: 0.09em; text-transform: uppercase; font-weight: 650; }
.cols .block { font-size: 0.94rem; color: var(--ink-soft); line-height: 1.7; }

footer {
  border-top: 1px solid var(--rule); margin-top: 3rem; padding: 1.4rem 0 0;
  font-size: 0.85rem; color: var(--ink-faint);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}

/* ---------- collaborators ---------- */

.namecloud { font-size: 0.9rem; color: var(--ink-soft); line-height: 1.9; max-width: 88ch; }

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  body { font-size: 16px; }
  main { padding: 2rem 1.15rem 4rem; }
  .hero { grid-template-columns: 1fr; gap: 1.2rem; }
  .hero img { width: 126px; height: 126px; }
  h1 { font-size: 1.72rem; }
  .news li { grid-template-columns: 1fr; gap: 0.15rem; }
  .news time { font-size: 0.79rem; }
  .topbar-inner { min-height: 0; padding-bottom: 0.15rem; }
  .navlinks { margin-left: 0; padding-top: 0; gap: 0.95rem; }
  .wordmark { padding-bottom: 0.35rem; }
}

@media print {
  .topbar, .quicklinks, .viewswitch { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; border: none; }
}
