/**
 * Smart Sticky Header Styles
 * Hides header on scroll down, shows on scroll up
 *
 * @package Sierra_At_Tahoe
 */

.smart-sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateY(0);
    transition: transform 0.3s ease-in-out;
    will-change: transform;
}

.smart-sticky-header.header-hidden {
    transform: translateY(-100%);
}

.smart-sticky-header.header-visible {
    transform: translateY(0);
}

/**
 * Admin bar adjustments
 */
body.admin-bar .smart-sticky-header {
    top: 32px; /* WordPress admin bar height on desktop */
}

@media screen and (max-width: 782px) {
    body.admin-bar .smart-sticky-header {
        top: 46px; /* WordPress admin bar height on mobile */
    }
}

/**
 * Prevent layout shift by adding top padding to main content
 * This compensates for the fixed positioning of the header
 * Using padding instead of margin to avoid collapsing margins
 *
 * Note: No fallback value to prevent flash - JavaScript will set this immediately
 *
 * IMPORTANT: This rule is overridden by helpers.css when the first child is a
 * full-width block (cover, group, etc.) to create seamless edge-to-edge layouts.
 *
 * Using !important to override inline styles from block editor
 */
body:has(.smart-sticky-header) main {
    padding-top: var(--header-height) !important;
}

/* When advisory is present, add both header and advisory heights
   Advisory sits below header, so total space needed is header + advisory */
body:has(.smart-sticky-header):has(.sierra-resort-advisory) main {
    padding-top: calc(var(--header-height) + var(--advisory-height, 0px)) !important;
}

/* Ensure the cover block inside main doesn't add extra space */
body:has(.smart-sticky-header) main > .wp-block-group > .wp-block-cover:first-child {
    margin-top: 0;
}

/**
 * Optional: Add shadow when header is visible and scrolled
 */
.smart-sticky-header.header-visible {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
