/* Floating action stack — back-to-top + WhatsApp */
:root {
    --float-btn-size: 2.65rem;
    --float-btn-gap: 0.55rem;
    --float-btn-inset: 1.15rem;
    --float-wa-bottom: calc(var(--float-btn-inset) + env(safe-area-inset-bottom));
}
.float-actions-stack {
    position: fixed;
    bottom: var(--float-wa-bottom);
    right: calc(var(--float-btn-inset) + env(safe-area-inset-right));
    z-index: 55;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--float-btn-gap);
}
.float-action-circle {
    width: var(--float-btn-size);
    height: var(--float-btn-size);
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    background: var(--text-heading);
    color: #fff;
    box-shadow: 0 8px 22px rgba(28,25,23,0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.float-action-circle svg,
.float-action-icon {
    display: block;
    width: 1.05rem;
    height: 1.05rem;
}
.float-action-circle:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(28,25,23,0.22);
    color: #fff;
}
.float-action-circle:active { transform: translateY(-1px) scale(0.96); }

/* Back to top — traveler morphs into footer pill */
.btn-back-top-label {
    white-space: nowrap;
    font-weight: 600;
    font-family: var(--font-sans);
    line-height: 1;
}
.btn-back-top-traveler {
    position: relative;
    padding: 0;
    overflow: hidden;
    display: none;
    transform: translateY(14px) scale(0.88);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(.22,1,.36,1), visibility 0.28s, box-shadow 0.2s;
}
.btn-back-top-traveler.is-visible:not(.is-morphing):not(.is-docked) {
    display: grid;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
.btn-back-top-traveler.is-morphing {
    position: fixed;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    z-index: 60;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    border-radius: 999px;
    overflow: hidden;
    transition: box-shadow 0.12s ease;
    box-shadow: 0 calc(8px - 3px * var(--morph, 0)) calc(22px - 8px * var(--morph, 0)) rgba(28,25,23,calc(0.18 - 0.1 * var(--morph, 0)));
    background: color-mix(in srgb, var(--text-heading) calc((1 - var(--morph, 0)) * 100%), var(--bg-card));
    color: color-mix(in srgb, #fff calc((1 - var(--morph, 0)) * 100%), var(--text-heading));
}
.btn-back-top-traveler.is-morphing .float-action-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: calc(1 - min(1, var(--morph, 0) / 0.22));
    pointer-events: none;
    z-index: 1;
}
.btn-back-top-traveler.is-morphing .btn-back-top-traveler-shell {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
    height: 100%;
    padding: 0.25rem 1rem 0.25rem 0.25rem;
    box-sizing: border-box;
    opacity: min(1, max(0, (var(--morph, 0) - 0.1) / 0.22));
}
.btn-back-top-traveler.is-docked {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
.btn-back-top-traveler-shell {
    display: none;
    box-sizing: border-box;
}
.btn-back-top-traveler:not(.is-morphing) .float-action-icon {
    display: block;
}
.btn-back-top-traveler:not(.is-morphing) .btn-back-top-traveler-shell {
    display: none;
}
.btn-back-top-traveler:not(.is-morphing) .btn-back-top-label { display: none; }
.btn-back-top-traveler .icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: #1c1917;
    color: #fff;
}
.btn-back-top-traveler.is-morphing .icon-circle {
    width: 28px;
    height: 28px;
    min-width: 28px;
}
.btn-back-top-traveler.is-morphing .icon-circle svg {
    width: 16px;
    height: 16px;
    display: block;
}
.btn-back-top-traveler .btn-back-top-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1;
}
.btn-back-top-traveler.is-morphing .btn-back-top-label {
    opacity: max(0, calc((var(--morph, 0) - 0.3) / 0.7));
    max-width: 100%;
    flex: 1;
    min-width: 0;
}
.btn-back-top-traveler:not(.is-morphing):not(.is-docked):hover {
    background: var(--primary-dark);
    transform: translateY(-3px) scale(1);
    box-shadow: 0 12px 28px rgba(28,25,23,0.22);
}
.btn-back-top-traveler:not(.is-morphing):active { transform: translateY(-1px) scale(0.96); }
@keyframes backTopFooterPop {
    0% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-7px) scale(1.03); }
    55% { transform: translateY(-2px) scale(0.98); }
    75% { transform: translateY(-5px) scale(1.01); }
    100% { transform: translateY(0) scale(1); }
}
@keyframes backTopIconRing {
    0% { box-shadow: 0 0 0 0 rgba(245,158,11,0.45); }
    70% { box-shadow: 0 0 0 8px rgba(245,158,11,0); }
    100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); }
}
#footer-back-top.is-merge-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}
#footer-back-top.is-approaching {
    opacity: var(--receive, 0);
    transform: scale(calc(0.96 + var(--receive, 0) * 0.04));
    pointer-events: none;
}
#footer-back-top.is-docked {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}
#footer-back-top.is-in-view {
    animation: backTopFooterPop 0.85s cubic-bezier(.34,1.4,.64,1);
    background-color: #bce5d5;
}
#footer-back-top.is-in-view .icon-circle {
    animation: backTopIconRing 0.85s ease;
}

/* WhatsApp — same circle as back-to-top */
.wa-float.float-action-circle,
a.wa-float {
    width: var(--float-btn-size);
    height: var(--float-btn-size);
    text-decoration: none;
}

@media (max-width: 768px) {
    :root {
        --float-btn-size: 2.35rem;
        --float-btn-gap: 0.4rem;
        --float-btn-inset: 0.75rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .btn-back-top-traveler { transition: opacity 0.15s, visibility 0.15s; transform: none; }
    .btn-back-top-traveler.is-visible:not(.is-morphing) { transform: none; }
    .float-action-circle,
    .wa-float { transition: opacity 0.15s; transform: none; }
    .float-action-circle:hover,
    .wa-float:hover { transform: none; }
    #footer-back-top.is-in-view,
    #footer-back-top.is-in-view .icon-circle { animation: none; }
}
