@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600&family=Jost:wght@400;500;600&display=swap');

/* Shared customer navbar for layouts outside the store shell. */
.topbar {
    height: 44px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    padding: 0 4.5vw;
    background: #1d1e1c;
    color: #f7f3ed;
    font-family: Montserrat, Arial, sans-serif;
    font-size: 13px;
    letter-spacing: .02em;
}
.topbar > div:last-child { text-align: right; }
.topbar-center {
    color: #cdbb9b;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 16px;
    font-style: italic;
    text-align: center;
}
.topbar-carousel { position: relative; height: 100%; }
.topbar-frase {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .5s, transform .5s;
}
.topbar-frase.is-visible { opacity: 1; transform: none; }

.header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    height: 91px;
    padding: 0 4vw;
    border-bottom: 1px solid #eee7de;
    background: #fffaf4;
}
.brand { display: flex; flex-direction: column; color: #171715; text-decoration: none; }
.brand:hover { color: #171715; text-decoration: none; }
.brand strong {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 47px;
    font-weight: 500;
    line-height: .8;
    letter-spacing: .19em;
}
.brand span { margin-top: 9px; font-size: 8px; letter-spacing: .25em; }
.brand__logo { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-width: 0; }
.header-actions a,
.header-actions .header__account {
    position: relative;
    display: inline-flex;
    min-width: 49px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 2px;
    border: 0;
    background: none;
    color: #171715;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}
.header-actions a:hover,
.header-actions .header__account:hover { color: #9b7440; text-decoration: none; }
.header-actions small {
    display: block;
    max-width: 74px;
    overflow: hidden;
    color: #6f685e;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 10px;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header-actions svg { flex: 0 0 auto; }
.header__account-wrap { position: relative; display: inline-flex; }
.header__account-img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.header__account-caret { margin-top: 1px; transition: transform .2s; }
.header__account-wrap.is-open .header__account-caret { transform: rotate(180deg); }
.header__account-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 70;
    width: 232px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #e8dbc8;
    border-radius: 14px;
    background: #fff8f0;
    box-shadow: 0 14px 30px rgba(42, 33, 25, .24), 0 2px 5px rgba(42, 33, 25, .1);
    font-family: Jost, sans-serif;
    text-align: left;
    transform-origin: top right;
}
.header__account-menu[hidden] { display: none; }
.header__account-menu:not([hidden]) { animation: account-menu-in 150ms ease-out both; }
@keyframes account-menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.header__account-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 11px;
}
.header__account-head::after {
    position: absolute;
    right: 10px;
    bottom: 0;
    left: 10px;
    height: 1px;
    background: #e8dbc8;
    content: "";
}
.header__account-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 1.25px solid #8a6a3b;
    border-radius: 50%;
    background: #f4e9da;
    color: #8a6a3b;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 17px;
    font-weight: 600;
    line-height: 1;
}
.header__account-identity {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}
.header__account-identity strong {
    max-width: 100%;
    overflow: hidden;
    color: #2a2119;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.05;
    font-feature-settings: "lnum" 1;
    font-variant-numeric: lining-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header__account-identity > span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: #7a6b5c;
    font-family: Jost, sans-serif;
    font-size: 11px;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header__account-role {
    align-self: flex-start;
    margin-top: 2px;
    padding: 2px 6px;
    border: 1px solid #8a6a3b;
    border-radius: 999px;
    color: #8a6a3b;
    font-family: Jost, sans-serif;
    font-size: 8px;
    font-style: normal;
    font-weight: 600;
    letter-spacing: 1px;
    line-height: 1.2;
    white-space: nowrap;
}
.header__account-links { display: flex; flex-direction: column; gap: 1px; padding: 5px 0; }
.header__account-menu a,
.header__account-logout {
    display: flex;
    width: 100%;
    min-height: 34px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border: 0;
    background: none;
    color: #2a2119;
    font-family: Jost, sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 150ms ease, color 150ms ease;
}
.header__account-menu a { justify-content: flex-start; }
.header__account-menu a svg,
.header__account-logout svg {
    display: block;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    fill: none;
    stroke: #8a6a3b;
    stroke-width: 1.6;
}
.header__account-menu a > span:not(.header__account-count) { flex: 1 1 auto; }
.header__account-menu a:hover,
.header__account-logout:hover { background: #f4e9da; color: #2a2119; text-decoration: none; }
.header__account-menu a:focus-visible,
.header__account-logout:focus-visible { outline: 2px solid #8a6a3b; outline-offset: 2px; }
/* giemei2/styles.css define .header-actions button{font-size:22px}, que es
   mas especifico que .header__account-logout y por eso el texto de
   "Cerrar sesion" se renderizaba gigante. Estos selectores suben a
   0,2,1 para ganarle. */
.header__account-menu .header__account-logout {
    min-height: 36px;
    justify-content: space-between;
    margin: 5px 10px 0;
    padding: 0 10px;
    width: calc(100% - 20px);
    border-top: 1px solid #e8dbc8;
    border-radius: 8px;
    color: #7a6b5c;
    font-family: Jost, sans-serif;
    font-size: 12px;
    font-weight: 500;
    min-width: 0;
}
.header__account-logout svg { margin-left: auto; }
@media (prefers-reduced-motion: reduce) {
    .header__account-menu:not([hidden]) { animation: none; }
    .header__account-menu a,
    .header__account-logout { transition: none; }
}
.header__account-count,
.header__badge {
    position: absolute;
    top: -3px;
    right: 0;
    display: flex;
    min-width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border-radius: 99px;
    background: #9b7440;
    color: #fff;
    font-family: Montserrat, Arial, sans-serif;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}
.header__badge.is-empty { display: none; }

.nav-toggle,
.nav-close,
.nav-backdrop { display: none; }
#giemei-nav { display: none; }
/* Los overlays de subcategorias son HERMANOS del drawer, no hijos (el drawer
   los recortaba por su overflow:hidden). Por eso no alcanza con el
   display:none de #giemei-nav: sin esta linea se imprimen en desktop como
   bloques comunes entre el navbar y el <main>, que es donde esta el buscador.
   El @media de 900px los vuelve a mostrar. */
.nav-subs-panel { display: none; }

@media (max-width: 900px) {
    .topbar { grid-template-columns: 1fr; justify-items: center; padding: 0 4vw; }
    .topbar > div:first-child,
    .topbar > div:last-child { display: none; }
    .topbar-center { font-size: 14px; }
    .topbar-center.topbar-carousel { width: 100%; min-width: 0; justify-self: stretch; }
    .topbar-frase { padding: 0 12px; font-size: 14px; text-align: center; white-space: nowrap; }
    /* El logo va centrado sobre el centro real del viewport, no sobre el de
       su columna. Con el grid de 3 columnas (auto 1fr auto) eso no alcanzaba:
       la columna central es 1fr, pero la izquierda (hamburguesa, 40px) y la
       derecha (3 acciones con etiqueta, ~150px) no miden lo mismo, asi que el
       1fr queda desplazado y el logo salia hacia la derecha.
       Sacando el logo del flujo y ubicandolo en 50%/50% queda centrado sin
       importar que los lados midan distinto; los dos lados se reparten con
       space-between. */
    .header { display: flex; align-items: center; justify-content: space-between; column-gap: 10px; padding: 14px; }
    .brand {
        position: absolute;
        top: 50%;
        left: 50%;
        min-width: 0;
        /* Margen de seguridad: en este corte los dos lados ocupan ~238px
           (hamburguesa 50 + acciones 160 + padding 28). En viewports muy
           angostos el logo se recorta antes de meterse bajo los iconos
           (el strong ya tiene overflow hidden + ellipsis). */
        max-width: calc(100% - 240px);
        transform: translate(-50%, -50%);
    }
    .brand strong { overflow: hidden; font-size: clamp(24px, 6.6vw, 34px); text-overflow: ellipsis; white-space: nowrap; }
    .brand span { overflow: hidden; font-size: 6.4px; letter-spacing: .16em; text-overflow: ellipsis; white-space: nowrap; }
    .header-actions { gap: 6px; }
    .header-actions a,
    .header-actions .header__account { min-width: 40px; }
    .header-actions small { max-width: 58px; font-size: 9px; }
    .header-actions .header__account small { display: block; }
    .header__account-caret { display: none; }
    .nav-toggle { display: grid; width: 40px; height: 40px; padding: 0; place-items: center; border: 0; background: none; color: #171715; cursor: pointer; }
    .nav-toggle svg { display: block; width: 24px; height: 24px; }
    #giemei-nav {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 60;
        display: block;
        width: min(84vw, 340px);
        overflow: hidden;
        transform: translateX(-100%);
        visibility: hidden;
        border-right: 1px solid #eee7de;
        background: #fffaf4;
        box-shadow: 10px 0 34px rgba(23, 23, 21, .18);
        transition: transform .32s ease, visibility .32s;
        -webkit-overflow-scrolling: touch;
    }
    #giemei-nav.is-open { transform: none; visibility: visible; }

    /* --- Drawer + overlay de subcategorías --- */
    /* Panel raíz: dentro del drawer, en su propia posición. */
    .nav-drawer__panel {
        position: absolute;
        inset: 0;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 20px 24px 34px;
        transform: translateX(0);
        visibility: hidden;
        -webkit-overflow-scrolling: touch;
    }
    .nav-drawer__panel[data-active] { visibility: visible; }

    /* Overlay de subcategorías: hermano del drawer (este lo recortaría por
       su overflow:hidden). Arranca con el borde izquierdo pegado al borde
       DERECHO de la pantalla (translateX(100vw)) y se detiene en left:0,
       de modo que entra desde la derecha y tapa el panel de categorías. */
    .nav-subs-panel {
        display: block;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 70;
        width: min(84vw, 340px);
        overflow-y: auto;
        overflow-x: hidden;
        padding: 20px 24px 34px;
        border-right: 1px solid #eee7de;
        background: #fffaf4;
        box-shadow: 10px 0 34px rgba(23, 23, 21, .18);
        transform: translateX(100vw);
        visibility: hidden;
        transition: transform .34s cubic-bezier(.4, 0, .2, 1), visibility .34s;
        -webkit-overflow-scrolling: touch;
    }
    .nav-subs-panel[data-active] { transform: translateX(0); visibility: visible; }
    .nav-subs-panel[data-leaving] { transform: translateX(100vw); visibility: visible; }

    /* Lista compartida por el panel raíz y los overlays, para que las filas
       se vean iguales en los dos niveles. */
    .nav-list { display: flex; flex-direction: column; align-items: stretch; }
    .nav-list a { position: static; padding: 15px 0; border-bottom: 1px solid #eee7de; color: #171715; font-size: 19px; text-decoration: none; }
    .nav-list a:hover { color: #9b7440; }

    /* Categorías raíz: <a> cuando no tiene subs, <button> cuando sí. Ambos
       comparten caja para que la fila se vea idéntica. */
    .nav-list .nav__category {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 15px 0;
        border: 0;
        border-bottom: 1px solid #eee7de;
        background: none;
        color: #171715;
        font-family: inherit;
        font-size: 19px;
        line-height: 1.25;
        text-align: left;
        text-decoration: none;
        cursor: pointer;
    }
    .nav-list .nav__category:hover { color: #9b7440; }
    .nav-list .nav__category:focus-visible,
    .nav-list .nav__subs-all:focus-visible,
    .nav-back:focus-visible { outline: 2px solid #9b7440; outline-offset: -3px; }
    .nav__category-meta { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
    .nav__drill-arrow { flex: 0 0 auto; color: #9b7440; transition: transform .2s ease; }
    .nav-list .nav__category--drill:hover .nav__drill-arrow { transform: translateX(3px); }
    .nav-list .nav__category--drill[aria-expanded="true"] { color: #9b7440; }

    /* Overlay de subcategorías */
    .nav-drawer__subhead {
        position: sticky;
        top: -20px;
        z-index: 1;
        display: flex;
        align-items: center;
        gap: 8px;
        margin: -20px -24px 0;
        padding: 20px 24px 12px;
        background: #fffaf4;
        border-bottom: 1px solid #eee7de;
    }
    .nav-back { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; margin: 0; padding: 0; border: 0; background: none; color: #171715; cursor: pointer; }
    .nav-back:hover { color: #9b7440; }
    .nav-drawer__title {
        min-width: 0;
        color: #171715;
        font-family: "Cormorant Garamond", Georgia, serif;
        font-size: 22px;
        font-weight: 600;
        line-height: 1.15;
        overflow-wrap: break-word;
    }
    .nav-list a.nav__subs-all { color: #9b7440; font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
    .nav-list a.nav__subs-all:hover { color: #171715; }
    .nav-list a.nav__sub { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-left: 18px; color: #6f685e; font-size: 16px; }

    .nav__category-name { min-width: 0; overflow-wrap: break-word; }
    .nav__genre { flex: 0 0 auto; padding: 4px 7px; border-radius: 3px; background: #efe7d9; color: #77633f; font-family: Montserrat, Arial, sans-serif; font-size: 9px; font-weight: 600; letter-spacing: .07em; line-height: 1; text-transform: uppercase; }
    .nav__label { margin: 24px 0 2px; color: #6f685e; font-family: Montserrat, Arial, sans-serif; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; }
    .nav-close { position: sticky; top: 0; z-index: 1; display: grid; width: 44px; height: 44px; place-items: center; margin-left: auto; padding: 0; border: 0; background: none; color: #171715; font-size: 30px; cursor: pointer; }

    @media (prefers-reduced-motion: reduce) {
        .nav-subs-panel { transition: none; }
        .nav__drill-arrow { transition: none; }
    }
    .nav-backdrop { position: fixed; inset: 0; z-index: 50; display: block; background: rgba(23, 23, 21, .45); opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
    .nav-backdrop.is-open { opacity: 1; visibility: visible; }
    body.nav-open { position: fixed; width: 100%; overflow: hidden; }
    .header__account-menu { right: -4px; width: 268px; max-width: calc(100vw - 32px); }
    .header__account-head { padding: 12px 12px 13px; gap: 12px; }
    .header__account-avatar { width: 40px; height: 40px; flex: 0 0 40px; font-size: 20px; }
    .header__account-identity strong { font-size: 18px; }
    .header__account-identity > span { font-size: 12px; }
    .header__account-menu .header__account-logout { min-height: 42px; font-size: 14px; gap: 12px; padding: 0 12px; }
    .header__account-menu a svg,
    .header__account-logout svg { width: 18px; height: 18px; flex: 0 0 18px; }
    .header__account-menu .header__account-logout { margin: 6px 12px 0; width: calc(100% - 24px); padding: 0 12px; font-size: 13px; }
}

@media (max-width: 359px) {
        .header__account-menu { width: calc(100vw - 32px); }
}

@media (max-width: 480px) {
    .header { column-gap: 6px; padding: 12px; }
    .nav-toggle { width: 36px; height: 36px; }
    .header-actions { gap: 4px; }
    .header-actions a,
    .header-actions .header__account { min-width: 34px; }
    .header-actions small { max-width: 48px; font-size: 8px; }
    /* Aqui los lados se achican (toggle 42 + acciones 131 + padding 24 = ~198),
       asi que el margen del logo puede bajarse a 200 sin recortar de mas. */
    .brand { max-width: calc(100% - 200px); }
    .brand span { display: none; }
    .brand strong { font-size: clamp(21px, 6.2vw, 26px); letter-spacing: .14em; }
}
