/* Site header + menu drawer (templates/components/heading.html) */

/* ---------- Header ---------- */
.site-header {
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: 100;
    transition: background-color .3s ease, box-shadow .3s ease;
}
.site-header.is-scrolled {
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 1px 0 rgba(202, 180, 135, .35);
}
.site-header-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem .5rem;
}
@media (min-width: 768px) {
    .site-header-inner { padding: 1.5rem 2rem .75rem; }
}
.site-header.is-scrolled .site-header-inner { padding-top: .5rem; padding-bottom: .5rem; }
.site-logo img {
    height: 6rem;
    width: auto;
    transition: height .3s ease;
}
.site-header.is-scrolled .site-logo img { height: 4rem; }
.menu-toggle {
    padding: .5rem;
    margin: -.5rem;
    border-radius: 9999px;
    transition: transform .2s ease;
}
.menu-toggle:hover { transform: scale(1.06); }
.menu-toggle:focus-visible, .menu-close:focus-visible { outline: 2px solid #8A7242; outline-offset: 2px; }

/* ---------- Drawer ---------- */
html.menu-open { overflow: hidden; }
.site-menu { position: fixed; inset: 0; z-index: 1000; }
.site-menu[hidden] { display: none; }

.site-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 16, 10, .45);
    opacity: 0;
    transition: opacity .4s ease;
}
.site-menu.is-open .site-menu-backdrop { opacity: 1; }

/* Panel slides in from the start side (right, RTL) */
.site-menu-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    width: min(100%, 440px);
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(100%);
    transition: transform .45s cubic-bezier(.32, .72, 0, 1);
    box-shadow: -20px 0 50px -20px rgba(46, 36, 22, .35);
}
.site-menu.is-open .site-menu-panel { transform: none; }

.site-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid #f0ebe1;
}
.menu-close { padding: .4rem; margin: -.4rem; border-radius: 9999px; transition: transform .3s ease; }
.menu-close:hover { transform: rotate(90deg); }

.menu-list { padding: 1rem 1.75rem 2rem; flex: 1; }
.menu-list > li {
    border-bottom: 1px solid #f4efe6;
    opacity: 0;
    transform: translateX(16px);
}
/* Items arrive one after another once the panel is in */
.site-menu.is-open .menu-list > li,
.site-menu.is-open .site-menu-foot {
    animation: menu-item-in .5s cubic-bezier(.32, .72, 0, 1) both;
    animation-delay: calc(140ms + var(--i, 0) * 45ms);
}
@keyframes menu-item-in {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: none; }
}

.menu-link {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    font-size: 1.35rem;
    color: #8A7242;
    transition: color .25s ease, padding .3s cubic-bezier(.32, .72, 0, 1);
}
/* Hover: the text slides in a little and a gold line grows under it */
.menu-link::after {
    content: "";
    position: absolute;
    bottom: -1px;
    inset-inline-start: 0;
    width: 0;
    height: 2px;
    background: #CAB487;
    transition: width .35s cubic-bezier(.32, .72, 0, 1);
}
.menu-link:hover, .menu-link:focus-visible, .menu-acc-btn.is-active { color: #2E2416; padding-inline-start: .5rem; }
.menu-link:hover::after, .menu-link:focus-visible::after, .menu-acc-btn.is-active::after { width: 100%; }
.menu-link:focus-visible { outline: none; }
@media (max-width: 1023px) { .menu-link { font-size: 1.125rem; padding: .85rem 0; } }   /* phones: one step smaller */
.menu-chevron { width: 1.1rem; height: 1.1rem; transition: transform .35s ease; }
.menu-acc.is-expanded .menu-chevron { transform: rotate(180deg); }
@media (min-width: 1024px) {
    /* Sections open sideways: the arrow points at the flyout */
    .menu-acc-btn .menu-chevron { transform: rotate(90deg); }   /* points left (‹), toward the flyout */
    .menu-acc-btn.is-active .menu-chevron { transform: rotate(90deg) translateY(4px); }
    .menu-acc-body { display: none; }
}

/* Accordion: animates to the content's real height (grid 0fr -> 1fr) */
.menu-acc-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .4s cubic-bezier(.32, .72, 0, 1);
}
.menu-acc.is-expanded .menu-acc-body { grid-template-rows: 1fr; }
.menu-acc-inner { overflow: hidden; }
.menu-acc-inner > :last-child { margin-bottom: 1.25rem; }
.menu-acc:not(.is-expanded) .menu-acc-inner { visibility: hidden; transition: visibility 0s linear .4s; }

