/*
 * R13 slide-out (inc/slideout.php): a hire-orange "Contact Us" tab on the right-hand
 * edge and a panel that slides in from the right with the form card. Both are fixed,
 * so they never move the page. Stacking: tab under the sticky header (100); panel and
 * backdrop above it; the cookie banner (CookieYes, 9999999) stays above everything.
 */

.tr-slideout__tab {
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 90;
    margin: 0;
    padding: 16px 10px;
    writing-mode: vertical-rl;
    transform: translateY(-50%) rotate(180deg);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.01em;
    color: var(--tr-black, #1C1C1C);
    background-color: var(--tr-hire-orange, #E8632A);
    border: 0;
    /* rotated 180deg, so these are the visible left-hand corners */
    border-radius: 0 var(--tr-radius-field, 8px) var(--tr-radius-field, 8px) 0;
    box-shadow: 0 2px 10px rgba(28, 28, 28, 0.18);
    cursor: pointer;
    transition: background-color 180ms ease, opacity 180ms ease, visibility 0s linear 0s;
}

.tr-slideout__tab:hover {
    color: var(--tr-black, #1C1C1C);
    background-color: var(--tr-hire-hover, #F07A45);
}

.tr-slideout__tab:focus-visible {
    outline: 3px solid var(--tr-black, #1C1C1C);
    outline-offset: 2px;
}

/* Stepping aside while another form or the cookie banner is under it, or the panel is open */
.tr-slideout__tab.is-aside,
.tr-slideout.is-open .tr-slideout__tab {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
}

.tr-slideout__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background-color: rgba(28, 28, 28, 0.55);
    opacity: 0;
    transition: opacity 220ms ease;
}

.tr-slideout__backdrop[hidden] {
    display: none;
}

.tr-slideout.is-open .tr-slideout__backdrop {
    opacity: 1;
}

.tr-slideout__panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    box-sizing: border-box;
    width: min(440px, 100%);
    padding: 64px clamp(16px, 3vw, 28px) calc(24px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    color: var(--tr-cream, #FFFDF7);
    background-color: var(--tr-black, #1C1C1C);
    box-shadow: -8px 0 32px rgba(28, 28, 28, 0.25);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 260ms var(--tr-ease-out, cubic-bezier(0.22, 1, 0.36, 1)), visibility 0s linear 260ms;
}

.tr-slideout.is-open .tr-slideout__panel {
    transform: none;
    visibility: visible;
    transition: transform 260ms var(--tr-ease-out, cubic-bezier(0.22, 1, 0.36, 1)), visibility 0s linear 0s;
}

.tr-slideout__panel:focus {
    outline: none;
}

.tr-slideout__close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    color: var(--tr-cream, #FFFDF7);
    background: transparent;
    border: 1px solid rgba(255, 253, 247, 0.35);
    border-radius: 50%;
    cursor: pointer;
}

.tr-slideout__close:hover {
    color: var(--tr-black, #1C1C1C);
    background-color: var(--tr-cream, #FFFDF7);
}

.tr-slideout__close:focus-visible {
    outline: 3px solid var(--tr-tan, #C8A87A);
    outline-offset: 2px;
}

.tr-slideout .tr-form-card--slideout {
    margin: 0;
}

/* Phones: a slimmer tab; the panel takes the full screen */
@media (max-width: 719px) {
    /* about 24px wide: it covers the 16px gutter and only a few pixels of the text */
    .tr-slideout__tab {
        top: 58%;
        padding: 10px 5px;
        font-size: 0.8125rem;
        letter-spacing: 0.02em;
    }

    .tr-slideout__panel {
        width: 100%;
        padding-top: 60px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tr-slideout__tab,
    .tr-slideout__backdrop,
    .tr-slideout__panel,
    .tr-slideout.is-open .tr-slideout__panel {
        transition: none;
    }
}

@media print {
    .tr-slideout {
        display: none;
    }
}
