/* ── MedStats AI — Classic Professional Stylesheet ─────────────────────────── */

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

:root {
  --black:   #1A1A1A;
  --grey:    #444444;
  --lgrey:   #6B6B6B; /* darkened from #888 for WCAG AA contrast on white */
  --rule:    #1A1A1A;
  --bg:      #FFFFFF;
  --bg-alt:  #F7F6F4;
  --accent:  #8B1E1E; /* used sparingly: focus rings, timeline markers */
  --max-w:   900px;
  --serif:      'Source Serif 4', Georgia, 'Times New Roman', Times, serif;
  --serif-disp: 'Fraunces', Georgia, 'Times New Roman', Times, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html { font-size: 16px; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  font-family: var(--serif);
  font-optical-sizing: auto;
  color: var(--black);
  background: var(--bg);
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--black); text-decoration: none; }
a:hover { text-decoration: underline; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── Skip link (a11y) ───────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--black);
  color: #FFFFFF;
  padding: 0.75rem 1.25rem;
  z-index: 100;
  font-size: 0.9rem;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ── Scroll-reveal ──────────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-visible { opacity: 1; transform: none; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 2rem; }

/* ── Site header / nav ──────────────────────────────────────────────────────── */
.site-header {
  border-bottom: 2px solid var(--rule);
  padding: 1.4rem 0 0;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(6px);
  -webkit-backdrop-filter: saturate(180%) blur(6px);
}

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

.brand { max-width: none; padding-bottom: 1rem; }

.site-logo {
  font-family: var(--serif-disp);
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--black);
}

.site-logo span {
  font-weight: normal;
  color: var(--grey);
  font-size: 1.25rem;
  margin-left: 0.75rem;
}

.site-tagline {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--lgrey);
  margin-top: 0.5rem;
  line-height: 1.5;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .site-tagline { font-size: 0.9rem; }
}

@media (max-width: 640px) {
  .site-tagline { white-space: normal; }
}

nav { display: flex; gap: 2rem; padding-bottom: 1rem; }

nav a {
  position: relative;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--grey);
  border-bottom: 2px solid transparent;
  padding-bottom: 0.2rem;
  transition: color 0.15s, border-color 0.2s var(--ease);
}

nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 2px;
  background: var(--black);
  transition: right 0.25s var(--ease);
}

nav a:hover::after,
nav a.active::after { right: 0; }

nav a:hover, nav a.active {
  color: var(--black);
  text-decoration: none;
}

/* ── Page hero ──────────────────────────────────────────────────────────────── */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid #DDDDDD;
}

.hero-noline { border-bottom: none; }

.hero-name {
  font-family: var(--serif-disp);
  font-size: 2.6rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}

.hero-title {
  font-size: 1rem;
  color: var(--grey);
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

.hero-rule {
  width: 48px;
  height: 3px;
  background: var(--black);
  margin-bottom: 1.5rem;
}

.hero-lead {
  font-size: 1.05rem;
  max-width: 680px;
  color: var(--black);
  line-height: 1.75;
}

/* ── Section ─────────────────────────────────────────────────────────────────── */
section { padding: 3rem 0; border-bottom: 1px solid #DDDDDD; }
section:last-of-type { border-bottom: none; }

.section-title {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lgrey);
  margin-bottom: 1.6rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #DDDDDD;
}

h2 { font-family: var(--serif-disp); font-size: 1.5rem; font-weight: 600; margin-bottom: 0.75rem; }
h3 { font-family: var(--serif-disp); font-size: 1.15rem; font-weight: 600; margin-bottom: 0.5rem; }
p  { margin-bottom: 0.9rem; }
p:last-child { margin-bottom: 0; }

/* ── Two-column grid ─────────────────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}

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

/* ── Service card ────────────────────────────────────────────────────────────── */
.service-area { margin-bottom: 3rem; }

.service-area h2 {
  font-size: 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--black);
  margin-bottom: 1.2rem;
}

.service-list { list-style: none; }

.service-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid #EBEBEB;
  display: flex;
  gap: 0.75rem;
  font-size: 0.97rem;
  color: var(--black);
}

.service-list li::before {
  content: '—';
  color: var(--lgrey);
  flex-shrink: 0;
}

/* ── About / Bio ─────────────────────────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.about-photo {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid #DDDDDD;
}

.about-grid p {
  font-size: 0.95rem;
  line-height: 1.75;
}

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

/* ── Highlight cards ─────────────────────────────────────────────────────────── */
.highlights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

@media (max-width: 640px) { .highlights { grid-template-columns: 1fr; } }

