/**
 * Iris Custom Header - Frontend Styles
 * Fully responsive – matches admin dashboard design system
 * Breakpoints: 1024px (tablet), 768px (mobile), 480px (small)
 */

/* ========================================
   DESIGN TOKENS
   ======================================== */
:root {
    --iris-primary: #86b255;
    --iris-primary-hover: #79a14a;
    --iris-text-dark: #333333;
    --iris-text-light: #666666;
    --iris-border: #e8e8e8;
    --iris-bg-white: #ffffff;
    --iris-shadow-card: 0 4px 16px rgba(0, 0, 0, 0.08);
    --iris-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
    --iris-radius-pill: 50px;
    --iris-touch-target: 44px;
    /* minimum accessible touch size */
    --iris-header-bg: rgba(255, 255, 255, 0.9);
    --iris-transition: all 0.3s ease;
}

/* Lock scroll on BOTH html and body when drawer is open.
   Mobile browsers require this on the root element to prevent
   horizontal scroll bar from appearing when drawer slides in. */
html.iris-menu-open,
html.iris-menu-open body {
    overflow: hidden !important;
    max-width: 100vw;
    overscroll-behavior: none;
}

/* ========================================
   HEADER WRAPPER
   ======================================== */
.iris-custom-header {
    background: transparent;
    border-bottom: none;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: var(--iris-transition);
}

/* Scroll-shrink state (added by JS) */
.iris-custom-header.iris-header-scrolled .iris-custom-header-container {
    padding-top: clamp(8px, 1.2vw, 14px);
    padding-bottom: clamp(8px, 1.2vw, 14px);
}

.iris-custom-header.iris-header-scrolled .iris-header-logo img {
    max-height: clamp(44px, 6vw, 58px);
}

/* ========================================
   CONTAINER
   ======================================== */
.iris-custom-header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: clamp(12px, 2vw, 20px) clamp(16px, 3vw, 40px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(16px, 3vw, 48px);
    transition: padding 0.3s ease;
}

/* ========================================
   LOGO
   ======================================== */
.iris-header-logo {
    flex-shrink: 0;
}

.iris-header-logo a {
    display: block;
    text-decoration: none;
}

.iris-header-logo img {
    max-height: clamp(70px, 7vw, 78px);
    width: auto;
    display: block;
    transition: max-height 0.3s ease;
}

.iris-header-site-title {
    font-size: clamp(18px, 2.2vw, 28px);
    font-weight: 700;
    color: var(--iris-primary);
    text-decoration: none;
}

/* ========================================
   DESKTOP NAVIGATION
   ======================================== */
.iris-header-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    background: var(--iris-header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--iris-radius-pill);
    padding: clamp(8px, 1.2vw, 12px) clamp(16px, 2.5vw, 32px);
    box-shadow: var(--iris-shadow-card);
}

.iris-header-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: clamp(16px, 2.5vw, 32px);
    align-items: center;
}

.iris-header-menu li {
    margin: 0;
    padding: 0;
}

.iris-header-menu a {
    color: var(--iris-text-dark);
    text-decoration: none;
    font-size: clamp(13px, 1.1vw, 16px);
    font-weight: 500;
    transition: color 0.2s ease;
    padding: 8px 0;
    display: block;
    position: relative;
    white-space: nowrap;
}

.iris-header-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--iris-primary);
    transition: width 0.3s ease;
}

.iris-header-menu a:hover {
    color: var(--iris-primary);
}

.iris-header-menu a:hover::after {
    width: 100%;
}

.iris-header-menu .current-menu-item a,
.iris-header-menu .current_page_item a {
    color: var(--iris-primary);
    font-weight: 600;
}

.iris-header-menu .current-menu-item a::after,
.iris-header-menu .current_page_item a::after {
    width: 100%;
}

/* ========================================
   RIGHT SECTION (Social + Auth)
   ======================================== */
.iris-header-right {
    display: flex;
    align-items: center;
    gap: clamp(10px, 1.5vw, 20px);
    flex-shrink: 0;
    background: var(--iris-header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--iris-radius-pill);
    padding: clamp(8px, 1.2vw, 12px) clamp(12px, 2vw, 24px);
    box-shadow: var(--iris-shadow-card);
}

/* Social Icons */
.iris-header-social {
    display: flex;
    gap: clamp(6px, 1vw, 12px);
    align-items: center;
}

