/* ==========================================================================
   Apostolova Lab - site stylesheet
   Restyles the Bootstrap 3 theme used by rmarkdown to match the original site.
   ========================================================================== */

/* ---- Design tokens ------------------------------------------------------- */
:root {
  --bg:        #f6f6f6;   /* page background            */
  --surface:   #ffffff;   /* cards / boxes              */
  --ink:       #281a39;   /* main text (dark purple)    */
  --ink-soft:  #5b4f68;   /* secondary text             */
  --pink:      #ecbdbd;   /* banner band                */
  --beige:     #eae0da;   /* section label boxes        */
  --accent:    #a8324a;   /* logo burgundy, links       */
  --line:      #b9b4be;   /* rules                      */
  --maxw:      980px;
  --font-body: "Nunito Sans", "Avenir Next", Avenir, Helvetica, Arial, sans-serif;
  --font-head: "Heebo", Helvetica, Arial, sans-serif;
  --font-news: "Oswald", "Arial Narrow", sans-serif;
}

/* ---- Base ---------------------------------------------------------------- */
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.65;
  padding-top: 96px !important;      /* space for fixed navbar */
}
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); }
h1 { font-weight: 700; }
h2 { font-weight: 400; font-size: 27px; }
h3 { font-weight: 500; font-size: 20px; }
h4 { font-weight: 500; font-size: 17px; margin-top: 18px; }
strong, b { font-weight: 600; }
a { color: var(--accent); }
a:hover, a:focus { color: var(--ink); }
img { max-width: 100%; height: auto; }
.main-container { max-width: var(--maxw); padding: 0 16px; margin: 0 auto; }
.center { text-align: center; }
.muted  { color: var(--ink-soft); font-size: 14px; }
.lead-text { font-size: 18px; max-width: 680px; margin: 0 auto 32px; }
.section { margin-top: 0; }
/* rmarkdown adds padding/negative margin to all section headings for the
   fixed navbar; neutralise it (anchors use scroll-margin-top instead) */
.main-container .section h1, .main-container .section h2, .main-container .section h3,
.main-container .section h4, .main-container .section h5, .main-container .section h6 {
  padding-top: 0; margin-top: 20px;
}
/* anchor offset under fixed navbar */
.section.level2, [id] { scroll-margin-top: 110px; }

/* Full-width bands inside the centred container */
html, body { overflow-x: hidden; }
.full-bleed { margin-left: calc(50% - 50vw) !important; margin-right: calc(50% - 50vw) !important; }

/* ---- Navbar --------------------------------------------------------------- */
.navbar-default {
  background: rgba(246, 246, 246, 0.95);
  border: 0;
  min-height: 86px;
}
.navbar-default .container {
  max-width: var(--maxw);
  border-bottom: 1px solid #8f8a94;
  padding: 0 16px;
}
.navbar-brand { height: 86px; padding: 26px 0 0 0; }
.navbar-brand img { height: 34px; width: auto; }
.navbar-default .navbar-nav { margin-top: 26px; }
.navbar-default .navbar-nav > li > a {
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  padding: 8px 9px;
}
.navbar-default .navbar-nav > li > a:hover { color: var(--accent); background: transparent; }
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}
.navbar-toggle { margin-top: 26px; border-color: var(--line); }
@media (max-width: 991px) {
  .navbar-default .navbar-nav > li > a { padding: 8px 6px; font-size: 13px; }
}
@media (max-width: 767px) {
  .navbar-default .navbar-nav { margin-top: 0; }
  .navbar-collapse { background: var(--bg); }
  .navbar-default .navbar-nav > li > a { font-size: 15px; padding: 10px 4px; }
}

/* ---- Home ----------------------------------------------------------------- */
.pink-band { background: var(--pink); padding: 18px 16px; margin-top: 0; margin-bottom: 4px; }
.pink-band-thin { padding: 14px 0; margin-top: 48px; margin-bottom: 40px; }
h1.welcome {
  text-align: center;
  margin: 0;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.3;
}
.hero img { width: 100%; display: block; }
.mission-box {
  background: var(--surface);
  border: 1px solid #ddd8e0;
  padding: 36px clamp(20px, 6vw, 72px);
  margin: 40px auto 0;
  max-width: 880px;
  text-align: center;
}
.main-container > .section.mission-box > h2 { margin-top: 0; margin-bottom: 20px; border-top: 0; padding-top: 0; }

