/* Shared top bar for every page, the About page included.
   Self-contained: values are hard-coded and every selector is namespaced so the
   About page's own inline styles and variables cannot leak in or out. */

.site-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  /* A floating translucent layer, not an opaque strip: the page scrolls under it.
     The hairline and the shadow only appear once there is content behind the bar,
     so an unscrolled page has no divider to explain. */
  border-bottom: 1px solid transparent;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 0 0 0 rgba(28, 36, 48, 0);
  transition: border-color 200ms var(--ease-spring, ease-out),
    box-shadow 200ms var(--ease-spring, ease-out),
    background-color 200ms var(--ease-spring, ease-out);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
}

.site-bar[data-scrolled] {
  border-bottom-color: rgba(201, 208, 217, 0.9);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 12px rgba(28, 36, 48, 0.06);
}

/* Legibility over a changing backdrop: slightly heavier, slightly looser, and the
   colour stays on the solid text itself rather than on the translucent surface. */
.site-bar__links a,
.site-bar__brand {
  letter-spacing: 0.004em;
}

/* No JavaScript, no scroll state: /js/chrome.js stamps data-chrome on the bar, and
   without it the bar keeps a permanent hairline rather than floating over nothing. */
.site-bar:not([data-chrome]) {
  border-bottom-color: #c9d0d9;
}

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

.site-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  width: 100%;
  max-width: 1080px;
  min-height: 60px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem;
}

.site-bar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  color: #1c2430;
  font-size: 1rem;
  font-weight: 650;
  text-decoration: none;
}

