/* Dv257 — animated mobile navigation and consistent, browser-independent filter menus.
   All earlier page artwork, layouts, and project-gallery sizing remain unchanged. */

/* The hamburger has two existing strokes: transform them into a close cross. */
@media (max-width: 900px) {
  html body #r-header .menu-btn i {
    transform: translateY(0) rotate(0deg) !important;
    transform-origin: center !important;
    transition: transform .32s cubic-bezier(.22, 1, .36, 1),
                background-color .22s ease !important;
    will-change: transform;
  }
  html body #r-header .menu-btn[aria-expanded="true"] i:first-child {
    transform: translateY(3.5px) rotate(45deg) !important;
  }
  html body #r-header .menu-btn[aria-expanded="true"] i:last-child {
    transform: translateY(-3.5px) rotate(-45deg) !important;
  }
  /* Visibility replaces abrupt display toggling; the original layout stays put. */
  html body #r-header .main-nav,
  html body #r-header .main-nav:not(.open),
  html body #r-header .main-nav.open {
    display: flex !important;
    transition: opacity .26s ease, transform .32s cubic-bezier(.22, 1, .36, 1),
                visibility .26s ease !important;
    transform-origin: top center !important;
    /* Prevent underlying page copy from ghosting through the open menu. */
    background: #191919 !important;
  }
  html body #r-header .main-nav:not(.open) {
    opacity: 0 !important;
    transform: translateY(-9px) scale(.985) !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  html body #r-header .main-nav.open {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  html body #r-header .menu-btn:focus-visible {
    outline: 2px solid rgba(255,255,255,.8) !important;
    outline-offset: 3px !important;
    border-radius: 8px !important;
  }
}

/* Replace system-native option popups (which can show blue/white artifacts)
   with our own keyboard-accessible styled menu for all six project filters. */
html body.projects-page #r-main .filter-group.dersin-select-ready > select {
  display: none !important;
}
html body.projects-page #r-main .filter-group .dersin-select-trigger {
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 46px !important;
  margin: 0 !important;
  padding: 0 15px !important;
  border: 1px solid rgba(255,255,255,.21) !important;
  border-radius: 9px !important;
  background: #191919 !important;
  color: #fff !important;
  font-family: inherit !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.2 !important;
  text-align: left !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .18s ease, background-color .18s ease !important;
}
html body.projects-page #r-main .dersin-select-trigger:hover,
html body.projects-page #r-main .dersin-select-trigger[aria-expanded="true"] {
  border-color: rgba(255,255,255,.52) !important;
  background: #1f222a !important;
}
html body.projects-page #r-main .dersin-select-trigger:focus-visible {
  outline: 2px solid #5a6572 !important;
  outline-offset: 3px !important;
}
html body.projects-page #r-main .dersin-select-trigger .dersin-select-value {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
html body.projects-page #r-main .dersin-select-trigger .dersin-select-arrow {
  box-sizing: border-box;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-bottom: 1.7px solid #f2f4f5;
  border-right: 1.7px solid #f2f4f5;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .22s ease;
}
html body.projects-page #r-main .dersin-select-trigger[aria-expanded="true"] .dersin-select-arrow {
  transform: translateY(2px) rotate(225deg);
}

/* Single floating popup, attached to the viewport to prevent clipping by
   the animated filter panel, and to keep styling identical on every browser. */
.dersin-select-popup {
  box-sizing: border-box !important;
  position: fixed !important;
  z-index: 2147483647 !important;
  padding: 5px !important;
  margin: 0 !important;
  background: #191919 !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.25) !important;
  border-radius: 10px !important;
  box-shadow: 0 18px 38px rgba(0,0,0,.34) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  scrollbar-width: thin;
  scrollbar-color: #2f3542 transparent;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(-7px) scale(.985);
  transform-origin: top center;
  transition: opacity .18s ease, transform .22s cubic-bezier(.22,1,.36,1),
              visibility .18s ease !important;
}
.dersin-select-popup[data-placement="top"] {
  transform: translateY(7px) scale(.985);
  transform-origin: bottom center;
}
.dersin-select-popup.is-open,
.dersin-select-popup.is-open[data-placement="top"] {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1);
}
.dersin-select-popup .dersin-select-option {
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  min-height: 41px !important;
  padding: 9px 11px !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: #f5f6f7 !important;
  text-align: left !important;
  font: 400 14px/1.3 system-ui, -apple-system, sans-serif !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .14s ease;
}
.dersin-select-popup .dersin-select-option:hover,
.dersin-select-popup .dersin-select-option:focus-visible {
  background: #242933 !important;
  outline: none !important;
}
.dersin-select-popup .dersin-select-option[aria-selected="true"] {
  background: #2f3542 !important;
  color: white !important;
}
.dersin-select-popup .dersin-select-option[aria-selected="true"]::after {
  content: '✓';
  opacity: .87;
  margin-left: 12px;
  font-size: 13px;
}
@media (prefers-reduced-motion: reduce) {
  html body #r-header .menu-btn i,
  html body #r-header .main-nav,
  html body #r-header .main-nav:not(.open),
  html body #r-header .main-nav.open,
  .dersin-select-popup,
  .dersin-select-popup .dersin-select-option {
    transition: none !important;
  }
}
