/*
  Overrides for this static (file://) build.
*/

/* Fix masthead to top so JS-added body padding-top doesn't create a blank gap above it.
   Explicit background needed because position:fixed removes it from the normal flow. */
.masthead {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: #fff;
  border-bottom: none;
}

.greedy-nav button {
  z-index: 30;
}

/* Horizontal top nav — all links visible; wraps on small viewports (no hamburger). */
#site-nav.greedy-nav.masthead-nav-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem 0.5rem;
  padding: 0.4rem 1em;
  width: 100%;
  max-width: 100%;
  clear: both;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Site name + nav links + theme on one row (scroll horizontally if needed on narrow screens). */
#site-nav.masthead-nav-bar .site-title {
  flex: 0 0 auto;
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
  padding: 0.35em 0;
  white-space: nowrap;
}

#site-nav.masthead-nav-bar .visible-links {
  display: flex !important;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.1rem 0.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
  flex: 1 1 auto;
  min-width: 0;
}

#site-nav.masthead-nav-bar .visible-links li {
  display: list-item !important;
  list-style: none;
}

#site-nav.masthead-nav-bar .visible-links li:first-child {
  font-weight: inherit;
}

#site-nav.masthead-nav-bar .masthead__menu-item {
  margin: 0;
  padding: 0;
}

#site-nav.masthead-nav-bar .masthead__menu-item a {
  display: inline-block;
  margin: 0 0.1rem;
  padding: 0.45em 0.55em;
  white-space: nowrap;
}

/* Wide layout: slightly wider sidebar + .page; align nav with main column (nudged 3cm + 1cm left). */
@media (min-width: 57.8125em) {
  #main .sidebar {
    width: 17.5% !important;
    margin-right: 1.6949152542% !important;
  }

  #main .page {
    width: 80.8050847458% !important;
  }

  #site-nav.masthead-nav-bar .visible-links {
    margin-left: calc(17.5% + 1.6949152542% + 4.2372881356% - 3cm - 1cm);
  }

  #site-nav.masthead-nav-bar .visible-links .masthead__menu-item:first-child a {
    margin-left: 0;
    padding-left: 0;
  }
}

@media (max-width: 57.8124em) {
  #site-nav.masthead-nav-bar .visible-links {
    margin-left: 0 !important;
  }
}

#site-nav.masthead-nav-bar #theme-toggle {
  position: relative !important;
  right: auto !important;
  top: auto !important;
  height: auto !important;
  flex: 0 0 auto;
  margin-left: auto;
  align-self: center;
}

@media (max-width: 28rem) {
  #site-nav.masthead-nav-bar #theme-toggle {
    margin-left: 0;
  }
}

/* Remove theme’s animated underline bar under nav links. */
#site-nav.masthead-nav-bar .visible-links a::before {
  display: none !important;
}

#site-nav.masthead-nav-bar .masthead__menu-item a.active {
  border-bottom: none;
}

/* Make the News tab red across all pages. */
#site-nav.masthead-nav-bar .masthead__menu-item a[href="news.html"] {
  color: #d93025;
  font-weight: 700;
}

#site-nav.masthead-nav-bar .masthead__menu-item a[href="news.html"]:hover {
  color: #b3261e;
}

/* Home is the site title; show current page on index (no horizontal rule). */
#site-nav.masthead-nav-bar .site-title.site-title--current {
  font-weight: 700;
}

/* Research page: numbered projects with headings inside list items */
ol.research-projects {
  margin-top: 0.75em;
  padding-left: 1.35rem;
}

ol.research-projects > li {
  margin-bottom: 1.75em;
}

ol.research-projects > li:last-child {
  margin-bottom: 0;
}

ol.research-projects h3 {
  margin: 0.35em 0 0.5em;
  font-size: 1.05em;
  line-height: 1.35;
  font-weight: 700;
}

/* News page: date + entry list. */
ul.news-list {
  list-style: none;
  margin: 1em 0 0;
  padding: 0;
}

ul.news-list > li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em 1em;
  padding: 0.75em 0;
  border-bottom: 1px solid #e3e3e3;
}

ul.news-list > li:last-child {
  border-bottom: none;
}

ul.news-list .news-date {
  flex: 0 0 6.5em;
  font-weight: 700;
  color: #1a73e8;
}

ul.news-list .news-body {
  flex: 1 1 16em;
  min-width: 0;
}

