/* The site assistant (landing/_support.html): a quiet button at the bottom
   right, and the chat it opens. Floating on large screens, full screen on
   phones. The chat is a design system island whose sheets load on first
   open; until then only the button below is styled, from plain values. */

.sk-support {
    --sks-gap: 20px;
    --sks-launcher: 52px;
    position: fixed;
    right: calc(var(--sks-gap) + env(safe-area-inset-right, 0px));
    bottom: calc(var(--sks-gap) + env(safe-area-inset-bottom, 0px));
    z-index: 990; /* under the landing nav (1000) until it is open */
    font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ------------------------------------------------------------ the button */
.sk-support__launcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0;
    height: var(--sks-launcher);
    min-width: var(--sks-launcher);
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    color: #fff;
    background: radial-gradient(circle at 30% 20%, #8f90ff, #5856eb 58%, #7c3aed);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 10px 30px -10px rgba(88, 86, 235, .75), 0 2px 8px rgba(0, 0, 0, .35);
    cursor: pointer;
    font: inherit;
    transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, padding .3s cubic-bezier(.2, .8, .2, 1), opacity .2s;
    animation: sks-arrive .6s cubic-bezier(.2, .8, .2, 1) .8s both;
    -webkit-tap-highlight-color: transparent;
}
.sk-support__launcher:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 16px 36px -12px rgba(88, 86, 235, .85), 0 2px 8px rgba(0, 0, 0, .35); }
.sk-support__launcher:active { transform: scale(.96); }
.sk-support__launcher:focus-visible { outline: 2px solid #a5a6ff; outline-offset: 3px; }

.sk-support__launcher-icon { position: relative; display: grid; place-items: center; width: calc(var(--sks-launcher) - 2px); height: calc(var(--sks-launcher) - 2px); flex-shrink: 0; }
.sk-support__launcher-icon svg { position: absolute; width: 24px; height: 24px; transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .2s; }
.sk-support__i-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.sk-support.is-open .sk-support__i-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.sk-support.is-open .sk-support__i-close { opacity: 1; transform: none; }

/* "Need help?" slides out on hover and focus, on screens with a pointer. */
.sk-support__launcher-label {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -.005em;
    opacity: 0;
    transition: max-width .35s cubic-bezier(.2, .8, .2, 1), opacity .2s, padding .35s;
}
@media (hover: hover) and (min-width: 641px) {
    .sk-support:not(.is-open) .sk-support__launcher:is(:hover, :focus-visible) .sk-support__launcher-label,
    .sk-support.is-greeting:not(.is-open) .sk-support__launcher-label { max-width: 140px; padding-right: 20px; opacity: 1; }
}

/* A reply from the team while the chat is closed. */
.sk-support__dot {
    position: absolute; top: 1px; right: 1px;
    width: 13px; height: 13px;
    border: 2px solid #0f1117;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, .6);
    animation: sks-pulse 2s ease-out infinite;
}

@keyframes sks-arrive { from { opacity: 0; transform: translateY(14px) scale(.85); } }
@keyframes sks-pulse { 70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

/* ------------------------------------------------------------- the panel */
.sk-support__panel {
    position: absolute;
    right: 0;
    bottom: calc(var(--sks-launcher) + 14px);
    display: flex;
    flex-direction: column;
    width: min(400px, calc(100vw - 2 * var(--sks-gap)));
    height: min(680px, calc(100dvh - var(--sks-launcher) - 2 * var(--sks-gap) - 30px));
    overflow: hidden;
    border: 1px solid var(--sk-border-subtle, rgba(255, 255, 255, .08));
    border-radius: 24px;
    background:
        radial-gradient(120% 60% at 100% 0%, rgba(124, 58, 237, .13), transparent 60%),
        radial-gradient(90% 50% at 0% 0%, rgba(88, 86, 235, .16), transparent 55%),
        var(--sk-surface, #16181f);
    box-shadow: 0 30px 80px -24px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .02);
    transform-origin: bottom right;
    opacity: 0;
    transform: translateY(12px) scale(.96);
    transition: opacity .22s ease, transform .3s cubic-bezier(.2, .8, .2, 1);
}
.sk-support__panel[hidden] { display: none; }
/* Open, the chat sits above the landing nav, which otherwise paints over its top edge. */
.sk-support.is-open { z-index: 1100; }
.sk-support.is-open .sk-support__panel { opacity: 1; transform: none; }

.sk-support__head {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 12px 12px 16px;
    border-bottom: 1px solid var(--sk-border-subtle);
}
.sk-support__titles { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sk-support__title { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; color: var(--sk-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-support__status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--sk-fg-muted); }
.sk-support__live { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }
.sk-support[data-status="WAITING"] .sk-support__live { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, .2); animation: sks-wait 1.6s ease-in-out infinite; }
.sk-support[data-status="CLOSED"] .sk-support__live { background: var(--sk-fg-subtle); box-shadow: none; }
@keyframes sks-wait { 50% { opacity: .35; } }
.sk-support__head-actions { display: flex; gap: 2px; }
.sk-support__who { display: grid; place-items: center; }

.sk-support__avatar {
    display: grid; place-items: center;
    width: 30px; height: 30px; border-radius: 50%;
    font-size: 13px; font-weight: 700; color: #04201a;
    background: linear-gradient(145deg, #5eead4, #14b8a6);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
.sk-support__who .sk-support__avatar { width: 34px; height: 34px; font-size: 14px; }

/* The conversation. */
.sk-support__scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; scrollbar-width: thin; }
.sk-support__thread { display: flex; flex-direction: column; gap: 18px; padding: 18px 16px 12px; }
.sk-support__thread .sk-ai-msg { gap: 10px; }
.sk-support__thread .sk-ai-msg--user .sk-ai-msg__main { max-width: 84%; }
.sk-support__thread .sk-ai-msg__body { font-size: 14.5px; line-height: 1.6; }
.sk-support__thread .sk-ai-msg--assistant .sk-ai-msg__body { padding-top: 3px; }
.sk-support__thread .sk-ai-msg__body.sk-prose :where(p, ul, ol) { margin: 0; }
.sk-support__thread .sk-ai-msg__body.sk-prose :where(p, ul, ol) + :where(p, ul, ol) { margin-top: .6em; }
.sk-support__thread .sk-ai-msg__body.sk-prose a { color: var(--sk-brand-11); text-decoration: underline; text-underline-offset: 2px; }
.sk-support__name { font-size: 12.5px; color: var(--sk-fg-muted); }
.sk-support__name b { color: var(--sk-fg); font-weight: 600; }
.sk-support__team .sk-ai-msg__main { gap: 3px; }

/* A note in the conversation: someone joined, the chat closed. */
.sk-support__note {
    align-self: center;
    max-width: 92%;
    margin: 0;
    padding: 9px 14px;
    border: 1px solid var(--sk-border-subtle);
    border-radius: 14px;
    background: rgb(255 255 255 / .03);
    color: var(--sk-fg-muted);
    font-size: 12.5px; line-height: 1.5; text-align: center;
    animation: sk-rise var(--sk-dur-slow) var(--sk-ease-out);
}

/* Buttons the script offers, under its message. */
.sk-support__choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.sk-support__choice {
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 36px;
    padding: 7px 13px;
    border: 1px solid var(--sk-border);
    border-radius: 999px;
    color: var(--sk-fg);
    background: var(--sk-surface-raised);
    font-size: 13.5px; font-weight: 550; line-height: 1.25; text-align: start;
    transition: border-color var(--sk-dur-fast), background var(--sk-dur-fast), transform var(--sk-dur-fast), color var(--sk-dur-fast);
    animation: sk-rise var(--sk-dur-slow) var(--sk-ease-out) both;
}
.sk-support__choice:nth-child(2) { animation-delay: 40ms; }
.sk-support__choice:nth-child(3) { animation-delay: 80ms; }
.sk-support__choice:nth-child(4) { animation-delay: 120ms; }
.sk-support__choice:nth-child(n+5) { animation-delay: 160ms; }
.sk-support__choice .sk-icon { color: var(--sk-brand-11); width: 15px; height: 15px; }
.sk-support__choice:hover { border-color: rgb(var(--sk-brand-rgb) / .6); background: rgb(var(--sk-brand-rgb) / .12); }
.sk-support__choice:active { transform: scale(.97); }
.sk-support__choice[data-action="HUMAN"] .sk-icon { color: var(--sk-teal-11); }
.sk-support__choice[data-action="AI"] .sk-icon { color: var(--sk-violet-11); }
.sk-support__choices.is-spent .sk-support__choice { opacity: .45; pointer-events: none; }
.sk-support__choices.is-spent .sk-support__choice.is-picked { opacity: 1; border-color: rgb(var(--sk-brand-rgb) / .55); }

/* The contact card. */
.sk-support__card {
    display: flex; flex-direction: column; gap: 12px;
    padding: 16px;
    border: 1px solid var(--sk-border);
    border-radius: 18px;
    background: var(--sk-surface-raised);
    box-shadow: var(--sk-shadow-md);
    animation: sk-rise var(--sk-dur-slow) var(--sk-ease-out);
}
.sk-support__card-title { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 650; font-size: 14.5px; color: var(--sk-fg); }
.sk-support__card-title .sk-icon { color: var(--sk-teal-11); }
.sk-support__card-text { margin: -4px 0 2px; color: var(--sk-fg-muted); font-size: 13px; line-height: 1.5; }
.sk-support__card-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.sk-support__card .sk-field { gap: 5px; }

/* The composer. */
.sk-support__composer { padding: 8px 12px 10px; }
/* One row: the message, then the send button. */
.sk-support__composer .sk-ai-composer__box { flex-direction: row; align-items: flex-end; border-radius: 24px; box-shadow: var(--sk-shadow-sm); }
.sk-support__composer .sk-ai-composer__context { display: none; }
.sk-support__composer .sk-ai-composer__line { flex: 1; min-width: 0; padding-left: 10px; }
.sk-support__composer .sk-ai-composer__input { min-height: 46px; max-height: 140px; padding: 13px 6px 11px 6px; font-size: 14.5px; }
.sk-support__composer .sk-ai-composer__input:focus-visible { outline: none; }
.sk-support__composer .sk-ai-composer__bar { flex-shrink: 0; padding: 0 6px 6px 0; }
.sk-support__composer.is-locked, .sk-support.is-contact .sk-support__composer { display: none; }
.sk-support__fine { margin: 7px 4px 0; color: var(--sk-fg-subtle); font-size: 11.5px; line-height: 1.4; text-align: center; }
.sk-support__error { margin: 0 16px 6px; padding: 8px 12px; border-radius: 12px; background: rgb(var(--sk-red-rgb) / .12); color: var(--sk-red-11); font-size: 13px; }
.sk-support__error[hidden] { display: none; }

/* Loading the first time. */
.sk-support__panel.is-loading .sk-support__thread::before {
    content: ''; align-self: center; width: 22px; height: 22px; margin-top: 40px;
    border: 2px solid rgba(255, 255, 255, .15); border-top-color: #a5a6ff; border-radius: 50%;
    animation: sks-spin .8s linear infinite;
}
@keyframes sks-spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- phones */
@media (max-width: 640px) {
    .sk-support { --sks-gap: 16px; --sks-launcher: 50px; }
    .sk-support__panel {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        border: 0;
        border-radius: 0;
        transform: translateY(24px);
        transform-origin: bottom center;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .sk-support.is-open .sk-support__launcher { opacity: 0; pointer-events: none; }
    .sk-support__head { padding: 10px 8px 10px 14px; }
    .sk-support__composer .sk-ai-composer__input { font-size: 16px; } /* no zoom on iOS */
    .sk-support__card .sk-input__control, .sk-support__card textarea { font-size: 16px; }
}
html.sk-support-locked, html.sk-support-locked body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    .sk-support__launcher, .sk-support__panel, .sk-support__choice, .sk-support__card, .sk-support__launcher-icon svg { animation: none !important; transition: none !important; }
    .sk-support__scroll { scroll-behavior: auto; }
}
