/* One dropdown for the whole site -- see web/dropdown.js.
 *
 * Linked by index.html (studio) and panel.html (order desk) BEFORE each page's
 * own stylesheet, so a page can still tune a control but never has to redraw
 * one. Every colour here is a token both pages define, with a fallback so a
 * third page could link this file alone.
 *
 * The language is the site's: a graphite field with a hairline, a rounded
 * trigger, and one lifted neutral slab for what is chosen. No accent hue -- a
 * dropdown says what is set, not whether it is good. */

/* -------------------------------------------------- the floating list shell */

.popover {
  position: fixed;                    /* on <body>, placed against the anchor */
  z-index: 200;
  min-width: 190px;
  max-width: min(280px, 86vw);        /* never overflow a narrow panel */
  padding: 12px;
  background: var(--pop-face, #191919);
  border: 1px solid var(--line, rgba(255, 255, 255, 0.07));
  border-radius: 12px;
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.7),
              0 2px 8px -2px rgba(0, 0, 0, 0.5);
}

.popover.select-pop {
  min-width: 132px;
  max-height: min(60vh, 420px);
  overflow: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.select-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink, rgba(255, 255, 255, 0.95));
  font-family: inherit;
  font-size: 13px;
  letter-spacing: -0.005em;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.select-item-text { flex: 1 1 auto; }
/* A status dot, when the list is naming coloured states rather than values. */
.select-dot {
  flex: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.select-item:hover, .select-item:focus-visible { background: var(--field-hover, rgba(255, 255, 255, 0.07)); }
.select-item:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.55); outline-offset: -2px; }
/* An option the schema greys out: still listed, so the reader sees it exists
   and the tooltip says what it needs, but it does not light up or pick. */
.select-item.is-off {
  opacity: 0.38;
  cursor: not-allowed;
}
.select-item.is-off:hover { background: none; }
/* What is chosen: a lifted neutral slab and full-strength ink, plus a tick, so
   the row reads as set at a glance and in greyscale. */
.select-item.is-selected {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink, rgba(255, 255, 255, 0.95));
}
.select-item.is-selected::after {
  content: "";
  flex: none;
  width: 11px; height: 6px;
  margin-left: 4px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(-45deg);
}

/* ------------------------------------------------------------- the trigger */

.select-trigger {
  grid-column: 1 / -1;
  margin-top: 8px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong, rgba(255, 255, 255, 0.13));
  border-radius: var(--radius-ctl, 10px);
  background: var(--field, #1b1b1b);
  color: var(--ink, rgba(255, 255, 255, 0.95));
  font-family: inherit;
  font-size: 13px;
  letter-spacing: -0.005em;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.select-trigger:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: var(--field-hover, #202020);
}
/* Neutral, like every other focus ring on the site: a brighter hairline and a
   soft white halo, never a hue. */
.select-trigger:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}
.select-trigger:disabled { opacity: 0.5; cursor: not-allowed; }
.select-value { flex: 1 1 auto; }
.select-caret {
  flex: none;
  width: 8px; height: 8px;
  margin-left: 2px;
  border-right: 1.5px solid var(--ink-dim, rgba(255, 255, 255, 0.5));
  border-bottom: 1.5px solid var(--ink-dim, rgba(255, 255, 255, 0.5));
  transform: translateY(-2px) rotate(45deg);
}
.select-trigger:hover .select-caret {
  border-color: var(--ink, rgba(255, 255, 255, 0.95));
}

/* Inline variant: a compact pill for a toolbar or a table cell. */
.select-inline { display: inline-flex; }
.select-trigger-mini {
  grid-column: auto;
  margin-top: 0;
  width: auto;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  letter-spacing: 0.02em;
}
.select-trigger-mini .select-caret { width: 6px; height: 6px; }

/* A native control kept for its value and its change event, out of the layout. */
.native-hidden {
  position: absolute !important;
  width: 1px !important; height: 1px;
  min-width: 0 !important; max-width: 1px !important;   /* a page's own .select sizing loses */
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Raw enum values arrive as "round rect"; authored labels ("All parts combined,
   in colour", "Waiting on quote") arrive written. Capitalising is the default
   because most lists are the former; `select-plain` opts a control out. */
.select-value, .select-item-text { text-transform: capitalize; }
.select-plain .select-value,
.select-pop.is-plain .select-item-text { text-transform: none; }

/* A group heading inside a list (an enhanced <optgroup>: a printer maker). */
.select-group {
  padding: 10px 10px 4px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint, rgba(255, 255, 255, 0.34));
  pointer-events: none;
}
.select-group:first-child { padding-top: 4px; }

/* Long lists scroll with a thin dark bar, not the system's white one. */
.popover {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.popover::-webkit-scrollbar { width: 8px; }
.popover::-webkit-scrollbar-track { background: transparent; }
.popover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