/* Beige section label with a horizontal rule ("News") */
.section-label {
  position: relative;
  text-align: center;
  margin: 10px 0 40px;
}
.section-label::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  border-top: 1px solid #d0cbd3;
}
.section-label span {
  position: relative;
  display: inline-block;
  background: var(--beige);
  padding: 12px 70px;
  font-family: var(--font-head);
  font-size: 20px;
  color: var(--ink-soft);
  box-shadow: 0 12px 10px -8px rgba(0,0,0,0.45);
}

/* ---- News cards ----------------------------------------------------------- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 22px;
  margin-bottom: 30px;
}
.news-card {
  display: block;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none !important;
  transition: transform .15s ease, box-shadow .15s ease;
}
.news-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(40,26,57,.12); color: var(--ink); }
.news-thumb { aspect-ratio: 16 / 9; overflow: hidden; background: var(--beige); }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-body { padding: 14px 16px 18px; }
.news-meta { font-size: 11px; color: var(--ink-soft); }
.news-title {
  font-family: var(--font-news);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: .02em;
  margin: 8px 0 6px;
}
.news-body p { font-size: 14px; margin: 0; }

/* ---- Buttons -------------------------------------------------------------- */
.btn-outline, .btn-solid {
  display: inline-block;
  padding: 8px 22px;
  border: 1px solid var(--ink);
  font-family: var(--font-head);
  font-size: 14px;
  text-decoration: none !important;
  margin-top: 8px;
}
.btn-outline { color: var(--ink); background: transparent; }
.btn-outline:hover { background: var(--ink); color: #fff; }
.btn-solid { background: var(--ink); color: #fff; }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- Generic page title --------------------------------------------------- */
h1.page-title, .page-title h1, .section.level1.page-title > h1 {
  text-align: center;
  font-size: 34px;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 10px 0 30px;
}
.page-banner img { width: 100%; max-height: 320px; object-fit: cover; display: block; margin-bottom: 10px; }

/* ---- Research ------------------------------------------------------------- */
.tagline {
  text-align: center;
  font-family: var(--font-head);
  font-size: 15px;
  color: var(--ink-soft);
  margin: 10px auto 28px;
  max-width: 820px;
}
.research-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.research-tile {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  background: var(--surface);
  padding: 12px 10px 16px;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .03em;
  text-decoration: none !important;
}
.research-tile img { aspect-ratio: 1; object-fit: cover; margin-bottom: 10px; }
.research-tile:hover { color: var(--accent); }
@media (max-width: 700px) { .research-tiles { grid-template-columns: repeat(2, 1fr); } }

.main-container > .section.level2 > h2 {
  border-top: 1px solid #d0cbd3;
  padding-top: 32px;
  margin-top: 36px;
}
/* Research sections: figure floats right, text is justified and flows
   beside it and then underneath it (figure block comes first in the .Rmd) */
.research-row::after { content: ""; display: block; clear: both; }
.research-figure {
  float: right;
  width: 55%;
  margin: 4px 0 16px 28px;
}
.research-text { text-align: justify; }
.research-figure img { background: var(--surface); padding: 8px; }
@media (max-width: 760px) {
  .research-figure { float: none; width: 100%; margin: 0 0 16px; }
}

/* ---- Publications --------------------------------------------------------- */
.pub-year h2 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 24px;
  border-bottom: 2px solid var(--pink);
  padding-bottom: 4px;
  margin-top: 34px;
}
.pub-list { list-style: none; padding-left: 0; }
.pub-list li { margin: 0 0 16px; }
.pub-title { font-weight: 600; color: var(--ink); text-decoration: underline; }
.pub-title:hover { color: var(--accent); text-decoration: underline; }
.pub-authors { font-size: 14px; }
.pub-note { font-size: 13px; font-style: italic; color: var(--ink-soft); }
.pub-more { text-decoration: underline; }
.pub-journal { font-size: 14px; color: var(--ink-soft); }




/* ---- Key publications (mirrors the original page layout) ----------------- */
.keypub { padding: 40px 0 34px; }
.keypub + .keypub { border-top: 3px solid var(--pink); }
.keypub-title { font-size: 22px; font-weight: 600; line-height: 1.35; margin-bottom: 14px; }
.keypub-meta  { font-size: 14px; }
.keypub-body  { margin-top: 12px; text-align: justify; hyphens: auto; }
.keypub-body::after { content: ""; display: block; clear: both; }
.keypub-img { width: 55%; height: auto; margin-bottom: 16px; }
.keypub-img.img-right { float: right; margin-left: 28px; }
.keypub-img.img-left  { float: left;  margin-right: 28px; }
.keypub-link a { color: var(--ink); text-decoration: underline; word-break: break-all; }
@media (max-width: 640px) {
  .keypub-img.img-right, .keypub-img.img-left { float: none; width: 100%; margin: 0 0 16px; }
}

/* ---- Team ----------------------------------------------------------------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
/* Team links: one per line, icon + label */
.member-card .member-links a { display: block; margin-bottom: 2px; }
.member-card .member-links i { width: 1.3em; text-align: center; margin-right: 4px; }
.member-photo { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: center; }
.member-text { padding: 16px 20px 20px; }
.member-text h3 { margin: 0 0 2px; }
.member-role {
  font-family: var(--font-news);
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.member-text > p:not(.member-links) { text-align: justify; }   /* bio text */
.member-links i { width: 1.3em; text-align: center; margin-right: 4px; }
.alumni { list-style: none; padding: 0; text-align: center; }
#alumni { margin-top: 48px; }
.alumni li { margin: 4px 0; }

/* ---- Funding -------------------------------------------------------------- */
.funder-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
@media (max-width: 700px) {
  .funder-grid { grid-template-columns: repeat(2, 1fr); }
}
.funder {
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  min-height: 160px;
}
.funder img { max-height: 120px; width: auto; object-fit: contain; }

/* ---- Contact -------------------------------------------------------------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.contact-card { background: var(--surface); padding: 26px 28px; }
.contact-card h3 { margin-top: 0; }
.map { display: block; width: 100%; height: 400px; border: 0; margin-top: 24px; }
.map-link { font-size: 14px; margin-top: 6px; }
@media (max-width: 700px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---- News posts ----------------------------------------------------------- */
.post { max-width: 740px; margin: 0 auto; background: var(--surface); padding: 28px clamp(18px, 5vw, 48px) 36px; }
.post h1 { font-family: var(--font-news); font-weight: 500; text-transform: uppercase; font-size: 30px; margin-top: 10px; }
.post-meta { color: var(--ink-soft); font-size: 13px; margin-bottom: 18px; }
.post-image { width: 100%; margin-bottom: 20px; }
.back-link { font-size: 14px; text-decoration: none; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 20px;
}
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

/* ---- Openings ------------------------------------------------------------- */
.job { padding: 30px 0 34px; }
.job + .job { border-top: 3px solid var(--pink); }
.main-container .section .job h3 { margin-top: 0; font-size: 24px; font-weight: 600; }
.job-meta { font-size: 14px; color: var(--ink-soft); margin-bottom: 14px; }
.job .btn-solid { margin-top: 6px; }

/* ---- Lightbox (gallery images enlarged on click, see assets/lightbox.js) -- */
.lightbox-link { display: block; cursor: zoom-in; }
.lightbox {
  display: none;
  position: fixed; inset: 0;
  z-index: 2000;                         /* above the fixed navbar */
  background: rgba(20, 14, 30, 0.88);
  align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 90vw; max-height: 88vh;
  object-fit: contain;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.lightbox button {
  position: absolute;
  background: none; border: 0;
  color: #fff; font-size: 48px; line-height: 1;
  cursor: pointer; opacity: 0.8;
  padding: 10px 18px;
}
.lightbox button:hover { opacity: 1; }
.lb-close { top: 10px; right: 14px; }
.lb-prev  { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next  { right: 10px; top: 50%; transform: translateY(-50%); }
.lightbox.single .lb-prev, .lightbox.single .lb-next { display: none; }

/* ---- Footer --------------------------------------------------------------- */
.site-footer { max-width: var(--maxw); margin: 60px auto 0; padding: 0 16px 30px; }
.footer-inner {
  border-bottom: 1px solid #8f8a94;
  padding: 18px 0;
  text-align: center;
  font-size: 13px;
}
.footer-inner span { display: inline-block; padding: 0 12px; border-left: 1px solid var(--line); }
.footer-inner span:first-child { border-left: 0; }

/* Home: justified mission text (heading stays centred) */
.mission-box p {
  text-align: justify;
  hyphens: manual;          /* avoids large gaps between words */
}