html[data-theme="dark"] ul.news-list > li {
  border-bottom-color: #5e5e5e;
}

html[data-theme="dark"] ul.news-list .news-date {
  color: #58a6ff;
}

/* Solid blue vertical rule between sidebar and main content (two-column layout). */
@media (min-width: 57.8125em) {
  #main > .sidebar.sticky {
    position: relative;
    padding-right: 1.1rem;
    border-right: 2px solid #1a73e8;
  }
}

/* Publication list: blue links (scoped to publications page only). */
body.page-publications .page__content a {
  color: #0b57d0;
}

body.page-publications .page__content a:hover {
  color: #084298;
}

/* ==========================================================================
   DARK MODE
   The compiled main.css uses hardcoded light-theme colors. These rules
   override them when JS sets data-theme="dark" on <html>.
   ========================================================================== */

html[data-theme="dark"],
html[data-theme="dark"] body {
  background-color: #474747;
  color: #fff;
}

html[data-theme="dark"] a {
  color: #0ea1c5;
}

html[data-theme="dark"] a:hover {
  color: #0b7fa0;
}

html[data-theme="dark"] .masthead {
  background-color: #474747;
  border-bottom: none;
}

/* .greedy-nav has its own hardcoded background:#fff in main.css — must override it */
html[data-theme="dark"] .greedy-nav {
  background: #474747;
}

html[data-theme="dark"] .masthead a,
html[data-theme="dark"] .masthead .site-title,
html[data-theme="dark"] .masthead .masthead__menu-item a {
  color: #fff;
}

html[data-theme="dark"] .masthead .masthead__menu-item a:hover {
  color: #0ea1c5;
}

html[data-theme="dark"] .masthead .masthead__menu-item a.active {
  color: #fff;
  border-bottom: none;
}

/* Keep the News tab red (brighter) in dark mode. */
html[data-theme="dark"] #site-nav.masthead-nav-bar .masthead__menu-item a[href="news.html"] {
  color: #ff6b5e;
}

html[data-theme="dark"] #site-nav.masthead-nav-bar .masthead__menu-item a[href="news.html"]:hover {
  color: #ff8a80;
}

html[data-theme="dark"] #site-nav.masthead-nav-bar .site-title.site-title--current {
  color: #fff;
  border-bottom-color: #fff;
}

html[data-theme="dark"] #theme-toggle,
html[data-theme="dark"] .greedy-nav__toggle {
  color: #fff;
}

html[data-theme="dark"] #main > .sidebar.sticky {
  border-right: 2px solid #58a6ff;
}

html[data-theme="dark"] body.page-publications .page__content a {
  color: #79c0ff;
}

html[data-theme="dark"] body.page-publications .page__content a:hover {
  color: #a5d6ff;
}

html[data-theme="dark"] .sidebar {
  background-color: #474747;
}

html[data-theme="dark"] .author__name,
html[data-theme="dark"] .author__bio,
html[data-theme="dark"] .author__urls .label {
  color: #fff;
}

html[data-theme="dark"] .author__urls {
  background: #3a3a3a;
  border-color: #5e5e5e;
}

html[data-theme="dark"] .author__urls a {
  color: #fff;
}

html[data-theme="dark"] .author__urls a:hover {
  color: #0ea1c5;
}

html[data-theme="dark"] .btn--inverse {
  color: #fff;
  border-color: #5e5e5e;
  background-color: transparent;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 {
  color: #fff;
}

html[data-theme="dark"] .page__title {
  color: #fff;
}

html[data-theme="dark"] .page__content h2 {
  border-bottom-color: #5e5e5e;
}

html[data-theme="dark"] .page__footer {
  background-color: #3a3a3a;
  color: #ccc;
  border-top-color: #5e5e5e;
}

html[data-theme="dark"] thead {
  background-color: #3a3a3a;
  border-bottom-color: #5e5e5e;
}

html[data-theme="dark"] .page__footer a {
  color: #0ea1c5;
}

html[data-theme="dark"] .page__footer-copyright {
  color: #ccc;
}

html[data-theme="dark"] .hidden-links {
  background: #3a3a3a;
  border-color: #5e5e5e;
}

html[data-theme="dark"] .hidden-links a {
  color: #fff;
}

html[data-theme="dark"] li,
html[data-theme="dark"] p,
html[data-theme="dark"] dt,
html[data-theme="dark"] dd {
  color: #fff;
}

html[data-theme="dark"] strong {
  color: #fff;
}
