/* ==========================================================================
   Shadows ® Interactive 3D & Conversational Contact Experience (/contact)
   ========================================================================== */

/* Hide default scroll-down indicator on the full-viewport assistant stage */
body.sa-active-page .layout-scroll-down {
    display: none !important;
}

.sa-stage {
    --sa-progress: 0;
    --sa-accent: #c24040;
    --sa-border: rgba(255, 255, 255, 0.16);
    --sa-border-hover: rgba(255, 255, 255, 0.55);
    --sa-surface: rgba(14, 14, 17, 0.65);
    --sa-surface-hover: rgba(255, 255, 255, 0.1);
    --sa-text-muted: rgba(255, 255, 255, 0.48);
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    color: #fff;
    font-family: 'HelveticaNeueCyr', Arial, Helvetica, sans-serif;
    user-select: none;
}

.sa-stage,
.sa-stage button,
.sa-stage input,
.sa-stage textarea,
.sa-stage select {
    font-family: 'HelveticaNeueCyr', Arial, Helvetica, sans-serif;
}

/* --------------------------------------------------------------------------
   3D WebGL Visualizer Layer
   -------------------------------------------------------------------------- */
.sa-visualizer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: auto;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.sa-visualizer.is-ready {
    opacity: 1;
}

.sa-visualizer canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

/* Subtle bottom & edge noir vignette so the lower torso melts seamlessly into #000 */
.sa-visualizer::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(to top, #000000 0%, rgba(0, 0, 0, 0.82) 12%, rgba(0, 0, 0, 0) 34%),
        radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0) 60%);
    transition: opacity 0.6s ease;
}

/* Desktop: subtle bottom gradient to softly melt the lower suit cut into black */
.sa-stage.sa-v3 .sa-visualizer::after {
    background:
        linear-gradient(
            to top,
            #000000 0%,
            rgba(0, 0, 0, 0.90) 10%,
            rgba(0, 0, 0, 0.50) 22%,
            rgba(0, 0, 0, 0) 35%
        ),
        radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0) 60%);
}

/* --------------------------------------------------------------------------
   Initial "Click to Start" Gate Overlay
   -------------------------------------------------------------------------- */
.sa-stage.is-gate .sa-shell {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    pointer-events: none;
}

.sa-stage.is-gate .sa-dialog {
    width: 100%;
    height: 100%;
    max-width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: none;
    padding: 0;
}

.sa-stage.is-gate .sa-prompt {
    display: none;
}

.sa-gate-wrap {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 5.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    pointer-events: auto;
    z-index: 10;
}

.sa-start-btn {
    appearance: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-width: 0;
    padding: 0.82rem 1.6rem;
    border-radius: 999px;
    background: var(--sa-surface);
    border: 1px solid var(--sa-border);
    color: rgba(255, 255, 255, 0.9);
    font-family: 'HelveticaNeueCyr', Arial, Helvetica, sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: none;
    transition: all 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sa-start-btn:hover,
.sa-start-btn:focus-visible {
    border-color: var(--sa-border-hover);
    background: var(--sa-surface-hover);
    color: #ffffff;
    transform: translateY(-2px);
    outline: none;
}

/* --------------------------------------------------------------------------
   Foreground Conversational Layout (Active Speaking & Steps)
   -------------------------------------------------------------------------- */
.sa-shell {
    position: relative;
    z-index: 5;
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: calc(var(--header-height, 5.5rem) + 1.5rem) var(--wrap, 3.5vw) 2rem;
    pointer-events: none;
}

.sa-dialog {
    width: 100%;
    max-width: min(41rem, 46vw);
    pointer-events: auto;
    user-select: text;
}

@keyframes saPulse {
    0%, 100% { opacity: 0.45; transform: scale(0.92); }
    50% { opacity: 1; transform: scale(1.15); }
}

/* Main Animated Dialogue Prompt */
.sa-prompt {
    font-size: clamp(1.5rem, 2.45vw, 2.4rem);
    font-weight: 400;
    line-height: 1.24;
    letter-spacing: -0.02em;
    color: #ffffff;
    margin: 0 0 1.75rem;
    min-height: 3.1rem;
}

.sa-prompt .sa-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    animation: saWordIn 0.44s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes saWordIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Step Body Container (Delayed via --sa-body-delay so character finishes speaking first!) */
.sa-body {
    opacity: 0;
    transform: translateY(14px);
    animation: saBodyIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) var(--sa-body-delay, 0.12s) forwards;
}

.sa-body.is-waiting-audio {
    opacity: 0 !important;
    transform: translateY(14px) !important;
    pointer-events: none !important;
    animation: none !important;
}