.site-bar__brand img {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.site-bar__id {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.site-bar__social {
  display: flex;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-bar__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: #1c2430;
}

.site-bar__social a:hover {
  color: #164a90;
  background: #e8f0fb;
}

.site-bar__social svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.site-bar__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-bar__links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  color: #545f6d;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.site-bar__links a:hover {
  color: #1c2430;
  background: #e8f0fb;
}

.site-bar__links a[aria-current="page"] {
  color: #164a90;
  background: #e8f0fb;
}

.site-bar a:focus-visible {
  outline: 3px solid #1d5fb8;
  outline-offset: 3px;
}

/* Phones: one 48px row (photo and links); the name stays for screen readers. */
@media (max-width: 600px) {
  .site-bar__inner {
    flex-wrap: nowrap;
    min-height: 48px;
    padding: 0.25rem 1rem;
  }

  .site-bar__brand {
    min-height: 40px;
  }

  .site-bar__name {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .site-bar__links {
    gap: 0;
  }

  .site-bar__links a {
    min-height: 36px;
    padding-inline: 0.3rem;
    font-size: 0.75rem;
  }

  /* "Imaging projects" becomes "Imaging" so the links fit on one row. */
  .site-bar__long {
    display: none;
  }

  .site-bar__id {
    flex: none;
    gap: 0.25rem;
  }

  /* Never a second row: the links scroll sideways inside the bar. */
  .site-bar__inner > nav {
    min-width: 0;
  }

  .site-bar__links {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-bar__links a {
    white-space: nowrap;
  }

  .site-bar__brand img {
    width: 28px;
    height: 28px;
  }

  .site-bar__social a {
    width: 24px;
    height: 28px;
  }

  .site-bar__social svg {
    width: 14px;
    height: 14px;
  }
}

/* Very narrow phones (under 380px): tighter links so the bar stays on one row. */
@media (max-width: 379px) {
  .site-bar__inner {
    padding-inline: 0.6rem;
  }

  .site-bar__links {
    gap: 0;
  }

  .site-bar__links a {
    padding-inline: 0.35rem;
    font-size: 0.75rem;
  }

  .site-bar__social a {
    width: 26px;
  }
}

/* Tools sub-navigation: second row of the pinned bar on every tools page. */
.site-subnav {
  border-top: 1px solid #e3e7ec;
  background: #f7f8fa;
}

.site-subnav__links {
  display: flex;
  gap: 0.25rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.3rem 1.25rem;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
}

.site-subnav__links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  color: #545f6d;
  font-size: 0.875rem;
  white-space: nowrap;
  text-decoration: none;
}

.nav-beta {
  margin-left: 0.35rem;
  padding: 0 0.3rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-subnav__links a:hover {
  color: #1c2430;
  background: #e8f0fb;
}

.site-subnav__links a[aria-current="page"],
.site-subnav__links a[aria-current="location"] {
  color: #ffffff;
  background: #164a90;
}

.site-subnav a:focus-visible {
  outline: 3px solid #1d5fb8;
  outline-offset: -3px;
}

@media (max-width: 600px) {
  .site-subnav__links {
    padding: 0.25rem 0.75rem;
  }

  .site-subnav__links a {
    min-height: 30px;
    padding-inline: 0.55rem;
    font-size: 0.8125rem;
  }
}


/* ----- Sub-navigation dropdowns -----
   A column name in the sub-bar opens the projects in that column. The bar itself scrolls
   sideways on a phone, so the panel cannot live inside that overflow: it is fixed and
   placed under its button by subnav.js on every open. */
.subnav-menu {
  position: relative;
  display: flex;
}

.subnav-menu__button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 32px;
  padding: 0.2rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: #545f6d;
  font: inherit;
  font-size: 0.875rem;
  white-space: nowrap;
  cursor: pointer;
}

.subnav-menu__button:hover {
  color: #1c2430;
  background: #e8f0fb;
}

.subnav-menu__button:focus-visible {
  outline: 3px solid #1d5fb8;
  outline-offset: -3px;
}

.subnav-menu__button[aria-expanded="true"] {
  color: #ffffff;
  background: #164a90;
}

.subnav-menu__chev {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
  .subnav-menu__chev {
    transition: none;
  }
}

.subnav-menu__button[aria-expanded="true"] .subnav-menu__chev {
  transform: rotate(180deg);
}

.subnav-menu__list {
  position: fixed;
  z-index: 60;
  min-width: 12rem;
  max-width: min(22rem, calc(100vw - 1.5rem));
  margin: 0;
  padding: 0.3rem;
  border: 1px solid #c9d0d9;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(28, 36, 48, 0.12);
  list-style: none;
}

.subnav-menu__list[hidden] {
  display: none;
}

/* The pill treatment belongs to the bar, not the panel: inside it the items read as a
   plain list of links, left aligned and allowed to wrap. */
.site-subnav__links .subnav-menu__list a {
  display: block;
  min-height: 0;
  padding: 0.4rem 0.6rem;
  border-radius: 5px;
  color: #1c2430;
  font-size: 0.875rem;
  line-height: 1.35;
  white-space: normal;
}

.site-subnav__links .subnav-menu__list a:hover {
  background: #e8f0fb;
}


/* ----- Press feedback: on pointer-down, 100ms, transform only ----- */
.site-bar__links a,
.site-bar__social a,
.subnav-menu__button,
.site-subnav__links a {
  touch-action: manipulation;
  transition: transform 100ms var(--ease-spring, ease-out),
    background-color 140ms var(--ease-spring, ease-out),
    color 140ms var(--ease-spring, ease-out);
}

.site-bar__links a:active,
.site-bar__social a:active,
.subnav-menu__button:active,
.site-subnav__links a:active {
  transform: scale(0.94);
}

/* ----- The sub-bar is the lighter material of the two, and it floats too ----- */
.site-subnav {
  border-top: 1px solid rgba(227, 231, 236, 0.9);
  background: rgba(247, 248, 250, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
}

/* ----- The dropdown is a material arriving, anchored to the button that opened it.
   subnav.js sets --origin-x so the panel scales out of its trigger rather than its own
   centre, and the exit runs the same path backwards. Blur and scale move together, so
   the glass reads as a surface arriving rather than an opacity fade. The timing lives in
   CSS, not in a spring library, because the sub-bar must behave before any CDN answers.
   ----- */
.subnav-menu__list {
  transform-origin: var(--origin-x, 1rem) top;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 10px 30px rgba(28, 36, 48, 0.14), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  opacity: 0;
  transform: scale(0.94);
  filter: blur(6px);
  transition: opacity 160ms var(--ease-spring, ease-out),
    transform 300ms var(--ease-spring, ease-out),
    filter 160ms var(--ease-spring, ease-out);
}

.subnav-menu__list[data-open] {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
  .subnav-menu__list {
    transform: none;
    filter: none;
    transition: opacity 120ms linear;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-bar__links a:active,
  .site-bar__social a:active,
  .subnav-menu__button:active,
  .site-subnav__links a:active {
    transform: none;
    background: #e8f0fb;
  }
}

/* Transparency turned down: the same geometry, frostier and solid. */
@media (prefers-reduced-transparency: reduce) {
  .site-bar,
  .site-bar[data-scrolled] {
    background: #ffffff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .site-subnav {
    background: #f7f8fa;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .subnav-menu__list {
    background: #ffffff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  .site-bar {
    background: #ffffff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom-color: #5c6675;
  }

  .site-subnav,
  .subnav-menu__list {
    background: #ffffff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .site-bar__links a[aria-current="page"] {
    outline: 2px solid #164a90;
  }
}