.iris-header-social a {
    color: var(--iris-text-light);
    transition: color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.iris-header-social a:hover {
    color: var(--iris-primary);
    transform: translateY(-2px);
}

.iris-header-social svg {
    width: 20px;
    height: 20px;
}

/* Auth Button Container */
.iris-header-auth {
    display: flex;
}

/* ========================================
   MOBILE MENU TOGGLE
   ======================================== */
.iris-header-mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: var(--iris-header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--iris-radius-pill);
    padding: 12px 16px;
    box-shadow: var(--iris-shadow-card);
    border: none;
    cursor: pointer;
    z-index: 1001;
    transition: var(--iris-transition);
    /* Minimum 44px touch target */
    min-width: var(--iris-touch-target);
    min-height: var(--iris-touch-target);
    align-items: center;
    justify-content: center;
}

.iris-header-mobile-toggle:hover {
    box-shadow: var(--iris-shadow-hover);
}

.iris-hamburger {
    width: 24px;
    height: 2px;
    background: var(--iris-text-dark);
    transition: var(--iris-transition);
    display: block;
}

.iris-header-mobile-toggle[aria-expanded="true"] .iris-hamburger:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.iris-header-mobile-toggle[aria-expanded="true"] .iris-hamburger:nth-child(2) {
    opacity: 0;
}

.iris-header-mobile-toggle[aria-expanded="true"] .iris-hamburger:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ========================================
   MOBILE MENU DRAWER
   ======================================== */
.iris-header-mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    /* Capped at 85vw so it never pushes layout outside the viewport */
    width: min(320px, 85vw);
    height: 100%;
    height: 100dvh;
    /* dynamic viewport height for mobile browsers */
    background: var(--iris-bg-white);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, right 0.3s ease;
    z-index: 999;
    overflow-y: auto;
    overflow-x: hidden;
    /* never allow horizontal scroll inside drawer */
    padding: 80px clamp(16px, 5vw, 24px) 24px;
    /* Prevent the drawer itself from adding to document width */
    box-sizing: border-box;
}

.iris-header-mobile-menu[aria-hidden="false"] {
    right: 0;
}

.iris-mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.iris-mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.iris-mobile-menu-list li {
    margin: 0;
    padding: 0;
}

.iris-mobile-menu-list a {
    color: var(--iris-text-dark);
    text-decoration: none;
    font-size: clamp(15px, 4vw, 18px);
    font-weight: 500;
    padding: clamp(10px, 3vw, 12px) 0;
    display: block;
    border-bottom: 1px solid #f0f0f0;
    transition: color 0.2s ease;
    /* 44px+ touch target */
    min-height: var(--iris-touch-target);
    line-height: 1.4;
    display: flex;
    align-items: center;
}

.iris-mobile-menu-list a:hover {
    color: var(--iris-primary);
}

.iris-mobile-menu-list .current-menu-item a,
.iris-mobile-menu-list .current_page_item a {
    color: var(--iris-primary);
    font-weight: 600;
}

/* Mobile Social Icons */
.iris-mobile-social {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid #f0f0f0;
}

.iris-mobile-social a {
    color: var(--iris-text-light);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--iris-touch-target);
    height: var(--iris-touch-target);
}

.iris-mobile-social a:hover {
    color: var(--iris-primary);
}

.iris-mobile-social svg {
    width: 24px;
    height: 24px;
}

/* Mobile Auth Button */
.iris-mobile-auth {
    padding-top: 16px;
}

/* Mobile Overlay — covers full viewport including scrolled area */
.iris-header-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Use 100vw/100vh so it covers even if body is wider than viewport */
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    /* Prevent overlay itself from becoming a scroll source */
    overflow: hidden;
    touch-action: none;
}

.iris-header-mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   RESPONSIVE: TABLET (≤1024px)
   ======================================== */
@media (max-width: 1024px) {
    .iris-custom-header-container {
        gap: clamp(12px, 2vw, 24px);
    }

    /* Compress nav pill padding on tablets */
    .iris-header-nav {
        padding: 10px clamp(12px, 2vw, 20px);
    }

    .iris-header-menu {
        gap: clamp(12px, 2vw, 20px);
    }

    /* Compress right pill padding */
    .iris-header-right {
        padding: 10px clamp(10px, 1.5vw, 16px);
    }

    /* Hide login label text on auth button, keep icon */
    .iris-auth-buttons .iris-btn-icon {
        margin-right: 0;
    }
}