.sa-body.is-revealed {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
    animation: saBodyIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
}

@keyframes saBodyIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --------------------------------------------------------------------------
   Interactive Choice Pills (Greeting, Budget, Discipline, Multi-Service)
   -------------------------------------------------------------------------- */
.sa-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.68rem;
}

.sa-pill {
    appearance: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.62rem;
    padding: 0.82rem 1.35rem;
    border-radius: 999px;
    border: 1px solid var(--sa-border);
    background: var(--sa-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.2;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition:
        border-color 0.25s ease,
        background-color 0.25s ease,
        color 0.25s ease,
        transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.25s ease;
}

.sa-pill:hover,
.sa-pill:focus-visible {
    border-color: var(--sa-border-hover);
    background: var(--sa-surface-hover);
    color: #fff;
    transform: translateY(-2px);
    outline: none;
}

.sa-pill:active {
    transform: translateY(0);
}

.sa-pill.is-selected {
    background: #ffffff;
    border-color: #ffffff;
    color: #000000;
    box-shadow: 0 8px 28px rgba(255, 255, 255, 0.16);
}

.sa-pill__check {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.36);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.66rem;
    transition: all 0.2s ease;
}

.sa-pill.is-selected .sa-pill__check {
    border-color: #000;
    background: #000;
    color: #fff;
}

.sa-pill--email {
    border-style: dashed;
    color: rgba(255, 255, 255, 0.75);
}

.sa-pill--email.is-copied {
    border-style: solid;
    border-color: #fff;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* --------------------------------------------------------------------------
   Text, Email, Dual Inputs & Auto-Expanding Textarea
   -------------------------------------------------------------------------- */
.sa-fields {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    max-width: 35rem;
}

.sa-fields--row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.sa-field {
    position: relative;
    display: flex;
    flex-direction: column;
}

.sa-field__label {
    display: none;
}

.sa-input,
.sa-textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 0;
    padding: 0.72rem 0 0.78rem;
    color: #ffffff;
    font-family: inherit;
    font-size: 1.18rem;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.25s ease;
}

.sa-input::placeholder,
.sa-textarea::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

.sa-input:focus,
.sa-textarea:focus {
    border-bottom-color: #ffffff;
}

.sa-field.has-error .sa-input,
.sa-field.has-error .sa-textarea {
    border-bottom-color: var(--sa-accent);
}

.sa-textarea {
    resize: none;
    min-height: 3.4rem;
    max-height: 10.5rem;
    overflow-y: auto;
}

