/*
 * Floating WhatsApp enquiry button - inc/whatsapp-widget.php
 *
 * Loaded LAST (after responsive.css) so the .scroll-to-top override below
 * wins on equal specificity. Colours are the site tokens from global.css:
 * --main-color (gold), --color-two (deep green), --white-color.
 */

.tj-wa {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 14px;
    font-family: 'Urbanist', sans-serif;
}

/* --- Launcher ---------------------------------------------------------- */

.tj-wa-launcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 22px 0 18px;
    height: 58px;
    border: 1px solid var(--main-color);
    border-radius: 999px;
    background: var(--main-color);
    color: var(--color-two);
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
    transition: background 300ms ease, color 300ms ease, box-shadow 300ms ease, transform 300ms ease;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .tj-wa-launcher:hover {
        background: var(--white-color);
        color: var(--color-two);
        box-shadow: 0 12px 30px rgba(0, 0, 0, .34);
    }
}

.tj-wa-launcher:focus-visible {
    background: var(--white-color);
    color: var(--color-two);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .34);
}

.tj-wa-launcher:focus-visible {
    outline: 2px solid var(--white-color);
    outline-offset: 3px;
}

.tj-wa-launcher-icon {
    position: relative;
    display: block;
    width: 28px;
    height: 28px;
    flex: none;
}

.tj-wa-launcher-icon svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transition: opacity 200ms ease, transform 200ms ease;
}

.tj-wa-glyph { fill: currentColor; }

.tj-wa-glyph-close {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    opacity: 0;
    transform: rotate(-45deg) scale(.7);
}

.tj-wa-launcher-label {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: .04em;
    line-height: 1;
    white-space: nowrap;
}

/* Open state: the glyph flips to a close cross. */
.tj-wa.is-open .tj-wa-glyph {
    opacity: 0;
    transform: rotate(45deg) scale(.7);
}

.tj-wa.is-open .tj-wa-glyph-close {
    opacity: 1;
    transform: none;
}

/* --- Panel ------------------------------------------------------------- */

/* Without JS the panel simply stays visible above the button, so both
   prefilled links remain reachable. .tj-wa-ready is set by the script. */
.tj-wa-panel {
    width: 320px;
    max-width: calc(100vw - 40px);
    background: var(--color-two);
    border: 1px solid rgba(230, 177, 95, .45);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .42);
}

.tj-wa-ready .tj-wa-panel {
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(.97);
    transform-origin: 100% 100%;
    transition: opacity 220ms ease, transform 220ms ease, visibility 0s linear 220ms;
}

.tj-wa-ready.is-open .tj-wa-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 220ms ease, transform 220ms ease, visibility 0s;
}

.tj-wa-panel-head {
    position: relative;
    padding: 20px 52px 16px 20px;
    border-bottom: 1px solid rgba(230, 177, 95, .22);
}

.tj-wa-eyebrow {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--main-color);
}

.tj-wa-title {
    margin: 0 0 6px;
    font-family: 'Fraunces', serif;
    font-size: 21px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--white-color);
}

.tj-wa-note {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(255, 255, 255, .62);
}

.tj-wa-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(230, 177, 95, .3);
    border-radius: 50%;
    background: transparent;
    color: var(--main-color);
    cursor: pointer;
    transition: background 250ms ease, color 250ms ease;
}

.tj-wa-close:hover,
.tj-wa-close:focus-visible {
    background: var(--main-color);
    color: var(--color-two);
}

.tj-wa-close svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.tj-wa-options {
    margin: 0;
    padding: 8px;
    list-style: none;
}

.tj-wa-options li + li { margin-top: 4px; }

.tj-wa-option {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 12px;
    border-radius: 10px;
    color: var(--white-color);
    text-decoration: none;
    transition: background 250ms ease;
}

.tj-wa-option:hover,
.tj-wa-option:focus-visible {
    background: rgba(230, 177, 95, .12);
    color: var(--white-color);
    text-decoration: none;
}

.tj-wa-option:focus-visible {
    outline: 2px solid var(--main-color);
    outline-offset: -2px;
}

.tj-wa-option-icon {
    flex: none;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(230, 177, 95, .38);
    border-radius: 50%;
    color: var(--main-color);
}

.tj-wa-option-icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tj-wa-option-text {
    flex: 1 1 auto;
    min-width: 0;
}

.tj-wa-option-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.tj-wa-option-hint {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    line-height: 1.35;
    color: rgba(255, 255, 255, .58);
}

.tj-wa-option-go {
    flex: none;
    color: var(--main-color);
    opacity: .55;
    transition: opacity 250ms ease, transform 250ms ease;
}

.tj-wa-option-go svg {
    display: block;
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tj-wa-option:hover .tj-wa-option-go,
.tj-wa-option:focus-visible .tj-wa-option-go {
    opacity: 1;
    transform: translateX(3px);
}

/* --- Sit the existing scroll-to-top button above the launcher ----------- */
/* global.css pins it to the same corner (right:20px; bottom:20px). */

.scroll-to-top {
    bottom: 94px;
}

/* --- Mobile: compact pill, thumb-friendly, clear of the home indicator -- */

@media only screen and (max-width: 767px) {

    .tj-wa {
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        gap: 12px;
    }

    .tj-wa-launcher {
        width: 54px;
        height: 54px;
        padding: 0;
        justify-content: center;
        gap: 0;
    }

    /* Icon only - the label would crowd the viewport on a phone. */
    .tj-wa-launcher-label { display: none; }

    .tj-wa-launcher-icon {
        width: 27px;
        height: 27px;
    }

    .tj-wa-panel {
        width: min(320px, calc(100vw - 32px));
    }

    .tj-wa-option {
        padding: 14px 12px;
    }

    .scroll-to-top {
        right: 18px;
        bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    }
}

@media only screen and (max-width: 479px) {
    .tj-wa-panel-head { padding: 18px 48px 14px 18px; }
    .tj-wa-title { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .tj-wa-launcher,
    .tj-wa-launcher-icon svg,
    .tj-wa-ready .tj-wa-panel,
    .tj-wa-option,
    .tj-wa-option-go {
        transition-duration: 1ms;
    }
    .tj-wa-ready .tj-wa-panel { transform: none; }
}
