/* Clark Lab website styles.
   Layout: one centred reading column (max 1080px) under a quiet lab masthead;
   navy text on white, purple used only for small accents (paper numbers, links on hover). */
:root {
  --ink: #27223E;        /* navy – the original site's text colour */
  --ink-soft: #5A5670;   /* secondary text */
  --accent: #6B5B95;     /* purple – paper numbers, small accents */
  --paper: #FFFFFF;      /* page background */
  --mist: #F3F2F7;       /* tinted panels */
  --rule: #DDDAE6;       /* hairlines */
  --font: "Jost", "Brandon Grotesque", "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
  --step-0: 1.0625rem;   /* 17px body */
  --step-1: 1.375rem;    /* 22px */
  --step-2: 1.75rem;     /* 28px section headings */
  --step-3: clamp(2.2rem, 5vw, 3.4rem);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-weight: 300; font-size: var(--step-0); line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-weight: 400; line-height: 1.25; text-wrap: balance; margin: 0; }
p { margin: 0; }
strong, b { font-weight: 500; }

.wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---- Masthead: Twelve Apostles banner ---- */
.masthead { position: relative; color: #fff; background: #27223E url("images/banner.jpg") center 36% / cover no-repeat; }
.masthead--home { background-position: center 58%; }
.masthead::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,17,34,.10) 0%, rgba(20,17,34,.18) 45%, rgba(20,17,34,.62) 100%); }
.masthead .wrap { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  min-height: 210px; padding-block: 28px 26px; }
.masthead--home .wrap { min-height: clamp(280px, 38vw, 440px); padding-block: 40px 40px; }
.brand { text-decoration: none; display: grid; gap: 8px; text-shadow: 0 2px 14px rgba(0,0,0,.35); }
.brand:hover { color: #fff; }
.brand span { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 400; letter-spacing: .01em; line-height: 1; }
.masthead--home .brand span { font-size: clamp(3rem, 8vw, 5.6rem); }
.brand small { font-size: clamp(.7rem, 1.4vw, .9rem); letter-spacing: .22em; text-transform: uppercase; font-weight: 500; opacity: .95; }
.social { display: flex; gap: 12px; align-items: center; }
.social a { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--rule); }
.masthead .social a { border-color: rgba(255,255,255,.55); color: #fff; background: rgba(20,17,34,.25); }
.masthead .social a:hover { background: rgba(255,255,255,.18); }
.social svg { width: 15px; height: 15px; fill: currentColor; }
@media (max-width: 860px) { .masthead { background-image: url("images/banner-small.jpg"); } .masthead .wrap { min-height: 150px; padding-block: 20px; } .masthead--home .wrap { min-height: 230px; } }

/* ---- Navigation ---- */
.nav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--ink); color: #E9E7F1; box-shadow: 0 2px 10px rgba(20,17,34,.15); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.nav a { display: block; padding: 14px 14px; text-decoration: none; font-size: .95rem; letter-spacing: .04em; }
.nav ul.top > li:first-child > a { padding-left: 0; }
.nav a:hover { color: #fff; }
.nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 #B8A8E8; }
.nav .has-sub { position: relative; }
.nav .sub { display: none; position: absolute; left: 0; top: 100%; min-width: 220px; background: var(--paper); border: 1px solid var(--rule); flex-direction: column; padding: 6px 0; box-shadow: 0 8px 24px rgba(39,34,62,.08); }
.nav .sub a { padding: 8px 16px; }
.nav .has-sub:hover .sub, .nav .has-sub:focus-within .sub { display: flex; }
.menu-btn { display: none; background: none; border: 0; font: inherit; color: inherit; padding: 14px 0; cursor: pointer; font-size: .95rem; letter-spacing: .08em; text-transform: uppercase; }
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .nav ul.top { display: none; flex-direction: column; width: 100%; padding-bottom: 10px; }
  .nav.open ul.top { display: flex; }
  .nav .wrap { flex-wrap: wrap; }
  .nav a, .nav ul.top > li:first-child > a { padding: 9px 0; }
  .nav a[aria-current="page"] { box-shadow: none; }
  .nav .sub { display: flex; position: static; border: 0; box-shadow: none; padding: 0 0 0 16px; min-width: 0; }
  .nav .sub a { padding: 6px 0; font-size: .9rem; color: var(--ink-soft); }
}

