/*
 * Universal <select> styling for every page of the site.
 * - All browsers: native arrow replaced by a chevron, pointer cursor, themed dropdown colors (color-scheme).
 * - Browsers with customizable select (appearance: base-select): fully styled dropdown panel and options.
 * Colors come from CSS variables; the defaults match the dark landing pages and
 * the main site overrides them for its light/dark themes (assets/src/tailwind.css).
 */
:root {
  --select-scheme: dark;
  --select-menu-bg: #161b26;
  --select-menu-border: rgba(255, 255, 255, .1);
  --select-menu-fg: #dfe2ee;
  --select-option-hover: rgba(138, 235, 255, .1);
  --select-accent: #8aebff;
  --select-menu-shadow: 0 18px 40px -12px rgba(0, 0, 0, .6);
}

html select {
  -webkit-appearance: none;
  appearance: none;
  color-scheme: var(--select-scheme);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .85rem center;
  background-size: 1.1rem;
  text-overflow: ellipsis;
}

@supports not (appearance: base-select) {
  /* Room for the background chevron. */
  html select {
    padding-right: 2.6rem !important;
  }
}

html select:disabled {
  cursor: not-allowed;
  opacity: .6;
}

html select option {
  background-color: var(--select-menu-bg);
  color: var(--select-menu-fg);
}

@supports (appearance: base-select) {
  html select {
    /* !important: pages use the `appearance-none` utility class, which would otherwise win. */
    appearance: base-select !important;
    background-image: none !important;
    align-items: center;
    gap: .5rem;
  }

  html select::picker-icon {
    content: "";
    width: 1.1rem;
    height: 1.1rem;
    margin-inline-start: auto;
    background-color: currentColor;
    opacity: .6;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: rotate .2s ease;
  }

  html select:open::picker-icon {
    rotate: 180deg;
  }

  html select::picker(select) {
    appearance: base-select;
    margin-block: 6px;
    padding: 6px;
    border: 1px solid var(--select-menu-border);
    border-radius: 14px;
    background: var(--select-menu-bg);
    color: var(--select-menu-fg);
    box-shadow: var(--select-menu-shadow);
    opacity: 0;
    translate: 0 -4px;
    transition: opacity .16s ease, translate .16s ease, overlay .16s allow-discrete, display .16s allow-discrete;
  }

  html select:open::picker(select) {
    opacity: 1;
    translate: 0 0;
  }

  @starting-style {
    html select:open::picker(select) {
      opacity: 0;
      translate: 0 -4px;
    }
  }

  html select option {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .7rem;
    border-radius: 9px;
    background: transparent;
    color: inherit;
    font-size: .9rem;
    line-height: 1.3;
    cursor: pointer;
    outline: none;
    transition: background-color .15s ease;
  }

  html select option:hover,
  html select option:focus-visible {
    background: var(--select-option-hover);
  }

  html select option:checked {
    color: var(--select-accent);
    font-weight: 600;
  }

  html select option::checkmark {
    order: 1;
    margin-inline-start: auto;
    content: "\2713";
    color: var(--select-accent);
  }
}

@media (prefers-reduced-motion: reduce) {
  html select::picker-icon,
  html select::picker(select),
  html select option {
    transition: none;
  }
}
