.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    background: color-mix(in oklch, var(--surface) 94%, transparent);
    backdrop-filter: blur(16px);
}

.announcement-bar {
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    padding: .375rem 1.25rem;
    background: var(--fg);
    color: var(--surface);
    font-size: .75rem;
    letter-spacing: .025em;
}

.announcement-bar a {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    color: var(--accent-on-dark);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: .1875rem;
}

.announcement-bar a:hover { color: var(--surface); }

.header-main {
    position: relative;
    z-index: 53;
    display: grid;
    grid-template-columns: auto minmax(18rem, 1fr) auto;
    align-items: center;
    gap: clamp(1rem, 2.5vw, 2rem);
    padding-block: .75rem;
}

.brand,
.footer-logo {
    display: inline-flex;
    min-height: 3rem;
    align-items: center;
    gap: .625rem;
    color: var(--fg);
    font-family: var(--font-display);
    font-size: .95rem;
    letter-spacing: -.055em;
}

.brand-mark {
    position: relative;
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: .7rem;
    background: var(--surface);
}

.brand-mark img {
    position: absolute;
    top: -2rem;
    left: -2.25rem;
    width: 7.0625rem;
    max-width: none;
    height: 7.0625rem;
}

.site-search {
    position: relative;
    z-index: 4;
    max-width: 44rem;
    width: 100%;
    justify-self: center;
}

.site-search input {
    width: 100%;
    min-height: 3rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: .6875rem 3.25rem .6875rem 1rem;
    background: var(--surface);
    color: var(--fg);
}

.site-search input:hover { border-color: var(--muted); }

.site-search input:focus-visible {
    border-color: var(--accent-strong);
    outline: 3px solid color-mix(in oklch, var(--accent) 20%, transparent);
    outline-offset: 1px;
}

.site-search:focus-within input { box-shadow: 0 0 0 1px var(--accent-strong); }

.site-search button {
    position: absolute;
    top: 50%;
    right: .25rem;
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--accent-strong);
    color: var(--surface);
    transition: background-color .18s ease, box-shadow .18s ease;
}

.site-search button:hover { background: var(--accent-hover); }
.site-search button:focus-visible { outline-offset: 1px; }

