/*
 * Nactarome Regulatory Radar — My interests no-scroll correction.
 * Loaded after the compiled stylesheet so the validated content snapshot stays intact.
 */

/*
 * Desktop and laptop:
 * show the complete interest builder as a compact deck above the results.
 * There is no nested scroll container and no sticky action that can fail in Safari.
 */
.content-layout {
  display: block;
}

.filters {
  --filter-panel-padding: 22px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 22px;
  max-height: none;
  overflow: visible;
  overscroll-behavior: auto;
  padding: var(--filter-panel-padding);
  position: static;
  scrollbar-gutter: auto;
}

.filter-heading {
  align-items: end;
  background: transparent;
  border-bottom: 1px solid var(--line);
  grid-column: 1 / -1;
  margin: 0;
  padding: 0 0 14px;
  position: static;
}

.filter-heading p {
  margin-bottom: 3px;
}

.filters fieldset {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
}

.filters fieldset legend {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.filters .all-bu,
.filters .bu-filter {
  margin: 0;
  min-height: 54px;
}

.filters > label {
  margin: 0;
}

.filters > label select {
  margin-top: 6px;
}

.save-button,
.reset-button {
  bottom: auto;
  box-shadow: none;
  margin: 0;
  position: static;
  z-index: auto;
}

.save-button {
  grid-column: 1 / span 2;
}

.reset-button {
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--forest);
  min-height: 41px;
  padding: 11px 13px;
  text-decoration: none;
}

.public-note {
  grid-column: 4 / -1;
  margin: 0;
  min-height: 41px;
  padding: 10px 13px;
}

@media (max-width: 1180px) {
  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filters fieldset {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .save-button {
    grid-column: 1;
  }

  .public-note {
    grid-column: 3;
  }
}

/*
 * Phone and tablet:
 * use a full-height sheet. Save and Reset are fixed above the bottom edge,
 * so users can finish from any point in the list without scrolling to the end.
 */
@media (max-width: 820px) {
  .filters {
    bottom: 0;
    display: none;
    gap: 14px;
    grid-template-columns: 1fr;
    left: 0;
    margin: 0;
    max-height: none;
    overflow-y: auto;
    padding: 20px 20px 142px;
    position: fixed;
    right: 0;
    top: 0;
    transform: none;
    transition: none;
    z-index: 100;
  }

  .filters.open {
    display: grid;
    transform: none;
  }

  .filter-heading {
    background: #fff;
    grid-column: 1;
    margin: -20px -20px 0;
    padding: 20px 20px 15px;
    position: sticky;
    top: -20px;
    z-index: 8;
  }

  .filters fieldset {
    grid-column: 1;
    grid-template-columns: 1fr 1fr;
  }

  .filters fieldset legend,
  .filters .all-bu {
    grid-column: 1 / -1;
  }

  .filters > label,
  .public-note {
    grid-column: 1;
  }

  .save-button {
    bottom: 56px;
    box-shadow: 0 -14px 24px 14px rgba(255, 255, 255, .96);
    left: 20px;
    position: fixed;
    right: 20px;
    width: auto;
    z-index: 110;
  }

  .reset-button {
    background: #fff;
    bottom: 10px;
    left: 20px;
    position: fixed;
    right: 20px;
    width: auto;
    z-index: 110;
  }
}

@media (max-width: 540px) {
  .filters fieldset {
    grid-template-columns: 1fr;
  }

  .filters fieldset legend,
  .filters .all-bu {
    grid-column: 1;
  }
}

@media print {
  .filters {
    display: none !important;
  }
}
