/* ======================================================================
   The theme's shared flag picker, egw-diaspora theme 3.14.0: the EGWForms country and dial-code pickers in the kit's
   well look, with drawn flags (assets/js/egw-picker.js adds them). Made from Contact's picker block (contact.css,
   theme 3.12.0, "05 the theme's pickers"), which stays as it is; first used by Join Us, reused by Salvation,
   Testimonies and the policy pages. Load it after global.css and the kit, and give the picker's root the class
   egw-picker inside an .egw-kit ancestor.

   global.css dresses .egw-country-* and .egw-phone-* for the old forms, in light and in dark (through
   [data-theme="dark"], at up to three classes, and through prefers-color-scheme); the rules below sit at three classes
   or more and load after it. Dennis, 2026-10-03 19:08 and 19:09: "all country fields on the site should include the
   country flag in the drop list. also, make the drop list in such a away that every view is in seen all well enough to
   avoid horizontal scrolling. please this be a rule and never forgetten even for future tasks." So: a flag before every
   name and in both buttons; each list as wide as its field (at most 440px), positioned by the field's group (the page
   gives that group position: relative), so it is bounded by the form card and never by the page; names wrap instead of
   clipping; nothing in a list scrolls sideways. The roots are static so the group places the list.
   The look is the approved picker's (Join Us preview v1.4.2, picker.css: Contact's, kit change log 44): the buttons in the
   well look with 16px sides and 12px between their parts, the chosen flag inline before the name or the +code, in the
   button's own font. Buttons and search fields are 44px high; a page whose fields are taller sets its buttons' height
   (Join Us: 52px, in join-us.css). The search field keeps 16px text (kit v1.5: phones zoom into a field whose text is
   smaller).
   ====================================================================== */
.egw-kit .egw-picker.egw-phone-wrap, .egw-kit .egw-picker.egw-country-select { position: static; }
.egw-kit .egw-picker .egw-phone-flag, .egw-kit .egw-picker .egw-phone-option-flag, .egw-kit .egw-picker .egw-country-flag { display: none; }

/* the two buttons: dial code (flag, +code, chevron) and country (flag and name, chevron) */
.egw-kit .egw-picker .egw-phone-country-btn, .egw-kit .egw-picker .egw-country-trigger { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 44px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--r-sm); background: var(--well); box-shadow: var(--well-shadow); color: var(--ink); font: 500 var(--t-base)/1.3 var(--font); font-size: max(1rem, 16px); text-align: left; cursor: pointer; white-space: nowrap; transition: border-color .15s ease, background-color .2s ease, box-shadow .15s ease; }
.egw-kit .egw-picker .egw-phone-country-btn:hover, .egw-kit .egw-picker .egw-country-trigger:hover { background: var(--well); border-color: var(--line-strong); }
.egw-kit .egw-picker .egw-phone-country-btn:focus-visible, .egw-kit .egw-picker .egw-country-trigger:focus-visible,
.egw-kit .egw-picker .egw-phone-country-btn.open, .egw-kit .egw-picker .egw-country-trigger.open { border-color: var(--ink); background: var(--page); box-shadow: 0 0 0 4px var(--tint-2); outline: none; }
.egw-kit .egw-picker .egw-phone-code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: inherit; font-weight: inherit; color: var(--ink); font-variant-numeric: tabular-nums; }
.egw-kit .egw-picker.is-ph .egw-phone-code { color: var(--muted); font-weight: 400; }
.egw-kit .egw-picker .egw-country-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.egw-kit .egw-picker.egw-country-select:not(.has-value) .egw-country-value { color: var(--muted); font-weight: 400; }
.egw-kit .egw-picker .egw-phone-country-btn .chev, .egw-kit .egw-picker .egw-country-trigger .chev { width: 18px; height: 18px; flex: none; color: var(--ink-2); transition: transform .3s var(--ease-spring); }
.egw-kit .egw-picker .egw-phone-country-btn.open .chev, .egw-kit .egw-picker .egw-country-trigger.open .chev { transform: rotate(180deg); }

