/* Cantu Lab site styles (redesign, option B).
   Plain CSS, no build step. Works in current Safari (macOS, iPhone, iPad),
   Chrome, Firefox and Edge. Layout is fluid; breakpoints at 900px and 600px. */

:root {
  --plum: #702050;
  --plum-dark: #521439;
  --tint: #F1DCE8;
  --stone: #F3EDE8;
  --sand: #E9DED6;
  --lilac: #DCCAD6;
  --line: #E2D7D0;
  --line-strong: #D9CBC3;
  --ink: #1C1416;
  --text: #4E4448;
  --muted: #6A5F62;
  --footer: #4A1838;
  --footer-text: #EBDCE5;
  --footer-label: #E0B4D0;
  --footer-muted: #D9C2D1;
  --footer-line: #6A3A5C;
  --surface: #fff;
  --strong: #16141A;
  --accent-fill: #702050;
  --accent-fill-hover: #521439;
  --icon-bg: #F7F1F5;
  --input-line: #CDBEB6;
  --preprint-bg: #FFF1DD;
  --preprint-text: #7A3E00;
  --marker-resources: #2F6B47;
  --marker-lab: #B5651D;
  --logo-leaf: #3E6B3A;
  --logo-berry: #702050;
  --shadow: rgba(22, 20, 26, 0.18);
  color-scheme: light;
  --display: "Archivo", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Dark theme. data-theme is set in <head> from the visitor's choice or,
   by default, the device setting. Contrast checked with scripts/check_contrast.py. */
:root[data-theme="dark"] {
  --plum: #E28CBE;
  --plum-dark: #F4BCDB;
  --tint: #45283C;
  --stone: #1B1318;
  --sand: #231A1F;
  --lilac: #3B2636;
  --line: #3B2E35;
  --line-strong: #4D3D45;
  --ink: #F3EAEE;
  --text: #D2C5CB;
  --muted: #AD9EA5;
  --footer: #2C0F22;
  --footer-line: #4E2B43;
  --surface: #31242C;
  --strong: #F7F0F3;
  --accent-fill: #9A3A72;
  --accent-fill-hover: #B04A86;
  --icon-bg: #2A1A25;
  --input-line: #8A7680;
  --preprint-bg: #3E2B14;
  --preprint-text: #F2C27E;
  --marker-resources: #5BAA7B;
  --marker-lab: #D98B47;
  --logo-leaf: #7BAE6F;
  --logo-berry: #C2609A;
  --shadow: rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--stone);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { max-width: 100%; }
img { height: auto; }

a { color: var(--plum); text-underline-offset: 3px; }
@media (hover: hover) { a:hover { color: var(--plum-dark); } }

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

[hidden] { display: none !important; }

.container {
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 32px;
  padding-right: 32px;
}

.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 16px; top: 16px; z-index: 10; background: var(--surface); padding: 10px 14px; border-radius: 6px; }

