/* ====================== DESIGN TOKENS ====================== */
:root {
    --bg-1: #eef3fc;
    --bg-2: #dde7f8;
    --brand: #2563eb;
    --brand-deep: #1d4ed8;
    --brand-soft: #e8efff;
    --brand-softer: #f3f6fe;
    --ink: #0f1c3f;
    --ink-2: #25304f;
    --muted: #6b7591;
    --line: #e6eaf4;
    --line-2: #eef1f8;
    --card: #ffffff;
    --crown: #f59e0b;
    --check: #10b981;
    --star: #8b5cf6;
}

* { box-sizing: border-box; }

body {
    font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
    background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
    background-attachment: fixed;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    letter-spacing: -0.005em;
    min-height: 100vh;
    margin: 0;
}

.page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 24px 0;
}

/* ====================== SKELETON LOADER ====================== */
@keyframes skeleton-shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton-loader {
    background: linear-gradient(90deg, #e8edf5 25%, #d4daf0 50%, #e8edf5 75%);
    background-size: 800px 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}

.skeleton-rect { border-radius: 6px; }
.skeleton-circle { border-radius: 50%; }

/* ====================== TOP BAR ====================== */
.topbar {
    background: var(--card);
    border-radius: 16px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 1px 0 rgba(15,28,63,0.04), 0 8px 24px -16px rgba(15,28,63,0.18);
}

/* Search styles — the topbar_search partial outputs .search */
.topbar .search {
    flex: 0 0 420px;
    display: flex;
    align-items: center;
    background: var(--brand-softer);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 4px 0 14px;
    height: 44px;
    transition: border-color .15s, background .15s;
}
.topbar .search:focus-within {
    border-color: var(--brand);
    background: #fff;
}
.topbar .search .lead {
    color: var(--muted);
    flex-shrink: 0;
}
.topbar .search .search-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    padding: 0 12px;
    min-width: 0;
}
.topbar .search .search-input::placeholder { color: var(--muted); }
.topbar .search .go,
.topbar .search .search-btn {
    background: var(--brand);
    color: #fff;
    border: 0;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}
.topbar .search .go:hover,
.topbar .search .search-btn:hover { background: var(--brand-deep); }

/* Category nav pills */
.cats {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
}
.cats::-webkit-scrollbar { display: none; }

/* Make the server-rendered <nav class="category-nav"> transparent to flex layout */
.cats .category-nav { display: contents; }

/* Server-rendered category nav links */
.cats a,
.cats .cat,
.category-nav a {
    flex: 0 0 auto;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.cats a:hover,
.cats .cat:hover,
.category-nav a:hover { background: var(--brand-softer); }

.cats a.active,
.cats .cat.is-active,
.category-nav a.active { background: var(--brand); color: #fff; }

/* ====================== SECTION ====================== */
.section { margin-top: 36px; }

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 16px;
}
.section-head h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1.1;
    position: relative;
    padding-bottom: 8px;
}
.section-head h2::after {
    content: "";
    position: absolute;
    left: 0; bottom: 0;
    width: 36px; height: 3px;
    background: var(--brand);
    border-radius: 2px;
}

a.view-all,
button.view-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background .15s;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
a.view-all:hover,
button.view-all:hover { background: var(--brand-soft); }
a.view-all svg,
button.view-all svg { width: 16px; height: 16px; }

.carousel-head {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink-2);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: border-color .15s, color .15s;
    flex-shrink: 0;
}
.nav-btn:hover { border-color: var(--brand); color: var(--brand); }
.nav-btn svg { width: 16px; height: 16px; }

/* ====================== HERO GRID ====================== */
.hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}
.hero-row-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
    margin-top: 16px;
}
.hero-tile {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 21 / 9;
    background: #d4dbeb;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(15,28,63,0.04), 0 14px 30px -22px rgba(15,28,63,0.3);
    transition: transform .25s ease;
}
.hero-tile:hover { transform: translateY(-2px); }
.hero-tile img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.hero-tile::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(15,28,63,0) 30%, rgba(15,28,63,0.65) 100%);
    pointer-events: none;
}
/* .hero-tile.small inherits aspect-ratio: 21/9 from .hero-tile — the 1fr column makes it shorter */

.hero-content {
    position: absolute;
    left: 28px; bottom: 24px; right: 28px;
    z-index: 2;
    color: #fff;
}
.hero-pre {
    display: inline-block;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 999px;
    margin-bottom: 12px;
}
.hero-title {
    margin: 0 0 6px;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    text-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.hero-tile.small .hero-title { font-size: 22px; }
.hero-sub {
    margin: 0;
    font-size: 14px;
    color: rgba(255,255,255,0.92);
    font-weight: 500;
    line-height: 1.4;
}
.hero-cta {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    color: var(--brand);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: transform .12s;
}
.hero-cta:hover { transform: translateX(2px); }
.hero-cta svg { width: 14px; height: 14px; }

/* ====================== CATEGORIES STRIP ====================== */
/* Restyle server-rendered .categories-container structure */
.categories-container { }

.categories-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 4px 0;
}
.categories-scroll::-webkit-scrollbar { display: none; }

