/* Layout 1 — subcategory listing.
   Loaded only by templates/Slugs/v1/subcategory.php. Layout 1 loads just
   app-mobile.css and v1/base.css, so none of the desktop sheets that style
   .hero__categories / .cat-card are present — this sheet stands alone rather
   than overriding them. */

.app-shell .subcat-page {
    padding: var(--app-page-top) 0 var(--app-page-bottom);
}

.app-shell .subcat-page > .container {
    width: 100%;
    max-width: 100%;
    padding-inline: var(--app-pad);
}

/* --- Category chip row --------------------------------------------------
   The desktop sidebar list becomes a scrolling row of sibling categories.
   It bleeds to both frame edges so a chip scrolled half off screen reads as
   "there is more" instead of colliding with the container padding. */

.app-shell .subcat-nav {
    display: flex;
    gap: 8px;
    margin: 0 calc(var(--app-pad) * -1) 14px;
    padding: 2px var(--app-pad) 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.app-shell .subcat-nav::-webkit-scrollbar {
    display: none;
}

.app-shell .subcat-chip {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 15px;
    border: 1px solid #e4e6ea;
    border-radius: 20px;
    background: #fff;
    color: var(--app-ink);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.app-shell .subcat-chip:hover,
.app-shell .subcat-chip:focus {
    border-color: var(--app-theme);
    color: var(--app-theme);
    text-decoration: none;
}

.app-shell .subcat-chip.is-active {
    background: var(--app-theme);
    border-color: var(--app-theme);
    color: #fff;
}

/* --- Header row: count + sort ------------------------------------------- */

.app-shell .subcat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.app-shell .subcat-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--app-muted);
}

/* The native select is kept (the page's sort JS binds to it) but restyled to
   match the app's inputs, with room for the chevron drawn on the right. */
.app-shell .subcat-sort {
    min-width: 132px;
    min-height: 40px;
    padding: 9px 32px 9px 13px;
    border: 1px solid #e4e6ea;
    border-radius: 11px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    color: var(--app-ink);
    font-size: 13.5px;
    font-weight: 600;
    appearance: none;
    -webkit-appearance: none;
}

.app-shell .subcat-sort:focus {
    border-color: var(--app-theme);
    box-shadow: 0 0 0 3px var(--app-theme-soft);
    outline: 0;
}

/* --- Subcategory grid ---------------------------------------------------
   Two per row at phone width. The JS sort re-injects .product-sec-xls items
   into .products-merge, so the grid must stay on that container. */

.app-shell .products-merge {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.app-shell .products-merge .product-sec-xls {
    display: flex;
    width: 100%;
    padding: 0;
}

.app-shell .subcat-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid #eceef1;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
    color: var(--app-ink);
    text-decoration: none;
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.app-shell .subcat-card:hover,
.app-shell .subcat-card:focus {
    border-color: var(--app-theme);
    box-shadow: 0 6px 16px rgba(16, 24, 40, .1);
    color: var(--app-ink);
    text-decoration: none;
}

.app-shell .subcat-card:active {
    transform: translateY(1px);
}

.app-shell .subcat-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f7f8f9;
    overflow: hidden;
}

/* contain, not cover: these are catalogue images that get cropped badly when
   filled edge to edge. */
.app-shell .subcat-card-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.app-shell .subcat-card-caption {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    border-top: 1px solid #f4f5f7;
}

.app-shell .subcat-card-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--app-ink);
    /* Two lines then ellipsis, so a long name cannot shove the arrow out or
       leave neighbouring cards at different heights. */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.app-shell .subcat-card-arrow {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--app-theme-soft, #f1f2f4);
    color: var(--app-theme);
    font-size: 10px;
    transition: background .15s ease, color .15s ease;
}

.app-shell .subcat-card:hover .subcat-card-arrow {
    background: var(--app-theme);
    color: #fff;
}

/* --- Empty state -------------------------------------------------------- */

.app-shell .subcat-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 38vh;
    padding: 24px var(--app-pad);
    text-align: center;
}

.app-shell .subcat-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: var(--app-theme-soft, #f1f2f4);
    color: var(--app-theme);
    font-size: 32px;
}

.app-shell .subcat-empty h3 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: var(--app-ink);
}

.app-shell .subcat-empty p {
    margin: 0;
    font-size: 14px;
    color: var(--app-muted);
}

/* --- Wider frames -------------------------------------------------------
   The app shell is capped by --app-width, but on a tablet-sized frame there
   is room for a third column. */

@media (min-width: 560px) {
    .app-shell .products-merge {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }

    .app-shell .subcat-card-name {
        font-size: 14px;
    }
}
