/**
 * Header do site (faixa dourada + logo + busca + menu) — prefixo hm-.
 * Usado pela home (index.html, com o carrossel dentro da faixa), pela home de
 * cosméticos e pelas páginas que montam o header com js/site-header.js
 * (catálogo, curadoria — faixa compacta, classe .is-compact).
 * Mobile-first: @media (min-width: 768px) acrescenta o desktop.
 */

:root {
    /* Dourado da faixa: o mesmo do hover de "Pedir pelo WhatsApp" do catálogo de cosméticos */
    --hm-band: var(--ds-gold-light);
    --hm-ink: #0B0B0B;
    --hm-ink-soft: rgba(11, 11, 11, 0.72);
    /* Dourado escuro o bastante para texto pequeno em fundo branco (~6:1).
       --ds-gold-dark (#A57C1B) fica em 3,4:1 e não passa em 14px. */
    --hm-link: #7A5A10;
    --hm-fade: 200px;       /* trecho final da faixa em que o dourado vira fundo */
    /* Treliça de estrelas de 8 pontas (khatam): dois quadrados cruzados, ligados
       aos vizinhos pelas pontas. Tinta a 9%, some junto com o degradê. */
    --hm-lattice: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%230B0B0B' stroke-opacity='.09' stroke-width='1'%3E%3Crect x='16' y='16' width='24' height='24'/%3E%3Crect x='16' y='16' width='24' height='24' transform='rotate(45 28 28)'/%3E%3Cpath d='M28 0v11M28 45v11M0 28h11M45 28h11'/%3E%3C/g%3E%3C/svg%3E");
}

/* ========== FAIXA DOURADA (header + carrossel) ==========
   Uma faixa só, na largura inteira da tela: dourado chapado em cima, que se
   dissolve no fundo da página nos últimos --hm-fade px. */
.hm-top {
    position: relative;
    isolation: isolate;
    background: linear-gradient(
        to bottom,
        var(--hm-band) 0,
        var(--hm-band) calc(100% - var(--hm-fade)),
        var(--ds-bg) 100%
    );
}
.hm-top::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: var(--hm-lattice);
    background-position: center top;
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 35%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0, #000 35%, transparent 100%);
    pointer-events: none;
}

/* Faixa só com o header (catálogo, curadoria): dourado chapado, sem o trecho
   que se dissolve — sem carrossel embaixo, o degradê começaria no meio da busca. */
.hm-top.is-compact {
    background: var(--hm-band);
    /* O isolation da faixa prende o drawer dentro dela: sem z-index, os cards
       da página (que têm o seu) pintariam por cima do menu aberto. */
    z-index: 30;
}

.hm-top :focus-visible,
.hm-drawer :focus-visible { outline: 2px solid var(--hm-ink); outline-offset: 2px; }
.hm-top .hm-search input:focus-visible { outline: none; } /* o form já acende com :focus-within */

.hm-sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ========== HEADER ========== */
.hm-header {
    color: var(--hm-ink);
    position: relative;
    z-index: 20;
}

.hm-header-inner {
    max-width: var(--ds-page-max);
    margin: 0 auto;
    padding: 10px 16px 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "logo    actions"
        "search  search";
    align-items: center;
    column-gap: 12px;
    row-gap: 10px;
}

.hm-logo {
    grid-area: logo;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--hm-ink);
    text-decoration: none;
}
.hm-logo img {
    width: 44px; height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.hm-logo-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 17px;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hm-logo-text small {
    display: block;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--hm-ink-soft);
    margin-top: 2px;
}

/* Busca */
/* Invólucro da busca: dá o lugar no grid e ancora a caixa de sugestões
   (o .hm-search tem overflow: hidden e cortaria a lista). */