/* ========================================
   RESPONSIVE: MOBILE (≤768px)
   ======================================== */
@media (max-width: 768px) {
    .iris-custom-header-container {
        padding: clamp(10px, 3vw, 16px) clamp(12px, 4vw, 20px);
    }

    /* Hide desktop nav and right section */
    .iris-header-nav {
        display: none !important;
    }

    .iris-header-right {
        display: none !important;
    }

    /* Show mobile toggle */
    .iris-header-mobile-toggle {
        display: flex !important;
    }
}

/* ========================================
   RESPONSIVE: DESKTOP (≥769px) — hide mobile drawer
   ======================================== */
@media (min-width: 769px) {
    .iris-header-mobile-menu {
        display: none !important;
    }
}

/* ========================================
   RESPONSIVE: SMALL MOBILE (≤480px)
   ======================================== */
@media (max-width: 480px) {
    .iris-custom-header-container {
        padding: 10px 12px;
    }

    /* Slightly smaller logo on very small screens */
    .iris-header-logo img {
        max-height: clamp(60px, 10vw, 70px);
    }

    .iris-header-site-title {
        font-size: clamp(15px, 4.5vw, 20px);
    }

    /* Narrower hamburger on tiny screens */
    .iris-header-mobile-toggle {
        padding: 10px 12px;
    }

    /* Mobile drawer fills more of the screen */
    .iris-header-mobile-menu {
        width: 85vw;
        padding: 70px 16px 20px;
    }

    .iris-mobile-menu-list a {
        font-size: clamp(14px, 4vw, 16px);
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
.iris-custom-header a:focus,
.iris-header-mobile-toggle:focus {
    outline: none;
    box-shadow: none;
}

.iris-header-menu a:focus {
    color: var(--iris-primary);
}

.iris-header-menu a:focus::after {
    width: 100%;
}

.iris-header-social a:focus {
    color: var(--iris-primary);
    transform: translateY(-2px);
}

/* Skip to content */
.iris-header-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--iris-primary);
    color: #ffffff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
}

.iris-header-skip-link:focus {
    top: 0;
}

/* ========================================
   WOOCOMMERCE COMPATIBILITY
   ======================================== */
body.woocommerce-cart,
body.woocommerce-checkout,
body.woocommerce-account {
    padding-top: 100px;
}

.woocommerce,
.woocommerce-page {
    position: relative;
    z-index: 1;
}

.woocommerce-notices-wrapper {
    margin-top: 20px;
}

@media (max-width: 768px) {

    body.woocommerce-cart,
    body.woocommerce-checkout,
    body.woocommerce-account {
        padding-top: 80px;
    }
}

@media (max-width: 480px) {

    body.woocommerce-cart,
    body.woocommerce-checkout,
    body.woocommerce-account {
        padding-top: 70px;
    }
}

/* ========================================
   HERO BANNER
   ======================================== */
.iris-hero-banner {
    position: relative;
    width: 100%;
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden; /* Required so the overlay respects border-radius */
    /* Offset for the fixed header so the banner starts below it */
    padding-top: 90px;
    padding-bottom: 60px;
    box-sizing: border-box;
}

/* Dark overlay — opacity controlled via inline style from PHP */
.iris-hero-overlay {
    position: absolute;
    inset: 0;
    background: #000000;
    pointer-events: none;
}

/* Centred content sits above the overlay */
.iris-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0 clamp(16px, 6vw, 80px);
    max-width: 900px;
    width: 100%;
}

.iris-hero-title {
    color: #ffffff;
    font-size: clamp(28px, 5vw, 64px);
    font-weight: 700;
    margin: 0 0 16px;
    line-height: 1.15;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.iris-hero-subtitle {
    color: rgba(255, 255, 255, 0.88);
    font-size: clamp(14px, 2.2vw, 22px);
    font-weight: 400;
    margin: 0;
    line-height: 1.5;
}

/* Fallback colour when no background image is provided */
.iris-hero-banner:not([style*="background-image"]) {
    background-color: var(--iris-primary);
}

/* Tablet */
@media (max-width: 1024px) {
    .iris-hero-banner {
        min-height: 300px;
        padding-top: 90px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .iris-hero-banner {
        min-height: 260px;
        padding-top: 80px;
        padding-bottom: 40px;
    }

    .iris-hero-title {
        margin-bottom: 10px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .iris-hero-banner {
        min-height: 200px;
        padding-top: 70px;
        padding-bottom: 30px;
    }
}