.category-item {
    flex: 0 0 96px;
    scroll-snap-align: start;
    background: var(--card);
    border-radius: 14px;
    padding: 16px 8px 12px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--line-2);
    box-shadow: 0 1px 2px rgba(15,28,63,0.03);
    transition: transform .15s, border-color .15s, box-shadow .15s;
    cursor: pointer;
    display: block;
}
.category-item:hover {
    transform: translateY(-3px);
    border-color: #d8deef;
    box-shadow: 0 12px 24px -16px rgba(15,28,63,0.25);
}
.category-circle {
    width: 56px;
    height: 56px;
    margin: 0 auto 10px;
    border-radius: 50%;
    background: var(--brand-softer);
    display: grid;
    place-items: center;
    color: var(--brand);
    transition: background .15s, color .15s;
}
.category-item:hover .category-circle {
    background: var(--brand);
    color: #fff;
}
.category-circle i { font-size: 22px; }
.category-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Category skeleton */
.category-skeleton {
    background: var(--card);
    border-radius: 14px;
    padding: 18px 10px 14px;
    text-align: center;
    border: 1px solid var(--line-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.category-skeleton-circle { width: 56px; height: 56px; }
.category-skeleton-name { width: 60px; height: 12px; }

/* ====================== CAROUSEL ROW ====================== */
.row-wrap { position: relative; }
.row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    scroll-behavior: smooth;
    margin: 0 -4px;
    padding: 4px;
}
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; flex-shrink: 0; }

/* ====================== MINI CARD (new stores / new products) ====================== */
.mini-card {
    width: 320px;
    background: var(--card);
    border-radius: 14px;
    padding: 14px;
    border: 1px solid var(--line-2);
    box-shadow: 0 1px 2px rgba(15,28,63,0.04);
    cursor: pointer;
    transition: transform .15s, border-color .15s, box-shadow .15s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mini-card:hover {
    transform: translateY(-2px);
    border-color: #d8deef;
    box-shadow: 0 10px 22px -14px rgba(15,28,63,0.25);
}
.mini-top {
    display: flex;
    align-items: center;
    gap: 12px;
}
.mini-thumb {
    width: 56px; height: 56px;
    border-radius: 12px;
    background: var(--brand-softer);
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-thumb-tier {
    position: absolute;
    bottom: -3px; right: -3px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--check);
    color: #fff;
    border: 2px solid #fff;
    display: grid;
    place-items: center;
}
.mini-thumb-tier svg { width: 9px; height: 9px; }
.mini-info { min-width: 0; flex: 1; }
.mini-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.mini-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.mini-type {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--brand-softer);
    color: var(--brand);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    flex-shrink: 0;
    white-space: nowrap;
}
.mini-type svg { width: 10px; height: 10px; }
.mini-cat {
    margin-top: 3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--brand);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.mini-cat svg { width: 11px; height: 11px; flex-shrink: 0; }
.mini-sub {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mini-feats {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding-top: 8px;
    border-top: 1px solid var(--line-2);
}
.mini-feats .sfeat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    background: var(--brand-softer);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-2);
}
.mini-feats .sfeat svg { width: 11px; height: 11px; color: var(--brand); }
.mini-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--brand);
    font-feature-settings: "tnum";
}

/* Mini card skeleton */
.mini-card-skeleton {
    width: 320px;
    background: var(--card);
    border-radius: 14px;
    padding: 14px;
    border: 1px solid var(--line-2);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}
.mini-skeleton-top { display: flex; align-items: center; gap: 12px; }
.mini-skeleton-thumb { width: 56px; height: 56px; border-radius: 12px; }
.mini-skeleton-info { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.mini-skeleton-title { height: 14px; width: 70%; }
.mini-skeleton-sub { height: 11px; width: 90%; }
.mini-skeleton-price { height: 14px; width: 40%; }

/* ====================== RESPONSIVE ====================== */
@media (max-width: 1024px) {
    .topbar { flex-wrap: wrap; gap: 12px; }
    .topbar .search { flex: 1 1 100%; }
    .cats { flex: 1 1 100%; }
    .hero-grid { grid-template-columns: 1fr; }
    .hero-row-2 { grid-template-columns: 1fr; }
    .hero-tile { aspect-ratio: 21/9; }
}

@media (max-width: 720px) {
    .page { padding: 14px 14px 0; }
    .topbar { border-radius: 14px; padding: 10px; }
    .topbar .search .search-input { font-size: 16px; }
    .section { margin-top: 28px; }
    .section-head h2 { font-size: 20px; }
    .hero-title { font-size: 22px; }
    .hero-content { left: 18px; right: 18px; bottom: 16px; }

    /* Mobile hero: show only the first large tile */
    .hero-grid .hero-tile:nth-child(2) { display: none; }
    .hero-row-2 { display: none; }

    /* Categories: already a flex scroll carousel at all sizes */

    .mini-card { width: 280px; }
}
