/* Converted from src/components/site/blog/ArchiveFilters.module.css (CSS Module): local classes are prefixed "blog-archive-filters__". */
/* Archive filters: "Showing x-y of z results" + category / tag dropdowns (original Ohio selects). */

.blog-archive-filters__filters {
  display: flex;
  align-items: center;
}

.blog-archive-filters__inline {
  display: flex;
  align-items: center;
  gap: 0.5em; /* 8.2px */
}

.blog-archive-filters__count {
  margin: 0 8px;
  font-size: var(--text-sm);
  line-height: 1.6;
  white-space: nowrap;
}

/* ----- Dropdown ----- */
/* Styled like the original native <select>: no hover / open change, a static arrow. */
.blog-archive-filters__menu {
  position: relative;
  flex: none;
}

.blog-archive-filters__categories {
  width: 128px;
}

.blog-archive-filters__tags {
  width: 80px;
}

.blog-archive-filters__trigger {
  position: relative;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 32px 0 12px;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background-color: var(--color-field);
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.blog-archive-filters__trigger::-webkit-details-marker {
  display: none;
}

.blog-archive-filters__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blog-archive-filters__chevron {
  position: absolute;
  top: 50%;
  right: 16px;
  color: var(--color-text);
  transform: translateY(-50%);
}

.blog-archive-filters__list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: max-content;
  min-width: 220px;
  max-width: min(340px, calc(100vw - 32px));
  max-height: min(60vh, 26rem);
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  background-color: var(--color-bg);
  border-radius: var(--radius);
  box-shadow:
    0 20px 32px -8px rgb(17 16 19 / 0.15),
    0 0 1px 0 rgb(17 16 19 / 0.25);
}

/* Raised surface on the dark scheme (the page background would swallow the menu). */
html[data-theme="dark"] .blog-archive-filters__list {
  background-color: color-mix(in srgb, var(--color-bg) 92%, white);
}

html[data-theme="dark"] .blog-archive-filters__stacked .blog-archive-filters__list {
  background-color: var(--color-fill);
}

.blog-archive-filters__option {
  display: block;
  padding: 6px 16px;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-text);
  transition:
    color var(--duration-fast) var(--ease),
    background-color var(--duration-fast) var(--ease);
}

.blog-archive-filters__option:hover,
.blog-archive-filters__option:focus-visible {
  color: var(--color-brand);
  background-color: var(--color-fill);
}

.blog-archive-filters__option:focus-visible {
  outline-offset: -2px;
}

.blog-archive-filters__option[aria-current="page"] {
  font-weight: var(--weight-semibold);
  color: var(--color-brand);
}

/* In the mobile panel: full-width triggers, list in the flow. */
.blog-archive-filters__stacked {
  width: 100%;
}

.blog-archive-filters__stacked .blog-archive-filters__list {
  position: static;
  width: auto;
  min-width: 0;
  max-width: none;
  max-height: none;
  margin-top: 6px;
  box-shadow: none;
  background-color: var(--color-fill);
}

/* ----- Mobile: "Filters" button + slide-in panel ----- */
.blog-archive-filters__openButton {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 36px;
  padding: 0 16px;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.6;
  white-space: nowrap;
  color: var(--color-text);
  background: none;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--duration) var(--ease);
}

.blog-archive-filters__openButton:hover {
  background-color: var(--color-fill);
}

.blog-archive-filters__openIcon {
  margin-left: -8px;
}

/*
 * The whole layer fades (.35s, theme curve) while the panel slides from 3rem and fades (.35s
 * ease), as the theme's .slide-in-overlay / .holder transitions did. `clip` (not a scroll
 * container) keeps the focus of the close button from scrolling the sliding panel into view.
 */
.blog-archive-filters__dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overflow: clip;
  color: var(--color-text);
  background: transparent;
  border: 0;
  transition: opacity var(--duration) var(--ease);
}

.blog-archive-filters__dialog::backdrop {
  background: transparent;
}

.blog-archive-filters__overlay {
  position: absolute;
  inset: 0;
  background-color: rgb(17 16 19 / 0.9);
}

.blog-archive-filters__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: calc(100% - 56px);
  padding-top: var(--header-h);
  background-color: var(--color-bg);
  box-shadow:
    0 20px 32px -8px rgb(17 16 19 / 0.15),
    0 0 1px 0 rgb(17 16 19 / 0.05);
  transition:
    opacity var(--duration) ease,
    transform var(--duration) ease;
}

/* Over the top band of the panel (which never scrolls: only .panelBody does), outside the panel
   so it doesn't slide. */
.blog-archive-filters__closeBar {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: calc(100% - 56px);
  height: var(--header-h);
  padding: 0 16px;
  pointer-events: none;
}

.blog-archive-filters__closeBar > * {
  pointer-events: auto;
}

.blog-archive-filters__panelBody {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 1em;
  min-height: 0;
  padding: 0 16px 16px;
  overflow-y: auto;
}

@starting-style {
  .blog-archive-filters__dialog[open] {
    opacity: 0;
  }

  .blog-archive-filters__dialog[open] .blog-archive-filters__panel {
    opacity: 0;
    transform: translateX(3rem);
  }
}

/* Closing: after the theme's 200ms wait, the same transitions backwards; the script closes the
   dialog when the fade has ended. */
.blog-archive-filters__dialog[data-closing] {
  opacity: 0;
  pointer-events: none;
  transition-delay: 0.2s;
}

.blog-archive-filters__dialog[data-closing] .blog-archive-filters__panel {
  opacity: 0;
  transform: translateX(3rem);
  transition-delay: 0.2s;
}

@media (prefers-reduced-motion: reduce) {
  .blog-archive-filters__dialog,
  .blog-archive-filters__panel {
    transition: none;
  }
}

@media (max-width: 768px) {
  .blog-archive-filters__inline {
    display: none;
  }

  .blog-archive-filters__openButton {
    display: inline-flex;
  }
}
