@import url('https://fonts.cdnfonts.com/css/open-sauce-one');

:root {
    --color-dark: #2A2B2D;
    --color-gray: #A6A195;
    --color-light: #F6F4F0;
}

@font-face {
    font-family: 'Kenao';
    src: url('Kenao.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-light);
    font-family: 'Kenao', sans-serif;
    /* Allow scrolling to drive the animation */
    height: 300vh; /* Long scroll area for gradual control */
    overflow-x: hidden;
    overflow-y: auto;
}

.container {
    width: 100%;
    height: 100%;
}

.logo-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* Fixed position to scrub animation while scrolling */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 250; /* Above menu (200) so it stays clickable in header */
    transform-origin: center center;
    will-change: transform;
    touch-action: manipulation; /* Faster touch response */
    -webkit-tap-highlight-color: transparent;
    /* CRITICAL: Shrink the hitbox to only the text */
    width: min-content;
    height: min-content;
    white-space: nowrap;
}

/* SVG Logo Styling - Main page */
@keyframes logoEntrance {
    0% {
        opacity: 0;
        filter: blur(10px);
        transform: scale(1.125); /* 0.9 * 1.25 */
    }
    100% {
        opacity: 0.68;
        filter: blur(0);
        transform: scale(1.25); /* Initial landing size (240 * 1.25 = 300px) */
    }
}

