/* GS WAPF Help Sidebar — slide-in panel replacing the WAPF tooltip bubble. */

.gs-help {
    position: fixed;
    inset: 0;
    z-index: 999999; /* above the sticky header and the WAPF totals bar */
}
.gs-help[hidden] { display: none; }

.gs-help__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, .45);
    opacity: 0;
    transition: opacity .25s ease;
}

.gs-help__panel {
    position: absolute;
    top: 0;
    left: 0;                       /* slides in from the LEFT */
    bottom: 0;
    width: min(420px, 88vw);
    max-width: 100%;
    background: #fff;
    color: #1d1d1f;
    box-shadow: 4px 0 28px rgba(0, 0, 0, .18);
    padding: 28px 26px 32px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.32, .72, 0, 1);
    outline: none;
}

/* .is-open is set one frame after unhiding so the transition actually runs */
.gs-help.is-open .gs-help__overlay { opacity: 1; }
.gs-help.is-open .gs-help__panel  { transform: translateX(0); }

/* ID-prefixed: the theme styles bare <button> elements (red pill), which would
   otherwise win over a plain class selector and turn the X into a red circle. */
#gs-help .gs-help__close {
    position: absolute;
    top: 12px;
    right: 12px;                   /* close X sits top-RIGHT of the panel */
    width: 40px;
    height: 40px;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    background-color: transparent;
    box-shadow: none;
    color: #1d1d1f;
    font-size: 0;
    cursor: pointer;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    transition: background-color .15s ease;
}
#gs-help .gs-help__close:hover,
#gs-help .gs-help__close:focus-visible {
    background: rgba(0, 0, 0, .08);
    background-color: rgba(0, 0, 0, .08);
    color: #1d1d1f;
}
#gs-help .gs-help__close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
#gs-help .gs-help__close svg { display: block; }

.gs-help__title {
    margin: 0 44px 14px 0;         /* clear the close button */
    font-size: 1.15rem;
    line-height: 1.3;
    font-weight: 700;
}

.gs-help__body {
    font-size: .95rem;
    line-height: 1.6;
    overflow-wrap: break-word;
}
.gs-help__body > *:first-child { margin-top: 0; }
.gs-help__body > *:last-child  { margin-bottom: 0; }
.gs-help__body img { max-width: 100%; height: auto; }
.gs-help__body a   { text-decoration: underline; }

/* The trigger is a real button now — keep WAPF's look, add affordance. */
.wapf .wapf-tt-icon[data-gs-help-trigger] { cursor: pointer; }
.wapf .wapf-tt-icon[data-gs-help-trigger]:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 50%;
}

/* Prevent background scroll while the sidebar is open. */
html.gs-help-open, body.gs-help-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    .gs-help__overlay,
    .gs-help__panel { transition: none; }
}
