:root {
    --color-cream: #F5F0EB;
    --color-cream-soft: #FAF7F4;
    --color-brown: #3C2415;
    --color-gold: #B8956A;
    --color-gold-deep: #a68459;
    --color-sage: #A8B5A0;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Sarabun', 'Inter', sans-serif;
    background-color: var(--color-cream);
    color: var(--color-brown);
    font-weight: 300;
    line-height: 1.65;
    opacity: 0;
    transition: opacity 0.35s ease;
}
body.page-loaded { opacity: 1; }
body.page-leaving { opacity: 0; }

h1, h2, h3, h4, h5, h6, .font-serif {
    font-family: 'Playfair Display', serif;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.font-en { font-family: 'Inter', sans-serif; }

/* Scroll-reveal */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(1.5rem);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}
.animate-on-scroll.is-visible { opacity: 1; transform: translateY(0); }
.animate-on-scroll.delay-100 { transition-delay: 0.1s; }
.animate-on-scroll.delay-200 { transition-delay: 0.2s; }
.animate-on-scroll.delay-300 { transition-delay: 0.3s; }
.animate-on-scroll.delay-400 { transition-delay: 0.4s; }

/* Sticky nav */
#main-nav {
    transition: padding 0.3s ease, background-color 0.3s ease, backdrop-filter 0.3s ease;
}
#main-nav.scrolled {
    background-color: rgba(245, 240, 235, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(60, 36, 21, 0.06);
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}
body[data-page]:not([data-page="home"]) #main-nav {
    background-color: rgba(245, 240, 235, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(60, 36, 21, 0.06);
}

/* Home nav transparent over hero */
body[data-page="home"] #main-nav:not(.scrolled) {
    background-color: rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
body[data-page="home"] #main-nav:not(.scrolled) .nav-logo,
body[data-page="home"] #main-nav:not(.scrolled) .nav-link:not(.text-gold),
body[data-page="home"] #main-nav:not(.scrolled) #mobile-menu-btn {
    color: #ffffff;
}
body[data-page="home"] #main-nav:not(.scrolled) .nav-link:not(.text-gold):hover {
    color: #C4A265;
}
body[data-page="home"] #main-nav:not(.scrolled) .lang-toggle {
    border-color: rgba(255, 255, 255, 0.25);
    background-color: rgba(255, 255, 255, 0.08);
}
body[data-page="home"] #main-nav:not(.scrolled) .lang-toggle .lang-inactive {
    color: rgba(255, 255, 255, 0.75);
}
body[data-page="home"] #main-nav:not(.scrolled) .lang-toggle .lang-inactive:hover {
    color: #ffffff;
}

/* Language toggle */
.lang-toggle {
    border: 1px solid rgba(60, 36, 21, 0.15);
    border-radius: 9999px;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.4);
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
.lang-toggle button {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 9999px;
    transition: all 0.2s ease;
    line-height: 1;
    cursor: pointer;
}
.lang-toggle .lang-active {
    background-color: var(--color-gold);
    color: #ffffff;
    font-weight: 600;
}
.lang-toggle .lang-inactive { color: rgba(60, 36, 21, 0.55); }
.lang-toggle .lang-inactive:hover { color: var(--color-brown); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--color-cream); }
::-webkit-scrollbar-thumb { background: rgba(60, 36, 21, 0.2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-gold); }

img { -webkit-user-drag: none; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* =========== HERO PARALLAX =========== */
.hero-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
/* Mobile Safari/Chrome don't support background-attachment: fixed reliably;
   fall back to scroll there. */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .hero-bg { background-attachment: scroll; }
}

/* =========== SERVICES ROW HOVER =========== */
.service-row {
    transition: background-color 0.25s ease, padding-left 0.25s ease;
    padding-left: 0.5rem;
    margin-left: -0.5rem;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
    border-radius: 0.5rem;
}
.service-row:hover {
    background-color: rgba(184, 149, 106, 0.08);
    padding-left: 1rem;
}

