/* ==========================================================================
   IMungro - Header & Navigation Styles
   ========================================================================== */

/* WP Admin Bar collision fix */
body.admin-bar .im-header { top: 32px; }
@media (max-width: 782px) {
    body.admin-bar .im-header { top: 46px; }
}

.im-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9700;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: none;
}

.im-header.scrolled {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: none;
}

.im-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2.5rem;
    min-height: 80px;
    gap: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* ==========================================================================
   Logo — black shadow, max 10px spread as requested
   ========================================================================== */

.im-header-logo {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    height: 80px;
    overflow: visible;
    position: relative;
    z-index: 10;
    margin-left: 0;
}

.im-logo-link {
    display: flex;
    align-items: flex-start;
    height: 100%;
    line-height: 0;
    text-decoration: none;
}

.im-logo-img {
    height: 95px;
    max-height: 95px;
    width: auto;
    max-width: 260px;
    object-fit: contain;
    display: block;
    background: transparent;
    /* Black shadow behind and around the logo — tight, max ~10px spread */
    filter:
        drop-shadow(0 2px 6px rgba(0, 0, 0, 0.9))
        drop-shadow(0 0 10px rgba(0, 0, 0, 0.7));
}

.im-logo-img.im-logo-default {
    filter:
        drop-shadow(0 2px 6px rgba(0, 0, 0, 0.9))
        drop-shadow(0 0 10px rgba(0, 0, 0, 0.7))
        drop-shadow(0 0 6px rgba(242, 202, 80, 0.2));
}

.im-header-logo .custom-logo-link {
    display: block;
    line-height: 0;
}

.im-header-logo .custom-logo {
    max-height: 95px;
    width: auto;
    object-fit: contain;
}

/* ==========================================================================
   Primary Navigation - Dual Language Desktop
   ========================================================================== */

.im-primary-nav {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.im-nav-desktop {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    overflow: visible;
}

.im-nav-list {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 0;
    flex-wrap: nowrap;
    max-width: 100%;
}

.im-nav-list > .im-nav-item {
    position: relative;
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
}

.im-nav-list > .im-nav-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 1px;
    height: 30px;
    background: linear-gradient(180deg, transparent 0%, var(--im-primary) 25%, var(--im-primary) 75%, transparent 100%);
    opacity: 0.4;
    box-shadow: 0 0 5px rgba(242, 202, 80, 0.4);
    pointer-events: none;
}

.im-nav-list > .im-nav-item:not(:last-child)::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    transform: translate(50%, -50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: radial-gradient(circle, #fffbe8 0%, var(--im-primary) 50%, transparent 80%);
    box-shadow: 0 0 6px 2px rgba(242, 202, 80, 0.8), 0 0 14px 5px rgba(242, 202, 80, 0.4);
    z-index: 2;
    pointer-events: none;
}

.im-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    padding: 0.25rem 0;
    transition: color 0.15s ease;
    position: relative;
}

.im-nav-en {
    font-family: var(--im-font-nav);
    font-size: 12px;
    font-weight: 700;
    color: var(--im-on-surface);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    line-height: 1.4;
    transition: color 0.15s ease;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(0, 0, 0, 0.5);
}

.im-nav-jp {
    font-family: var(--im-font-nav-sub);
    font-size: 10px;
    font-weight: 300;
    color: var(--im-on-surface-variant);
    letter-spacing: 0.05em;
    line-height: 1.2;
    margin-top: 2px;
    transition: color 0.15s ease;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.im-nav-link:hover .im-nav-en,
.im-nav-item:hover > .im-nav-link .im-nav-en {
    color: var(--im-primary);
}

.im-nav-link:hover .im-nav-jp,
.im-nav-item:hover > .im-nav-link .im-nav-jp {
    color: var(--im-secondary);
}

.im-nav-item.current-menu-item > .im-nav-link .im-nav-en {
    color: var(--im-primary);
}

/* ==========================================================================
   Sub Menu (Dropdowns)
   ========================================================================== */

.im-nav-has-children { position: relative; }

.im-nav-has-children > .im-nav-link::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-right: 1px solid var(--im-primary);
    border-bottom: 1px solid var(--im-primary);
    transform: rotate(45deg);
    margin-left: 6px;
    margin-top: -3px;
    transition: transform 0.15s ease;
}

.im-nav-has-children:hover > .im-nav-link::after {
    transform: rotate(-135deg);
    border-color: var(--im-secondary-container);
}

