/* ============================================================
   Slide-over job panel for careers.html. Pure UI chrome: opening a
   job loads job.html into the iframe below (a fresh page load each
   time -- see assets/js/job-panel.js), so the apply form and its
   CV auto-fill keep their normal one-load-per-job lifecycle
   untouched. careers.html's own listing markup/behaviour is
   unchanged; this only adds the panel on top of it.
   Same architecture as PowerVacMEP's job-panel.css; AAGH's own dark
   theme instead of a light panel popping out of a dark page.
   ============================================================ */

/* Stacking + background lock + blur while the panel is open.
   Raised to the two highest z-index values the spec allows (2147483647 is
   the max 32-bit signed int every engine clamps to) so the panel and its
   backdrop stay on top of this page's own fixed-position header (.site-header,
   z-index: 1000 or similar) and any floating widgets, not a number nudged
   just above today's highest. */
#job-panel-backdrop {
    position: fixed; inset: 0;
    background: rgba(10, 8, 5, .6);
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease, -webkit-backdrop-filter .25s ease, backdrop-filter .25s ease;
    z-index: 2147483646;
}
#job-panel-backdrop.is-open {
    opacity: 1; pointer-events: auto;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

#job-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(960px, 94vw);
    background: #221d14;
    box-shadow: -24px 0 60px -20px rgba(0, 0, 0, .55);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.2, .8, .2, 1);
    z-index: 2147483647;
    display: flex; flex-direction: column;
}
#job-panel.is-open { transform: translateX(0); }

/* A real flex row above the iframe, not an overlay on top of it -- so it
   can never be scrolled away (the iframe's own scrolling is entirely
   below it) and the title and close icon always share one line, flush
   with each other end to end. */
#job-panel-header {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    height: 68px;
    /* Same padding-inline as .apply-container/.career-hero__container
       (career-redesign.css's --apply-container-pad, 16px). */
    padding-inline: 16px;
    background: #1a160f; border-bottom: 1px solid rgba(253,253,255,.14);
}
#job-panel-title {
    font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 16px; font-weight: 700; color: rgb(253 253 255);
    min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#job-panel-close {
    all: unset;
    flex: 0 0 auto;
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(255,255,255,.06); border: 1px solid rgba(253,253,255,.2);
    color: rgb(226 221 206); font-size: 16px; cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
#job-panel-close:hover { background: rgba(218,165,32,.18); color: #f0cf6c; }

#job-panel-frame {
    flex: 1 1 auto; width: 100%; height: 100%;
    border: none; background: #221d14;
    /* The iframe scrolls its own document internally; this stops that
       scroll from "chaining" into the page behind once it hits the end,
       which overflow:hidden on body alone does not prevent. */
    overscroll-behavior: contain;
}

/* Background lock while the panel is open. :has() lets <html> react to the
   existing body.job-panel-open class (already toggled by job-panel.js, see
   openJobPanel()/closeJobPanel()) without adding any new class of our own.
   scrollbar-gutter: stable reserves the scrollbar's own width at all times,
   so hiding it here never shifts the layout by that width -- no scroll
   position bookkeeping needed either: overflow:hidden only refuses further
   scrolling, it never moves the page, so the exact same scrollTop is still
   there the moment job-panel-open is removed and overflow is allowed again. */
html:has(body.job-panel-open) {
    overflow: hidden;
    scrollbar-gutter: stable;
}
body.job-panel-open {
    overflow: hidden;
    overscroll-behavior: contain;
    touch-action: none;
}
/* The panel's own chrome (header, close button) must stay interactive even
   though the rest of the page is locked via touch-action: none above. */
body.job-panel-open #job-panel,
body.job-panel-open #job-panel * { touch-action: auto; }

@media (max-width: 640px) {
    #job-panel { width: 100vw; }
}