/* =========== FORM FOCUS =========== */
.form-field {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.form-field:focus {
    outline: none;
    border-color: var(--color-gold) !important;
    box-shadow: 0 0 0 4px rgba(184, 149, 106, 0.15);
    background-color: #ffffff;
}

/* =========== BOOKING MODAL =========== */
body.modal-open { overflow: hidden; }

#booking-modal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 1rem;
}
#booking-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}
#booking-modal-wrap {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 85vh;
}
#booking-modal-panel {
    position: relative;
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
    transform: scale(0.96);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
#booking-modal.is-open #booking-modal-panel {
    transform: scale(1);
}
#booking-modal-close {
    position: absolute;
    top: -16px;
    right: -16px;
    z-index: 20;
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    background: #ffffff;
    color: var(--color-brown);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
#booking-modal-close:hover {
    background: var(--color-gold);
    color: #ffffff;
    transform: scale(1.08) rotate(90deg);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}
#booking-modal-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: var(--color-cream-soft);
    position: relative;
    z-index: 1;
}

/* Mobile: full-screen modal (no padding, no blur, no rounded corners,
   close button moves inside the top-right corner) */
@media (max-width: 640px) {
    #booking-modal {
        padding: 0;
        /* Switch dark backdrop for white so the brief entry-scale gap
           around the edge of the panel blends in rather than flashing dark */
        background-color: #ffffff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    #booking-modal-wrap {
        max-width: none;
        width: 100%;
        height: 100%;
    }
    #booking-modal-panel {
        border-radius: 0;
        box-shadow: none;
    }
    #booking-modal-close {
        top: 12px;
        right: 12px;
        /* Keep shadow now that the button no longer overhangs the panel edge */
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    }
}

/* Spinner */
#booking-modal-spinner {
    position: absolute;
    inset: 0;
    background: var(--color-cream-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 5;
    opacity: 1;
    transition: opacity 0.35s ease;
}
#booking-modal-spinner.is-hidden {
    opacity: 0;
    pointer-events: none;
}
.spinner-ring {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(184, 149, 106, 0.25);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: spinner-spin 0.85s linear infinite;
}
.spinner-label {
    font-family: 'Sarabun', 'Inter', sans-serif;
    font-size: 0.85rem;
    color: rgba(60, 36, 21, 0.6);
    letter-spacing: 0.05em;
}
@keyframes spinner-spin { to { transform: rotate(360deg); } }

/* =========== BACK TO TOP =========== */
#back-to-top {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 49;
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    background: var(--color-brown);
    color: var(--color-cream);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
}
#back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
#back-to-top:hover {
    background: var(--color-gold);
}

/* =========== TOAST =========== */
#vorn-toast {
    position: fixed;
    left: 50%;
    bottom: 6.5rem;
    transform: translateX(-50%) translateY(0.75rem);
    z-index: 200;
    background-color: var(--color-brown);
    color: var(--color-cream);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-family: 'Sarabun', 'Inter', sans-serif;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}
#vorn-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =========== TEAM CARD HOVER ENHANCEMENT =========== */
.team-card {
    transition: box-shadow 0.4s ease, transform 0.4s ease, border-color 0.3s ease;
}
.team-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 25px 50px -12px rgba(60, 36, 21, 0.25);
    border-color: rgba(184, 149, 106, 0.3);
}
.team-card .team-photo {
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), filter 0.7s ease;
}
.team-card:hover .team-photo {
    transform: scale(1.08);
    filter: grayscale(0);
}

/* =========== FOOTER POWERED-BY =========== */
.footer-powered-by {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.footer-powered-by a.bkk-link {
    color: var(--color-gold);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    transition: color 0.2s ease;
    border-bottom: 1px solid transparent;
}
.footer-powered-by a.bkk-link:hover {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.4);
}
