/* The designer's in-page help panel (#help-panel, templates/app/designer/_helpPanel.html.twig).
 * Design: the design channel, "Designer help panel", canvas v53 (HelpSpec board). Literal token
 * values, so it looks the same on pages that don't load base.css.
 *   ink-950 #080C1E  ink-900 #0B1026  ink-800 #121A3A  ink-700 #1C254F  ink-600 #293360
 *   ink-500 #3E4879  ink-400 #5C6599  ink-300 #8A8FAE  ink-200 #B4B8D2  ink-100 #EBECF5
 *   gold-400 #F0C66A  gold-300 #F6D68C
 * data-mode: sheet (phones), fill (tablet, narrow preview pane), pop (desktop popover). */

#help-panel {
    position: fixed;
    inset: 0;
    z-index: 1100;
    pointer-events: none;
}

#help-panel[hidden] {
    display: none;
}

#help-panel .hp {
    position: fixed;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #121A3A;
    color: #EBECF5;
    font-family: Montserrat, "Montserrat Fallback", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
    -webkit-font-smoothing: antialiased;
    pointer-events: auto;
    outline: none;
    opacity: 0;
}

#help-panel .hp *,
#help-panel .hp *::before,
#help-panel .hp *::after {
    box-sizing: border-box;
    letter-spacing: inherit; /* the designer tracks its body text */
}

#help-panel [hidden] {
    display: none !important;
}

#help-panel .hp-scrim {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 30, .6);
    opacity: 0;
    display: none;
}

/* ---- Desktop: a popover from the "?" ---- */

#help-panel[data-mode="pop"] .hp {
    left: 80px;
    bottom: 20px;
    width: 360px;
    height: 600px;
    max-height: calc(100vh - 196px);
    max-height: min(600px, calc(100dvh - 196px)); /* clears the logo tab above it */
    border: 1px solid #3E4879;
    border-radius: 12px;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, .75);
    transform-origin: left bottom;
    transform: translateY(8px) scale(.96);
    transition: opacity .14s ease-in, transform .14s ease-in;
}

#help-panel[data-mode="pop"].is-open .hp {
    opacity: 1;
    transform: none;
    transition: opacity .18s cubic-bezier(.2, .8, .2, 1), transform .18s cubic-bezier(.2, .8, .2, 1);
}

/* ---- Tablet: fills the preview pane (left and width are set from #preview) ---- */

#help-panel[data-mode="fill"] .hp {
    top: 12px;
    bottom: 12px;
    border: 1px solid #3E4879;
    border-radius: 12px;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, .75);
    transition: opacity .16s ease;
}

#help-panel[data-mode="fill"].is-open .hp {
    opacity: 1;
}

/* ---- Phones: a modal bottom sheet. Anchored at both ends, no height and no vh, so it holds in
   the FB/IG in-app browsers. ---- */

#help-panel[data-mode="sheet"] {
    pointer-events: auto;
}

#help-panel[data-mode="sheet"] .hp-scrim {
    display: block;
    transition: opacity .2s ease;
}

#help-panel[data-mode="sheet"].is-open .hp-scrim {
    opacity: 1;
}

#help-panel[data-mode="sheet"] .hp {
    left: 0;
    right: 0;
    top: calc(56px + env(safe-area-inset-top));
    bottom: 0;
    height: auto;     /* anchored at both ends: no height, no max-height */
    max-height: none;
    border-top: 1px solid #3E4879;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -16px 40px -12px rgba(0, 0, 0, .6);
    opacity: 1;
    transform: translateY(100%);
    transition: transform .22s cubic-bezier(.4, 0, 1, 1);
}

#help-panel[data-mode="sheet"].is-open .hp {
    transform: none;
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}

#help-panel[data-mode="sheet"].is-dragging .hp {
    transition: none;
}

html.hp-modal,
html.hp-modal body {
    overflow: hidden;
}

#help-panel .hp-handle {
    display: none;
    justify-content: center;
    padding: 8px 0 0;
    flex: none;
}

#help-panel[data-mode="sheet"] .hp-handle {
    display: flex;
}

#help-panel .hp-handle span {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #5C6599;
}

/* ---- Header ---- */

