/* Adaptive Trend taxonomy navigation expressed in Instrument Paper. */

body.dashboard-view #dashboard {
  container-type: inline-size;
  min-width: 0;
}

body.dashboard-view .measurement-toolbar {
  display: block;
  margin: var(--mf-space-1) 0 0;
}

body.dashboard-view .category-filter-toolbar {
  display: block;
  width: 100%;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: var(--mf-radius-none);
  background: transparent;
  box-shadow: none;
  font-family: var(--mf-font-sans);
}

body.dashboard-view .category-filter-level {
  display: block;
  width: 100%;
  min-width: 0;
}

body.dashboard-view .category-filter-buttons {
  display: flex;
  flex-flow: row nowrap;
  align-items: stretch;
  gap: var(--mf-space-6);
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

body.dashboard-view .category-filter-buttons::-webkit-scrollbar,
body.dashboard-view .category-minor-filter-buttons::-webkit-scrollbar,
body.dashboard-view .index-sort-buttons::-webkit-scrollbar {
  display: none;
}

body.dashboard-view .category-filter-button {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  height: var(--mf-control-height-touch);
  min-height: var(--mf-control-height-touch);
  padding: 0 var(--mf-space-0-5);
  border: 0;
  border-radius: var(--mf-radius-none);
  background: transparent;
  color: var(--mf-text-secondary);
  box-shadow: none;
  font-family: var(--mf-font-sans);
  font-size: var(--mf-font-size-body);
  font-weight: var(--mf-font-weight-medium);
  letter-spacing: 0;
  line-height: 1;
  transform: none;
  transition:
    color var(--mf-duration-fast) var(--mf-ease-standard),
    font-weight var(--mf-duration-fast) var(--mf-ease-standard);
}

body.dashboard-view .category-filter-button::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  background: var(--mf-signal-accent);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--mf-duration-fast) var(--mf-ease-standard),
    transform var(--mf-duration-standard) var(--mf-ease-standard);
}

body.dashboard-view .category-filter-button::after {
  left: 0;
  height: var(--mf-signal-rail-width);
  transform: scaleX(0.45);
  transform-origin: right center;
}

body.dashboard-view .category-filter-button.active {
  border: 0;
  background: transparent;
  color: var(--mf-text-strong);
  box-shadow: none;
  font-weight: var(--mf-font-weight-semibold);
}

body.dashboard-view .category-filter-button.active::after {
  opacity: 1;
  transform: scale(1);
}

body.dashboard-view .category-filter-button .category-filter-count {
  display: none;
}

body.dashboard-view .category-filter-button:active {
  color: var(--mf-text-strong);
  transform: none;
}

body.dashboard-view .category-filter-button:disabled,
body.dashboard-view .category-minor-filter-button:disabled {
  color: var(--mf-text-disabled);
  cursor: not-allowed;
  opacity: 0.72;
}

@media (hover: hover) and (pointer: fine) {
  body.dashboard-view .category-filter-button:not(.active):hover,
  body.dashboard-view .category-filter-button.active:hover {
    border: 0;
    background: transparent;
    color: var(--mf-text-strong);
  }
}

body.dashboard-view .category-filter-button:focus-visible,
body.dashboard-view .category-minor-filter-button:focus-visible,
body.dashboard-view .index-sort-button:focus-visible,
body.dashboard-view .range-custom-input:focus-visible,
body.dashboard-view .range-custom-apply:focus-visible,
body.dashboard-view .nav-clear-filters:focus-visible {
  outline: none;
  box-shadow: var(--mf-focus-ring);
}

body.dashboard-view .category-browser {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  min-width: 0;
  margin-top: var(--mf-space-5);
}

body.dashboard-view .category-browser-content {
  min-width: 0;
}

body.dashboard-view .category-minor-filter-toolbar {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0 0 var(--mf-space-4);
  padding: 0;
  border: 0;
  background: transparent;
}

