.zen-and-tao-currency-switcher {
  --currency-flag-width: 24px;
  --currency-flag-height: 18px;
  --currency-content-gap: 8px;
  --currency-menu-width: 112px;
  position: relative;
  flex: 0 0 auto;
  margin: 0;
  font-family: "Jost", Arial, Helvetica, sans-serif;
}

.zen-and-tao-currency-switcher [hidden] {
  display: none !important;
}

.zen-and-tao-currency-switcher select,
.zen-and-tao-currency-switcher__apply {
  display: block;
  width: 76px;
  min-height: 44px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--zen-and-tao-line);
  border-radius: 6px;
  background: var(--zen-and-tao-paper);
  color: var(--zen-and-tao-ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.zen-and-tao-currency-switcher__trigger {
  display: inline-flex;
  min-width: 60px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: var(--currency-content-gap);
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--zen-and-tao-ink);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
  cursor: pointer;
  transition: color 160ms ease;
}

.zen-and-tao-currency-switcher__trigger:hover,
.zen-and-tao-currency-switcher__trigger[aria-expanded="true"] {
  color: var(--zen-and-tao-jade-dark);
  background: transparent;
}

.zen-and-tao-currency-switcher :is(select, button):focus-visible {
  outline: 2px solid var(--zen-and-tao-jade);
  outline-offset: 3px;
}

.zen-and-tao-currency-switcher__code {
  font-weight: 500;
}

.zen-and-tao-currency-switcher__flag {
  display: block;
  flex: 0 0 var(--currency-flag-width);
  width: var(--currency-flag-width);
  height: var(--currency-flag-height);
  max-width: none;
  border-radius: 2px;
  object-fit: cover;
}

.zen-and-tao-currency-switcher__panel {
  position: absolute;
  z-index: 5;
  top: calc(100% + 12px);
  inset-inline-end: 0;
  width: var(--currency-menu-width);
  max-width: calc(100vw - 32px);
  overflow: hidden;
  border: 1px solid var(--zen-and-tao-line);
  border-radius: 10px;
  background: var(--zen-and-tao-paper);
  box-shadow: 0 14px 40px rgb(23 25 23 / 14%);
}

.zen-and-tao-currency-switcher__list {
  max-height: min(360px, calc(100dvh - 190px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--zen-and-tao-line) transparent;
  margin: 0;
  padding: 6px;
  list-style: none;
}

.zen-and-tao-currency-switcher__option {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: var(--currency-content-gap);
  padding: 9px 10px;
  border-radius: 5px;
  color: var(--zen-and-tao-ink);
  cursor: pointer;
}

.zen-and-tao-currency-switcher__option:hover,
.zen-and-tao-currency-switcher__option.is-active {
  background: transparent;
}

.zen-and-tao-currency-switcher__option[aria-selected="true"] {
  color: var(--zen-and-tao-jade-dark);
  background: transparent;
}

.zen-and-tao-currency-switcher__option:is(:hover, .is-active, [aria-selected="true"]) .zen-and-tao-currency-switcher__abbreviation {
  text-decoration: underline;
  text-decoration-color: #000;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.zen-and-tao-currency-switcher__abbreviation {
  flex: 1;
  color: var(--zen-and-tao-muted);
  font-size: 12px;
  font-weight: 500;
}

/* Leave room for both the flag and currency code on desktop. */
@media (min-width: 1101px) {
  .zen-and-tao-currency-switcher__trigger,
  .zen-and-tao-currency-switcher select,
  .zen-and-tao-currency-switcher__apply {
    width: var(--currency-menu-width);
    font-size: 16px;
  }

  .zen-and-tao-currency-switcher__panel {
    width: 100%;
  }

  .zen-and-tao-currency-switcher__abbreviation {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zen-and-tao-currency-switcher__trigger {
    transition: none;
  }
}

/* Reuse the existing navigation drawer when the full menu cannot fit. */
@media (min-width: 783px) and (max-width: 1100px) {
  .zen-and-tao-site-header .zen-and-tao-header__nav {
    display: none;
  }

  .zen-and-tao-site-header .zen-and-tao-menu-toggle {
    display: inline-grid;
  }

  .zen-and-tao-mobile-backdrop {
    display: block;
  }

  .zen-and-tao-mobile-nav {
    display: flex;
  }
}

@media (max-width: 782px) {
  .zen-and-tao-currency-switcher select,
  .zen-and-tao-currency-switcher__apply {
    width: 76px;
  }

  .zen-and-tao-currency-switcher__trigger {
    padding-inline: 7px;
  }

  .zen-and-tao-header__actions .zen-and-tao-icon-button,
  .zen-and-tao-header__actions .zen-and-tao-cart-trigger {
    width: 40px;
    height: 44px;
    min-height: 44px;
    flex-basis: 40px;
  }

  .zen-and-tao-header__actions .zen-and-tao-icon-button svg,
  .zen-and-tao-header__actions .zen-and-tao-cart-trigger > svg {
    width: 24px;
    height: 24px;
  }

  .zen-and-tao-header__inner .zen-and-tao-menu-toggle {
    width: 40px;
    min-width: 40px;
    padding-inline: 0;
  }
}

@media (max-width: 380px) {
  .zen-and-tao-currency-switcher {
    --currency-flag-width: 20px;
    --currency-flag-height: 15px;
    --currency-content-gap: 6px;
  }
}