#help-panel .hp-head {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 56px;
    padding: 0 6px 0 20px;
    flex: none;
}

#help-panel .hp-title {
    margin: 0;
    font: 500 26px/1 "Cormorant Garamond", "Cormorant Fallback", Georgia, serif;
    letter-spacing: -.01em;
    color: #EBECF5;
    text-transform: none;
    outline: none;
}

#help-panel .hp-grow {
    flex: 1;
}

#help-panel .hp-ibtn,
#help-panel .hp-clear {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 44px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: #B4B8D2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: none;
}

@media (hover: hover) {
    #help-panel .hp-ibtn:hover,
    #help-panel .hp-clear:hover {
        background: #1C254F;
        color: #EBECF5;
    }

    #help-panel .hp-back:hover {
        background: #1C254F;
    }

    #help-panel .hp-row:hover {
        background: #1C254F;
        text-decoration: none;
    }

    #help-panel .hp-ghost:hover {
        border-color: #EBECF5;
    }

    #help-panel .hp-prose a:hover {
        text-decoration-color: #F6D68C;
    }
}

#help-panel .hp-back {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    margin: 0 0 0 -12px;
    padding: 0 14px 0 10px;
    border: 0;
    border-radius: 22px;
    background: none;
    color: #EBECF5;
    font: 600 14px Montserrat, "Montserrat Fallback", sans-serif;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}

#help-panel .hp-ibtn:focus-visible,
#help-panel .hp-back:focus-visible,
#help-panel .hp-clear:focus-visible,
#help-panel .hp-row:focus-visible,
#help-panel .hp-ghost:focus-visible,
#help-panel .hp-link:focus-visible,
#help-panel .hp-mail:focus-visible {
    outline: 2px solid #F0C66A;
    outline-offset: -2px;
}

/* ---- Search ---- */

#help-panel .hp-search {
    position: relative;
    margin: 0;
    padding: 0 16px 12px;
    flex: none;
    border-bottom: 1px solid #293360;
}

#help-panel .hp-search input {
    display: block;
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 44px;
    border: 1px solid #3E4879;
    border-radius: 4px;
    background: #0B1026;
    color: #EBECF5;
    font: 400 16px Montserrat, "Montserrat Fallback", sans-serif; /* 16px: iOS doesn't zoom in */
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, .4);
    -webkit-appearance: none;
    appearance: none;
}

#help-panel .hp-search input::placeholder {
    color: #8A8FAE;
    opacity: 1;
}

#help-panel .hp-search input:focus {
    outline: 2px solid #F0C66A;
    outline-offset: 1px;
    border-color: #F0C66A;
}

#help-panel .hp-search input::-webkit-search-cancel-button {
    display: none;
}

#help-panel .hp-sicon {
    position: absolute;
    left: 30px;
    top: 15px;
    color: #8A8FAE;
    display: inline-flex;
    pointer-events: none;
}

#help-panel .hp-clear {
    position: absolute;
    right: 18px;
    top: 2px;
}

#help-panel .hp-bar {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 10px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #F0C66A, transparent) 0 0 / 40% 100% no-repeat;
    animation: hp-bar 1s linear infinite;
}

@keyframes hp-bar {
    from { background-position: -40% 0; }
    to { background-position: 140% 0; }
}

/* ---- Body and rows ---- */

#help-panel .hp-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 12px;
}

#help-panel .hp-fade {
    animation: hp-fade .12s ease;
}

@keyframes hp-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

#help-panel .hp-cap {
    margin: 0;
    padding: 16px 20px 6px;
    font: 600 12px/1.4 Montserrat, "Montserrat Fallback", sans-serif;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #8A8FAE;
}

#help-panel .hp-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

#help-panel .hp-list li {
    margin: 0;
    padding: 0;
}

#help-panel .hp-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 11px 16px 11px 20px;
    color: #EBECF5;
    text-decoration: none;
    font: 400 15px/1.4 Montserrat, "Montserrat Fallback", sans-serif;
    border-top: 1px solid #1C254F;
}

#help-panel .hp-list li:first-child .hp-row {
    border-top: 0;
}

#help-panel .hp-rt {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    hyphens: auto;
}