body.dashboard-view .category-minor-filter-buttons {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: var(--mf-space-1);
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

body.dashboard-view .category-minor-filter-button {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: var(--mf-space-2);
  width: auto;
  height: var(--mf-control-height-default);
  min-height: var(--mf-control-height-default);
  padding: 0 var(--mf-space-3);
  border: 0;
  border-radius: var(--mf-radius-sm);
  background: transparent;
  color: var(--mf-text-secondary);
  box-shadow: none;
  font-family: var(--mf-font-sans);
  font-size: var(--mf-font-size-body-sm);
  font-weight: var(--mf-font-weight-medium);
  letter-spacing: 0;
  line-height: 1;
  text-align: left;
  transform: none;
  transition:
    background-color var(--mf-duration-fast) var(--mf-ease-standard),
    color var(--mf-duration-fast) var(--mf-ease-standard),
    font-weight var(--mf-duration-fast) var(--mf-ease-standard);
}

body.dashboard-view .category-minor-filter-button::before,
body.dashboard-view .category-minor-filter-button::after {
  content: "";
  position: absolute;
  bottom: 0;
  background: var(--mf-signal-accent);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--mf-duration-fast) var(--mf-ease-standard),
    transform var(--mf-duration-standard) var(--mf-ease-standard);
}

body.dashboard-view .category-minor-filter-button::after {
  left: calc(50% - 12px);
  width: 24px;
  height: var(--mf-signal-rail-width);
  transform: scaleX(0.55);
  transform-origin: right center;
}

body.dashboard-view .category-minor-filter-button::before {
  right: calc(50% - 12px);
  width: var(--mf-signal-rail-width);
  height: 7px;
  transform: scaleY(0.55);
  transform-origin: center bottom;
}

body.dashboard-view .category-minor-filter-button.active {
  border: 0;
  background: var(--mf-surface-subtle);
  color: var(--mf-text-strong);
  box-shadow: none;
  font-weight: var(--mf-font-weight-semibold);
}

body.dashboard-view .category-minor-filter-button.active::before,
body.dashboard-view .category-minor-filter-button.active::after {
  opacity: 1;
  transform: scale(1);
}

body.dashboard-view .category-minor-filter-button .category-filter-count {
  display: none;
}

body.dashboard-view .category-minor-filter-button:active {
  background: var(--mf-surface-subtle);
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  body.dashboard-view .category-minor-filter-button:hover {
    border: 0;
    background: var(--mf-surface-hover);
    color: var(--mf-text-strong);
  }

  body.dashboard-view .category-minor-filter-button.active:hover {
    background: var(--mf-surface-subtle);
  }
}

body.dashboard-view .trend-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--mf-space-4);
  min-height: var(--mf-control-height-touch);
  margin-bottom: var(--mf-space-4);
}

body.dashboard-view .trend-results-copy {
  display: flex;
  align-items: baseline;
  gap: var(--mf-space-3);
  min-width: 0;
}

body.dashboard-view .trend-results-copy h2 {
  margin: 0;
  color: var(--mf-text-strong);
  font-family: var(--mf-font-sans);
  font-size: var(--mf-font-size-title-md);
  font-weight: var(--mf-font-weight-semibold);
  letter-spacing: var(--mf-letter-spacing-title);
  line-height: var(--mf-line-height-title);
  text-wrap: pretty;
}

body.dashboard-view .trend-results-copy p {
  flex: 0 0 auto;
  margin: 0;
  color: var(--mf-text-secondary);
  font-family: var(--mf-font-mono);
  font-size: var(--mf-font-size-meta);
  font-variant-numeric: tabular-nums;
  font-weight: var(--mf-font-weight-medium);
  letter-spacing: 0;
  line-height: 1;
}

body.dashboard-view .nav-dashboard {
  min-width: 0;
  margin-top: 0;
}

body.dashboard-view .index-sort-toolbar {
  flex: 0 1 auto;
  align-items: center;
}

body.dashboard-view .index-sort-buttons {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: var(--mf-space-1);
  border: 0;
  border-radius: var(--mf-radius-md);
  background: var(--mf-surface-subtle);
}

body.dashboard-view .index-sort-button {
  border-radius: var(--mf-radius-sm);
  transform: none;
}

body.dashboard-view .index-sort-button.active {
  border-color: var(--mf-border-default);
  background: var(--mf-surface-panel);
  color: var(--mf-text-strong);
  font-weight: var(--mf-font-weight-semibold);
  box-shadow: none;
}

