/* =========================================================
   SHARED INTERIOR-PAGE NAVIGATION
   Load after styles.css on every interior page.
   ========================================================= */

.interior-page {
  --site-bg: #C0C0C0;
  --site-ink: #2F4F4F;
  --site-link: #DEE4E7;
  background: var(--site-bg);
  color: var(--site-ink);
}

/* The same responsive shell gutter is used on every interior page. */
.interior-page .container {
  padding-right: var(--site-gutter);
  padding-left: var(--site-gutter);
}

/* =========================================================
   DESKTOP STICKY NAVIGATION
   The primary menu always starts at the same left position.
   Context links, when present, are pushed to the right.
   ========================================================= */

.site-sticky-navigation {
  position: sticky;
  top: 0;
  z-index: 1201;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 0 10px;
  background: rgba(192, 192, 192, 0.98);
  border-top: 1px solid rgba(47, 79, 79, 0.12);
  border-bottom: 1px solid rgba(47, 79, 79, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.primary-nav,
.context-nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.2vw, 32px);
  min-width: 0;
  margin: 0;
}

.primary-nav {
  flex: 0 0 auto;
}

.context-nav {
  justify-content: flex-end;
  margin-left: auto;
}

.primary-nav a,
.primary-nav a:visited,
.context-nav a,
.context-nav a:visited {
  display: inline-block;
  color: var(--site-ink);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  transition: color 180ms ease;
}

.context-nav a {
  font-size: 12px;
}

.primary-nav a[aria-current="page"] {
  font-weight: 700;
}

.primary-nav a:hover,
.context-nav a:hover {
  color: #777777;
}

/* =========================================================
   HAMBURGER BUTTON
   ========================================================= */

.menu-toggle {
  position: relative;
  display: none;
  flex: 0 0 34px;
  width: 34px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--site-ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.menu-toggle span {
  position: absolute;
  left: 4px;
  display: block;
  width: 26px;
  height: 3px;
  border-radius: 2px;
  background: var(--site-ink);
  opacity: 1;
  transform: rotate(0deg);
  transition:
    top 250ms ease-in-out,
    left 250ms ease-in-out,
    opacity 250ms ease-in-out,
    transform 250ms ease-in-out;
}

.menu-toggle span:nth-child(1) { top: 3px; }
.menu-toggle span:nth-child(2) { top: 12px; }
.menu-toggle span:nth-child(3) { top: 21px; }

.menu-toggle.is-open span:nth-child(1) {
  top: 12px;
  transform: rotate(135deg);
}

.menu-toggle.is-open span:nth-child(2) {
  left: -22px;
  opacity: 0;
}

.menu-toggle.is-open span:nth-child(3) {
  top: 12px;
  transform: rotate(-135deg);
}

/* =========================================================
   MOBILE MENU BACKDROP AND RIGHT-HAND DRAWER
   ========================================================= */

.mobile-menu-backdrop {
  position: fixed;
  inset: var(--drawer-top, 0px) 0 0;
  z-index: 1090;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: rgba(47, 79, 79, 0.22);
  opacity: 0;
  visibility: hidden;
  cursor: pointer;
  transition:
    opacity 300ms ease,
    visibility 300ms ease;
}

.mobile-menu-backdrop[hidden] {
  display: none;
}

.mobile-site-drawer {
  position: fixed;
  top: var(--drawer-top, 0px);
  right: 0;
  bottom: 0;
  z-index: 1100;
  width: min(82vw, 350px);
  padding: 28px 30px 40px;
  overflow-y: auto;
  background: var(--site-bg);
  color: var(--site-ink);
  box-shadow: -12px 0 35px rgba(0, 0, 0, 0.15);
  transform: translateX(105%);
  visibility: hidden;
  transition:
    transform 340ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 340ms ease;
}

.mobile-site-drawer nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.mobile-site-drawer a,
.mobile-site-drawer a:visited {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid rgba(47, 79, 79, 0.18);
  color: var(--site-ink);
  text-decoration: none;
  font-size: 16px;
  letter-spacing: 0.025em;
}

.mobile-site-drawer a[aria-current="page"] {
  font-weight: 700;
}

.mobile-site-drawer a:hover {
  color: #777777;
}

.drawer-context-nav {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(47, 79, 79, 0.25);
}

.drawer-context-nav a {
  padding: 11px 0;
  border-bottom: 0;
  font-size: 14px;
}

body.menu-open {
  overflow: hidden;
}

body.menu-open .mobile-menu-backdrop {
  opacity: 1;
  visibility: visible;
}

body.menu-open .mobile-site-drawer {
  transform: translateX(0);
  visibility: visible;
}

/* =========================================================
   TABLET AND MOBILE
   Keep the hamburger on the right at tablet widths as well.
   ========================================================= */

@media screen and (max-width: 1100px) {
  .site-sticky-navigation {
    justify-content: flex-end;
    min-height: 48px;
    padding: 0 10px;
  }

  .site-sticky-navigation .primary-nav,
  .site-sticky-navigation .context-nav {
    display: none;
  }

  .site-sticky-navigation .menu-toggle {
    display: block;
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .menu-toggle span,
  .mobile-menu-backdrop,
  .mobile-site-drawer {
    transition: none;
  }
}

/* =========================================================
   BACK TO TOP BUTTON — INDIVIDUAL PROJECT PAGES
   ========================================================= */

.back-to-top {
  position: fixed;
  left: 50%;
  bottom: 22px;
  right: auto;
  z-index: 1100;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 11px 15px;
  border: 1px solid rgba(47, 79, 79, 0.32);
  border-radius: 3px;

  background: rgba(192, 192, 192, 0.96);
  color: #2F4F4F;

  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translate(-50%, 8px);

  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease;

  cursor: pointer;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.back-to-top-arrow {
  font-size: 18px;
  line-height: 1;
}

.back-to-top:hover {
  background: #2F4F4F;
  color: #C0C0C0;
}

.back-to-top:focus-visible {
  outline: 2px solid #2F4F4F;
  outline-offset: 3px;
}

/* Hide when the footer enters the viewport */

.back-to-top.is-footer-visible {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Mobile and tablet */

@media (max-width: 1100px) {
  .back-to-top {
    bottom: 14px;
    padding: 10px 13px;
  }
}

/* Reduced motion accessibility */

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: none;
  }
}