/* Desktop-only dropdown — hard-scoped to min-width:1025px so it can
   NEVER bleed into the mobile slide-out panel, regardless of cascade
   order or stylesheet caching. Mobile submenu styles live entirely in
   their own @media (max-width: 1024px) block further down. */
@media (min-width: 1025px) {
    .im-sub-menu {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
        list-style: none;
        background: rgba(14, 14, 14, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid var(--im-primary);
        min-width: 200px;
        padding: 0;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
        z-index: 100;
    }

    .im-sub-menu::before,
    .im-sub-menu::after {
        content: '';
        position: absolute;
        width: 8px;
        height: 8px;
        border: 1px solid var(--im-primary);
    }

    .im-sub-menu::before {
        top: -1px; left: -1px;
        border-right: none; border-bottom: none;
    }

    .im-sub-menu::after {
        bottom: -1px; right: -1px;
        border-left: none; border-top: none;
    }

    .im-nav-has-children:hover > .im-sub-menu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }

    .im-sub-menu li {
        border-bottom: 1px solid var(--im-outline-variant);
    }

    .im-sub-menu li:last-child { border-bottom: none; }

    .im-sub-link {
        display: block;
        padding: 0.75rem 1.25rem;
        font-family: var(--im-font-nav);
        font-size: 12px;
        font-weight: 400;
        color: var(--im-on-surface);
        letter-spacing: 0.08em;
        text-transform: uppercase;
        text-decoration: none;
        transition: color 0.1s ease, background 0.1s ease;
        text-align: center;
    }

    .im-sub-link:hover {
        color: var(--im-secondary-container);
        background: rgba(0, 210, 255, 0.08);
    }
}

/* ==========================================================================
   Icon Bar (Far Right)
   ========================================================================== */

.im-header-icons {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.im-icon-group {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.im-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 2px solid var(--im-primary);
    border-radius: 10px;
    background: transparent;
    color: var(--im-primary);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
    position: relative;
    flex-shrink: 0;
}

.im-icon-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.im-icon-btn:hover {
    border-color: var(--im-secondary-container);
    color: var(--im-secondary-container);
}

.im-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--im-secondary-container);
    color: var(--im-on-secondary);
    font-family: var(--im-font-nav);
    font-size: 10px;
    font-weight: 600;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: 50%;
    min-width: 18px;
}

/* ==========================================================================
   Social Icon Bar
   ========================================================================== */

.im-social-icons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.im-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--im-social-icon-size, 32px);
    height: var(--im-social-icon-size, 32px);
    border: 1px solid var(--im-primary);
    border-radius: 7px;
    background: transparent;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
}

.im-social-btn svg {
    width: calc(var(--im-social-icon-size, 32px) * 0.5);
    height: calc(var(--im-social-icon-size, 32px) * 0.5);
    position: relative;
    z-index: 1;
}

.im-social-btn:hover {
    transform: translateY(-2px);
}