#help-panel .hp-chev {
    flex: none;
    color: #5C6599;
}

#help-panel .hp-n {
    font: 400 13px Montserrat, "Montserrat Fallback", sans-serif;
    color: #8A8FAE;
    font-variant-numeric: tabular-nums;
}

#help-panel .hp-res {
    align-items: flex-start;
}

#help-panel .hp-res .hp-chev {
    margin-top: 4px;
}

#help-panel .hp-ex {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: #B4B8D2;
}

#help-panel mark {
    background: rgba(240, 198, 106, .2);
    color: #F6D68C;
    border-radius: 2px;
    padding: 0 1px;
}

/* ---- Empty, errors, loading ---- */

#help-panel .hp-empty {
    padding: 20px 20px 4px;
}

#help-panel .hp-et {
    margin: 0;
    font: 400 16px/1.5 Montserrat, "Montserrat Fallback", sans-serif;
    color: #EBECF5;
    overflow-wrap: anywhere;
}

#help-panel .hp-es {
    margin: 4px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: #B4B8D2;
}

#help-panel .hp-err {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 56px 24px;
}

#help-panel .hp-err .hp-es {
    margin: 0;
}

#help-panel .hp-ghost {
    appearance: none;
    -webkit-appearance: none;
    margin-top: 12px;
    min-height: 48px;
    padding: 0 24px;
    border: 1px solid #5C6599;
    border-radius: 4px;
    background: transparent;
    color: #EBECF5;
    font: 600 16px Montserrat, "Montserrat Fallback", sans-serif;
    cursor: pointer;
}

#help-panel .hp-serr {
    margin: 0;
    padding: 20px;
    font-size: 14px;
    line-height: 1.5;
    color: #B4B8D2;
}

#help-panel .hp-link {
    appearance: none;
    -webkit-appearance: none;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    color: #F6D68C;
    font: 600 14px Montserrat, "Montserrat Fallback", sans-serif;
    text-decoration: underline;
    text-decoration-color: rgba(246, 214, 140, .5);
    text-underline-offset: 3px;
    cursor: pointer;
}

#help-panel .hp-sk {
    padding: 16px 20px;
    border-top: 1px solid #1C254F;
}

#help-panel .hp-sk:first-child {
    border-top: 0;
}

#help-panel .hp-sk span,
#help-panel .hp-skt,
#help-panel .hp-skp {
    display: block;
    border-radius: 5px;
    background: linear-gradient(90deg, #1C254F 0, #293360 40%, #1C254F 80%) 0 0 / 300% 100%;
    animation: hp-shimmer 1.4s linear infinite;
}

#help-panel .hp-sk span,
#help-panel .hp-skp {
    height: 10px;
}

#help-panel .hp-sk .hp-skc {
    width: 46%;
    height: 8px;
    margin-top: 8px;
}

#help-panel .hp-skt {
    width: 80%;
    height: 24px;
    margin: 8px 0 20px;
}

#help-panel .hp-skp {
    margin: 0 0 12px;
}

#help-panel .hp-skp:nth-child(3n) {
    width: 70%;
}

@keyframes hp-shimmer {
    from { background-position: 100% 0; }
    to { background-position: 0 0; }
}

/* ---- Article ---- */

#help-panel .hp-article {
    padding: 4px 20px 8px;
}

#help-panel .hp-sec {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font: 600 12px/1.4 Montserrat, "Montserrat Fallback", sans-serif;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #F0C66A;
}

#help-panel .hp-at {
    margin: 0 0 16px;
    font: 600 28px/1.12 "Cormorant Garamond", "Cormorant Fallback", Georgia, serif;
    letter-spacing: -.01em;
    color: #EBECF5;
    text-transform: none;
    overflow-wrap: anywhere;
    outline: none;
}

#help-panel .hp-prose {
    font: 400 15px/1.65 Montserrat, "Montserrat Fallback", sans-serif;
    color: #EBECF5;
    overflow-wrap: break-word;
}

#help-panel .hp-prose > :first-child {
    margin-top: 0;
}

#help-panel .hp-prose p,
#help-panel .hp-prose div {
    margin: 0 0 14px;
}

