/* CoralGrid — every dropdown in the brand's skin.
   Where the browser lets a <select>'s list be styled (customizable select:
   Chrome / Edge / Android WebView 135+): the field with its text in the middle
   and a thin chevron that turns coral and flips while open; the list a white
   panel that fades in, at most 20rem tall with a slim scrollbar, the option
   under the pointer tinted coral and the chosen one filled with it.
   Elsewhere (Firefox, Safari, an older WebView) the field gets the same
   chevron and the list stays the system's. globals.css gives every select the
   coral accent and focus ring.

   Served as is from /public, linked in app/layout.tsx: Next's CSS compiler
   drops these selectors (::picker(select), ::picker-icon, ::checkmark, :open)
   and the whole block with them, so they cannot live in globals.css.
   Unlayered, so it wins over the Tailwind utilities the selects are written
   with — it sets only what those leave alone (and the room for the chevron). */

:root {
  --cg-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --cg-chevron-slate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

@supports (appearance: base-select) {
  select:not([multiple]):not([size]),
  select:not([multiple]):not([size])::picker(select) {
    appearance: base-select;
  }

  /* The field. */
  select:not([multiple]):not([size]) {
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
  }
  select:not([multiple]):not([size]):disabled {
    cursor: not-allowed;
  }
  select:not([multiple]):not([size]):open {
    border-color: #ff6b5b;
    box-shadow: 0 0 0 1px #ff6b5b;
  }
  select:not([multiple]):not([size])::picker-icon {
    content: "";
    flex: none;
    width: 0.9rem;
    height: 0.9rem;
    margin-inline-start: auto;
    background-color: #94a3b8;
    -webkit-mask: var(--cg-chevron) center / contain no-repeat;
    mask: var(--cg-chevron) center / contain no-repeat;
    transition:
      rotate 0.15s ease,
      background-color 0.15s ease;
  }
  select:not([multiple]):not([size]):hover:not(:disabled)::picker-icon {
    background-color: #64748b;
  }
  select:not([multiple]):not([size]):open::picker-icon {
    background-color: #ff6b5b;
    rotate: 180deg;
  }

  /* The list. */
  select:not([multiple]):not([size])::picker(select) {
    margin-block: 0.25rem;
    padding: 0.25rem;
    max-height: min(20rem, 60vh);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    background: #fff;
    box-shadow:
      0 10px 15px -3px rgb(15 23 42 / 0.12),
      0 4px 6px -4px rgb(15 23 42 / 0.1);
    opacity: 1;
    translate: 0 0;
    transition:
      opacity 0.12s ease,
      translate 0.12s ease,
      display 0.12s allow-discrete,
      overlay 0.12s allow-discrete;
  }
  select:not([multiple]):not([size]):not(:open)::picker(select) {
    opacity: 0;
    translate: 0 -0.25rem;
  }
  @starting-style {
    select:not([multiple]):not([size]):open::picker(select) {
      opacity: 0;
      translate: 0 -0.25rem;
    }
  }
  select:not([multiple]):not([size]) option {
    padding: 0.45rem 0.65rem;
    border-radius: 0.4rem;
    color: #0f172a;
  }
  select:not([multiple]):not([size]) option:hover,
  select:not([multiple]):not([size]) option:focus-visible {
    outline: none;
    background: #fff1ef;
    color: #c23b2b;
  }
  select:not([multiple]):not([size]) option:checked {
    background: #ff6b5b;
    color: #fff;
  }
  select:not([multiple]):not([size]) option:disabled {
    color: #94a3b8;
    background: none;
    cursor: not-allowed;
  }
  /* The fill marks the choice; no tick beside it. */
  select:not([multiple]):not([size]) option::checkmark {
    display: none;
  }

  @media (prefers-reduced-motion: reduce) {
    select:not([multiple]):not([size])::picker(select),
    select:not([multiple]):not([size])::picker-icon {
      transition: none;
    }
  }
}

/* No customizable select: the system's list, the same chevron on the field. */
@supports not (appearance: base-select) {
  select:not([multiple]):not([size]) {
    -webkit-appearance: none;
    appearance: none;
    background-image: var(--cg-chevron-slate);
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 0.9rem 0.9rem;
    padding-inline-end: 2rem;
    cursor: pointer;
  }
  select:not([multiple]):not([size]):disabled {
    cursor: not-allowed;
  }
}