/* ---- Page furniture ---- */
main { padding-block: 44px 64px; }
.page-title { font-size: var(--step-2); letter-spacing: .06em; text-transform: uppercase; }
.page-title::after, .section-title::after { content: ""; display: block; width: 64px; height: 2px; background: var(--ink); margin-top: 12px; }
.section-title { font-size: var(--step-2); letter-spacing: .06em; text-transform: uppercase; margin-top: 56px; }
.sub-title { font-size: var(--step-1); margin-top: 36px; color: var(--accent); font-weight: 400; }
.lead { font-size: 1.25rem; line-height: 1.55; max-width: 62ch; }
.prose { display: grid; gap: 1em; max-width: 68ch; }
.stack { display: grid; gap: 28px; }
.muted { color: var(--ink-soft); }

/* ---- Home ---- */
.intro { display: grid; gap: 18px; padding-bottom: 12px; }
.themes { display: grid; gap: 56px; margin-top: 48px; }
.theme { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 36px; align-items: center; }
.theme:nth-child(even) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.theme:nth-child(even) .theme-img { order: 2; }
.theme-img img { width: 100%; aspect-ratio: 6 / 7; object-fit: cover; }
.theme-img { border-radius: 14px; overflow: hidden; box-shadow: 0 10px 28px rgba(39,34,62,.18); }
.theme h2 { font-size: var(--step-1); margin-bottom: 12px; font-weight: 500; }
.theme .more { display: inline-block; margin-top: 14px; font-size: .9rem; letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 720px) {
  .theme, .theme:nth-child(even) { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .theme:nth-child(even) .theme-img { order: 0; }
  .theme-img img { aspect-ratio: 16 / 10; }
}

/* ---- About ---- */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 44px; margin-top: 32px; align-items: start; }
.about figure { margin: 0; }
.about figure img { width: 100%; }
.about figure { border-radius: 14px; overflow: hidden; box-shadow: 0 10px 28px rgba(39,34,62,.18); }
.links-row { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; margin-top: 28px; }
.links-row img { height: 44px; width: auto; }
.positions { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 0; max-width: 760px; }
.positions li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 18px; padding: 14px 0; border-top: 1px solid var(--rule); }
.positions .yrs { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 400; }
.positions .role { font-weight: 500; }
@media (max-width: 720px) {
  .about { grid-template-columns: minmax(0, 1fr); }
  .about figure { max-width: 320px; }
  .positions li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* ---- People ---- */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 36px 44px; margin-top: 28px; }
.person { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 20px; align-items: start; }
.person img { width: 130px; height: 130px; object-fit: cover; border-radius: 50%; }
.person h3 { font-size: 1.15rem; font-weight: 500; }
.person .role { color: var(--ink-soft); font-size: .95rem; }
.person .where { font-size: .95rem; margin-bottom: 8px; }
.person .sup { font-size: .95rem; color: var(--ink-soft); margin-bottom: 8px; }
.person p.desc { font-size: 1rem; }
.person .more { display: inline-block; margin-top: 8px; font-size: .88rem; letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 480px) { .person { grid-template-columns: 88px minmax(0, 1fr); gap: 14px; } .person img { width: 88px; height: 88px; } }

.bio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 44px; margin-top: 32px; align-items: start; }
.bio figure { margin: 0; }
.bio figure img { width: 100%; max-width: 360px; border-radius: 14px; box-shadow: 0 10px 28px rgba(39,34,62,.18); }
.bio h1 { font-size: var(--step-2); }
.bio .role { color: var(--ink-soft); margin-top: 4px; }
.bio .contact-line { margin-top: 18px; font-size: .95rem; }
@media (max-width: 720px) { .bio { grid-template-columns: minmax(0, 1fr); gap: 24px; } .bio figure img { max-width: 240px; } }