#help-panel .hp-prose strong,
#help-panel .hp-prose b {
    font-weight: 600;
    color: #FFFFFF;
}

#help-panel .hp-prose ul,
#help-panel .hp-prose ol {
    margin: 0 0 14px;
    padding-left: 22px;
}

#help-panel .hp-prose ul {
    list-style: disc;
}

#help-panel .hp-prose ol {
    list-style: decimal;
}

#help-panel .hp-prose li {
    margin: 0 0 6px;
    padding-left: 2px;
}

#help-panel .hp-prose li::marker {
    color: #F0C66A;
}

#help-panel .hp-prose h1,
#help-panel .hp-prose h2 {
    margin: 22px 0 8px;
    font: 600 17px/1.35 Montserrat, "Montserrat Fallback", sans-serif;
    color: #EBECF5;
    text-transform: none;
    letter-spacing: 0;
}

#help-panel .hp-prose h3,
#help-panel .hp-prose h4 {
    margin: 18px 0 6px;
    font: 600 15px/1.4 Montserrat, "Montserrat Fallback", sans-serif;
    color: #EBECF5;
    text-transform: none;
    letter-spacing: 0;
}

#help-panel .hp-prose a {
    color: #F6D68C;
    text-decoration: underline;
    text-decoration-color: rgba(246, 214, 140, .5);
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

#help-panel .hp-ext {
    display: inline-block;
    margin-left: 2px;
    vertical-align: baseline;
}

#help-panel .hp-prose img {
    display: block;
    max-width: 100%;
    height: auto !important;
    margin: 16px 0;
    border-radius: 4px;
    box-shadow: 0 0 0 1px #3E4879;
}

#help-panel .hp-prose table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
    font: 400 13px/1.45 Montserrat, "Montserrat Fallback", sans-serif;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#help-panel .hp-prose th,
#help-panel .hp-prose td {
    padding: 8px 12px;
    border: 1px solid #3E4879;
    text-align: left;
    color: #EBECF5;
}

#help-panel .hp-prose th {
    background: #1C254F;
    font-weight: 600;
}

#help-panel .hp-prose blockquote {
    margin: 0 0 14px;
    padding: 0 0 0 14px;
    border-left: 2px solid #F0C66A;
    color: #B4B8D2;
}

/* ---- Footer ---- */

#help-panel .hp-foot {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0 12px;
    flex-wrap: wrap;
    padding: 8px 12px 8px 20px;
    border-top: 1px solid #293360;
    font-size: 13px;
    line-height: 1.4;
    color: #B4B8D2;
}

#help-panel[data-mode="sheet"] .hp-foot {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

#help-panel .hp-mail {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 8px;
    color: #F6D68C;
    font: 600 14px Montserrat, "Montserrat Fallback", sans-serif;
    text-decoration: underline;
    text-decoration-color: rgba(246, 214, 140, .5);
    text-underline-offset: 3px;
}

#help-panel .hp-vh {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---- The "?" turns gold while the panel is open ---- */

html.help-panel-open #preview #help-button {
    border-color: #F0C66A !important;
    box-shadow: 0 0 0 3px rgba(240, 198, 106, .18);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F0C66A' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.6 9.4a2.5 2.5 0 0 1 4.8.9c0 1.7-2.4 2.2-2.4 3.7'/%3E%3Ccircle cx='12' cy='17.2' r='.5' fill='%23F0C66A'/%3E%3C/svg%3E") !important;
}

/* ---- Reduced motion: everything is a 120ms fade ---- */

@media (prefers-reduced-motion: reduce) {
    #help-panel .hp,
    #help-panel[data-mode] .hp,
    #help-panel[data-mode].is-open .hp {
        transform: none !important;
        transition: opacity .12s linear !important;
    }

    #help-panel[data-mode="sheet"] .hp {
        opacity: 0;
    }

    #help-panel[data-mode="sheet"].is-open .hp {
        opacity: 1;
    }

    #help-panel .hp-scrim {
        transition: opacity .12s linear !important;
    }

    #help-panel .hp-sk span,
    #help-panel .hp-skt,
    #help-panel .hp-skp,
    #help-panel .hp-bar {
        animation: none;
        background: #1C254F;
    }
}