/* Shown only on preview builds (site.preview: true) */
.preview-banner { margin: 0; padding: 8px 16px; background: var(--footer); color: #fff; font-size: 13px; font-weight: 600; text-align: center; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--strong);
  text-decoration: none;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.brand svg { flex-shrink: 0; }

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--strong);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.nav-links a[aria-current="page"] { color: var(--plum); border-bottom-color: var(--plum); }
@media (hover: hover) { .nav-links a:hover { color: var(--plum); } }
.nav-links a.nav-contact {
  padding: 0 20px;
  border-radius: 999px;
  border-bottom: 0;
  background: var(--accent-fill);
  color: #fff;
}
@media (hover: hover) { .nav-links a.nav-contact:hover { background: var(--accent-fill-hover); color: #fff; } }
.nav-links { margin-left: auto; }

.brand .logo-stem { stroke: var(--logo-leaf); }
.brand .logo-leaf { fill: var(--logo-leaf); }
.brand .logo-berries { fill: var(--logo-berry); }

/* Light/dark switch: shows a moon in light mode and a sun in dark mode.
   Hidden when JavaScript is off (data-theme is then never set). */
.theme-toggle {
  display: none;
  position: relative;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: -12px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
/* Keeps a 44px touch target around the smaller visible circle */
.theme-toggle::after { content: ""; position: absolute; inset: -7px; }
.theme-toggle svg { width: 15px; height: 15px; }
[data-theme] .theme-toggle { display: inline-flex; }
.theme-toggle .icon-sun, [data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
@media (hover: hover) { .theme-toggle:hover { color: var(--plum); border-color: var(--plum); } }

/* ---------- Buttons and small text ---------- */
.btn, .btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
}
.btn { background: var(--accent-fill); color: #fff; }
.btn-outline { border: 1.5px solid var(--plum); color: var(--plum); background: transparent; }
@media (hover: hover) {
  .btn:hover { background: var(--accent-fill-hover); color: #fff; }
  .btn-outline:hover { background: var(--tint); color: var(--plum-dark); }
}
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 15px; letter-spacing: 0.06em; }

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--plum);
}
.eyebrow a { color: inherit; }

.section-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.05;
  font-weight: 800;
  text-transform: uppercase;
}
.center { text-align: center; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
}

/* ---------- Home: hero ---------- */
.hero-img {
  display: block;
  width: 100%;
  height: 620px;
  object-fit: cover;
  object-position: center 40%;
}
.hero-card-wrap { position: relative; margin-top: -240px; }
.hero-card {
  max-width: 700px;
  background: var(--surface);
  border-radius: 6px;
  box-shadow: 0 16px 40px var(--shadow);
  padding: 44px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.hero-card .eyebrow { font-size: 14px; }
.hero-card h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.hero-aim { margin: 0; font-size: 21px; line-height: 1.48; font-weight: 600; }
.hero-methods { margin: 0; font-size: 16px; line-height: 1.62; color: var(--text); }
.hero-card .btn { align-self: flex-start; margin-top: 8px; }

/* ---------- Home: cards ---------- */
.cards { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 48px; }
.card {
  flex: 1 1 300px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card-title {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
  line-height: 1.23;
  font-weight: 800;
  text-transform: uppercase;
}
.card p { margin: 0; }
.card p:not(.eyebrow) { color: var(--text); line-height: 1.56; }
.card .btn-outline { align-self: flex-start; margin-top: auto; }

/* ---------- Bands ---------- */
.band { padding: 88px 0; }
.band-lilac { background: var(--lilac); margin-top: 88px; }
.band-sand { background: var(--sand); }

/* ---------- Home: research areas ---------- */
.areas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px 28px;
  margin-top: 48px;
}
.area {
  flex: 1 1 190px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  color: var(--ink);
  text-decoration: none;
}
.icon-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--icon-bg);
  color: var(--plum);
  display: flex;
  align-items: center;
  justify-content: center;
}
.area-title { font-family: var(--display); font-size: 17px; font-weight: 800; line-height: 1.3; text-transform: uppercase; }
.area-short { font-size: 15px; line-height: 1.53; color: var(--text); }
@media (hover: hover) { .area:hover .area-title { color: var(--plum); } }

/* ---------- Home: recent work ---------- */
.work-grid { display: flex; flex-wrap: wrap; gap: 24px; }
.work {
  flex: 1 1 300px;
  min-width: 0;
  background: var(--surface);
  border-radius: 6px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.work p { margin: 0; }
.icon-square {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--tint);
  color: var(--plum);
  display: flex;
  align-items: center;
  justify-content: center;
}
.work h3 { margin: 0; font-family: var(--display); font-size: 24px; line-height: 1.2; font-weight: 800; }
.work-summary { color: var(--text); line-height: 1.56; }
.work-cite { font-size: 14px; line-height: 1.43; color: var(--muted); }
.work-links { margin-top: auto !important; display: flex; flex-wrap: wrap; gap: 0 20px; }