/* ---- News ---- */
.news { list-style: none; margin: 28px 0 0; padding: 0; display: grid; }
.news li { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 28px; padding: 28px 0; border-top: 1px solid var(--rule); }
.news li.no-img { grid-template-columns: minmax(0, 1fr); }
.news img { width: 180px; height: 130px; object-fit: cover; }
.paper-card { width: 180px; height: 130px; box-sizing: border-box; padding: 14px 16px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(135deg, var(--ink) 0%, #3B3366 60%, var(--accent) 100%); color: #fff; }
.paper-card .pc-label { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; opacity: .8; }
.paper-card .pc-journal { font-style: italic; font-size: .95rem; line-height: 1.25; font-weight: 400;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.paper-card .pc-journal.pc-long { font-size: .8rem; -webkit-line-clamp: 4; }
.paper-card .pc-year { font-size: .8rem; letter-spacing: .08em; opacity: .85; }
.news img.logo { object-fit: contain; background: var(--paper); }
.news time { display: inline-block; margin-right: 10px; color: var(--accent); font-weight: 400; margin-bottom: 6px; letter-spacing: .03em; }
@media (max-width: 560px) { .news li { grid-template-columns: minmax(0, 1fr); gap: 14px; } .news img { width: 100%; height: auto; max-height: 220px; } .paper-card { width: 100%; height: 140px; } }

/* ---- Publications ---- */
.pub-tools { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; margin-top: 24px; }
.pub-tools input { font: inherit; font-size: 1rem; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 4px; width: min(100%, 360px); color: var(--ink); background: var(--paper); }
.pub-tools .count { color: var(--ink-soft); font-size: .95rem; }
.pubs { list-style: none; margin: 0; padding: 0; }
.pubs li.pub { padding: 9px 0; line-height: 1.5; overflow-wrap: anywhere; }
.pubs li.pub .n { font-weight: 600; color: var(--accent); margin-right: .35em; font-variant-numeric: tabular-nums; }
.pubs li.year { font-size: var(--step-1); font-weight: 400; margin-top: 26px; padding-bottom: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 6px; vertical-align: 1px; }
.pubs .me { font-weight: 600; }
.pubs a { text-decoration-color: var(--rule); }
.pubs a:hover { text-decoration-color: currentColor; }
.pub-status { margin-top: 16px; color: var(--ink-soft); font-size: .95rem; }

/* ---- Colleagues & photos ---- */
.colleagues { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 20px 32px; margin-top: 24px; }
.colleagues div b { display: block; font-weight: 500; }
.colleagues div span { color: var(--ink-soft); font-size: .97rem; }
.gallery { columns: 3 260px; column-gap: 14px; margin-top: 24px; }
.gallery figure { break-inside: avoid; margin: 0 0 18px; }
.gallery button { padding: 0; border: 0; background: none; cursor: zoom-in; display: block; width: 100%; }
.gallery img { width: 100%; height: auto; transition: opacity .2s; }
.gallery button:hover img { opacity: .85; }
.gallery figcaption { font-size: .9rem; line-height: 1.4; color: var(--ink-soft); margin-top: 6px; }
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
dialog.lightbox[open] { display: flex; align-items: center; justify-content: center; }
dialog.lightbox::backdrop { background: rgba(20, 17, 34, .92); }
dialog.lightbox figure { margin: 0; display: grid; gap: 10px; justify-items: center; max-width: 88vw; }
dialog.lightbox img { max-width: 88vw; max-height: 80vh; width: auto; height: auto; }
dialog.lightbox figcaption { color: #fff; font-size: 1rem; text-align: center; max-width: 70ch; }
dialog.lightbox button { position: fixed; background: none; border: 0; color: #fff; cursor: pointer; line-height: 1; padding: 10px 14px; }
.lb-close { top: 10px; right: 12px; font-size: 2.2rem; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lb-prev { left: 4px; } .lb-next { right: 4px; }

/* ---- Contact ---- */
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; margin-top: 32px; }
.contact address { font-style: normal; display: grid; gap: 4px; }
form.msg { display: grid; gap: 14px; }
form.msg label { display: grid; gap: 4px; font-size: .95rem; }
form.msg input, form.msg textarea { font: inherit; font-size: 1rem; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 4px; color: var(--ink); background: var(--paper); width: 100%; }
form.msg textarea { min-height: 150px; resize: vertical; }
form.msg button { justify-self: start; font: inherit; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; padding: 10px 26px; background: var(--ink); color: var(--paper); border: 0; border-radius: 4px; cursor: pointer; }
form.msg button:hover { background: var(--accent); }
form.msg .note { font-size: .9rem; color: var(--ink-soft); }
@media (max-width: 720px) { .contact { grid-template-columns: minmax(0, 1fr); } }

/* ---- Footer ---- */
.footer { background: var(--ink); color: #E9E7F1; padding-block: 36px; font-size: .95rem; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 24px 60px; justify-content: space-between; }
.footer b { color: #fff; font-weight: 500; }
.footer a:hover { color: #fff; }
.footer .social a { border-color: rgba(255,255,255,.35); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

sub { font-size: .72em; line-height: 0; }
.news .tag { display: inline-block; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent); border-radius: 3px; padding: 1px 7px; margin-bottom: 6px; vertical-align: 1px; }
.news .read-more { white-space: nowrap; }
button.older { margin-top: 18px; font: inherit; font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; padding: 9px 22px; background: none; color: var(--ink); border: 1px solid var(--ink); border-radius: 4px; cursor: pointer; }
button.older:hover { background: var(--ink); color: var(--paper); }
.news-card { background: var(--mist); color: var(--ink); border: 1px solid var(--rule); }
.news-card .pc-journal { font-style: normal; font-size: 1.15rem; letter-spacing: .02em; }
.news .credit { display: block; margin-top: 6px; font-size: .78rem; color: var(--ink-soft); }
.news .credit a { color: inherit; }

/* ---- Home: eyebrow, button, latest news, theme icons ---- */
.eyebrow { font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
.button { display: inline-block; margin-top: 6px; padding: 11px 26px; background: var(--ink); color: #fff; text-decoration: none; border-radius: 4px; letter-spacing: .08em; text-transform: uppercase; font-size: .88rem; font-weight: 400; }
.button:hover { background: var(--accent); color: #fff; }
html { scroll-behavior: smooth; }
#research { scroll-margin-top: 70px; }
.home-news { margin-top: 8px; }
.news--home { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 26px; }
.news--home li { display: flex; flex-direction: column; gap: 14px; padding: 0; border-top: 0; }
.news--home img, .news--home .paper-card { width: 100%; height: auto; aspect-ratio: 16 / 10; border-radius: 10px; }
.news--home .paper-card { padding: 18px 20px; }
.news--home .paper-card .pc-journal { font-size: 1.1rem; }
.news--home .paper-card .pc-journal.pc-long { font-size: .95rem; }
.news--home img.logo { object-fit: contain; border: 1px solid var(--rule); }
.news--home p { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; font-size: 1rem; }
.news--home .read-more { display: none; }
.all-news { margin-top: 18px; }
.all-news a { letter-spacing: .08em; text-transform: uppercase; font-size: .88rem; }
@media (max-width: 860px) { .news--home { grid-template-columns: minmax(0, 1fr); } .news--home li { display: grid; grid-template-columns: 120px minmax(0, 1fr); } .news--home img, .news--home .paper-card { aspect-ratio: 1 / 1; } .news--home .paper-card { padding: 10px; } .news--home .paper-card .pc-journal, .news--home .paper-card .pc-journal.pc-long { font-size: .78rem; -webkit-line-clamp: 3; } }
.theme h2 { display: flex; align-items: center; gap: 12px; }
.theme-icon { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--mist); display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }
.theme-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Back to top, image fade-in ---- */
.to-top { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; text-decoration: none; font-size: 1.2rem; box-shadow: 0 6px 18px rgba(20,17,34,.25); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 6; }
.to-top.show { opacity: .9; pointer-events: auto; }
.to-top:hover { background: var(--accent); color: #fff; opacity: 1; }
img.fade { opacity: 0; transition: opacity .5s ease; }
img.fade.in { opacity: 1; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } img.fade { opacity: 1; } }
