[x-cloak] {
    display: none !important;
}

/* ── Global overflow & viewport lock ── */
html {
    overflow-x: hidden;
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
    -webkit-text-size-adjust: 100%;
}

@media (min-width: 1024px) {
    html {
        scroll-padding-top: 6rem;
    }
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Sticky header — iOS/cross-browser ── */
#main-header {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

.header-scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ── Mobile menu staggered slide-in ── */
@keyframes slideMenuIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ── Hero / page-load animations ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.8s ease-out forwards;
}

.animate-slide-down {
    animation: slideDown 0.4s ease-out forwards;
}

.animation-delay-200 { animation-delay: 0.2s; opacity: 0; animation-fill-mode: forwards; }
.animation-delay-400 { animation-delay: 0.4s; opacity: 0; animation-fill-mode: forwards; }
.animation-delay-600 { animation-delay: 0.6s; opacity: 0; animation-fill-mode: forwards; }
.animation-delay-800 { animation-delay: 0.8s; opacity: 0; animation-fill-mode: forwards; }

/* ── Range input styling ── */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    outline: none;
    touch-action: manipulation;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #1E4ED8;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #1E4ED8;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* ── HTMX indicator ── */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

/* ── Mobile sticky CTA clearance ── */
@media (max-width: 1023px) {
    body {
        padding-bottom: 64px;
    }
}

/* ── Focus styles for accessibility ── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #1E4ED8;
    outline-offset: 2px;
}

/* ── Alpine.js collapse ── */
[x-collapse] {
    overflow: hidden;
}

/* ── Selection colour ── */
::selection {
    background-color: #1E4ED8;
    color: #fff;
}

/* ── Global micro-interactions ── */
a, button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

a:active, button:active {
    transform: scale(0.97);
}

nav a:active {
    transform: scale(0.95);
}

.group:hover .group-hover\:scale-110 {
    transform: scale(1.05);
}

/* ── Smooth input interactions ── */
input, select, textarea {
    transition: all 0.2s ease-in-out;
    font-size: 16px;
}

/* ── Scrollbar styling ── */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ── Checkbox styling ── */
input[type="checkbox"] {
    accent-color: #1E4ED8;
}

/* ── Safe area insets (iPhone notch/Dynamic Island) ── */
@supports (padding: env(safe-area-inset-top)) {
    #main-header {
        padding-top: env(safe-area-inset-top);
    }

    .fixed.bottom-0 {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