/* ---------- Inner pages ---------- */
.page-head { background: var(--sand); padding: 72px 0 56px; }
.page-head h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(40px, 6vw, 56px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.lead { margin: 16px 0 0; max-width: 820px; font-size: 18px; line-height: 1.56; color: var(--text); }
.prose { max-width: 860px; padding-top: 48px; padding-bottom: 88px; line-height: 1.65; }

/* Research page */
.jump { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
@media (hover: hover) { .pill:hover { border-color: var(--plum); color: var(--plum); } }

.area-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 56px;
  padding: 56px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 16px;
}
.area-row:last-child { border-bottom: 0; }
.area-intro { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.area-num { font-size: 13px; font-weight: 700; letter-spacing: 0.12em; color: var(--plum); }
.area-intro h2 { margin: 0; font-family: var(--display); font-size: 28px; line-height: 1.1; font-weight: 800; text-transform: uppercase; }
.area-intro p { margin: 0; color: var(--text); line-height: 1.62; }
.area-intro .btn { align-self: flex-start; }
.area-papers { flex: 2 1 520px; min-width: 0; display: flex; flex-direction: column; }
.list-label { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.paper-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.paper-title { font-size: 17px; line-height: 1.47; font-weight: 600; }
.paper-meta { font-size: 14px; line-height: 1.43; color: var(--muted); }
@media (hover: hover) { .paper-link:hover .paper-title { color: var(--plum); text-decoration: underline; } }
.paper-multi .paper-title { color: var(--ink); text-decoration: none; align-self: flex-start; }
.paper-extra { display: flex; flex-wrap: wrap; gap: 0 20px; font-size: 14px; font-weight: 700; }
.paper-extra a { display: inline-flex; align-items: center; min-height: 44px; }

/* Publications page */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.chip {
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--strong);
  font: 600 14px/1 var(--body);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
@media (hover: hover) { .chip:hover { border-color: var(--plum); } }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  margin-top: 20px;
  font-size: 15px;
  color: var(--text);
}
.filters label { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.filters input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
  width: 320px;
  max-width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: 16px var(--body); /* 16px stops iOS zooming in on focus */
}
.filters input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--plum); }

.pubs { padding-bottom: 88px; }
.pub-year { padding-top: 40px; }
.pub-year h2 { margin: 0 0 8px; font-family: var(--display); font-size: 32px; line-height: 1.1; font-weight: 800; }
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 32px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.pub-main { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pub-title { font-size: 17px; line-height: 1.47; font-weight: 600; color: var(--ink); text-decoration: none; }
@media (hover: hover) { .pub-title:hover { color: var(--plum); text-decoration: underline; } }
.pub-meta { margin: 0; font-size: 14px; line-height: 1.43; color: var(--muted); overflow-wrap: anywhere; }
.pub-tags { flex: 0 1 340px; display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: flex-start; gap: 6px; margin: 0; }
.tag { padding: 3px 10px; border-radius: 999px; background: var(--tint); color: var(--plum-dark); font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.tag-preprint { background: var(--preprint-bg); color: var(--preprint-text); font-weight: 700; }
.pub-empty, .pub-source { margin: 40px 0 0; font-size: 15px; color: var(--muted); }
.pub-more { margin: 40px 0 0; }
.pub-year h2:focus { outline: none; }

/* People page */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 48px 32px;
  padding-top: 64px;
  padding-bottom: 64px;
}
.person { display: flex; flex-direction: column; gap: 10px; }
.person img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; }
.person h2 { margin: 8px 0 0; font-size: 20px; line-height: 1.3; }
.person-role { margin: 0; font-size: 15px; line-height: 1.53; color: var(--text); }
.person-links { margin: 0; display: flex; flex-wrap: wrap; gap: 0 16px; font-size: 14px; font-weight: 600; }
.person-links a { display: inline-flex; align-items: center; min-height: 44px; }

