/* ==========================================================================
   Aaqib Saeed, personal site
   Theme carried over from the previous Distill-based site (Open Sans, white
   ground, deep blue accent) but rebuilt on a plain document grid.
   ========================================================================== */

:root {
  --ink:        #14181d;
  --ink-soft:   #3d4750;
  --muted:      #667380;
  --bg:         #ffffff;
  --surface:    #f6f8fa;
  --surface-2:  #eef2f6;
  --line:       #e2e8ee;
  --line-soft:  #eef1f5;
  --accent:     #0f5fa8;
  --accent-ink: #0a4680;
  --accent-bg:  #eaf2fa;
  --on-accent:  #ffffff;

  --measure: 1080px;
  --radius: 10px;
  --font: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(.22,.61,.36,1);
}

html[data-theme="dark"] {
  --ink:        #e7edf3;
  --ink-soft:   #c3ccd6;
  --muted:      #8d9aa8;
  --bg:         #0e1216;
  --surface:    #151b21;
  --surface-2:  #1c242c;
  --line:       #242e37;
  --line-soft:  #1a222a;
  --accent:     #6cb4f2;
  --accent-ink: #9acbf7;
  --accent-bg:  #142330;
  --on-accent:  #0b1117;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --ink:        #e7edf3;
    --ink-soft:   #c3ccd6;
    --muted:      #8d9aa8;
    --bg:         #0e1216;
    --surface:    #151b21;
    --surface-2:  #1c242c;
    --line:       #242e37;
    --line-soft:  #1a222a;
    --accent:     #6cb4f2;
    --accent-ink: #9acbf7;
    --accent-bg:  #142330;
    --on-accent:  #0b1117;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16.5px;
  font-weight: 400;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 { margin: 0; line-height: 1.22; font-weight: 600; letter-spacing: -0.015em; }

img { max-width: 100%; }

::selection { background: var(--accent-bg); color: var(--ink); }

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

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

.wrap { width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 28px; }

.section { padding: 76px 0; border-top: 1px solid var(--line-soft); }
.section--tint { background: var(--surface); }
.section--flush { border-top: 0; }

.section-head { margin-bottom: 38px; }
.section-head h2 { font-size: 30px; margin-bottom: 10px; }
.section-head p { margin: 0; max-width: 64ch; color: var(--ink-soft); font-size: 16px; }

.eyebrow {
  display: block;
  font-size: 11.5px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 14px;
}

.skip { position: absolute; left: -9999px; background: var(--accent); color: var(--on-accent); padding: 10px 16px; z-index: 100; }
.skip:focus { left: 0; top: 0; }

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

.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.nav-links[hidden] { display: none; }
@supports (backdrop-filter: blur(1px)) {
  .nav {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
  }
}
.nav-inner { display: flex; align-items: center; gap: 18px; height: 60px; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.nav-links a {
  color: var(--ink-soft); font-size: 14.5px; padding: 7px 11px; border-radius: 6px; white-space: nowrap;
}
.nav-links a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-links a.is-current { color: var(--accent); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14.5px; font-weight: 600; padding: 9px 16px; border-radius: 7px;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s, color .15s;
}
.btn--solid { background: var(--accent); color: var(--on-accent); }
.btn--solid:hover { background: var(--accent-ink); color: var(--on-accent); text-decoration: none; }
.btn--ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid var(--line); background: transparent;
  border-radius: 7px; color: var(--ink-soft); cursor: pointer; flex-shrink: 0;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--ink); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  html:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.nav-toggle { display: none; }

@media (max-width: 880px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center; margin-right: auto;
    width: 34px; height: 34px; border: 1px solid var(--line); background: transparent;
    border-radius: 7px; color: var(--ink); cursor: pointer;
  }
  .nav-toggle svg { width: 17px; height: 17px; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px; margin: 0;
    padding: 10px 28px 18px; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .nav-links a { padding: 10px 12px; font-size: 15px; }
  .nav-links .btn { margin-top: 8px; }
}

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

.hero { padding: 70px 0 58px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 224px; gap: 56px; align-items: start; }
.hero h1 { font-size: 46px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 16px; }
.hero-lead { font-size: 21px; line-height: 1.5; color: var(--ink); margin: 0 0 22px; max-width: 44ch; }
.hero-lead strong { font-weight: 600; }
.hero-body { color: var(--ink-soft); font-size: 16px; margin: 0 0 14px; max-width: 62ch; }
.hero-body:last-of-type { margin-bottom: 26px; }

.hero-aside { display: flex; flex-direction: column; gap: 20px; }
.hero-photo {
  width: 100%; height: auto; aspect-ratio: 1; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); border: 1px solid var(--line);
}
.hero-meta { font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.hero-meta div + div { margin-top: 9px; }
.hero-meta b { display: block; color: var(--ink-soft); font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }

.linkrow { display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 0; margin: 0; list-style: none; font-size: 14.5px; }
.linkrow a { color: var(--ink-soft); display: inline-flex; align-items: center; gap: 7px; }
.linkrow a:hover { color: var(--accent); }
.linkrow svg { width: 15px; height: 15px; flex-shrink: 0; }

@media (max-width: 820px) {
  .hero { padding: 44px 0 40px; }
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-aside { flex-direction: row; align-items: center; gap: 24px; flex-wrap: wrap; }
  .hero-photo { width: 112px; }
  .hero h1 { font-size: 36px; }
  .hero-lead { font-size: 19px; max-width: none; }
}

/* ---------------------------------------------------------------- areas -- */

.areas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.area { border-top: 1px solid var(--line); padding-top: 18px; }
.area h3 { font-size: 17px; margin-bottom: 8px; }
.area p { margin: 0; font-size: 15px; color: var(--ink-soft); }
@media (max-width: 860px) { .areas { grid-template-columns: 1fr; gap: 26px; } }

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

.pubs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 30px; }
.filter {
  font-family: inherit; font-size: 14px; font-weight: 500; color: var(--ink-soft);
  background: transparent; border: 1px solid var(--line); border-radius: 20px;
  padding: 7px 15px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.filter:hover { background: var(--surface-2); }
.filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.filter .count { opacity: .62; font-variant-numeric: tabular-nums; margin-left: 4px; }

.pubs-note { font-size: 13.5px; color: var(--muted); margin: 16px 0 26px; }

.pub-group + .pub-group { margin-top: 38px; }
.pub-group-title {
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding-bottom: 10px; border-bottom: 1px solid var(--line);
}

.pub { border-bottom: 1px solid var(--line-soft); }
.pub-main {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: baseline;
  width: 100%; padding: 17px 0; background: none; border: 0; font: inherit; color: inherit;
  text-align: left; cursor: pointer;
}
.pub-main > span:first-child { display: block; min-width: 0; }
.pub-main:hover .pub-title { color: var(--accent); }
.pub-title { display: block; font-size: 16.5px; font-weight: 600; line-height: 1.4; margin-bottom: 5px; transition: color .15s; }
.pub-authors { display: block; font-size: 14px; color: var(--muted); line-height: 1.5; }
.pub-authors .me { color: var(--ink-soft); font-weight: 600; }
.pub-venue {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft); white-space: nowrap; padding-top: 2px;
}
.pub-venue .year { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.pub-chev {
  display: inline-block; width: 7px; height: 7px;
  border: solid var(--muted); border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translateY(-2px); transition: transform .2s var(--ease); margin-left: 2px;
}
.pub.is-open .pub-chev { transform: rotate(225deg) translateY(-1px); }

.pub-detail { display: none; padding: 0 0 24px; }
.pub.is-open .pub-detail { display: block; }
.pub-detail-inner {
  display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 26px; align-items: start;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px;
}
.pub-detail-inner.no-figure { grid-template-columns: 1fr; }
.pub-fig { width: 100%; border-radius: 6px; background: #fff; border: 1px solid var(--line); padding: 8px; }
.pub-detail p { margin: 0 0 14px; font-size: 15px; color: var(--ink-soft); }
.pub-detail p:only-child { margin-bottom: 0; }

.pub-links { display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin: 0; list-style: none; }
.pub-links a {
  display: inline-block; font-size: 12.5px; font-weight: 600; padding: 5px 11px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink-soft);
}
.pub-links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

@media (max-width: 760px) {
  .pub-main { grid-template-columns: 1fr; gap: 8px; }
  .pub-venue { padding-top: 0; }
  .pub-detail-inner { grid-template-columns: 1fr; }
}

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

.people { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.person {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  background: var(--bg); display: flex; flex-direction: column; gap: 2px;
  color: inherit; transition: border-color .15s;
}
.person:hover { border-color: var(--accent); text-decoration: none; }
.person b { font-size: 15.5px; font-weight: 600; }
.person span { font-size: 13px; color: var(--muted); }
@media (max-width: 880px) { .people { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .people { grid-template-columns: 1fr; } }

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

.footer { border-top: 1px solid var(--line); padding: 34px 0 46px; font-size: 13.5px; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
.footer a { color: var(--ink-soft); }
.footer a:hover { color: var(--accent); }

/* ----------------------------------------------------------------- misc -- */

.prose p { color: var(--ink-soft); max-width: 70ch; }
.prose p:first-child { margin-top: 0; }
.lede { font-size: 18px; line-height: 1.6; color: var(--ink); max-width: 64ch; }

html.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s var(--ease), transform .55s var(--ease); }
html.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html.js .reveal { opacity: 1; transform: none; } }
