/*
  fixes iOS default button color for non-pitviper buttons
  which we use for proper semantics on interactive elements
*/
button {
  color: var(--color-text-body);
}

/* hide the recaptcha badge */
.grecaptcha-badge {
  visibility: hidden;
}

/* mapbox style overrides */
.mapboxgl-map {
  font-family: var(--font-family-body, HK Grotesk, sans-serif) !important;
}

.mapboxgl-popup {
  padding-top: 28px;
  &:focus-within {
    border-color: var(--color-background-brand-highlight);
  }
}

.mapboxgl-popup-content {
  padding: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;

  a:focus {
    outline: none;
  }
}

.mapboxgl-popup-tip {
  display: none;
}

.mapboxgl-map .mapboxgl-popup-close-button {
  position: fixed;
  top: 6px;
  right: 6px;
  font-size: 20px;
  color: #6e7784;
}

/* Custom spacing because we can't use pv-inset-squish. Mapbox overwrites
   the style attribute on Markers, so we can't adjust the inset size. */
.map-marker {
  padding: 0px 4px;
}
/* end mapbox style overrides */

.tqc-map-loader {
  z-index: 1;
  opacity: 0;
  visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-background-brand-accent);

  transition: opacity 150ms ease-out;

  &.tqc-map-loader--show {
    opacity: 1;
    visibility: visible;
  }
}

/* Styles for HTMX */

