/* =======================================================================================
   BOOK-22 — the shared phone field (includes/PhoneField.php + assets/phone-field.js).
   The world-code selector and the number box sit on one line and read as ONE control;
   the number box takes the spare width. The closed selector shows a short name and the
   code (UK +44, Kuwait +965); where the name would crowd a full-length number, only the
   code (the script measures it — BOOK-23). The open list always shows full names.
   Tokens only (--be-*); Canvas is the page's own background. No new colours.
   ======================================================================================= */
.phf { width: 100%; container-type: inline-size; }
.phf-row { display: flex; align-items: stretch; width: 100%; }
.phf-row .phf-num { flex: 1 1 auto; min-width: 0; width: auto; }

/* No script: the plain select stays, beside the box. */
.phf-cc { flex: 0 0 auto; max-width: 45%; margin-right: .35rem; font: inherit; color: var(--be-navy); }

/* With the script (html.phf-js, set before the field is drawn): a button joined to the box. */
.phf-btn { display: none; }
.phf-js .phf-cc { display: none; }
.phf-js .phf-btn {
    display: inline-flex; align-items: center; gap: .3rem;
    flex: 0 1 auto; min-width: 4.4rem; max-width: 48%;
    box-sizing: border-box; padding: 0 .55rem;
    border: 1px solid var(--be-line); border-right-width: 0;
    border-radius: .5rem 0 0 .5rem;
    background: Canvas; color: var(--be-navy);
    font-family: inherit; line-height: 1.2; white-space: nowrap; cursor: pointer;
}
.phf-js .phf-num { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
.phf-js .phf-num { flex-basis: 0; }   /* the box takes what the button leaves, never shares a squeeze */
.phf-btn-name { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.phf-btn-code { flex: 0 0 auto; font-weight: 600; }
.phf-caret::before { content: "\25BE"; color: var(--be-grey); }
.phf-btn:hover { background: var(--be-hover); }
.phf-btn:focus-visible { outline: 2px solid var(--be-navy); outline-offset: 1px; position: relative; z-index: 1; }

/* The message: the form's own error class wins (zero specificity here); a warning is amber. */
:where(.phf-msg) { margin: .25rem 0 0; font-size: .8rem; font-weight: 600; line-height: 1.35; color: var(--be-red); }
.phf[data-state="warn"] .phf-msg { color: var(--be-amber-deep); }

.phf-yes {
    margin-top: .35rem; min-height: 2.25rem; padding: .3rem .8rem;
    border: 1px solid var(--be-navy); border-radius: .45rem;
    background: Canvas; color: var(--be-navy);
    font-family: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.phf-yes:hover { background: var(--be-hover); }
.phf-yes:focus-visible { outline: 2px solid var(--be-navy); outline-offset: 2px; }
.phf-yes-nojs { display: inline-flex; align-items: center; gap: .4rem; margin-top: .35rem; font-size: .85rem; color: var(--be-navy); }

/* The open list — fixed to the window, so a card or folded section cannot cut it off. */
.phf-pop {
    position: fixed; z-index: 1000; box-sizing: border-box;
    padding: .4rem;
    background: Canvas;
    border: 1px solid var(--be-line); border-radius: .6rem;
    box-shadow: 0 10px 28px color-mix(in srgb, var(--be-navy) 22%, transparent);
    font-family: inherit;
}
.phf-search {
    display: block; width: 100%; box-sizing: border-box;
    padding: .5rem .6rem;
    border: 1px solid var(--be-line); border-radius: .45rem;
    background: Canvas; color: var(--be-navy);
    font-family: inherit; font-size: 16px;            /* 16px: iPhone/iPad zoom into anything smaller */
}
.phf-search:focus { outline: 2px solid var(--be-navy); outline-offset: 0; }
.phf-list { list-style: none; margin: .35rem 0 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; }
.phf-opt {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    min-height: 2.5rem; padding: .35rem .55rem; border-radius: .35rem;
    color: var(--be-navy); font-size: .9rem; cursor: pointer;
}
.phf-opt-code { flex: 0 0 auto; color: var(--be-grey); }
.phf-opt[aria-selected="true"] .phf-opt-name { font-weight: 700; }
.phf-opt.phf-act, .phf-opt:hover { background: var(--be-surface); }
.phf-none { margin: .5rem; color: var(--be-grey); font-size: .85rem; }

/* `hidden` must win over the display rules above. */
.phf [hidden], .phf-pop[hidden], .phf-pop [hidden] { display: none !important; }