.menu-group-title {
    margin: .4rem 0 .5rem;
    font-size: .8rem;
    letter-spacing: .02em;
    color: #9a9182;
}
/* Mobile: each link is a photo card, two per row (nothing cut off at the screen edge) */
.menu-sub {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}
.menu-item { display: block; color: #4b4130; font-size: .9rem; text-align: center; }
.menu-thumb {
    display: block;
    aspect-ratio: 1;
    border-radius: .75rem;
    overflow: hidden;
    background: #f7f4ee;
    margin-bottom: .4rem;
}
.menu-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.menu-thumb img.menu-thumb-logo { object-fit: contain; padding: 22%; opacity: .5; }
.menu-item:hover .menu-thumb img { transform: scale(1.05); }
.menu-item-label { display: block; line-height: 1.5; }

/* ---------- Desktop flyout: the section's links + a photo of the hovered one, beside the panel ---------- */
.menu-flyout { display: none; }
@media (min-width: 1024px) {
    .menu-flyout {
        display: flex;
        position: absolute;
        top: 0;
        bottom: 0;
        inset-inline-start: 440px;
        width: min(760px, calc(100% - 440px));
        background: #fbf9f5;
        border-inline-start: 1px solid #f0ebe1;
        box-shadow: -24px 0 50px -30px rgba(46, 36, 22, .4);
        opacity: 0;
        visibility: hidden;
        transform: translateX(24px);
        transition: opacity .3s ease, transform .4s cubic-bezier(.32, .72, 0, 1), visibility 0s linear .4s;
    }
    .menu-flyout.is-open {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: opacity .3s ease, transform .4s cubic-bezier(.32, .72, 0, 1);
    }
    .flyout-links { flex: 0 0 300px; padding: 2.25rem 2rem; overflow-y: auto; overscroll-behavior: contain; }
    .flyout-title { font-size: 1.6rem; color: #2E2416; margin-bottom: 1rem; }
    .flyout-links .menu-group-title { margin-top: 1.25rem; }
    .flyout-links .menu-sub { display: block; margin: 0 0 .5rem; padding: 0; overflow: visible; }
    .flyout-links .menu-thumb { display: none; }
    .flyout-links .menu-item {
        position: relative;
        display: block;
        padding: .45rem 0;
        font-size: 1.05rem;
        text-align: start;
        color: #6b5a3a;
        transition: color .2s ease, padding .3s cubic-bezier(.32, .72, 0, 1);
    }
    .flyout-links .menu-item::before {
        content: "";
        position: absolute;
        inset-inline-start: 0;
        top: 50%;
        width: 0;
        height: 1px;
        background: #CAB487;
        transition: width .3s ease;
    }
    .flyout-links .menu-item:hover, .flyout-links .menu-item:focus-visible, .flyout-links .menu-item.is-previewed {
        color: #2E2416;
        padding-inline-start: 1.25rem;
        outline: none;
    }
    .flyout-links .menu-item:hover::before, .flyout-links .menu-item:focus-visible::before,
    .flyout-links .menu-item.is-previewed::before { width: .85rem; }

    /* The photo sits beside the list, framed, not full screen */
    .flyout-preview {
        position: relative;
        flex: 1;
        align-self: flex-start;
        margin: 2.25rem 0 2.25rem 2.25rem;
        aspect-ratio: 4 / 5;
        max-height: calc(100% - 4.5rem);
        border-radius: 1rem;
        overflow: hidden;
        background: #f1ece2;
    }
    .flyout-preview img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0;
        transform: scale(1.04);
        transition: opacity .5s ease, transform 1s cubic-bezier(.32, .72, 0, 1);
    }
    .flyout-preview img.is-active { opacity: 1; transform: none; }
    /* Link without a photo: the brand mark, small and faded */
    .flyout-preview img.is-placeholder { object-fit: contain; padding: 30%; }
    .flyout-preview img.is-placeholder.is-active { opacity: .35; }
    .flyout-preview figcaption {
        position: absolute;
        inset-inline-start: 1rem;
        bottom: 1rem;
        padding: .35rem 1rem;
        border-radius: 9999px;
        background: rgba(255, 255, 255, .9);
        color: #2E2416;
        font-size: .95rem;
    }
    .flyout-preview figcaption:empty { display: none; }
}


.site-menu-foot {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
    padding: 1.25rem 1.75rem calc(1.25rem + env(safe-area-inset-bottom));
    border-top: 1px solid #f0ebe1;
    font-size: .9rem;
    color: #6b6152;
}
.site-menu-foot a:hover { color: #8A7242; }

@media (prefers-reduced-motion: reduce) {
    .site-menu-panel, .site-menu-backdrop, .menu-flyout, .flyout-preview img, .menu-link, .menu-link::after,
    .menu-acc-body, .menu-chevron, .site-logo img, .site-header { transition: none !important; }
    .site-menu.is-open .menu-list > li, .site-menu.is-open .site-menu-foot { animation: none; opacity: 1; transform: none; }
}