.htmx-request #results-main {
  position: relative;
  &:after {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    content: "";
    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.1) 0%,
      rgba(255, 255, 255, 0.7) 50%,
      rgba(255, 255, 255, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

button,
[role="button"] {
  cursor: pointer;
}

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

/**
 * The search bar is largely similar between the home and search
 * results pages, with subtle differences. The home page is considered
 * the common style. Overrides for the search result page appear in
 * following block.
 *
 * Within the bar:
 *   .search-bar__group is a spacing/border container for each input
 *   .pv-input-search needs custom overrides of Pit Viper styles
 *      to align with the other inputs
 */
search-form {
  display: block;
}

.search-bar {
  /* begin search bar styles common to both pages */
  @media (min-width: 768px) {
    display: grid;
    padding: 0.7rem;
    grid-template-columns: repeat(3, minmax(0, 1fr)) 48px;
  }

  .search-bar__group {
    position: relative;
    min-width: auto;
    padding: 0.75rem;
    border: 0;
    border-block-end: 1px solid var(--color-border, #dcdfe4);

    insurance-selector {
      --inset-size: 0.2rem;
    }

    insurance-selector[member-id] {
      --inset-size: 0rem;

      .tqc-insurance-selector-border {
        border-block-end: unset;
        border-inline-end: unset;
      }

      .insurance-plan-and-id {
        flex-direction: column;
      }

      @media (max-width: 767px) {
        .tqc-insurance-selector-border {
          padding-bottom: 0rem;
        }
      }
    }

    @media (min-width: 768px) {
      border: 0;

      &:has(insurance-selector) {
        padding-top: 0rem;
        padding-bottom: 0rem;
      }

      &:nth-child(1),
      &:nth-child(2) {
        border-inline-end: 1px solid var(--color-border, #dcdfe4);
      }

      .search-bar--stacked & {
        border-inline-end: none;
      }
    }
  }

  insurance-selector {
    #insurance-selector-member-id {
      display: none;
    }

    &[member-id] {
      @media (min-width: 768px) {
        .tqc-insurance-selector-border {
          padding-right: 1rem;
          border-inline-end: 1px solid var(--color-border, #dcdfe4);
        }
        .insurance-plan-and-id {
          flex-direction: row;
        }
        .tqc-insurance-change-button {
          padding-left: 1rem;
        }
      }
      @media (max-width: 767px) {
        .tqc-insurance-selector-border {
          padding-bottom: 1rem;
          border-block-end: 1px solid var(--color-border, #dcdfe4);
        }
        .insurance-plan-and-id {
          flex-direction: column;
        }
        .tqc-insurance-change-button {
          display: flex;
          justify-content: center;
          /* --flex-justify: center; */
        }
      }

      #insurance-selector-member-id {
        display: flex;
      }
    }
  }
  /* end common search bar styles */
}

.tqc-stacked-search-container {
  padding: 16px 14px;
  border-radius: 10px;
  background: linear-gradient(
    to bottom,
    rgba(22, 105, 109, 1),
    rgba(22, 105, 109, 0)
  );
  position: relative;
}

.tqc-stacked-search-gradient-matte {
  background: white;
  position: relative;
  border-radius: 8px;
}

.tqc-stacked-search-gradient {
  padding: 3px;
  border-radius: 8px;
  background: linear-gradient(
    to top right,
    rgba(229, 160, 0, 0.5),
    rgba(198, 60, 128, 0.5)
  );
}

.search-bar--stacked {
  display: block;
  background: white;
  padding: 0;
  position: relative;
  border-radius: 0.5rem;

  .search-bar__group {
    padding: 1rem 0.75rem;
    & > label {
      font-size: 1rem;
      color: #16696d;
      font-weight: 600;
    }
  }

  .search-bar__group:nth-child(1),
  .search-bar__group:nth-child(2) {
    border-bottom: 1px solid #e3e7ea;
  }

  .search-bar__group:nth-child(3) {
    border-bottom: none;
  }

  .ts-wrapper.single .ts-control,
  .ts-wrapper.single .ts-control input,
  .insurance-selector-toggle {
    font-size: 1rem;
    line-height: 1.5rem;
  }

  insurance-selector {
    display: block;
  }
}

/* begin search results page-specific search bar styles */
.search-bar--popover {
  @media (max-width: 767px) {
    width: 100vw;
    height: 100vh;
    max-height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    position: fixed;
    background-color: #fff;
    box-shadow:
      0px 0px 1px rgba(0, 0, 0, 0.3),
      0px 8px 12px -4px rgba(0, 0, 0, 0.08),
      0px 12px 16px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    top: 0;
    left: 0;
    z-index: 50;

    .search-bar .pv-input-search {
      font-size: 1.25rem;
    }
  }

  .search-bar {
    @media (min-width: 768px) {
      display: grid;
      padding: 0.5rem;

      .search-bar__group {
        padding-top: unset;
        padding-bottom: unset;
      }
    }
    grid-template-columns: repeat(3, minmax(0, 1fr)) 36px;

    .search-bar__group {
      padding-inline: 0.5rem;
    }
  }
}
/* end search results page-specific search bar styles */

.tqc-filter[data-dropdown] + .pv-popover {
  visibility: visible;
  opacity: 1;
  border-radius: 5px;
}

.search-filter {
  .pv-button-primary {
    /* override the caret PV adds to any button inside a pv-dropdown */
    background-image: none !important;
    padding: 0.75rem 1.25rem !important;
  }

  @media (max-width: 767px) {
    .pv-popover {
      height: 100vh;
      width: 100vw;
      position: fixed;
      top: 0;

      .control-container {
        position: fixed;
        width: 100%;
      }
    }
  }
}

@media (max-width: 767px) {
  .pv-modal-sm.tqc-modal-filter {
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    max-width: none;

    .control-container {
      position: fixed;
      width: 100%;
    }
  }
}

@media (max-width: 767px) {
  .filter-buttons {
    overflow-x: scroll;
  }
}

/* Chrome, Safari, Edge, Opera Remove Number Input Arrows */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox Remove Number Input Arrows */
input[type="number"] {
  -moz-appearance: textfield;
}

.embedded {
  font-family: var(--font-family-body, HK Grotesk, HKGrotesk, sans-serif);
  font-weight: 400;
  font-size: 100%;
  line-height: 1.5;
  color: var(--color-text-body, #02363d);
  background: transparent;
  -webkit-font-smoothing: antialiased;
}

/* tom-select custom styles */
#service_code {
  /* hide the service dropdown until tomselect loads */
  &:not(.tomselected) {
    display: none;
  }

  /* once tomselect loads, hide the loading text */
  &.tomselected ~ .tqc-inline-loader {
    display: none;
  }
}

.ts-hidden-accessible {
  border: 0 !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  padding: 0 !important;
  position: absolute !important;
  width: 1px !important;
  white-space: nowrap !important;
}

.ts-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;

  .item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  &.single .ts-control,
  &.single .ts-control input {
    font-size: 18px;
    cursor: pointer;
    width: 100%;
  }

  &.single.input-active .ts-control {
    cursor: text;
  }

  input {
    padding: 0;
    border: none;
    &:focus {
      outline: none;
    }
  }

  &.input-hidden {
    input {
      opacity: 0;
      position: absolute;
    }
  }

  &.input-active {
    .item {
      display: none;
    }
  }
}

.ts-dropdown {
  /* z-index needs to beat .pv-sticky, which is set to 10 */
  z-index: 11;
  width: 100%;
  padding: 0;

  background: #fff;
  border-radius: 5px;

  .option,
  .optgroup-header,
  .no-results,
  .create {
    padding: 0.5rem 1rem 0.5rem 0;

    @media (min-width: 768px) {
      margin-inline: 0.5rem;
      padding: 0.5rem;
      padding-inline-end: 1rem;
    }

    background-image: var(--chevron-right);
    background-position: right;
    background-repeat: no-repeat;
  }
  .option:first-child {
    margin-top: 0.5rem;
  }
  .option:last-child {
    margin-bottom: 0.5rem;
  }

  .loading + & .option {
    display: none;
  }

  .overhang-autocomplete ~ & {
    position: absolute;
    top: 100%;
    left: 0;

    box-shadow:
      0px 0px 1px rgba(0, 0, 0, 0.3),
      0px 8px 12px -4px rgba(0, 0, 0, 0.08),
      0px 12px 16px rgba(0, 0, 0, 0.1);

    .option,
    .optgroup-header,
    .no-results,
    .create {
      padding-inline-start: 0.5rem;
    }
    .ts-dropdown-content {
      overflow: hidden auto;
      max-height: 260px;
    }
  }

  :not(.overhang-autocomplete) ~ & {
    @media (min-width: 768px) {
      overflow: hidden;
      max-height: 260px;
    }
  }

  [data-selectable] {
    cursor: pointer;
    overflow: hidden;

    .highlight {
      background: var(--color-background-brand-accent);
      font-weight: bold;
    }
  }

  .active {
    background-color: #f8f8fa;
  }

  .tq-loader {
    display: block;
    width: 30px;
    height: 30px;
    margin: 1rem auto;
  }

  .optgroup + .optgroup {
    & > .optgroup-header {
      border-top: 1px solid var(--color-border);
      &:empty {
        padding-top: 0;
      }
      &:not(:empty) {
        padding-top: 1rem;
      }
    }
  }
}

.tq-loader {
  animation: wobble 2s ease-in-out infinite;
  transform: scale(1) rotateY(0deg);
}
@keyframes wobble {
  0% {
    transform: scale(1) rotateY(0deg);
  }

  25% {
    transform: scale(0.95) rotateY(-30deg);
  }

  50% {
    transform: scale(1.2) rotateY(0deg);
  }

  75% {
    transform: scale(0.95) rotateY(30deg);
  }

  100% {
    transform: scale(1) rotateY(0deg);
  }
}

.pv-avatar-lg:has(img),
.pv-avatar-md:has(img) {
  background: transparent !important;
  border: 1px solid #dcdfe4 !important;
}

.tqc-package-result-card {
  /*
    this magic number prevents the sticky filter bar
    from covering the list items, when they're scrolled into
    view after clicking a map marker
  */
  scroll-margin-top: 68px;

  .tqc-see-cost-breakdown {
    text-decoration-line: underline;
    color: var(--color-text-body, #02363d);
  }

  &:hover {
    box-shadow: 0px 8px 16px 0px rgba(12, 12, 12, 0.1);
    text-decoration: none;

    .tqc-see-cost-breakdown,
    .tqc-provider-name {
      color: var(--color-text-interactive, #176f6f);
    }
  }

  .tqc-verifiers {
    display: none;
  }

  @media (max-width: 767px) {
    --flex-wrap: wrap;
  }

  &.tqc-verified {
    @media (min-width: 768px) {
      .tqc-verifiers-container {
        border-left: 1px solid var(--color-border, #dcdfe4);
      }

      .tqc-verifiers {
        display: block;
      }
    }

    @media (max-width: 767px) {
      .tqc-package-result-overview {
        flex: 0 0 100%; /* flex-grow, flex-shrink, flex-basis */
      }

      .tqc-verifiers {
        display: flex;
        --flex-justify: space-between;
        flex: 0 0 100%; /* flex-grow, flex-shrink, flex-basis */
      }

      .tqc-verifiers-container {
        border-top: 1px solid var(--color-border, #dcdfe4);
      }
    }
  }
}

.tqc-care-quality:hover {
  text-decoration: underline;
}

.tqc-logo path:first-of-type {
  fill: white;
}

.tqc-map-mover {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 2;
}

/* Override Pit-Viper padding for cost calculator */
.cost-calculator {
  .pv-label-selectable {
    padding: 12px 16px;
    border-radius: 5px;
  }
}

/*
  The services in the hero animation are invisible, overlapping, absolute-positioned elements

  We want to fade them into view over a half second,
  hold them still for ~3s, then fade them out over a half second
  (so, ~4 of total activity per item)

  This is accomplished by having each item run a long, looping animation
  with each item's start-time staggered by ~4s
*/
.tqc-rotating-services {
  position: relative;
  display: inline-block;
  overflow: hidden;
  height: 1lh;
  .tqc-service-item {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transform: translateY(100%);
    /*
      the 28s magic number comes from how many services we want to rotate:
        step 1: determine desired per-element timing
          (transition-in time [0.5s] + hold time [3s] + transition-out time [0.5s])
        step 2: get total animation time
          (number of elements [7] x per-element timing [4s])

      this needs to be updated whenever we update the service list
    */
    animation: rotating-text 28s infinite ease-in-out;

    @media (prefers-reduced-motion) {
      /* just display the first item for users who who prefer no animation */
      animation: none;
      &:first-child {
        opacity: 1;
        transform: translateY(0);
      }
    }
  }

  .tqc-hidden-service-sizer {
    visibility: hidden;
    white-space: nowrap;
  }
}

@keyframes rotating-text {
  0% {
    opacity: 0;
    transform: translateY(100%);
  }
  /*
    the fade-in will happen from 0 to 2% of the total animation duration
      0.02 * 28 is about a half second
  */
  2%,
  13% {
    /*
      the length of this keyframe segment should match how long we want each item
      to be held in-view

      so if we want it to display for ~3 seconds,
        from 2 to 13 = 11% of 28s, which is about 3
    */
    opacity: 1;
    transform: translateY(0);
  }
  /*
    the fade-in will happen from 18 to 20% of the total animation duration
      again, about a half second
  */
  15%,
  100% {
    opacity: 0;
    transform: translateY(-100%);
  }
}

.tqc-footer-list {
  @media (min-width: 768px) {
    --flex-gap: 24px;

    .tqc-footer-list-extra-col {
      align-self: end;
    }
  }

  @media (max-width: 767px) {
    --flex-gap: 12px;
  }
}

.tqc-toast-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  transform: translateY(200%);
  transition: transform 0.5s ease-in-out;
}

.tqc-toast-container.show {
  transform: translateY(0);
}

.tqc-back-to-results {
  @media (min-width: 768px) {
    padding-top: 24px;
  }
}
.tqc-hero-headline {
  font-size: clamp(3rem, 1.5rem + 2.75vw, 5rem);
  max-width: 12ch;
  @media (min-width: 768px) {
    max-width: 28ch;
  }
}

/* pv-label-selectable missed states */
.pv-label-selectable:has(:disabled) {
  color: #6e7784;
  border: 2px solid var(--color-border);
  cursor: auto;
}
.pv-label-selectable:has(:disabled):hover {
  color: #6e7784;
  border: 2px solid var(--color-border);
}

/* HOMEPAGE */
/* modifications for mobile */
@media (max-width: 768px) {
  .tqc-enterprise-solutions {
    /* override pv-figure-details grid display */
    margin-top: 128px;
  }
  .tqc-enterprise-figure-details {
    display: inline;
  }
}
/* used with pv-inset-block to make the inset size responsive to the screen size */
.tqc-responsive-inset {
  --inset-size: clamp(3rem, 3.714rem + 4.762vw, 5rem);
}

.tqc-desktop-top-section {
  @media (min-width: 768px) {
    padding: 24px 32px 0 32px;
  }
}

.tqc-inset-block-128-responsive {
  padding-top: 128px;
  padding-bottom: 128px;

  @media (max-width: 768px) {
    padding-top: 64px;
    padding-bottom: 64px;
  }
}

.tq-header-nav nav.tq-mobile-menu-section {
  display: none;
  padding: 0px;
  width: 100%;
}

body[data-menu] {
  overflow-y: hidden;

  .tq-header-nav .tq-mobile-header {
    height: 100dvh;
  }

  .tq-header-nav .tq-mobile-menu-section {
    display: flex;
  }
}

/* Language Modal */
.tq-language-modal-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: white;
  overflow-y: auto;
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
}

body[data-language-modal] {
  overflow-y: hidden;

  .tq-language-modal-section {
    display: flex !important;
    transform: translateY(0);
  }
}

/* Insurance Selector */
#insurance-selector-popover label:hover {
  cursor: pointer;
}
.insurance-selector-toggle {
  line-height: 1.1;
  --inset-size: 0;
}
.tqc-responsive-corners {
  border-radius: clamp(0.75rem, 0.5rem + 0.833vw, 1.25rem);
}

#orbit-group {
  animation: orbit 3s linear infinite;
  transform-origin: 30px 10px;
}

@keyframes orbit {
  0% {
    transform: rotate(0deg) translateX(17px) rotate(0deg);
  }
  100% {
    transform: rotate(360deg) translateX(17px) rotate(-360deg);
  }
}

/* Screen reader */
/* styling borrowed from https://www.a11y-collective.com/blog/skip-to-main-content/ */
.tqc-screen-reader {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 1em;
  background-color: black;
  color: white;
  opacity: 0;

  &:focus {
    left: 50%;
    transform: translateX(-50%);
    opacity: 1;
  }
}

viewport-intersection-observer {
  display: block;
}

.price-relativity-overview-container {
  @media (min-width: 768px) {
    align-self: start;
  }
}

.tcq-gfe-provider {
  background-color: #c86628;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
}

insurance-selector-dialog {
  &.htmx-request {
    .tqc-modal-step,
    .tqc-close-button {
      display: none;
    }

    .tqc-modal-indicator,
    .tqc-modal-indicator .tqc-close-button {
      display: block;
    }
  }
}
@media (max-width: 767px) {
  .pv-modal-sm.tqc-insurance-selector-dialog {
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    max-width: none;

    .control-container {
      position: fixed;
      width: 100%;
    }
  }
}

.pv-modal-sm.tqc-insurance-selector-dialog {
  .control-container {
    top: auto;
    bottom: 0;
  }
}

.tqc-yellow-dark {
  color: #e5a000;
}

.tqc-text-interactive {
  color: var(--color-text-interactive);
}

.tqc-popular-services-grid {
  --grid-col-min: auto;
  @media (min-width: 768px) {
    --grid-col-min: 360px;
  }
}
