/* Sampognaro Lab — shared stylesheet */
/* Fonts are loaded via <link preconnect> + <link stylesheet> in each page's <head>, not @import, so they don't block first paint. */

:root {
  --navy-950: #0a1730;
  --navy-900: #0e1f42;
  --navy-800: #142a56;
  --navy-700: #1c3a72;
  --blue-500: #5457d6;
  --teal-400: #3fd9c3;
  --teal-500: #21b8a4;
  --teal-700: #0d7a68;
  --ink: #0a0a0a;
  --muted: #3a3a3a;
  --line: #e4e6ee;
  --paper: #fbfbfd;
  --card: #ffffff;
  --coral: #e8685f;
  --max: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  line-height: 1.15;
  color: var(--navy-950);
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2.1rem, 4vw, 3.1rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1.1em; color: var(--ink); }
a { color: var(--blue-500); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* Skip link */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--navy-950); color: #fff; padding: 10px 16px;
  z-index: 200; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

/* Top utility bar (UCSF affiliation) */
.utility-bar {
  background: var(--navy-950);
  color: #c9cff0;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.utility-bar .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 34px;
}
.utility-bar a { color: #c9cff0; }
.utility-bar a:hover { color: #fff; }

/* Header / nav */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 100;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 84px;
}
.brand {
  display: flex; align-items: center; gap: 10px; flex: none;
  color: var(--navy-950); font-family: 'Fraunces', serif;
}
.brand-mark {
  height: 32px; width: auto; flex: none; object-fit: contain;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.25rem; font-weight: 700; }
.brand-text span { font-size: 0.72rem; color: var(--muted); font-family: 'Inter', sans-serif; letter-spacing: 0.03em; }

.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--navy-800); border-radius: 8px;
  width: 44px; height: 44px; cursor: pointer; color: var(--navy-800);
  align-items: center; justify-content: center;
}
.nav-toggle svg { width: 20px; height: 20px; }

/* Visible keyboard focus */
a:focus-visible, button:focus-visible, .nav-toggle:focus-visible {
  outline: 2px solid var(--blue-500); outline-offset: 2px; border-radius: 2px;
}