@keyframes taglineEntrance {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.brand-logo {
    display: block;
    width: 240px; /* Base width set to final header size */
    height: auto;
    opacity: 0.68;
    will-change: transform;
    transform-origin: center center;
    /* Entrance Animation - ends at 1.25 scale (300px) */
    animation: logoEntrance 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.logo-container .menu-tagline {
    animation: taglineEntrance 1.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
    margin-top: 2rem;
    margin-bottom: 0;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 1.5rem;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    z-index: 1100; /* Topmost, above logo and menu */
    pointer-events: none;
}

/* Ensure site header is above everything on subpages but below injected popups */
.subpage .site-header {
    z-index: 12;
}

/* Burger Menu */
.burger-menu {
    position: relative; 
    pointer-events: auto;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0.5rem;
    z-index: 20;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.burger-menu:hover {
    opacity: 0.8;
}

.burger-menu span {
    display: block;
    width: 1.5rem;
    height: 2px;
    background-color: var(--color-dark);
    transition: transform 0.3s, opacity 0.3s;
}

/* Active State for Burger Menu (X shape) */
.burger-menu.active span:nth-child(1) {
    transform: translateY(3.5px) rotate(45deg);
}
.burger-menu.active span:nth-child(2) {
    transform: translateY(-3.5px) rotate(-45deg);
}

/* Back Button State for Burger Menu (Arrow shape pointing left) */
.burger-menu.back-button span:nth-child(1) {
    width: 0.85rem;
    transform: translateY(2px) rotate(-45deg);
    transform-origin: left center;
}
.burger-menu.back-button span:nth-child(2) {
    width: 0.85rem;
    transform: translateY(-2px) rotate(45deg);
    transform-origin: left center;
}

/* Menu Container */
.menu-container {
    opacity: 0;
    /* Fixed behind the logo */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-family: 'Open Sauce One', sans-serif;
    z-index: 5;
    padding-top: 42vh; /* Increased from 35vh to avoid collision with larger logo tagline */
    padding-left: 5vw;
    padding-right: 5vw;
    box-sizing: border-box;
    pointer-events: none; /* Initially non-interactive */
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.menu-body {
    height: calc(100vh - 42vh); /* Updated to match new padding-top */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 2rem;
    box-sizing: border-box;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When menu is fully visible, we enable pointer events */
.menu-container.interactive {
    z-index: 200;
    pointer-events: auto; /* Full interaction enabled */
}

/* Ensure children are interactive */
.menu-body, .menu-list, .menu-item, .menu-trigger {
    pointer-events: auto;
}

.menu-tagline {
    font-family: 'Open Sauce One', sans-serif;
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    transition: opacity 0.3s ease;
}

/* Hide tagline when in focus mode (menu item expanded) */
.menu-body.focus-mode .menu-tagline {
    opacity: 0 !important;
    visibility: hidden !important;
}


.menu-list {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center; /* Explicitly center items */
    width: 100%;
    max-width: 600px;
    gap: 1.38rem; /* 20% closer spacing between menu elements */
    padding-bottom: 15vh; /* Extra space at bottom for scrolling */
}

.menu-item {
    margin: 0;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.menu-trigger,
.menu-link {
    cursor: pointer;
    font-family: 'Open Sauce One', sans-serif;
    color: var(--color-gray);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    transition: color 0.3s;
    padding: 0.5rem;
    display: block;
    touch-action: manipulation; /* Faster touch response */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    text-decoration: none;
    /* Fix mobile first-click issue */
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}

.menu-trigger:hover, .menu-item.active .menu-trigger,
.menu-link:hover {
    color: var(--color-dark);
}

/* Menu Top Arrow (replaces tagline when expanded) */
.menu-top-arrow {
    display: none;
    cursor: pointer;
    color: var(--color-gray);
    transition: color 0.3s ease, transform 0.3s ease;
    align-items: center;
    justify-content: center;
}

.menu-top-arrow:hover {
    color: var(--color-dark);
}

.menu-top-arrow svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Accordion Content */
.menu-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    width: 80%;
    max-width: 40rem;
    text-align: center;
    font-family: 'Kenao', sans-serif;
}

.menu-content h3 {
    font-family: 'Open Sauce One', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--color-dark);
}

.menu-content p {
    font-family: 'Open Sauce One', sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #555;
}

.menu-item.active .menu-content {
    max-height: calc(100vh - 42vh - 8rem); /* Updated to match new padding-top */
    opacity: 1;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; /* Prevent scroll leaking to body */
    flex: 1; /* Take up remaining space in flex container */
}

/* Focus Mode for all screen sizes */
.menu-body.focus-mode {
    transform: translateY(-5vh);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto 1fr;
    align-items: center;
    column-gap: 1.5rem;
    width: 100%;
}

.menu-body.focus-mode .menu-top-arrow {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    justify-self: end;
    margin: 0 !important;
    width: 1.5rem; /* Match font-size (1rem) + some padding */
    height: 1.5rem;
    transform: none;
}

.menu-list.focus-mode, 
.menu-list.focus-mode .menu-item.active {
    display: contents;
    margin: 0;
}

.menu-list.focus-mode .menu-trigger {
    grid-column: 2;
    grid-row: 1;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 1rem;
    line-height: 1.5rem; /* Match arrow height for perfect alignment */
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-item.active .menu-content {
    grid-column: 1 / span 3;
    grid-row: 2;
    width: 100%;
    max-width: 90vw; /* Much wider on desktop */
    margin: 3.5rem auto 0; /* Increased from 2rem to give more space below pill */
    opacity: 1;
    max-height: calc(100vh - 25vh); /* Taller */
    overflow-y: auto;
    align-self: start; /* Top-align content instead of centering */
}

/* Make widgets look native on desktop */
@media (min-width: 769px) {
    .menu-content {
        width: 90%;
        max-width: 70rem; /* Much wider */
    }
    
    .menu-item.active .menu-content {
        max-width: 70rem;
        max-height: 80vh;
        overflow: visible; /* No scroll appearance */
    }
    
    /* Widget containers - full height, no scroll look */
    .menu-item.active .menu-content > div {
        height: 75vh !important;
        padding-top: 0 !important;
    }
    
    .menu-item.active .menu-content iframe {
        border-radius: 1rem;
        box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    }
}

.menu-list.focus-mode {
    justify-content: center;
    padding-top: 0;
    gap: 0;
}

.menu-list.focus-mode .menu-item:not(.active) {
    display: none;
}

/* Subpage Styles */

body.subpage {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
}

/* Ensure subpage content headings use the branded sans serif stack */
.subpage .content-container h1,
.subpage .content-container h2,
.subpage .content-container h3,
.subpage .content-container h4,
.subpage .content-container h5,
.subpage .content-container h6 {
    font-family: 'Open Sauce One', sans-serif;
    font-weight: 600;
    letter-spacing: 0.08em;
}

/* Static Header for Subpages - includes logo + pill */
.subpage .logo-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 20vh; /* Center of logo will be at 10vh */
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--color-light);
    z-index: 10;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02); /* Subtle separation from content */
}

/* Extended header only for Packages page to cover pills */
.packages-page .logo-container {
    height: 20vh; /* Keep consistent with other subpages */
}

/* Subpage logo sizing */
.subpage .brand-logo {
    width: 240px; /* Explicitly set to ensure identical rendering path as 240px static width */
    height: auto;
    transform: scale(1); /* Matches final state of landing page */
}

/* Back Arrow */
.back-arrow {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 60;
    transition: transform 0.3s;
    color: var(--color-dark);
}

.back-arrow:hover {
    transform: translateX(-0.3rem);
}

.back-arrow svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Subpage Header - Pill inside header */
.subpage-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: fixed;
    top: 16vh; /* Adjusted to be below the logo center (10vh) */
    left: 0;
    right: 0;
    z-index: 11;
    padding: 0;
    gap: 1.2rem;
    pointer-events: none;
}

/* Specific position for packages page to fit pills */
.packages-page .subpage-header {
    top: 16vh;
}

.subpage-header h1 {
    margin: 0 !important;
    text-align: center;
    line-height: 1;
}

.subpage-title {
    font-family: 'Open Sauce One', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-gray);
    background: rgba(255, 255, 255, 0.95);
    padding: 0.7rem 1.8rem;
    border-radius: 3rem;
    border: 1px solid rgba(166, 161, 149, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

/* Content Area for Subpages */
.content-container {
    margin-top: 28vh; /* Added 3vh extra space below pill */
    padding: 0 2rem;
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    position: relative;
}

/* Specific margin for packages page to accommodate extended header */
.packages-page .content-container {
    margin-top: 28vh;
}

/* Widget container - fixed height with internal scrolling */
.widget-container {
    position: relative;
    width: 100%;
    min-height: 60vh;
    padding-top: 2vh;
}

/* For iframe embeds (legacy) */
.widget-container iframe {
    width: 100%;
    height: 75vh;
    border: 0;
    overflow: auto;
}

/* ============================
   Mobile-specific styles (Last to ensure overrides)
   ============================ */
@media (max-width: 768px) {
    .site-header {
        height: 12vh;
        padding: 0 5vw;
    }

    .brand-logo {
        width: 160px; /* Base width set to final mobile header size */
        height: auto;
    }

    /* Mobile Menu Optimization */
    .menu-container {
        padding-top: 5vh; 
        padding-bottom: env(safe-area-inset-bottom, 0);
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .menu-body {
        height: calc(100dvh - 5vh);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        position: relative; 
        transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .menu-tagline {
        font-size: 0.77rem;
        font-weight: 500;
        padding: 0 5vw;
        text-align: center;
        z-index: 1; /* Lower z-index so it doesn't block menu */
        margin: 0;
        pointer-events: none; /* Allow clicks to pass through */
    }

    .menu-list {
        gap: 0.94vh; 
        padding: 0;
        margin-top: 16vh; /* Adjusted to make room for tagline and match 1.8x gap rule */
        width: 100%;
        flex: 1; 
        display: flex;
        flex-direction: column;
        justify-content: center; 
        min-height: 0;
    }
    
    .menu-item {
        padding: 0; 
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 0;
    }

    .menu-trigger,
    .menu-link {
        font-size: clamp(0.31rem, 1.53vw, 0.41rem); /* 30% smaller */
        font-weight: 400;
        letter-spacing: 0.08em;
        padding: 0.41rem 0.55rem; /* 30% smaller */
        line-height: 1.2;
        min-height: 24px; /* 30% smaller than 34px */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Focus Mode overrides for mobile - Perfectly Centered Title with Offset Arrow */
    .menu-body.focus-mode {
        transform: translateY(10vh); /* Brought up from 14vh */
        column-gap: 0.75rem;
    }

    .menu-body.focus-mode .menu-top-arrow {
        width: 1.17rem; /* 22% smaller than 1.5rem */
        height: 1.17rem;
    }

    .menu-list.focus-mode .menu-trigger {
        /* Matches base menu trigger size - 30% smaller */
        font-size: clamp(0.39rem, 1.91vw, 0.52rem);
        line-height: 1.05rem;
    }

    .menu-item.active .menu-content {
        max-height: calc(100dvh - 45vh); /* Adjusted for lower header at 14vh */
        margin-top: 2.5rem; /* Increased from 1.5rem for more space below pill */
        align-self: start; /* Top-align content instead of centering */
    }

    .menu-body.focus-mode .menu-tagline {
        display: none;
    }

    /* Subpage overrides for mobile */
    .subpage .logo-container {
        height: 12vh; /* Center of logo will be at 6vh */
        padding: 0;
        align-items: center;
        justify-content: center;
        z-index: 10;
        background-color: var(--color-light);
    }

    .packages-page .logo-container {
        height: 12vh; /* Keep consistent */
    }

    .subpage .brand-logo {
        width: 160px; /* Matched to 200px * 0.8 scale from landing page */
        height: auto;
        transform: scale(1);
    }

    .subpage-header {
        top: 10vh; /* Below logo center (6vh) */
        padding: 0;
        gap: 0.8rem;
    }

    .packages-page .subpage-header {
        top: 10vh;
    }
    
    .subpage-header h1 {
        font-size: 0.65rem;
        padding: 0.6rem 1.4rem;
        white-space: nowrap;
    }
    
    .subpage .content-container {
        margin-top: 18vh; /* Added extra space below pill */
        padding: 0;
    }

    .packages-page .content-container {
        margin-top: 18vh;
    }

    .subpage .widget-container {
        min-height: 50vh;
        padding-top: 3vh;
        width: 100vw;
        margin-left: calc(-50vw + 50%);
    }
    
    /* For iframe embeds (legacy) */
    .subpage .widget-container iframe {
        height: 70vh;
        width: 100%;
        overflow: auto;
    }
}