.im-social-twitter svg { fill: #1DA1F2; }
.im-social-twitter:hover { border-color: #1DA1F2; }
.im-social-facebook svg { fill: #1877F2; }
.im-social-facebook:hover { border-color: #1877F2; }
.im-social-youtube svg { fill: #FF0000; }
.im-social-youtube:hover { border-color: #FF0000; }

.im-social-instagram {
    background: radial-gradient(circle at 30% 110%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
    border-color: var(--im-primary);
}
.im-social-instagram svg { fill: #fff; }

.im-social-google svg { fill: none; }
.im-social-google .g-blue   { fill: #4285F4; }
.im-social-google .g-green  { fill: #34A853; }
.im-social-google .g-yellow { fill: #FBBC05; }
.im-social-google .g-red    { fill: #EA4335; }
.im-social-google:hover { border-color: #4285F4; }

.im-social-bookbub {
    font-family: var(--im-font-display);
    font-weight: 700;
    font-size: calc(var(--im-social-icon-size, 32px) * 0.45);
    letter-spacing: -0.02em;
    color: var(--im-primary);
}
.im-social-bookbub:hover {
    border-color: var(--im-secondary-container);
    color: var(--im-secondary-container);
}

.im-header-icons-divider {
    width: 1px;
    height: 30px;
    background: var(--im-outline-variant);
    opacity: 0.5;
    flex-shrink: 0;
}

/* ==========================================================================
   Mobile Navigation Toggle (Hamburger)
   Positioned at far right — it's the last flex child of .im-header-inner
   ========================================================================== */

.im-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 9600;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.im-nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--im-primary);
    transition: transform 0.2s ease, opacity 0.2s ease;
    transform-origin: center;
}

.im-nav-toggle.active .im-nav-toggle-bar:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.im-nav-toggle.active .im-nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.im-nav-toggle.active .im-nav-toggle-bar:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ==========================================================================
   Mobile Navigation — Premium slide-out panel (right side)
   75vw width, max 360px, glass morphism, left-aligned typography
   ========================================================================== */

.im-mobile-nav {
    display: none;
}

.im-mobile-nav-overlay {
    display: none;
}

.im-mobile-nav-close {
    display: none;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1200px) {
    .im-header-inner {
        padding: 0.75rem 2rem;
    }
}

/* Tablet & Mobile — hamburger shows, desktop nav hides */
@media (max-width: 1024px) {
    .im-header-inner {
        padding: 0.75rem 1.25rem;
        gap: 0.75rem;
    }

    .im-primary-nav {
        display: none;
    }

    .im-nav-toggle {
        display: flex;
        order: 99; /* ensures it's the last (far right) item */
        /* Extra invisible padding so the touch target extends slightly
           beyond the visual bars, keeping it comfortably inside the edge */
        padding: 8px 4px;
        margin-right: 4px;
    }

    /* ---- Slide-out panel ---- */
    .im-mobile-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0);
        z-index: 9400;
        pointer-events: none;
        transition: background 0.35s ease;
    }

    .im-mobile-nav-overlay.active {
        background: rgba(0, 0, 0, 0.5);
        pointer-events: auto;
    }

    .im-mobile-nav {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 75vw;
        max-width: 360px;
        height: 100vh;
        height: 100dvh;
        background: rgba(14, 14, 14, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-left: 1px solid var(--im-outline-variant);
        padding: 0;
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 9500;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .im-mobile-nav.active {
        transform: translateX(0);
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.6);
    }

    /* ---- Navigation list ----
       Top padding clears the header height so the first link never
       sits under the fixed header/hamburger. */
    .im-mobile-nav-list {
        list-style: none;
        padding: 0;
        margin: 0;
        width: 100%;
        padding-top: calc(var(--im-header-height, 84px) + 16px);
    }

    /* ---- Parent links ---- */
    .im-mobile-nav-list > li {
        text-align: left;
        border-bottom: 1px solid rgba(77, 70, 53, 0.4);
    }

    .im-mobile-nav-list > li:first-child {
        border-top: 1px solid rgba(77, 70, 53, 0.4);
    }

    .im-mobile-nav-list > li > a,
    .im-mobile-nav-list > li > .im-nav-link {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 0 32px;
        min-height: 56px;
        justify-content: center;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
        transition: background 0.2s ease, padding-left 0.2s ease;
        box-sizing: border-box;
    }

    .im-mobile-nav-list > li > a:active,
    .im-mobile-nav-list > li > .im-nav-link:active {
        background: rgba(242, 202, 80, 0.06);
        padding-left: 36px;
    }

    .im-mobile-nav-list a > span:first-child,
    .im-mobile-nav-list .im-nav-link > span:first-child {
        font-family: var(--im-font-nav);
        font-size: 20px;
        font-weight: 600;
        color: var(--im-on-surface);
        letter-spacing: -0.02em;
        text-transform: none;
        line-height: 1.2;
    }

    .im-mobile-nav-list a > span:last-child,
    .im-mobile-nav-list .im-nav-link > span:last-child {
        font-family: var(--im-font-nav-sub);
        font-size: 13px;
        font-weight: 400;
        color: var(--im-on-surface-variant);
        opacity: 0.7;
        margin-top: 2px;
        letter-spacing: 0;
    }

    /* Hover/active accent — subtle background pill */
    .im-mobile-nav-list > li > a:hover > span:first-child,
    .im-mobile-nav-list > li > .im-nav-link:hover > span:first-child {
        color: var(--im-primary);
    }

    /* ---- Sub-menu (children) ---- */
    .im-mobile-nav .im-sub-menu {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        background: transparent;
        border: none;
        backdrop-filter: none;
        min-width: auto;
        padding: 0 0 8px 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
        opacity: 0;
    }

    .im-mobile-nav .im-sub-menu.im-mobile-expanded {
        max-height: 500px;
        opacity: 1;
    }

    .im-mobile-nav .im-sub-menu::before,
    .im-mobile-nav .im-sub-menu::after {
        display: none;
    }

    .im-mobile-nav .im-sub-menu li {
        border-bottom: none;
        opacity: 0;
        transform: translateX(-12px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    /* Staggered cascade reveal for child links */
    .im-mobile-nav .im-sub-menu.im-mobile-expanded li {
        opacity: 1;
        transform: translateX(0);
    }

    .im-mobile-nav .im-sub-menu.im-mobile-expanded li:nth-child(1) { transition-delay: 0.04s; }
    .im-mobile-nav .im-sub-menu.im-mobile-expanded li:nth-child(2) { transition-delay: 0.08s; }
    .im-mobile-nav .im-sub-menu.im-mobile-expanded li:nth-child(3) { transition-delay: 0.12s; }
    .im-mobile-nav .im-sub-menu.im-mobile-expanded li:nth-child(4) { transition-delay: 0.16s; }
    .im-mobile-nav .im-sub-menu.im-mobile-expanded li:nth-child(5) { transition-delay: 0.20s; }
    .im-mobile-nav .im-sub-menu.im-mobile-expanded li:nth-child(6) { transition-delay: 0.24s; }

    .im-mobile-nav .im-sub-link {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 0 32px 0 48px;
        min-height: 44px;
        justify-content: center;
        font-size: 15px;
        font-weight: 400;
        color: var(--im-on-surface-variant);
        opacity: 0.7;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.2s ease, padding-left 0.2s ease;
        box-sizing: border-box;
        line-height: 1.3;
    }

    .im-mobile-nav .im-sub-link:active {
        padding-left: 52px;
        color: var(--im-primary);
    }

    .im-mobile-nav .im-sub-link:hover {
        color: var(--im-primary);
    }

    /* Sub-link spacing — 18px vertical gap between children */
    .im-mobile-nav .im-sub-menu li + li .im-sub-link {
        padding-top: 18px;
    }

    /* Rotate the chevron indicator when a parent's submenu is expanded */
    .im-mobile-nav .im-nav-has-children.im-mobile-expanded > .im-nav-link::after {
        transform: rotate(-135deg);
        border-color: var(--im-primary);
    }

    /* Smaller social icons on tablet */
    .im-social-icons { gap: 0.35rem; }
    .im-social-btn {
        width: 28px;
        height: 28px;
    }
    .im-icon-btn { width: 36px; height: 36px; }
    .im-icon-group { gap: 0.4rem; }

    .im-logo-img {
        height: 68px;
        max-height: 68px;
        max-width: 200px;
    }
}

/* Phone — hide social icons, tighten spacing */
@media (max-width: 600px) {
    .im-header-inner {
        padding: 0.5rem 1.25rem;
        gap: 0.5rem;
    }

    .im-header-logo {
        height: 60px;
    }

    .im-logo-img {
        height: 51px;
        max-height: 51px;
        max-width: 140px;
    }

    .im-header-icons {
        gap: 0.5rem;
    }

    .im-header-icons-divider {
        display: none;
    }

    .im-social-icons {
        gap: 0.3rem;
    }

    .im-social-btn {
        width: 24px;
        height: 24px;
    }

    .im-icon-group {
        gap: 0.5rem;
    }

    .im-icon-btn {
        width: 32px;
        height: 32px;
    }

    .im-icon-btn svg {
        width: 14px;
        height: 14px;
    }

    .im-header-logo .custom-logo {
        max-height: 60px;
    }

}

/* ==========================================================================
   Footer
   ========================================================================== */

.im-footer {
    background: var(--im-surface-container-lowest);
    border-top: 1px solid var(--im-outline-variant);
    padding: 3rem 0 2rem;
    margin-top: auto;
}

.im-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.im-footer-brand { flex: 0 0 auto; }

.im-footer-tagline {
    font-size: 0.875rem;
    color: var(--im-on-surface-variant);
    margin-top: 0.5rem;
}

.im-footer-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.im-footer-nav-list a {
    color: var(--im-on-surface-variant);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s ease;
}

.im-footer-nav-list a:hover {
    color: var(--im-primary);
}

.im-footer-copyright {
    font-size: 0.75rem;
    color: var(--im-on-surface-variant);
    opacity: 0.6;
    margin-top: 1rem;
}

/* ==========================================================================
   Page Content
   ========================================================================== */

.im-page-content {
    padding-top: 80px;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    background: transparent;
}

.im-site-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Home Hero Background
   ========================================================================== */

.im-home-hero-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    /* Anchored to the top so the top of the scene (sky, monument, birds,
       the demon silhouette) is always fully visible and never cropped —
       any unavoidable crop on narrow/tall screens happens at the bottom. */
    background-position: center top;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

@media (max-width: 782px) {
    .im-home-hero-bg {
        background-attachment: scroll;
    }
}