.hm-search-wrap {
    grid-area: search;
    position: relative;
    min-width: 0;
}
.hm-search {
    display: flex;
    min-width: 0;
    background: var(--ds-card);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    border: 1px solid transparent;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.hm-search:focus-within {
    border-color: var(--ds-gold-dark);
    box-shadow: 0 0 0 3px var(--ds-accent-bg), 0 1px 2px rgba(0, 0, 0, 0.12);
}
.hm-search input {
    flex: 1;
    min-width: 0;
    height: 44px;
    border: 0;
    outline: 0;
    padding: 0 14px;
    font-size: 16px; /* 16px evita o zoom automático do iOS ao focar */
    color: var(--ds-text);
    background: transparent;
    font-family: inherit;
}
.hm-search input::placeholder { color: var(--ds-text-muted); }
.hm-search input::-webkit-search-cancel-button { cursor: pointer; }
.hm-search button {
    width: 48px;
    flex-shrink: 0;
    border: 0;
    border-left: 1px solid var(--ds-border);
    background: transparent;
    color: var(--ds-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.hm-search button:hover { color: var(--ds-gold-dark); }

/* Ações (conta + hambúrguer) */
.hm-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    gap: 2px;
}
.hm-account,
.hm-menu-btn {
    min-width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--hm-ink);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font: 500 14px/1 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
.hm-account:hover,
.hm-menu-btn:hover { background: rgba(0, 0, 0, 0.06); }
.hm-account-label { display: none; }

/* Menu inline: só no desktop — no celular ele mora no drawer */
.hm-nav { display: none; }

/* ========== DRAWER (celular) ========== */
.hm-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.hm-drawer-overlay.is-open { opacity: 1; pointer-events: auto; }

.hm-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(300px, 85vw);
    height: 100%;
    height: 100dvh;
    background: var(--ds-card);
    z-index: 100;
    transform: translateX(100%);
    visibility: hidden; /* fechado, nem a sombra vaza na borda da tela */
    transition: transform 0.28s ease, visibility 0s linear 0.28s;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
}
.hm-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.16);
    transition: transform 0.28s ease, visibility 0s;
}

.hm-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 8px 20px;
    background: var(--hm-band);
    color: var(--hm-ink);
    font: 600 15px/1 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
.hm-drawer-close {
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 0; border-radius: 8px;
    color: var(--hm-ink); cursor: pointer;
}
.hm-drawer-close:hover { background: rgba(0, 0, 0, 0.06); }

.hm-drawer nav { display: flex; flex-direction: column; padding: 8px 20px; }
.hm-drawer nav a {
    display: flex;
    align-items: center;
    min-height: 52px;
    font-size: 17px;
    font-weight: 500;
    color: var(--ds-text);
    text-decoration: none;
    border-bottom: 1px solid var(--ds-border);
}
.hm-drawer nav a:last-child { border-bottom: 0; }
.hm-drawer nav a:hover,
.hm-drawer nav a.is-active { color: var(--hm-link); }

/* ========== BARRA QUE VOLTA AO ROLAR PARA CIMA (.hm-float) ==========
   Fica escondida acima da tela; aparece quando o header da página já saiu de
   vista e a pessoa rola para cima (HomeHeader, useFloatingBar). */
