/**
 * DigiknackSelect — custom face + listbox for <select>.
 * Cream value, pink chevron 4px after text, Digiknack dark panel (not OS picker).
 * Pair with public/js/dk-select.js (window.DigiknackSelect).
 *
 *   <select class="contact-input" data-dk-select>
 *     <option value="">Select</option>
 *   </select>
 *
 * Note: the listbox panel is portaled to document.body, so panel tokens must live
 * on :root / .dk-select__panel — not only on .dk-select.
 */

:root {
  --dk-select-ink: var(--admin-nav-idle, #e3dbcc);
  --dk-select-muted: rgba(227, 219, 204, 0.5);
  --dk-select-accent: var(--cal-accent, #f2133c);
  --dk-select-icon-gap: 4px;
  --dk-select-panel: #0a0a0a;
  --dk-select-border: rgba(227, 219, 204, 0.22);
  --dk-select-hover: color-mix(in srgb, var(--cal-accent, #f2133c) 12%, transparent);
  --dk-select-selected: color-mix(in srgb, var(--cal-accent, #f2133c) 18%, #0a0a0a);
  --dk-select-selected-hover: color-mix(in srgb, var(--cal-accent, #f2133c) 28%, #0a0a0a);
}

.dk-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  vertical-align: middle;
  box-sizing: border-box;
}

.dk-select__trigger {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.dk-select__trigger:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.dk-select__trigger:focus,
.dk-select__trigger:focus-visible {
  outline: none;
}

.dk-select.is-open .dk-select__icon {
  transform: rotate(180deg);
}

.dk-select__face {
  display: inline-flex;
  align-items: center;
  gap: var(--dk-select-icon-gap);
  max-width: 100%;
  min-width: 0;
  color: var(--dk-select-ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.2;
  text-transform: none;
}

.dk-select__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dk-select-ink);
}

.dk-select__value.is-placeholder {
  color: var(--dk-select-muted);
}

.dk-select__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--dk-select-accent);
  line-height: 0;
  transition: transform 0.15s ease;
}

.dk-select__icon svg,
.dk-select__icon i {
  width: 14px;
  height: 14px;
  display: block;
  stroke: currentColor;
}

/* Visually hidden native select — keeps value/options for forms + JS */
.dk-select__native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

/* Stretch face to field width; chevron still 4px after the value text (not far right) */
.dk-select--block {
  display: flex;
  width: 100%;
}

.dk-select--block .dk-select__trigger,
.dk-select--block .dk-select__face {
  width: max-content;
  max-width: 100%;
}

.dk-select--end {
  width: 100%;
  justify-content: flex-end;
}

.dk-select--end .dk-select__trigger {
  margin-left: auto;
}

.dk-select--end .dk-select__value {
  text-align: right;
}

/* Inside DigiknackField */
.dk-field > .dk-select {
  width: max-content;
  max-width: 100%;
}

.dk-field--end > .dk-select {
  width: 100%;
  justify-content: flex-end;
}

/* Custom listbox panel (portaled to body — keep fill here, not only on .dk-select) */
.dk-select__panel {
  --dk-select-panel: #0a0a0a;
  --dk-select-border: rgba(227, 219, 204, 0.22);
  --dk-select-hover: color-mix(in srgb, var(--cal-accent, #f2133c) 12%, transparent);
  --dk-select-selected: color-mix(in srgb, var(--cal-accent, #f2133c) 18%, #0a0a0a);
  --dk-select-selected-hover: color-mix(in srgb, var(--cal-accent, #f2133c) 28%, #0a0a0a);
  --dk-select-ink: var(--admin-nav-idle, #e3dbcc);
  --dk-select-accent: var(--cal-accent, #f2133c);
  position: fixed;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(320px, calc(100vh - 24px));
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--dk-select-border, rgba(227, 219, 204, 0.22));
  border-radius: 12px;
  background-color: #0a0a0a;
  background-color: var(--dk-select-panel, #0a0a0a);
  background-image: none;
  opacity: 1;
  isolation: isolate;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.75);
  box-sizing: border-box;
  color: var(--dk-select-ink, #e3dbcc);
  -webkit-overflow-scrolling: touch;
}

.dk-select__panel[hidden] {
  display: none !important;
}

.dk-select__option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--dk-select-ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.dk-select__option:hover:not(:disabled),
.dk-select__option.is-active:not(:disabled) {
  background: var(--dk-select-hover, rgba(227, 219, 204, 0.1));
}

.dk-select__option.is-selected {
  background: var(--dk-select-selected);
  color: var(--dk-select-ink, #e3dbcc);
}

.dk-select__option.is-selected.is-active,
.dk-select__option.is-selected:hover:not(:disabled) {
  background: var(--dk-select-selected-hover);
}

.dk-select__option:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dk-select__option:focus,
.dk-select__option:focus-visible {
  outline: none;
}

.dk-select__check {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--dk-select-accent);
  line-height: 0;
}

.dk-select__check svg,
.dk-select__check i {
  width: 14px;
  height: 14px;
  display: block;
  stroke: currentColor;
}

.dk-select__option:not(.is-selected) .dk-select__check {
  visibility: hidden;
}

.dk-select__option-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