.alumni { padding-top: 48px; padding-bottom: 88px; border-top: 1px solid var(--line); }
.subhead { margin: 0 0 24px; font-family: var(--display); font-size: 28px; line-height: 1.1; font-weight: 800; text-transform: uppercase; }
.alumni-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 32px; }
.alumni-group h3 { margin: 0 0 14px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--plum); }
.alumni-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; font-size: 15px; line-height: 1.47; }
.muted { color: var(--muted); }

/* News page */
.news-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 40px 32px; padding-top: 56px; padding-bottom: 96px; }
.news-col { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.news-col.wide { flex: 2 1 460px; }
.news-col h2 {
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
  text-transform: uppercase;
}
.marker { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.marker-papers { background: var(--plum); }
.marker-resources { background: var(--marker-resources); }
.marker-lab { background: var(--marker-lab); }
.news-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px 26px; display: flex; flex-direction: column; gap: 8px; }
.news-card p, .news-card h3 { margin: 0; }
.news-date { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.news-card h3 { font-size: 18px; line-height: 1.44; }
.news-text { font-size: 15px; line-height: 1.53; color: var(--text); }
.news-card .text-link { align-self: flex-start; }
.news-col .btn-outline { align-self: flex-start; }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer); color: var(--footer-text); }
.footer-inner { padding-top: 64px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 40px; }
.footer-cols { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px 40px; }
.footer-col { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 1.6; }
.footer-col.wide { flex: 1 1 320px; }
.footer-brand { font-family: var(--display); font-size: 24px; font-weight: 800; color: #fff; }
.footer-label { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--footer-label); }
.site-footer a { color: #fff; }
@media (hover: hover) { .site-footer a:hover { color: var(--footer-label); } }
.map-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; align-self: flex-start; }
.map-link svg { flex-shrink: 0; color: var(--footer-label); }
.footer-social { display: flex; flex-wrap: wrap; gap: 0 20px; }
.footer-social a { display: inline-flex; align-items: center; min-height: 44px; }
.footer-bottom { margin: 0; padding-top: 24px; border-top: 1px solid var(--footer-line); font-size: 14px; color: var(--footer-muted); }

/* ---------- Tablet (iPad portrait and smaller) ---------- */
@media (max-width: 900px) {
  /* Switch stays top right next to the lab name; links take the second row. */
  .theme-toggle { order: 1; margin-left: auto; }
  .nav-links { order: 2; flex-basis: 100%; margin-left: 0; }
  .hero-img { height: 480px; }
  .hero-card-wrap { margin-top: -160px; }
  .band { padding: 64px 0; }
  .band-lilac { margin-top: 64px; }
  .page-head { padding: 56px 0 44px; }
}

/* ---------- Phone ---------- */
@media (max-width: 600px) {
  .container { padding-left: 20px; padding-right: 20px; }
  .brand { font-size: 21px; }
  .nav { gap: 4px 20px; padding-top: 10px; padding-bottom: 6px; }
  .nav-links { gap: 0 16px; font-size: 13px; letter-spacing: 0.04em; }
  /* Contact details are in the footer; keep the phone menu to one row. */
  .nav-links li:last-child { display: none; }
  .hero-img { height: 300px; }
  .hero-card-wrap { margin-top: -56px; }
  .hero-card { padding: 28px 22px; }
  .hero-aim { font-size: 19px; }
  .cards { margin-top: 32px; gap: 16px; }
  .card, .work { padding: 24px; }
  .band { padding: 48px 0; }
  .band-lilac { margin-top: 48px; }
  .areas { gap: 32px 20px; margin-top: 32px; }
  .section-head { margin-bottom: 28px; }
  .page-head { padding: 44px 0 36px; }
  .lead { font-size: 17px; }
  .area-row { padding: 40px 0; }
  .filters input[type="search"] { width: 100%; }
  .filters label:first-child { flex: 1 1 100%; }
  .pub-tags { justify-content: flex-start; }
  .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 16px; padding-top: 40px; }
  .person h2 { font-size: 17px; }
  .news-grid { padding-top: 40px; padding-bottom: 64px; }
  .footer-inner { padding-top: 48px; }
}