.site-search button svg {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    left: 0;
    z-index: 70;
    max-height: min(29rem, calc(100dvh - var(--header-offset) - 1rem));
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.search-suggestion {
    display: grid;
    min-width: 0;
    min-height: 4.75rem;
    grid-template-columns: 3.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: .875rem;
    border-radius: calc(var(--radius-md) - 2px);
    padding: .625rem .75rem;
    color: var(--fg);
}

.search-suggestion + .search-suggestion { border-top: 1px solid var(--border); border-radius: 0; }
.search-suggestion:hover,
.search-suggestion.is-active { background: var(--accent-soft); color: var(--fg); }
.search-suggestion:focus-visible { position: relative; z-index: 1; }

.search-suggestion-image {
    display: grid;
    width: 3.5rem;
    height: 3.5rem;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.search-suggestion-image img { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; object-position: center; padding: var(--product-image-padding); }
.search-suggestion-copy { min-width: 0; }
.search-suggestion-copy strong { display: block; overflow: hidden; font-size: .875rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.search-suggestion-copy span { display: block; margin-top: .2rem; overflow: hidden; color: var(--muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.search-suggestion-price { font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.search-suggestions-state {
    margin: 0;
    padding: 1rem;
    color: var(--muted);
    font-size: .875rem;
    text-align: center;
}

.search-more {
    position: sticky;
    bottom: 0;
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    border-top: 1px solid var(--border);
    padding: .75rem 1rem;
    background: var(--surface);
    color: var(--accent-strong);
    font-size: .8125rem;
    font-weight: 750;
}
.search-more:hover { background: var(--accent-soft); }
.search-more:focus-visible { outline-offset: -3px; }

.site-search svg,
.header-action svg {
    width: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.header-action {
    position: relative;
    display: grid;
    min-width: 4.5rem;
    min-height: 3rem;
    place-items: center;
    gap: .125rem;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: .6875rem;
    transition: background-color .18s ease, color .18s ease;
}

.header-action:hover {
    background: var(--accent-soft);
    color: var(--fg);
}

.header-action[aria-current="page"] { background: var(--accent-soft); color: var(--fg); }

.action-icon { position: relative; display: grid; }

.action-count {
    position: absolute;
    top: -.55rem;
    right: -.75rem;
    display: grid;
    min-width: 1.25rem;
    height: 1.25rem;
    place-items: center;
    border: 2px solid var(--surface);
    border-radius: var(--radius-pill);
    padding-inline: .2rem;
    background: var(--accent-strong);
    color: var(--surface);
    font-size: .625rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.primary-nav {
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.primary-nav-inner {
    display: flex;
    min-height: 2.875rem;
    align-items: center;
    gap: clamp(1.25rem, 3vw, 2.25rem);
    font-size: .875rem;
    font-weight: 750;
}

.primary-nav a {
    position: relative;
    display: inline-flex;
    min-height: 2.875rem;
    align-items: center;
}

.primary-nav a::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    transform: scaleX(0);
    transform-origin: center;
    background: var(--accent-strong);
    transition: transform .18s ease;
}

.primary-nav a:hover::after,
.primary-nav a.is-active::after { transform: scaleX(1); }
.primary-nav .nav-emphasis { margin-left: auto; color: var(--accent-strong); }
.primary-nav a.primary-nav-mobile { display: none; }

.menu-toggle {
    display: none;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--fg);
}

.menu-toggle span:not(.sr-only) {
    display: block;
    width: 1.25rem;
    height: 2px;
    margin: .25rem auto;
    transform-origin: center;
    background: currentColor;
    transition: transform .18s ease, opacity .18s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-of-type(2) { transform: translateY(.375rem) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-of-type(3) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-of-type(4) { transform: translateY(-.375rem) rotate(-45deg); }

.menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 51;
    display: none;
    border: 0;
    background: color-mix(in oklch, var(--fg) 42%, transparent);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(.875rem, 2vw, 1.5rem);
    align-items: stretch;
    container: product-grid / inline-size;
}

.product-card {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.product-card:focus-within {
    border-color: var(--accent-strong);
    box-shadow: var(--shadow-md);
}

@media (hover: hover) {
    .product-card:hover {
        transform: translateY(-.25rem);
        border-color: var(--border-strong);
        box-shadow: var(--shadow-md);
    }
}

.favorite-button {
    position: absolute;
    top: .75rem;
    right: .75rem;
    z-index: 2;
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: color-mix(in oklch, var(--surface) 94%, transparent);
    color: var(--fg);
    box-shadow: var(--shadow-sm);
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.favorite-button:hover {
    border-color: var(--accent-strong);
    background: var(--accent-soft);
    transform: translateY(-1px);
}

.favorite-button svg {
    width: 1.25rem;
    fill: transparent;
    stroke: currentColor;
    stroke-width: 1.8;
}

.favorite-button.is-active {
    border-color: var(--accent-strong);
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.favorite-button.is-active svg { fill: currentColor; }

.product-image-wrap {
    position: relative;
    display: grid;
    aspect-ratio: 1;
    place-items: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.product-image {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
    object-position: center;
    padding: var(--product-image-padding);
    transition: transform .25s ease;
}

.product-image.is-placeholder {
    display: none;
}

.product-card.has-placeholder .product-image-wrap::after {
    content: "Imagen no disponible";
    max-width: 9rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: .625rem .75rem;
    color: var(--muted);
    background: var(--surface);
    font-size: .75rem;
    text-align: center;
}

@media (hover: hover) {
    .product-card:hover .product-image:not(.is-placeholder) { transform: scale(1.025); }
}

.product-badge {
    position: absolute;
    bottom: .75rem;
    left: .75rem;
    border-radius: var(--radius-pill);
    padding: .3rem .625rem;
    background: var(--success);
    color: var(--surface);
    font-size: .6875rem;
    font-weight: 800;
}

.product-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 1rem;
}

.product-category {
    margin-bottom: .375rem;
    color: var(--accent-strong);
    font-size: .6875rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.product-card h3 {
    min-height: 2.5em;
    margin-bottom: .75rem;
    font-size: 1rem;
    font-weight: 750;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.product-card h3 a:hover { color: var(--accent-strong); }

.product-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 1.25rem;
    margin-bottom: .75rem;
    color: var(--muted);
    font-size: .75rem;
}

.product-rating { color: var(--warning); font-weight: 800; }

.product-price-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: .75rem;
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: .875rem 0;
}

.product-price-row strong {
    color: var(--fg);
    font-size: clamp(1.2rem, 2vw, 1.4rem);
    line-height: 1;
}

.stock-label {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--success);
    font-size: .75rem;
    font-weight: 700;
    text-align: right;
}

.stock-label::before {
    content: "";
    width: .45rem;
    height: .45rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: currentColor;
}

.stock-label.is-unavailable { color: var(--danger); }
.stock-label.is-low-stock { color: var(--warning); }

.product-card-actions {
    display: grid;
    grid-template-columns: .9fr 1.1fr;
    gap: .5rem;
}

.product-card-actions .button { min-width: 0; padding-inline: .625rem; text-wrap: balance; }

.product-card-skeleton { pointer-events: none; }

.product-card-skeleton .product-card-body { gap: .625rem; }

.skeleton-block {
    display: block;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
}

.skeleton-block::after {
    content: "";
    display: block;
    width: 45%;
    height: 100%;
    transform: translateX(-130%);
    background: linear-gradient(90deg, transparent, color-mix(in oklch, var(--surface) 78%, transparent), transparent);
    animation: skeleton-sweep 1.25s ease-in-out infinite;
}

.skeleton-image { aspect-ratio: 1; border-radius: 0; }
.skeleton-kicker { width: 38%; height: .7rem; }
.skeleton-title { width: 92%; height: .95rem; }
.skeleton-title-short { width: 68%; }
.skeleton-price { width: 48%; height: 1.35rem; margin-top: auto; }
.skeleton-action { width: 100%; height: 2.75rem; }

@keyframes skeleton-sweep { to { transform: translateX(280%); } }

.state-box,
.state-panel {
    display: grid;
    min-height: 13rem;
    place-items: center;
    grid-column: 1 / -1;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 5vw, 2.5rem);
    background: var(--surface);
    text-align: center;
}

.state-box > div,
.state-panel > div { max-width: 29rem; }
.state-box h2,
.state-box h3,
.state-panel h2,
.state-panel h3 { margin-bottom: .5rem; }
.state-box p,
.state-panel p { margin-bottom: 1.125rem; color: var(--muted); }
.state-error { border-color: color-mix(in oklch, var(--danger) 38%, var(--border)); background: var(--danger-soft); }
.state-symbol { color: var(--accent-strong); font-size: 2rem; font-weight: 800; }

.spinner {
    width: 2.25rem;
    height: 2.25rem;
    margin: 0 auto 1rem;
    border: 3px solid var(--border);
    border-top-color: var(--accent-strong);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.toast-region {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 100;
    display: grid;
    width: min(23rem, calc(100vw - 2rem));
    gap: .625rem;
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid color-mix(in oklch, var(--surface) 18%, transparent);
    border-radius: var(--radius-md);
    padding: .8125rem 1rem;
    background: var(--fg);
    color: var(--surface);
    box-shadow: var(--shadow-md);
    animation: toast-in .22s ease both;
}

.toast-error { background: var(--danger); }
.toast-success { background: var(--success); }

.toast-action {
    min-height: 2.75rem;
    border: 1px solid color-mix(in oklch, var(--surface) 70%, transparent);
    border-radius: var(--radius-sm);
    padding-inline: .75rem;
    background: transparent;
    color: var(--surface);
    font-weight: 750;
}

.toast-action:hover { background: color-mix(in oklch, var(--surface) 14%, transparent); }

@keyframes toast-in {
    from { transform: translateY(.625rem); opacity: 0; }
}

.site-footer {
    margin-top: clamp(3rem, 7vw, 6rem);
    padding: 4rem 0 1.5rem;
    background: var(--fg);
    color: var(--surface);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.7fr repeat(4, minmax(0, 1fr));
    gap: clamp(1.75rem, 4vw, 3rem);
}

.footer-grid section {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: .625rem;
}

.footer-grid h2 { margin-bottom: .375rem; color: var(--surface); font-size: .9375rem; }

.footer-grid a,
.footer-grid p {
    color: var(--muted-on-dark);
    font-size: .875rem;
    overflow-wrap: anywhere;
}

.footer-grid a { display: inline-flex; min-height: 2.75rem; align-items: center; }
.footer-grid a:hover { color: var(--accent-on-dark); text-decoration: underline; text-underline-offset: .2rem; }
.footer-brand .footer-logo { color: var(--surface); }
.footer-brand .brand-mark { background: var(--surface); }

.footer-brand > h2 {
    max-width: 23rem;
    margin-top: .75rem;
    font-family: var(--font-display);
    font-size: 1.15rem;
    line-height: 1.25;
}

.footer-payments {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .4rem;
}

.footer-payments span {
    border: 1px solid var(--border-on-dark);
    border-radius: var(--radius-sm);
    padding: .3rem .5rem;
    color: var(--muted-on-dark);
    font-size: .6875rem;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    border-top: 1px solid var(--divider-on-dark);
    padding-top: 1.25rem;
    color: var(--subtle-on-dark);
    font-size: .75rem;
}

@media (max-width: 64rem) {
    .header-main { grid-template-columns: auto 1fr auto; gap: .75rem; }
    .brand-word { display: none; }
    .header-action { min-width: 3rem; }
    .header-action > span:last-child { display: none; }
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .footer-grid { grid-template-columns: 1.5fr repeat(2, 1fr); }
    .footer-grid section:nth-child(n + 4) { margin-top: .5rem; }
}

@media (max-width: 53.125rem) {
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 47.5rem) {
    .site-header { backdrop-filter: none; background: var(--surface); }
    .announcement-bar { justify-content: space-between; gap: .75rem; padding-inline: .75rem; }
    .header-main { grid-template-columns: 1fr auto auto; padding-block: .625rem; }
    .brand { width: max-content; }
    .site-search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
    .search-suggestions { max-height: min(25rem, calc(100dvh - var(--header-offset) - .75rem)); }
    .search-suggestion { grid-template-columns: 3rem minmax(0, 1fr) auto; gap: .625rem; min-height: 4.25rem; padding: .5rem .625rem; }
    .search-suggestion-image { width: 3rem; height: 3rem; }
    .header-actions .header-action:first-child { display: none; }
    .header-actions { gap: 0; }
    .menu-toggle { display: block; }
    .primary-nav { position: absolute; top: 100%; right: 0; left: 0; z-index: 52; display: none; max-height: calc(100dvh - var(--header-offset)); overflow-y: auto; overscroll-behavior: contain; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); }
    .primary-nav.is-open { display: block; }
    .primary-nav-inner { align-items: stretch; flex-direction: column; gap: 0; padding-block: .5rem; }
    .primary-nav a { min-height: 3rem; padding-inline: .25rem; }
    .primary-nav a::after { right: auto; width: 2px; height: 100%; transform: scaleY(0); }
    .primary-nav a:hover::after,
    .primary-nav a.is-active::after { transform: scaleY(1); }
    .primary-nav .nav-emphasis { margin-left: 0; }
    .primary-nav a.primary-nav-mobile { display: flex; border-top: 1px solid var(--border); }
    .menu-backdrop.is-open { display: block; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
    .product-card-body { padding: .875rem; }
    .product-card-actions { grid-template-columns: 1fr; }
    .product-card-actions .button-secondary { display: none; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem 1.25rem; }
    .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 32.5rem) {
    .announcement-bar span { display: none; }
    .announcement-bar { justify-content: center; }
    .search-suggestion { grid-template-columns: 2.75rem minmax(0, 1fr); }
    .search-suggestion-image { width: 2.75rem; height: 2.75rem; }
    .search-suggestion-price { grid-column: 2; margin-top: -.35rem; }
    .product-grid { grid-template-columns: 1fr; }
    .product-card h3 { min-height: auto; }
    .product-card-actions { grid-template-columns: .9fr 1.1fr; }
    .product-card-actions .button-secondary { display: inline-flex; }
    .footer-grid { grid-template-columns: 1fr; }
    .footer-brand { grid-column: auto; }
    .footer-bottom { align-items: flex-start; flex-direction: column; }
}

@container product-grid (max-width: 27rem) {
    .product-card-actions { grid-template-columns: 1fr 1fr; }
}