body.dashboard-view .index-sort-button:hover,
body.dashboard-view .index-sort-button:active {
  transform: none;
}

body.dashboard-view .range-custom-input,
body.dashboard-view .range-custom-apply {
  border-color: var(--mf-border-subtle);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-surface-panel);
  color: var(--mf-text-strong);
}

body.dashboard-view .nav-clear-filters {
  min-height: var(--mf-control-height-default);
  padding: 0 var(--mf-space-3);
  border: var(--mf-rule-width) solid var(--mf-border-default);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-surface-panel);
  color: var(--mf-text-primary);
  font-family: var(--mf-font-sans);
  font-size: var(--mf-font-size-body-sm);
  font-weight: var(--mf-font-weight-semibold);
  letter-spacing: 0;
  transform: none;
}

@container (min-width: 1320px) {
  body.dashboard-view .category-browser.has-secondary {
    grid-template-columns: 176px minmax(0, 1fr);
    gap: var(--mf-space-6);
  }

  body.dashboard-view .category-browser.has-secondary .category-minor-filter-toolbar {
    position: sticky;
    top: var(--mf-space-6);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    align-self: start;
    gap: var(--mf-space-2);
    width: 176px;
    margin: 0;
  }

  body.dashboard-view .category-browser.has-secondary .category-minor-filter-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: var(--mf-space-0-5);
    overflow: visible;
  }

  body.dashboard-view .category-browser.has-secondary .category-minor-filter-button {
    justify-content: space-between;
    width: 100%;
    height: 40px;
    min-height: 40px;
    padding: 0 var(--mf-space-3) 0 var(--mf-space-4);
    border-radius: var(--mf-radius-xs);
  }

  body.dashboard-view .category-browser.has-secondary .category-minor-filter-button::before {
    top: var(--mf-space-2);
    right: auto;
    bottom: var(--mf-space-2);
    left: 0;
    width: var(--mf-signal-rail-width);
    height: auto;
    transform: scaleY(0.55);
    transform-origin: center bottom;
  }

  body.dashboard-view .category-browser.has-secondary .category-minor-filter-button::after {
    display: none;
  }

  body.dashboard-view .category-browser.has-secondary .category-minor-filter-button.active {
    background: var(--mf-color-accent-quiet);
  }

  body.dashboard-view .category-browser.has-secondary .category-minor-filter-button.active::before {
    transform: scaleY(1);
  }

  body.dashboard-view .category-browser.has-secondary .category-minor-filter-button .category-filter-count {
    display: inline;
    color: var(--mf-text-secondary);
    font-family: var(--mf-font-mono);
    font-size: var(--mf-font-size-meta);
    font-variant-numeric: tabular-nums;
    font-weight: var(--mf-font-weight-medium);
  }
}

@media (max-width: 820px) {
  body.dashboard-view .trend-results-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--mf-space-3);
  }

  body.dashboard-view .index-sort-toolbar,
  body.dashboard-view .index-sort-buttons {
    width: 100%;
  }

  body.dashboard-view .index-sort-buttons {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  body.dashboard-view .category-filter-level {
    display: block;
  }

  body.dashboard-view .category-filter-buttons {
    gap: var(--mf-space-5);
  }

  body.dashboard-view .category-minor-filter-buttons {
    display: flex;
  }

  body.dashboard-view .category-minor-filter-button {
    height: var(--mf-control-height-touch);
    min-height: var(--mf-control-height-touch);
  }

  body.dashboard-view .trend-results-copy h2 {
    font-size: var(--mf-font-size-title-sm);
  }
}

@media (forced-colors: active) {
  body.dashboard-view .category-filter-button.active,
  body.dashboard-view .category-minor-filter-button.active,
  body.dashboard-view .index-sort-button.active {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }

  body.dashboard-view .category-filter-button.active::after,
  body.dashboard-view .category-minor-filter-button.active::before,
  body.dashboard-view .category-minor-filter-button.active::after {
    background: Highlight;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.dashboard-view .category-filter-button,
  body.dashboard-view .category-filter-button::after,
  body.dashboard-view .category-minor-filter-button,
  body.dashboard-view .category-minor-filter-button::before,
  body.dashboard-view .category-minor-filter-button::after {
    transition-duration: 0.01ms;
  }
}