.main-nav ul {
  display: flex; gap: 4px; list-style: none; margin: 0; padding: 0;
  flex-wrap: wrap;
}
.main-nav a {
  color: var(--navy-800); font-weight: 500; font-size: 0.88rem;
  padding: 8px 9px; border-radius: 8px; display: block; white-space: nowrap;
}
.main-nav a:hover { background: #f0f2fb; text-decoration: none; }
.main-nav a[aria-current="page"] {
  color: var(--blue-500); background: #eef0fc;
}

/* Hero */
.hero {
  background: linear-gradient(150deg, var(--navy-950), var(--navy-800) 65%, var(--navy-700));
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(480px 480px at 88% 15%, rgba(63,217,195,0.25), transparent 60%),
    radial-gradient(420px 420px at 100% 90%, rgba(84,87,214,0.35), transparent 60%);
  pointer-events: none;
}
.hero .container { position: relative; padding: 76px 24px 88px; }
.hero .eyebrow {
  text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.76rem;
  color: var(--teal-400); font-weight: 600; margin-bottom: 14px;
}
.hero h1 { color: #fff; max-width: 20ch; }
.hero .lede { color: #d3d8f2; font-size: 1.15rem; max-width: 62ch; margin-top: 14px; }
.hero .cta-row { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }

/* Page header (interior pages) */
.page-header {
  background: linear-gradient(150deg, var(--navy-950), var(--navy-800));
  color: #fff;
}
.page-header .container { padding: 46px 24px 52px; }
.page-header h1 { color: #fff; margin-bottom: 8px; }
.page-header .lede { color: #ccd2ef; max-width: 68ch; font-size: 1.02rem; margin: 0; }

.breadcrumb {
  font-size: 0.82rem; color: #9aa2ce; margin-bottom: 14px;
}
.breadcrumb a { color: #9aa2ce; }
.breadcrumb a:hover { color: #fff; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 0.92rem;
  border: 1px solid transparent; cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--teal-400); color: var(--navy-950); }
.btn-primary:hover { background: #58e3cf; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.4); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-outline { background: transparent; color: var(--navy-800); border-color: var(--line); }
.btn-outline:hover { background: #f4f5fb; }

/* Sections */
.section { padding: 64px 0; }
.section-tight { padding: 40px 0; }
.section-alt { background: #f4f5fb; }
.section-head { max-width: 68ch; margin-bottom: 36px; }
.section-head .eyebrow {
  text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.74rem;
  color: var(--teal-700); font-weight: 700; margin-bottom: 10px;
}

/* Layout helpers */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

.with-sidebar {
  display: grid; grid-template-columns: 1fr 320px; gap: 48px;
  align-items: start;
}
@media (max-width: 900px) {
  .with-sidebar { grid-template-columns: 1fr; }
}

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 26px; height: 100%;
}
.card h3 { margin-bottom: 10px; }
.tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--teal-700); background: #e6faf6; padding: 4px 10px; border-radius: 999px;
  margin-bottom: 12px;
}
.card-link { font-weight: 600; font-size: 0.9rem; }

/* Micrograph placeholder art */
.micrograph {
  border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3;
  position: relative; background: var(--navy-950);
}
.micrograph svg { width: 100%; height: 100%; display: block; }
.micrograph figcaption {
  font-size: 0.78rem; color: var(--muted); margin-top: 8px;
}

/* Building photos (source images are ~550px wide, so cap display size to keep them sharp) */
.place-grid { align-items: center; gap: 48px; }
.place-grid p:last-child { margin-bottom: 0; }
@media (max-width: 860px) { .place-grid { gap: 24px; } }
.place-photo { margin: 0; }
.place-photo img {
  display: block; width: 100%; max-width: 568px; height: auto;
  border-radius: 12px; box-shadow: 0 8px 24px rgba(20,30,60,0.12);
}
.place-photo figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 10px; }
/* Small photo under the sidebar contact card (source images are low-res, so keep them small) */
.sidebar-stack { display: flex; flex-direction: column; gap: 16px; }
.place-photo--side { max-width: 360px; }
.place-photo--side img { aspect-ratio: 3 / 2; object-fit: cover; object-position: center 70%; border-radius: 12px; }

/* When a page ends on a gray band, let it meet the footer without a white strip */
body:has(main > section.section-alt:last-child) .site-footer { margin-top: 0; }

/* People */
.person {
  display: grid; grid-template-columns: 120px 1fr; gap: 20px;
  padding: 26px 0; border-bottom: 1px solid var(--line);
}
.person:last-child { border-bottom: none; }
.avatar {
  width: 120px; height: 120px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.6rem;
  object-fit: cover; flex: none;
}
.person h3 { margin-bottom: 2px; }
.person .role { color: var(--teal-700); font-weight: 600; font-size: 0.88rem; margin-bottom: 10px; }
@media (max-width: 560px) {
  .person { grid-template-columns: 1fr; }
  .avatar { width: 72px; height: 72px; font-size: 1.2rem; }
}

.group-label {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); font-weight: 700; margin: 44px 0 4px;
}
.group-label:first-of-type { margin-top: 0; }

/* Publications */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub-item {
  padding: 20px 0; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 64px 1fr; gap: 18px;
}
.pub-item:first-child { padding-top: 0; }
.pub-year {
  font-family: 'Fraunces', serif; font-weight: 600; color: var(--teal-700); font-size: 1.05rem;
}
.pub-item p { margin: 0 0 6px; }
.pub-item .pub-authors { color: var(--muted); font-size: 0.9rem; }
.pub-item .pub-links a { font-size: 0.85rem; font-weight: 600; margin-right: 16px; }
@media (max-width: 560px) {
  .pub-item { grid-template-columns: 1fr; }
}

/* News / timeline */
.news-item { padding: 22px 0; border-bottom: 1px solid var(--line); }
.news-item:first-child { padding-top: 0; }
.news-date { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* Sidebar contact card */
.contact-card {
  background: var(--navy-950); color: #fff; border-radius: 16px; padding: 28px;
}
.contact-card h3 { color: #fff; font-size: 1.05rem; }
.contact-card .name { font-weight: 700; font-size: 1.1rem; }
.contact-card .role { color: #9aa2ce; font-size: 0.88rem; margin-bottom: 18px; }
.contact-card .block { margin-bottom: 18px; }
.contact-card .block:last-child { margin-bottom: 0; }
.contact-card .label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--teal-400); font-weight: 700; margin-bottom: 6px;
}
.contact-card a { color: #fff; }
.contact-card p { color: #d3d8f2; margin: 0 0 4px; font-size: 0.92rem; }

/* Callout / under construction */
.callout {
  border: 1px dashed var(--line); border-radius: 14px; padding: 32px;
  background: #fff; text-align: left;
}

/* Prose */
.prose h2 { margin-top: 2em; }
.prose h2:first-child { margin-top: 0; }
.prose p { max-width: 74ch; }
.prose ul { max-width: 74ch; }

/* Footer */
.site-footer {
  background: var(--navy-950); color: #b9bfe4; margin-top: 80px;
}
.site-footer .container { padding: 48px 24px 28px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { color: #fff; font-family: 'Inter', sans-serif; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px; }
.site-footer p { color: #c9cff0; }
.site-footer a { color: #b9bfe4; }
.site-footer a:hover { color: #fff; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; font-size: 0.9rem; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12); margin-top: 36px; padding-top: 20px;
  font-size: 0.8rem; color: #8b91ba;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.footer-bottom a { color: #8b91ba; }

@media (max-width: 860px) {
  .main-nav { position: absolute; top: 84px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); display: none; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; padding: 12px 24px 20px; gap: 2px; }
  .nav-toggle { display: inline-flex; flex: none; }
  .site-header .container { flex-wrap: nowrap; }
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand-text { min-width: 0; }
  .brand-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Scroll reveal (progressive enhancement, added via JS only) */
.reveal-init { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal-init.revealed { opacity: 1; transform: translateY(0); }

/* Mechanism diagram — presented as a journal-style figure card */
.mechanism-section { background: #0e1f42; }
.mechanism-wrap {
  border-radius: 10px; overflow: hidden; background: #ffffff;
  padding: 32px 36px; box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}
.mechanism-wrap svg { width: 100%; height: auto; display: block; margin: 0 auto; }

/* Small explainer diagrams within research prose — same journal-figure treatment */
.explainer {
  background: #ffffff; border: 1px solid var(--line); border-radius: 10px; padding: 28px 32px;
  margin: 32px 0; max-width: 640px; box-shadow: 0 2px 10px rgba(20,30,60,0.06);
}
.explainer svg { width: 100%; height: auto; display: block; }
.explainer figcaption { color: var(--ink); font-size: 0.9rem; margin-top: 16px; text-align: center; }
.mechanism-caption { color: #aab0d6; font-size: 0.86rem; text-align: center; max-width: 60ch; margin: 18px auto 0; }
@media (prefers-reduced-motion: no-preference) {
  .flow-dash { stroke-dasharray: 5 6; animation: dashmove 1.8s linear infinite; }
  @keyframes dashmove { to { stroke-dashoffset: -22; } }
}

/* Jump nav (research page) */
.jump-nav {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 40px; padding: 14px;
  background: #f4f5fb; border-radius: 12px; border: 1px solid var(--line);
}
.jump-nav span { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); align-self: center; margin-right: 4px; }
.jump-nav a {
  font-size: 0.85rem; font-weight: 600; color: var(--navy-800); background: #fff;
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px;
}
.jump-nav a:hover { border-color: var(--blue-500); color: var(--blue-500); text-decoration: none; }

/* Publication "why it matters" annotation */
.pub-why {
  margin-top: 8px; padding: 10px 14px; background: #f4f5fb; border-left: 3px solid var(--teal-700);
  border-radius: 0 8px 8px 0; font-size: 0.88rem; color: var(--navy-800);
}
.pub-why strong { color: var(--teal-700); }