.hm-float {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 80;
    background: var(--hm-band);
    box-shadow: 0 2px 12px rgba(11, 11, 11, 0.14);
    transform: translateY(-110%);
    transition: transform 0.25s ease;
    padding-top: env(safe-area-inset-top);
}
.hm-float.is-shown { transform: translateY(0); }
.hm-float-inner {
    max-width: var(--ds-page-max);
    margin: 0 auto;
    padding: 8px 8px 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.hm-float-logo { flex-shrink: 0; display: inline-flex; }
.hm-float-logo img { width: 36px; height: 36px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.hm-float-search { flex: 1 1 auto; }
.hm-float-search .hm-search input { height: 40px; }

/* ========== SUGESTÕES DA BUSCA ========== */
/* A lista nasce dentro da faixa dourada (isolation: isolate), e na home os módulos
   (z-index 5) sobem por cima da faixa e cortariam a lista. Enquanto ela está aberta,
   a faixa inteira sobe de camada. */
.hm-top:has(.hm-suggest) { z-index: 40; }
.hm-suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 85;
    background: var(--ds-card);
    border: 1px solid var(--ds-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(11, 11, 11, 0.18);
    overflow: hidden;
    color: var(--ds-text);
}
.hm-suggest ul { list-style: none; margin: 0; padding: 6px 0; }
.hm-suggest-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 6px 14px;
    color: inherit;
    text-decoration: none;
}
.hm-suggest-item a:hover,
.hm-suggest-item.is-active a { background: var(--ds-bg); }
.hm-suggest-item img {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 8px;
    background: var(--ds-bg);
}
.hm-suggest-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hm-suggest-title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hm-suggest-sub {
    font-size: 13px;
    color: var(--ds-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hm-suggest-sub em { font-style: normal; color: var(--hm-link); }
.hm-suggest-all {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 0;
    border-top: 1px solid var(--ds-border-light);
    background: transparent;
    color: var(--hm-link);
    font: 600 14px/1.2 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    text-align: left;
    cursor: pointer;
}
.hm-suggest-all:hover { background: var(--ds-bg); }

/* ========== RODAPÉ (mountSiteFooter) ========== */
.hm-foot {
    margin-top: 32px;
    background: #0B0B0B; /* preto do logo: fecha a página no tom oposto à faixa dourada */
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    line-height: 1.5;
}
.hm-foot-inner {
    max-width: var(--ds-page-max);
    margin: 0 auto;
    padding: 32px 16px 8px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 20px;
}
.hm-foot-brand { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; }
.hm-foot-brand img { width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; }
.hm-foot-name { margin: 0; color: #fff; font: 700 18px/1.2 'Playfair Display', Georgia, serif; }
.hm-foot-tag { margin: 2px 0 0; font-size: 13px; }
.hm-foot-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hm-foot-col p { margin: 0; }
.hm-foot-title {
    margin-bottom: 6px !important;
    color: var(--ds-gold-light);
    font: 600 12px/1.2 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.hm-foot-col a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    color: rgba(255, 255, 255, 0.86);
    text-decoration: none;
}
.hm-foot-col a:hover { color: #fff; text-decoration: underline; }
.hm-foot-col strong { color: #fff; font-weight: 600; }
.hm-foot-note { margin-top: 6px !important; font-size: 13px; color: rgba(255, 255, 255, 0.6); }
.hm-foot-bottom {
    max-width: var(--ds-page-max);
    margin: 0 auto;
    padding: 16px 16px calc(88px + env(safe-area-inset-bottom)); /* livra o botão do WhatsApp */
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}
.hm-foot :focus-visible { outline: 2px solid var(--ds-gold-light); outline-offset: 2px; }

/* ========== WHATSAPP (botão flutuante) ==========
   A loja vende pelo WhatsApp: o atalho fica sempre à mão, no canto do polegar. */
.hm-wa-fab {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 70;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1FA855; /* verde do WhatsApp, um tom abaixo para o branco passar 3:1 */
    color: #fff;
    box-shadow: 0 6px 18px rgba(11, 11, 11, 0.22);
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.hm-wa-fab:hover { transform: translateY(-2px); }
.hm-wa-fab:focus-visible { outline: 2px solid var(--hm-ink); outline-offset: 3px; }
.hm-wa-fab.is-hidden { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
    .hm-float, .hm-wa-fab { transition: none; }
}

/* ========== DESKTOP ========== */
@media (min-width: 768px) {
    .hm-header-inner {
        padding: 12px 24px 8px;
        grid-template-columns: auto minmax(0, 1fr) auto;
        /* Menu na largura toda, embaixo: com as categorias são 10 itens, que não
           cabiam só na coluna da busca (quebrava linha). */
        grid-template-areas:
            "logo  search  actions"
            "nav   nav     nav";
        column-gap: 32px;
        row-gap: 6px;
    }

    .hm-logo img { width: 48px; height: 48px; }
    .hm-logo-text { font-size: 19px; }

    .hm-search-wrap { max-width: 640px; width: 100%; }

    .hm-account { padding: 0 10px; }
    .hm-account-label { display: inline; }
    .hm-menu-btn { display: none; }

    .hm-nav {
        grid-area: nav;
        display: flex;
        flex-wrap: nowrap;
        gap: 4px 20px;
        min-width: 0;
        /* Tablet: os 10 itens não cabem numa linha — rola de lado em vez de quebrar.
           A partir de ~1000px cabem inteiros e a rolagem nem aparece. */
        overflow-x: auto;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
    }
    .hm-nav::-webkit-scrollbar { display: none; }
    .hm-nav-link {
        flex-shrink: 0;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        min-height: 32px;
        font: 500 14px/1 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
        color: var(--hm-ink-soft);
        text-decoration: none;
        border-bottom: 2px solid transparent;
        transition: color 0.15s ease, border-color 0.15s ease;
    }
    .hm-nav-link:hover { color: var(--hm-ink); }
    .hm-nav-link.is-active { color: var(--hm-ink); border-bottom-color: var(--hm-ink); }

    /* Drawer nunca aparece no desktop, mesmo se ficou aberto antes de a janela crescer */
    .hm-drawer,
    .hm-drawer-overlay { display: none; }

    .hm-float-inner { padding: 8px 24px; gap: 16px; }
    .hm-float-search { max-width: 640px; margin: 0 auto; }

    .hm-foot-inner { grid-template-columns: 1.4fr 1fr 1fr 1fr; padding: 48px 24px 16px; gap: 32px; }
    .hm-foot-brand { grid-column: auto; align-items: flex-start; }
    .hm-foot-bottom { padding: 16px 96px 24px 24px; } /* direita livre para o botão do WhatsApp */
    .hm-wa-fab { right: 24px; bottom: calc(24px + env(safe-area-inset-bottom)); }
}
