/* =====================================================================
   The site's own dropdown (assets/js/select.js) and number fields.
   Every <select> keeps working as a form control; only what is drawn changes.
   Self-contained colours so the same file serves the site pages and the reader.
   ===================================================================== */
:root {
  --sel-surface: #fffdf8;
  --sel-text: #17241f;
  --sel-muted: #6c7a72;
  --sel-line: rgba(120, 96, 50, .28);
  --sel-hover: rgba(195, 160, 90, .16);
  --sel-on: rgba(14, 59, 46, .08);
  --sel-mark: #8f6c2c;
  --sel-ring: rgba(195, 160, 90, .45);
  --sel-shadow: 0 18px 44px -14px rgba(8, 41, 32, .38), 0 6px 14px -8px rgba(8, 41, 32, .22);
  --sel-thumb: rgba(143, 108, 44, .45);
}
[data-theme="dark"] {
  --sel-surface: #0d2a21;
  --sel-text: #f2e9d2;
  --sel-muted: #a9b8ae;
  --sel-line: rgba(230, 207, 156, .26);
  --sel-hover: rgba(230, 207, 156, .12);
  --sel-on: rgba(230, 207, 156, .08);
  --sel-mark: #e6cf9c;
  --sel-ring: rgba(230, 207, 156, .5);
  --sel-shadow: 0 22px 50px -14px rgba(0, 0, 0, .7), 0 6px 16px -8px rgba(0, 0, 0, .5);
  --sel-thumb: rgba(230, 207, 156, .35);
}

/* ---- the control: the real <select> stays in the box (it sets the width) but is not drawn ---- */
.nq-select { position: relative; display: inline-grid; vertical-align: middle; min-width: 0; max-width: 100%; }
.nq-select.is-fill { display: grid; width: 100%; }
.nq-select > select, .nq-select > .nq-select__btn { grid-area: 1 / 1; min-width: 0; }
.nq-select > select { visibility: hidden; pointer-events: none; }
.nq-select > .nq-select__btn {
  display: flex; align-items: center; justify-content: space-between; gap: .6em;
  width: 100%; margin: 0; text-align: start; cursor: pointer; line-height: inherit;
  background-image: none !important; appearance: none; -webkit-appearance: none;
  padding-inline-end: .85em; white-space: nowrap; overflow: hidden;
}
/* the select's own bottom/top margin stays on the hidden select; the button must not double it */
.nq-select > .nq-select__btn[class] { margin-block: 0; }
.nq-select__label { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nq-select__chev { flex: none; width: .8em; height: .8em; color: var(--sel-mark); transition: transform .18s cubic-bezier(.2, .8, .2, 1); }
.nq-select__btn[aria-expanded="true"] .nq-select__chev { transform: rotate(180deg); }
.nq-select__btn:focus-visible { outline: 2px solid var(--sel-ring); outline-offset: 2px; }
.nq-select__btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- the list ---- */
.nq-select__pop {
  position: fixed; z-index: 2147483000; box-sizing: border-box;
  margin: 0; padding: 6px; list-style: none;
  background: var(--sel-surface); color: var(--sel-text);
  border: 1px solid var(--sel-line); border-radius: 14px; box-shadow: var(--sel-shadow);
  max-height: min(340px, 60vh); overflow-y: auto; overscroll-behavior: contain;
  font: 500 .95rem/1.5 "Tajawal", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  scrollbar-width: thin; scrollbar-color: var(--sel-thumb) transparent;
  opacity: 0; transform: translateY(-6px); transition: opacity .14s ease-out, transform .18s cubic-bezier(.2, .8, .2, 1);
}
.nq-select__pop.is-up { transform: translateY(6px); }
.nq-select__pop.is-open { opacity: 1; transform: none; }
.nq-select__pop::-webkit-scrollbar { width: 8px; }
.nq-select__pop::-webkit-scrollbar-thumb { background: var(--sel-thumb); border-radius: 8px; border: 2px solid var(--sel-surface); }
.nq-select__opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 42px; padding: 8px 12px; border-radius: 9px; cursor: pointer; user-select: none;
  scroll-margin: 6px;
}
.nq-select__opt + .nq-select__opt { margin-top: 2px; }
.nq-select__opt.is-active { background: var(--sel-hover); }
.nq-select__opt[aria-selected="true"] { background: var(--sel-on); font-weight: 700; }
.nq-select__opt[aria-selected="true"].is-active { background: var(--sel-hover); }
.nq-select__opt[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.nq-select__tick { flex: none; width: 1em; height: 1em; color: var(--sel-mark); visibility: hidden; }
.nq-select__opt[aria-selected="true"] .nq-select__tick { visibility: visible; }
.nq-select__group { padding: 10px 12px 4px; font-size: .78rem; font-weight: 700; color: var(--sel-muted); }
.nq-select__pop:focus { outline: none; }
@media (prefers-reduced-motion: reduce) {
  .nq-select__pop, .nq-select__chev { transition: none; }
}
@media (forced-colors: active) {
  .nq-select__opt.is-active { outline: 2px solid Highlight; }
}

/* ---- number fields: no browser spinner; the field is typed into or stepped with the arrow keys ---- */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