/* Error Feedback & Shake */
.sa-error {
    min-height: 1.25rem;
    margin-top: 0.55rem;
    font-size: 0.84rem;
    color: #e45c5c;
    letter-spacing: 0.01em;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sa-error.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.sa-shake {
    animation: saShake 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes saShake {
    10%, 90% { transform: translateX(-3px); }
    20%, 80% { transform: translateX(5px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}

/* --------------------------------------------------------------------------
   Action Bar (Back, Continue / Submit, Keyboard Hint)
   -------------------------------------------------------------------------- */
.sa-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 1.35rem;
}

.sa-btn-back {
    appearance: none;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    border: 1px solid var(--sa-border);
    background: var(--sa-surface);
    color: rgba(255, 255, 255, 0.82);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}

.sa-btn-back svg {
    display: block;
    pointer-events: none;
    transition: transform 0.22s ease;
}

.sa-btn-back:hover,
.sa-btn-back:focus-visible {
    border-color: #fff;
    background: var(--sa-surface-hover);
    color: #fff;
    outline: none;
}

.sa-btn-back:hover svg,
.sa-btn-back:focus-visible svg {
    transform: translateX(-2px);
}

/* Guard: never display back button or stray action bars on intro or gate */
.sa-stage[data-step="intro"] .sa-btn-back,
.sa-stage[data-step="gate"] .sa-btn-back,
.sa-stage.is-gate .sa-btn-back,
.sa-stage[data-step="intro"] .sa-actions,
.sa-stage[data-step="gate"] .sa-actions,
.sa-stage.is-gate .sa-actions {
    display: none !important;
}

.sa-btn-next {
    appearance: none;
    position: relative;
    width: 2.75rem;
    height: 2.75rem;
    min-width: 0;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #ffffff;
    background-color: #ffffff;
    color: #000000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.18);
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.sa-btn-next svg {
    display: block;
    pointer-events: none;
    transition: transform 0.22s ease;
}

.sa-btn-next:hover,
.sa-btn-next:focus-visible {
    background-color: #f0f0f0;
    border-color: #ffffff;
    box-shadow: 0 6px 22px rgba(255, 255, 255, 0.28);
    outline: none;
}

.sa-btn-next:hover svg,
.sa-btn-next:focus-visible svg {
    transform: translateX(2px);
}

.sa-btn-next:disabled {
    opacity: 0.45;
    cursor: wait;
    box-shadow: none;
}

/* Final Step: "Send" Button */
.sa-btn-next.sa-btn-send {
    width: auto;
    height: 2.75rem;
    min-width: 7.25rem;
    padding: 0 1.85rem;
    border-radius: 999px;
    font-family: 'HelveticaNeueCyr', Arial, Helvetica, sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-align: center;
    white-space: nowrap;
    color: #000000;
    background-color: #ffffff;
    border: 1px solid #ffffff;
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.18);
    transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.sa-btn-next.sa-btn-send:hover,
.sa-btn-next.sa-btn-send:focus-visible {
    background-color: #f0f0f0;
    border-color: #ffffff;
    color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.28);
    outline: none;
}

.sa-btn-next.sa-btn-send:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

/* Turnstile Wrap on Final Step */
.sa-turnstile-wrap {
    margin-top: 0.9rem;
    min-height: 0;
    overflow: visible;
}

/* --------------------------------------------------------------------------
   Sound Toggle (Desktop: bottom right; Mobile: right of assistant character)
   -------------------------------------------------------------------------- */
.sa-sound-btn {
    appearance: none;
    position: absolute;
    bottom: 1.65rem;
    right: var(--wrap, 3.5vw);
    z-index: 20;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    border: 1px solid var(--sa-border);
    background: var(--sa-surface);
    color: rgba(255, 255, 255, 0.85);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    contain: layout paint;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: border-color 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}

.sa-sound-btn svg {
    display: block;
    pointer-events: none;
}

.sa-sound-btn .sa-sound-icon--off {
    display: block;
}

.sa-sound-btn .sa-sound-icon--on {
    display: none;
}

.sa-sound-btn.is-playing .sa-sound-icon--off {
    display: none;
}

.sa-sound-btn.is-playing .sa-sound-icon--on {
    display: block;
}

.sa-sound-btn:not(.is-playing) {
    color: rgba(255, 255, 255, 0.42);
    border-color: rgba(255, 255, 255, 0.1);
}

.sa-sound-btn:hover,
.sa-sound-btn:focus-visible {
    border-color: #ffffff;
    background: var(--sa-surface-hover);
    color: #ffffff;
    outline: none;
}

/* --------------------------------------------------------------------------
   Bottom Bar (Socials)
   -------------------------------------------------------------------------- */
.sa-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 6;
    width: 100%;
    padding: 0 var(--wrap, 3.5vw) 1.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.62);
    pointer-events: none;
}

.sa-bottom-bar > * {
    pointer-events: auto;
}

.sa-socials {
    display: flex;
    align-items: center;
    gap: 1.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.sa-socials a {
    color: rgba(255, 255, 255, 0.62);
    text-decoration: none;
    position: relative;
    transition: color 0.25s ease;
}

.sa-socials a:hover {
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   Responsive Breakpoints (Mobile Bust Crop: Head + Neck + Shoulder Top)
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
    /* Once active (after Click to Start), smoothly crop below top edge of shoulders */
    .sa-stage:not(.is-gate) .sa-visualizer::after {
        background:
            linear-gradient(
                to top,
                #000000 0%,
                #000000 45%,
                rgba(0, 0, 0, 0.92) 49%,
                rgba(0, 0, 0, 0.45) 53%,
                rgba(0, 0, 0, 0) 60%
            );
    }

    /* Subtle bottom vignette so the full torso, suit, and clasped hands remain visible */
    .sa-stage.sa-v3 .sa-visualizer::after,
    .sa-stage.sa-v3:not(.is-gate) .sa-visualizer::after {
        background:
            linear-gradient(
                to top,
                #000000 0%,
                rgba(0, 0, 0, 0.94) 8%,
                rgba(0, 0, 0, 0.65) 18%,
                rgba(0, 0, 0, 0.25) 28%,
                rgba(0, 0, 0, 0) 38%
            );
    }

    .sa-stage:not(.is-gate) .sa-shell {
        justify-content: flex-start;
        padding-top: 52vh;
        padding-top: 52dvh;
        padding-bottom: 1.5rem;
    }

    .sa-stage:not(.is-gate) .sa-dialog {
        max-width: 100%;
    }

    .sa-prompt {
        font-size: clamp(1.32rem, 4.2vw, 1.85rem);
        margin-bottom: 1.2rem;
    }

    .sa-socials {
        display: none;
    }
}

/* Contact Assistant: Tablet & Smaller Landscape Viewports (Side-by-Side: Text Left, Character Right) */
@media (min-width: 768px) and (max-width: 1199px) and (orientation: landscape),
       (min-width: 768px) and (max-width: 1199px) and (min-aspect-ratio: 1.18/1) {
    .sa-stage:not(.is-gate) .sa-shell,
    .sa-stage.sa-v3:not(.is-gate) .sa-shell {
        justify-content: center;
        padding-top: calc(var(--header-height, 4.5rem) + 1.2rem);
        padding-bottom: 3.5rem;
        padding-left: var(--wrap, 4vw);
        padding-right: var(--wrap, 4vw);
    }

    .sa-stage:not(.is-gate) .sa-dialog,
    .sa-stage.sa-v3:not(.is-gate) .sa-dialog {
        max-width: min(45vw, 32rem);
    }

    .sa-prompt,
    .sa-stage.sa-v3 .sa-prompt {
        font-size: clamp(1.2rem, 2.7vw, 1.85rem);
        line-height: 1.24;
        margin-bottom: 1.15rem;
        min-height: auto;
    }

    .sa-body .sa-pills,
    .sa-stage.sa-v3 .sa-body .sa-pills {
        max-width: min(45vw, 32rem);
    }

    .sa-pill,
    .sa-stage.sa-v3 .sa-pill {
        padding: 0.65rem 1.15rem;
        font-size: 0.88rem;
    }
}

@media (max-width: 767px) {
    /* Mobile active state: lowered dialogue text gives generous room in upper half;
       smooth noir gradient fades right beneath the neck into solid #000000 */
    .sa-stage:not(.is-gate) .sa-visualizer::after {
        background:
            linear-gradient(
                to top,
                #000000 0%,
                #000000 46%,
                rgba(0, 0, 0, 0.94) 50%,
                rgba(0, 0, 0, 0.42) 54%,
                rgba(0, 0, 0, 0) 60%
            );
    }

    /* Subtle bottom fade on mobile so character chest, suit, and hands stay clearly visible */
    .sa-stage.sa-v3 .sa-visualizer::after,
    .sa-stage.sa-v3:not(.is-gate) .sa-visualizer::after {
        background:
            linear-gradient(
                to top,
                #000000 0%,
                rgba(0, 0, 0, 0.94) 8%,
                rgba(0, 0, 0, 0.65) 18%,
                rgba(0, 0, 0, 0.25) 28%,
                rgba(0, 0, 0, 0) 38%
            );
    }

    .sa-stage:not(.is-gate) .sa-shell {
        padding-top: 64vh;
        padding-top: 64dvh;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
        padding-bottom: 2.5rem;
    }

    .sa-gate-wrap {
        bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
        gap: 0.65rem;
    }

    .sa-start-btn,
    .sa-start-btn.sa-pill {
        min-width: 8.5rem;
        padding: 0.95rem 2.2rem !important;
        font-size: 1.02rem !important;
        font-weight: 500;
        letter-spacing: 0.02em;
    }

    .sa-prompt {
        font-size: 1.22rem;
        line-height: 1.28;
        margin-bottom: 1rem;
        min-height: 2.3rem;
    }

    .sa-pills {
        gap: 0.46rem;
    }

    .sa-pill {
        padding: 0.62rem 0.98rem;
        font-size: 0.84rem;
    }

    .sa-fields {
        gap: 0.9rem;
    }

    .sa-fields--row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .sa-input,
    .sa-textarea {
        font-size: 1.02rem;
        padding: 0.5rem 0 0.56rem;
    }

    .sa-actions {
        margin-top: 1rem;
        gap: 0.65rem;
    }

    .sa-btn-next {
        width: 2.5rem;
        height: 2.5rem;
        min-width: 0;
        padding: 0;
    }

    .sa-btn-next.sa-btn-send {
        width: auto;
        height: 2.5rem;
        min-width: 6.25rem;
        padding: 0 1.45rem;
        font-size: 0.88rem;
    }

    .sa-btn-back {
        width: 2.5rem;
        height: 2.5rem;
    }

    .sa-sound-btn {
        position: absolute;
        top: calc(var(--header-height, 4.2rem) + 0.85rem);
        right: 1.25rem;
        bottom: auto;
        z-index: 25;
        width: 2.5rem;
        height: 2.5rem;
        display: inline-flex !important;
    }

    .sa-bottom-bar {
        display: none !important;
    }
}
