/* ==========================================================================
   Krabi ATV Adventours — Global Stylesheet
   Header, footer, buttons, typography, and shared utilities.
   Homepage-specific rules live in homepage.css.
   ========================================================================== */

/* --- CSS Variables --- */
:root {
    --color-primary: #f7941d;
    --color-primary-dark: #e07f0a;
    --color-primary-light: #ffb347;
    --color-dark: #0a1128;
    --color-dark-mid: #1a2a4a;
    --color-text: #333333;
    --color-text-muted: #6b7280;
    --color-white: #ffffff;
    --color-bg-light: #f5f7fa;
    --color-border: #e2e8f0;

    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --header-height: 90px;
    --logo-mark-size: 66px;
    --container-max: 1200px;
    --radius: 6px;
    --radius-lg: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
    --transition: 0.3s ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-white);
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
}

ul {
    list-style: none;
}

button,
input,
select {
    font-family: inherit;
    font-size: inherit;
}

/* --- Layout Utilities --- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
}

.text-accent {
    color: var(--color-primary);
}

.text-muted {
    color: var(--color-text-muted);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition), transform var(--transition),
                box-shadow var(--transition);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: 0 4px 15px rgba(247, 148, 29, 0.4);
}

.btn-white {
    background: var(--color-white);
    color: var(--color-primary);
    border-color: var(--color-white);
}

.btn-white:hover {
    background: var(--color-bg-light);
}

.btn-outline {
    background: transparent;
    color: var(--color-white);
    border-color: rgba(255, 255, 255, 0.6);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-white);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* --- Section Shared Tags (used in footer context too) --- */
.section-tag {
    display: inline-block;
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.section-title {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--color-dark);
    line-height: 1.3;
    margin-bottom: 16px;
}

/* ==========================================================================
   STICKY TRANSPARENT HEADER
   ========================================================================== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-height);
    background: transparent;
    transition: background var(--transition), box-shadow var(--transition);
}

/* Solid background applied on scroll via JS */
.site-header.is-scrolled {
    background: rgba(10, 17, 40, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
}

.header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    height: 100%;
    gap: 24px;
    position: relative;
}

.logo {
    grid-column: 1;
}

.btn-header {
    grid-column: 3;
}

/* Logo — compact mark + wordmark, fully contained in header */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-white);
    flex-shrink: 0;
    justify-self: start;
    min-width: 0;
    transition: opacity var(--transition);
    position: relative;
    z-index: 2;
}

.logo:hover {
    opacity: 0.9;
}

.logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--logo-mark-size);
    height: var(--logo-mark-size);
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.logo-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.logo-wordmark {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    gap: 1px;
}

.logo-wordmark-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.logo-wordmark-sub {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Drop shadow on wordmark for legibility over hero imagery */
.page-home .site-header:not(.is-scrolled) .logo-wordmark {
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

/* Navigation — centred in header bar on desktop */
.main-nav {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.main-nav ul {
    display: flex;
    align-items: center;
    gap: 32px;
}

.main-nav a {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: width var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--color-white);
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

.btn-header {
    padding: 10px 22px;
    font-size: 0.85rem;
    flex-shrink: 0;
    justify-self: end;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-white);
    transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu backdrop */
.nav-backdrop {
    display: none;
}

/* Header open state — solid bar, no backdrop-filter (prevents fixed-menu clipping) */
.site-header.is-nav-open {
    background: rgba(10, 17, 40, 0.98);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 1100;
}

.site-header.is-nav-open .header-inner {
    position: relative;
    z-index: 1102;
}

body.nav-open {
    overflow: hidden;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
    background: var(--color-dark);
    color: rgba(255, 255, 255, 0.75);
    padding: 60px 0 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1.4fr;
    gap: 40px;
    padding-bottom: 40px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-white);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 16px;
}

.footer-about {
    font-size: 0.875rem;
    line-height: 1.7;
    margin-bottom: 20px;
}

.social-links {
    display: flex;
    gap: 12px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    transition: background var(--transition), color var(--transition);
}

.social-links a:hover {
    background: var(--color-primary);
    color: var(--color-white);
}

.footer-col h4 {
    color: var(--color-white);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.65);
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--color-primary);
}

.footer-hours li {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    margin-bottom: 8px;
    gap: 12px;
}

.footer-hours span:first-child {
    color: rgba(255, 255, 255, 0.65);
}

.footer-hours span:last-child {
    color: var(--color-white);
    font-weight: 500;
}

/* Footer newsletter box */
.footer-newsletter {
    margin-top: 24px;
}

.footer-newsletter h4 {
    margin-bottom: 12px;
}

.newsletter-form .newsletter-input-group {
    display: flex;
    gap: 0;
}

.newsletter-input-group input[type="email"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-white);
    outline: none;
    font-size: 0.875rem;
    min-width: 0;
}

.newsletter-input-group input[type="email"]::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.newsletter-input-group input[type="email"]:focus {
    border-color: var(--color-primary);
}

.newsletter-input-group .btn {
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 10px 18px;
    font-size: 0.85rem;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 20px 0;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
}

/* ==========================================================================
   SEARCH RESULTS PAGE (minimal global styles)
   ========================================================================== */
.search-results-page {
    padding: calc(var(--header-height) + 40px) 0 60px;
}

.search-results-page h1 {
    font-size: 2rem;
    color: var(--color-dark);
    margin-bottom: 24px;
}

.search-params {
    background: var(--color-bg-light);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.search-params p {
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.search-results-container {
    min-height: 200px;
}

/* ==========================================================================
   RESPONSIVE — Global
   ========================================================================== */
@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .main-nav ul {
        gap: 20px;
    }
}

@media (max-width: 900px) {
    .logo-wordmark {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 72px;
        --logo-mark-size: 54px;
    }

    .header-inner {
        grid-template-columns: 1fr auto;
        gap: 12px;
        position: relative;
        z-index: 1102;
    }

    .logo {
        grid-column: 1;
    }

    .btn-header {
        grid-column: auto;
    }

    .logo-wordmark {
        display: none;
    }

    .nav-toggle {
        display: flex;
        justify-self: end;
        z-index: 1103;
    }

    .btn-header {
        display: none;
    }

    /* Dim overlay behind menu panel */
    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1098;
        background: rgba(10, 17, 40, 0.65);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity var(--transition), visibility var(--transition);
    }

    .nav-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* Full-width slide-in panel (sibling of .container — not grid-constrained) */
    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100vw;
        height: calc(100dvh - var(--header-height));
        margin: 0;
        padding: 28px 24px 40px;
        background: rgba(10, 17, 40, 0.98);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        z-index: 1101;
        transform: translateX(100%);
        opacity: 1;
        visibility: hidden;
        transition: transform 0.35s ease, visibility 0.35s ease;
        pointer-events: none;
    }

    .main-nav.is-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }

    .main-nav li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .main-nav a {
        display: block;
        font-size: 1.1rem;
        font-weight: 500;
        padding: 16px 4px;
        width: 100%;
    }

    .main-nav a::after {
        bottom: 12px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}
