/* =========================================================
   LIDS Lab — Shared Website Styles
   ========================================================= */

/* Theme and global defaults */
:root {
  --accent: #007c41;
  --text: #111111;
  --rule: #a2a9b1;
  --width: 948px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  overflow-y: scroll;
  scroll-padding-top: 65px;
}

body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

strong,
b {
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

/* Navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 0 rgba(17, 17, 17, 0.02);
}

.nav-inner {
  max-width: var(--width);
  margin: auto;
  padding: 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  color: #171717;
  white-space: nowrap;
  font-size: 1.38em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-evenly;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  position: relative;
  padding: 6px 0;
  color: #4b4f54;
  font-size: 0.98rem;
  font-weight: 600;
  transition: color 0.15s ease;
}

.nav-links a:hover,
.nav-links a[aria-current] {
  color: #171717;
  text-decoration: none;
}

.nav-links a:hover::after,
.nav-links a[aria-current]::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border: 0;
  background: none;
  color: #4b4f54;
  font-size: 2.1rem;
  line-height: 1;
}

.icon-button svg {
  width: 28px;
  height: 28px;
}

.search-toggle {
  margin-left: auto;
  color: var(--accent);
}

.menu-toggle {
  display: none;
  font-size: 23px;
}

.search-panel {
  max-width: var(--width);
  margin: auto;
  padding: 8px 0;
}

.search-panel input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.search-panel p {
  margin: 5px 0 0;
  color: #666;
}

/* Main content and typography */
main {
  max-width: var(--width);
  min-height: 75vh;
  margin: 10px auto 35px;
}

h1,
h2 {
  margin: 0 0 0.6em;
  padding: 0.5em 0 0.17em;
  border-bottom: 1px solid var(--rule);
  color: var(--text);
  font-weight: 700;
}

h1 {
  font-size: 1.8em;
}

h2 {
  font-size: 1.5em;
}

h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 1.3em;
}

h4 {
  margin: 15px 0 8px;
  color: var(--text);
  font-size: 1.15em;
}

p {
  margin: 0 0 15px;
}

ul {
  padding-left: 20px;
}

/* Justify longer paragraphs without stretching small UI components. */
main p {
  text-align: justify;
}

.callout p,
.research-direction p {
  text-align: left;
}

/* Shared callouts */
.callout {
  padding: 8px 13px;
  border: 1px solid #d7b16a;
  border-left: 4px solid #d7b16a;
  border-radius: 4px;
  background: #fff9eb;
}

.callout p {
  margin: 0 0 6px;
}

.callout p:last-child {
  margin-bottom: 0;
}

/* People page base styles
   Specific People-page rules in people.html may override these. */
.people-section {
  margin: 0 0 28px;
}

.person {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 10px 0 25px;
}

.portrait {
  flex: 0 0 280px;
  width: 280px;
}

.portrait img {
  display: block;
  width: 100%;
  height: auto;
}

.person-body {
  flex: 1;
  min-width: 0;
}

.contact {
  margin-bottom: 15px;
}

.bio-placeholder {
  color: #687078;
}

.pi-details ul {
  margin-top: 0;
}

/* Images and research layouts */
.wide-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 20px 0;
}

.research-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  gap: 28px;
  margin: 0 0 24px;
}

.research-copy {
  order: 1;
}

.research-figure {
  order: 2;
  justify-self: end;
  width: 100%;
  max-width: 420px;
  margin: 0;
}

.research-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f7f7f7;
}

.intro-figure {
  margin: 0;
}

/* Tables */
.news-table,
.publication-table,
.facilities-table {
  width: 100%;
  border-collapse: collapse;
}

.news-table td,
.publication-table td,
.facilities-table td,
.facilities-table th {
  padding: 10px 8px;
  border-bottom: 1px solid #eee;
  text-align: justify;
  vertical-align: top;
}

.news-table td:first-child {
  width: 110px;
  white-space: nowrap;
}

/* Publications */
.pub-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
}

.pub-role {
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.pub-role-separator {
  display: inline-block;
  color: #6b7280;
  font-weight: 700;
  line-height: 1;
}

.pub-role.pi,
.author.pi {
  color: #111827;
}

.pub-role.postdoc {
  color: #1d4ed8;
}

.pub-role.student {
  color: var(--accent);
}

.pub-role.urop {
  color: #d4a017;
}

.pub-role.visitor {
  color: #6d28d9;
}

.author {
  font-weight: 700;
}

/* Gallery and image dialog */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.gallery-grid img {
  width: 100%;
  height: 260px;
  object-fit: cover;
}

.gallery-grid button {
  padding: 0;
  border: 0;
  background: none;
}

.gallery-grid figure {
  margin: 0;
}

dialog {
  max-width: 95vw;
  border: 1px solid #ccc;
  border-radius: 4px;
}

dialog img {
  display: block;
  max-width: 85vw;
  max-height: 80vh;
}

dialog::backdrop {
  background: #000a;
}

/* Miscellaneous page components */
.detail-link {
  display: inline-block;
  margin-bottom: 15px;
}

.resource-list li {
  margin: 15px 0;
}

.page-note {
  color: #626a73;
}

.no-results {
  padding: 25px 0;
}

.search-hit {
  padding: 10px;
  border-bottom: 1px solid #ddd;
}

.search-hit a {
  font-weight: bold;
}

/* Accessibility */
.skip {
  position: absolute;
  top: -60px;
  left: 8px;
  z-index: 30;
  padding: 8px;
  background: white;
}

.skip:focus {
  top: 4px;
}

/* Shared site footer */
.footer {
  padding: 14px 8px;
  border-top: 1px solid #ddd;
  font-size: 1em;
  text-align: center;
}

.footer small {
  font-size: 0.8em;
}

.home-footer {
  padding: 16px 0;
  color: #46524b;
  font-size: 0.875rem;
  text-align: left;
}

.home-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--width);
  margin: 0 auto;
}

.home-footer p {
  margin: 0;
  color: var(--accent);
}

.home-footer nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Responsive layout */
@media (max-width: 999px) {
  main,
  .nav-inner,
  .search-panel {
    margin-left: 8px;
    margin-right: 8px;
  }

  .home-footer-inner {
    margin-left: 8px;
    margin-right: 8px;
  }
}

@media (max-width: 991px) {
  .nav-inner {
    flex-wrap: wrap;
  }

  .menu-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    order: 3;
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 7px 0;
  }

  .person {
    flex-direction: column;
    gap: 12px;
  }

  .portrait {
    flex-basis: auto;
  }

  .person-body {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .research-row {
    grid-template-columns: 1fr;
  }

  .research-copy,
  .research-figure {
    order: initial;
  }

  .research-figure {
    max-width: none;
    justify-self: stretch;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .facilities-table {
    font-size: 14px;
  }

  .brand {
    font-size: 17px;
  }
}

@media (max-width: 600px) {
  .home-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
