/* Profile banner (6 Nov 2026): the banner at the top of a candidate's public
   profile, an employer's My Profile and its public company page, with the
   owner's Edit banner / Remove tools and the crop dialog
   (frontend/js/profile-banner.js, <x-profile-banner>).

   The box takes the banner's own shape (--pb-ratio, set from the
   component's ratio: candidates 4:1 saved at 1584 x 396, companies 8:1
   saved at 1584 x 198), the shape it is cropped and saved in, so the area
   cropped in the dialog is exactly the area shown. Never cap the box's
   height: object-fit: cover would then trim the saved crop again. A banner
   saved in another shape before (employers' were 1920 x 312) is shown
   centred and cropped to fit, as before. */

.pb {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: var(--pb-ratio, 4 / 1);
    background: var(--pb-empty, linear-gradient(120deg, #3664D1 0%, #1d4ed8 55%, #1e3a8a 100%));
}
@supports not (aspect-ratio: 4 / 1) {
    .pb { height: 0; padding-top: var(--pb-pad, 25%); }
}
.pb__img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.pb.is-busy .pb__img { opacity: .6; }

/* The owner's tools, top-right, clear of a photo or logo at the bottom-left. */
.pb__tools { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; gap: 8px; }
.pb__file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.pb__btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 13px; border: 0; border-radius: 999px;
    background: rgba(255, 255, 255, .92); color: #121A2B;
    font-size: 13px; font-weight: 650; line-height: 1; cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
}
.pb__btn:hover { background: #fff; }
.pb__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 4px rgba(18, 26, 43, .55); }
.pb__btn:disabled { cursor: progress; opacity: .85; }
.pb__btn--icon { width: 34px; padding: 0; }
.pb__btn[hidden] { display: none; }
.pb__btn i { font-size: 16px; }

@media (max-width: 575.98px) {
    .pb__tools { top: 8px; right: 8px; gap: 6px; }
    /* Icon-only; the name stays in aria-label. */
    .pb__label { display: none; }
    .pb__btn { width: 34px; padding: 0; }
}

/* ===== The crop dialog ===== */
.pb-dlg {
    width: min(760px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    padding: 0; border: 0; border-radius: 16px;
    background: #fff; color: #0f172a;
    box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .45);
}
.pb-dlg[open] { display: flex; flex-direction: column; }
.pb-dlg::backdrop { background: rgba(15, 23, 42, .62); }
.pb-dlg__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #e2e8f0; }
.pb-dlg__title { margin: 0; font-size: 18px; font-weight: 700; color: #0f172a; }
.pb-dlg__x { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #475569; font-size: 20px; cursor: pointer; }
.pb-dlg__x:hover { background: #f1f5f9; color: #0f172a; }
.pb-dlg__body { padding: 16px 20px; overflow: auto; }
.pb-dlg__hint { margin: 0 0 10px; font-size: 13px; color: #64748b; }

/* The crop area (10 Nov 2026): a 5:2 stage with the banner's 4:1 frame
   fixed in the middle, labelled. The picture moves and zooms underneath;
   what falls outside the frame stays in view, dimmed, as the part that is
   cut off. */
.pb-dlg__stage { position: relative; width: 100%; aspect-ratio: 5 / 2; overflow: hidden; border-radius: 10px; background: #0f172a; touch-action: none; cursor: grab; }
@supports not (aspect-ratio: 5 / 2) {
    .pb-dlg__stage { height: 0; padding-top: 40%; }
    .pb-dlg__stage > .cropper-container { position: absolute; inset: 0; }
}
.pb-dlg__stage:active { cursor: grabbing; }
.pb-dlg__stage img { display: block; max-width: 100%; }
.pb-dlg__stage .cropper-modal { background: #0f172a; opacity: .62; }
.pb-dlg__stage .cropper-view-box { outline: 0; box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(15, 23, 42, .35); }
.pb-dlg__stage .cropper-face { background: transparent; }
.pb-dlg__stage .cropper-dashed { border-color: rgba(255, 255, 255, .7); opacity: .55; }
.pb-dlg__stage .cropper-line, .pb-dlg__stage .cropper-point { display: none; }
.pb-dlg__tag {
    position: absolute; top: 6px; left: 6px; z-index: 1; pointer-events: none;
    padding: 3px 8px; border-radius: 999px;
    background: rgba(15, 23, 42, .72); color: #fff;
    font-size: 11.5px; font-weight: 650; line-height: 1.3; white-space: nowrap;
}
.pb-dlg__legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin: 8px 0 0; font-size: 12.5px; color: #475569; }
.pb-dlg__key { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.pb-dlg__key--in { background: #f59e0b; box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px #0f172a; }
.pb-dlg__key--out { margin-left: 8px; background: #64748b; }

.pb-dlg__zoom { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; }
.pb-dlg__zoom input[type="range"] { flex: 1; min-width: 0; accent-color: #1d4ed8; }
.pb-dlg__icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border: 1px solid #cbd5e1; border-radius: 50%; background: #fff; color: #0f172a; font-size: 17px; cursor: pointer; }
.pb-dlg__icon:hover { background: #f1f5f9; }
.pb-dlg__icon:focus-visible, .pb-dlg__x:focus-visible, .pb-dlg__btn:focus-visible { outline: 3px solid #3664d1; outline-offset: 2px; }

/* The live preview: the banner as the profile shows it. */
.pb-dlg__label { display: block; margin: 16px 0 8px; font-size: 13px; font-weight: 650; color: #334155; }
.pb-dlg__mock { max-width: 520px; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; }
.pb-dlg__preview { position: relative; width: 100%; aspect-ratio: var(--pb-ratio, 4 / 1); overflow: hidden; background: #e2e8f0; }
.pb-dlg__mock-head { display: flex; align-items: flex-end; gap: 10px; padding: 0 12px 12px; }
.pb-dlg__ghost { position: relative; z-index: 1; width: 64px; height: 64px; margin-top: -32px; flex-shrink: 0; border: 3px solid #fff; border-radius: 50%; background: #cbd5e1; }
.pb-dlg__lines { flex: 1; padding-bottom: 4px; }
.pb-dlg__lines span { display: block; height: 8px; border-radius: 4px; background: #e2e8f0; }
.pb-dlg__lines span + span { width: 60%; margin-top: 6px; }

.pb-dlg__foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid #e2e8f0; flex-wrap: wrap; }
.pb-dlg__spacer { flex: 1; }
.pb-dlg__btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 650; cursor: pointer; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; }
.pb-dlg__btn:hover { background: #f8fafc; }
.pb-dlg__btn--primary { border-color: #1d4ed8; background: #1d4ed8; color: #fff; }
.pb-dlg__btn--primary:hover { background: #1e40af; }
.pb-dlg__btn:disabled { opacity: .6; cursor: not-allowed; }

@media (max-width: 575.98px) {
    .pb-dlg { width: calc(100vw - 16px); max-height: calc(100vh - 16px); border-radius: 12px; }
    .pb-dlg__head, .pb-dlg__body, .pb-dlg__foot { padding-left: 14px; padding-right: 14px; }
    .pb-dlg__foot .pb-dlg__spacer { display: none; }
    .pb-dlg__foot .pb-dlg__btn { flex: 1 1 auto; }
}