.highlight-card {
  background: var(--bg-alt);
  padding: 1.4rem 1.2rem;
  border-top: 2px solid var(--black);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.highlight-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -14px rgba(26, 26, 26, 0.35);
}

.highlight-card .number {
  font-size: 1.8rem;
  font-weight: bold;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.highlight-card p {
  font-size: 0.88rem;
  color: var(--grey);
  line-height: 1.5;
  margin: 0;
}

/* ── Publications ────────────────────────────────────────────────────────────── */
.pub-entry {
  padding: 1rem 0;
  border-bottom: 1px solid #EBEBEB;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 0.5rem;
  align-items: baseline;
  transition: background 0.2s var(--ease);
}

.pub-entry:hover { background: var(--bg-alt); }

.pub-entry:last-child { border-bottom: none; }

.pub-num {
  font-size: 0.82rem;
  color: var(--lgrey);
  text-align: right;
}

.pub-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--black);
}

.pub-text.starred { font-weight: bold; }

.pub-journal {
  display: block;
  font-size: 0.82rem;
  color: var(--grey);
  margin-top: 0.15rem;
  font-style: italic;
}

/* ── Affiliations strip ──────────────────────────────────────────────────────── */
.affiliations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  font-size: 0.88rem;
  color: var(--grey);
}

.affiliations span::before { content: '· '; color: var(--lgrey); }

/* ── Partners ────────────────────────────────────────────────────────────────── */
.partners { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; }

.partner-tag {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--grey);
  border: 1px solid #CCCCCC;
  padding: 0.35rem 0.85rem;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.partner-tag:hover { border-color: var(--black); color: var(--black); }

/* ── Contact ─────────────────────────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

@media (max-width: 640px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-detail {
  padding: 0.5rem 0;
  border-bottom: 1px solid #EBEBEB;
  display: flex;
  gap: 1rem;
  font-size: 0.95rem;
}

.contact-label {
  min-width: 110px;
  color: var(--lgrey);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 0.1rem;
}

form { display: flex; flex-direction: column; gap: 1rem; }

label { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--lgrey); }

input, textarea, select {
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--black);
  border: 1px solid #CCCCCC;
  border-radius: 0;
  padding: 0.6rem 0.75rem;
  width: 100%;
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}

input:focus, textarea:focus { border-color: var(--black); }
textarea { min-height: 130px; resize: vertical; }

.btn {
  display: inline-block;
  background: var(--black);
  color: #FFFFFF;
  font-family: var(--serif);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.7rem 1.8rem;
  border: 1px solid var(--black);
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn:hover { background: #333333; color: #FFFFFF; text-decoration: none; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--black);
}

.btn-outline:hover { background: var(--black); color: #FFFFFF; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.9rem; }

/* ── Career timeline ─────────────────────────────────────────────────────────── */
.timeline { position: relative; margin-left: 0.5rem; padding-left: 1.6rem; border-left: 2px solid #DDDDDD; }

.timeline-item { position: relative; padding-bottom: 1.8rem; }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.86rem;
  top: 0.3rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--black);
}

.timeline-date {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lgrey);
  margin-bottom: 0.2rem;
}

.timeline-role { font-family: var(--serif-disp); font-weight: 600; font-size: 1.02rem; margin-bottom: 0.15rem; }

.timeline-org { font-size: 0.9rem; color: var(--grey); }

/* ── Back to top ─────────────────────────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  color: #FFFFFF;
  border-radius: 50%;
  font-size: 1rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 40;
}

.back-to-top.is-shown { opacity: 1; pointer-events: auto; transform: none; }
.back-to-top:hover { background: #333333; text-decoration: none; }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 2px solid var(--rule);
  padding: 2rem 0;
  margin-top: 2rem;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--lgrey);
}

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

.footer-email-img {
  display: block;
  height: 0.95rem;
  width: auto;
  vertical-align: middle;
  opacity: 0.85;
  transition: opacity 0.2s var(--ease);
}

.site-footer a:hover .footer-email-img { opacity: 1; }

/* ── Research page extras ────────────────────────────────────────────────────── */
.grants-note {
  background: var(--bg-alt);
  border-left: 3px solid var(--black);
  padding: 1rem 1.2rem;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.reviewing-list {
  font-size: 0.92rem;
  color: var(--grey);
  line-height: 1.7;
}

.reviewing-list strong { color: var(--black); }

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.text-grey { color: var(--grey); }
.text-small { font-size: 0.88rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Print ───────────────────────────────────────────────────────────────────── */
@media print {
  .site-header, .back-to-top, .skip-link, form, .btn { display: none !important; }
  body { line-height: 1.4; }
  a { text-decoration: underline; color: #000; }
  section { border-bottom: none; padding: 0.75rem 0; }
}