/* the pop-up: search field on top, list under it */
.egw-kit .egw-picker .egw-phone-dropdown, .egw-kit .egw-picker .egw-country-dropdown { position: absolute; z-index: 40; left: 0; right: auto; top: calc(100% + 8px); width: 100%; max-width: 440px; display: grid; gap: var(--s-2); padding: var(--s-2); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-float); overflow: visible; transform-origin: top left; opacity: 0; scale: .97; translate: 0 -6px; pointer-events: none; visibility: hidden; transition: opacity .18s ease, scale .25s var(--ease-spring), translate .25s var(--ease-out), visibility 0s .25s; }
.egw-kit .egw-picker .egw-phone-dropdown.open, .egw-kit .egw-picker .egw-country-dropdown.open { display: grid; opacity: 1; scale: 1; translate: 0; pointer-events: auto; visibility: visible; transition: opacity .18s ease, scale .25s var(--ease-spring), translate .25s var(--ease-out), visibility 0s; }
.egw-kit .egw-picker .egw-phone-search-wrap, .egw-kit .egw-picker .egw-country-search-wrap { padding: 0; border: 0; background: none; }
.egw-kit .egw-picker .egw-phone-search, .egw-kit .egw-picker .egw-country-search { width: 100%; min-height: 44px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--r-sm); background: var(--well); box-shadow: var(--well-shadow); color: var(--ink); font: 500 var(--t-base)/1.3 var(--font); font-size: max(1rem, 16px); outline: none; }
.egw-kit .egw-picker .egw-phone-search::placeholder, .egw-kit .egw-picker .egw-country-search::placeholder { color: var(--muted); opacity: 1; font-weight: 400; }
.egw-kit .egw-picker .egw-phone-search:focus, .egw-kit .egw-picker .egw-country-search:focus { border-color: var(--ink); background: var(--page); box-shadow: 0 0 0 4px var(--tint-2); outline: none; }
.egw-kit .egw-picker .egw-phone-list, .egw-kit .egw-picker .egw-country-list { position: relative; max-height: 264px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; display: grid; gap: 2px; padding-right: 2px; scrollbar-width: thin; }
.egw-kit .egw-picker .egw-phone-option, .egw-kit .egw-picker .egw-country-option { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 42px; margin: 0; padding: 8px 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); font: 500 var(--t-sm)/1.2 var(--font); text-align: left; cursor: pointer; transition: background-color .1s ease; }
/* the flag: inline-block, as global.css makes every img a block, which would put the chosen country's flag on a line of its
   own above the name */
.egw-kit .egw-picker .flag { display: inline-block; width: 20px; height: 15px; flex: none; border-radius: 2px; object-fit: cover; background: var(--well); box-shadow: 0 0 0 1px var(--line-strong); }
.egw-kit .egw-picker .egw-country-value .flag, .egw-kit .egw-picker .egw-phone-code .flag { vertical-align: -2px; margin-right: 2px; }
.egw-kit .egw-picker .egw-phone-option::after, .egw-kit .egw-picker .egw-country-option::after { content: ""; width: 16px; height: 16px; flex: none; background: currentColor; opacity: 0; transform: scale(.6); transition: opacity .12s ease, transform .3s var(--ease-spring);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7'/%3E%3C/svg%3E") center / 16px 16px no-repeat; }
.egw-kit .egw-picker .egw-phone-option:hover, .egw-kit .egw-picker .egw-phone-option.on, .egw-kit .egw-picker .egw-country-option:hover, .egw-kit .egw-picker .egw-country-option.on { background: var(--well); color: var(--ink); } /* global: rgba hover and .selected tints */
.egw-kit .egw-picker .egw-phone-option.is-sel, .egw-kit .egw-picker .egw-country-option.is-sel { font-weight: 600; }
.egw-kit .egw-picker .egw-phone-option.is-sel::after, .egw-kit .egw-picker .egw-country-option.is-sel::after { opacity: 1; transform: none; }
.egw-kit .egw-picker .egw-phone-option-name, .egw-kit .egw-picker .egw-country-option > span:not(.egw-country-flag):not(.egw-picker-code) { flex: 1; min-width: 0; white-space: normal; overflow-wrap: anywhere; } /* long names wrap */
.egw-kit .egw-picker .egw-phone-option-dial, .egw-kit .egw-picker .egw-picker-code { flex: none; font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.egw-kit .egw-picker .egw-phone-no-results, .egw-kit .egw-picker .egw-country-no-results { margin: 0; padding: var(--s-3) 12px; font: inherit; font-size: var(--t-sm); color: var(--muted); text-align: left; }
/* the countries listed first (opts.popular), then a hairline before the rest, while the search is empty */
.egw-kit .egw-picker .rest-start { position: relative; margin-top: 10px; }
.egw-kit .egw-picker .rest-start::before { content: ""; position: absolute; left: 10px; right: 10px; top: -6px; height: 1px; background: var(--line); }

/* small phones (kit v1.5, change log 43; Contact's 400px and 384px rules): up to 400px the buttons and search fields pad their sides with
   var(--field-pad) (12px; 8px below 385px, the kit's token), as the page's fields do, so a whole entry shows from 360px up */
@media (max-width: 400px) {
  .egw-kit .egw-picker .egw-phone-country-btn, .egw-kit .egw-picker .egw-country-trigger, .egw-kit .egw-picker .egw-phone-search, .egw-kit .egw-picker .egw-country-search { padding-inline: var(--field-pad, 12px); }
}
@media (prefers-reduced-motion: reduce) {
  .egw-kit .egw-picker .egw-phone-dropdown, .egw-kit .egw-picker .egw-country-dropdown,
  .egw-kit .egw-picker .egw-phone-dropdown.open, .egw-kit .egw-picker .egw-country-dropdown.open { scale: 1; translate: 0; transition: opacity .12s ease, visibility 0s; }
  .egw-kit .egw-picker .chev, .egw-kit .egw-picker .egw-phone-option::after, .egw-kit .egw-picker .egw-country-option::after { transition: none; }
}
