/* AGAL TOYS — COMPONENTS: buttons, product card, price, ratings, forms */

/* ============ Buttons ============
   Deliberately NOT full-pill — a moderate structured radius plus a offset
   hard shadow reads as a considered, original button language rather than
   the generic rounded-pill/flat-fill pattern every template ships with. */
.btn-brand,
.btn-outline-brand,
.btn-accent {
    position: relative;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
    border-radius: var(--radius-md);
    padding-inline: var(--space-5);
    padding-block: 0.7rem;
    border: 2px solid var(--ink);
    transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
    min-block-size: 44px;
    box-shadow: 3px 3px 0 var(--ink);
}

.btn-brand {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: var(--grey-0);
    box-shadow: 3px 3px 0 var(--blue-700);
}

.btn-brand:hover:not(:disabled) {
    background-color: var(--brand-primary-hover);
    color: var(--grey-0);
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--blue-700);
}

.btn-accent {
    background-color: var(--brand-accent);
    border-color: var(--brand-accent);
    color: var(--grey-0);
    box-shadow: 3px 3px 0 var(--orange-600);
}

.btn-accent:hover:not(:disabled) {
    background-color: var(--brand-accent-hover);
    color: var(--grey-0);
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--orange-600);
}

.btn-outline-brand {
    background-color: var(--surface);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    box-shadow: 3px 3px 0 var(--brand-primary);
}

.btn-outline-brand:hover:not(:disabled) {
    background-color: var(--brand-primary);
    color: var(--grey-0);
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--brand-primary);
}

.btn-brand:disabled,
.btn-accent:disabled,
.btn-outline-brand:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 44px;
    block-size: 44px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--surface-border);
    color: var(--ink);
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.btn-icon:hover {
    background: var(--brand-primary-tint);
    color: var(--brand-primary);
}

/* ============ Pagination (Laravel's default Bootstrap-5 markup) ============ */
.pagination {
    gap: var(--space-2);
}

.page-link {
    border-radius: var(--radius-md) !important;
    border: 2px solid var(--surface-border);
    color: var(--ink-soft);
    font-weight: 700;
    min-inline-size: 40px;
    min-block-size: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
}

.page-link:hover {
    background-color: var(--brand-primary-tint);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.page-item.active .page-link {
    background-color: var(--brand-primary);
    border-color: var(--blue-700);
    color: var(--grey-0);
    box-shadow: 2px 2px 0 var(--blue-700);
}

.page-item.disabled .page-link {
    background-color: var(--surface);
    border-color: var(--surface-border);
    color: var(--ink-muted);
}

/* ============ Section heading ============ */
.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    margin-block-end: var(--space-5);
    flex-wrap: wrap;
}

.section-heading__text {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.section-heading__eyebrow {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-accent);
}

.section-heading__title {
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem);
    font-weight: 800;
}

.section-heading__subtitle {
    color: var(--ink-soft);
    font-size: 0.95rem;
}

.section-heading__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    color: var(--brand-primary);
    white-space: nowrap;
}

.section-heading__link:hover {
    color: var(--brand-primary-hover);
}

/* ============ Breadcrumb ============ */
.breadcrumb-trail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin-block-end: var(--space-4);
}

.breadcrumb-trail a {
    color: var(--ink-soft);
}

.breadcrumb-trail a:hover {
    color: var(--brand-primary);
}

.breadcrumb-trail li[aria-current="page"] {
    color: var(--ink);
    font-weight: 600;
}

.breadcrumb-trail ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: 0;
}

.breadcrumb-trail li:not(:last-child)::after {
    content: "/";
    margin-inline-start: var(--space-2);
    color: var(--ink-muted);
}

/* ============ Badges ============ */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.3em 0.75em;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge-pill--new { background: var(--green-100); color: #1f7a30; }
.badge-pill--featured { background: var(--yellow-100); color: #96650f; }
.badge-pill--sale { background: var(--brand-accent); color: var(--grey-0); }

/* ============ Price ============ */
.price-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.price-current {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--ink);
}

.price-was {
    font-size: 0.9rem;
    color: var(--ink-muted);
    text-decoration: line-through;
}

.price-save {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1f7a30;
    background: var(--green-100);
    padding: 0.15em 0.55em;
    border-radius: var(--radius-sm);
}

/* ============ Star rating ============ */
.star-rating {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--brand-yellow);
    font-size: 0.9rem;
}

.star-rating[data-empty="true"] {
    color: var(--ink-muted);
}

.star-rating__count {
    color: var(--ink-soft);
    font-size: 0.82rem;
    margin-inline-start: 0.2em;
}

/* ============ Product card ============ */
/* container-queried so the same markup adapts across grid, carousel slide,
   and the narrower related-products context. */
.prod-card {
    container-type: inline-size;
    container-name: prod-card;
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: clip;
    box-shadow: var(--shadow-sm);
    transition: transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.prod-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* ============ Product carousel chrome (arrows + dots) ============
   Reserve room below the cards for the dots and inset the rail slightly so
   card shadows aren't clipped; arrows sit vertically centred on the cards
   and dots are centred horizontally underneath, never over the buttons. */
.swiper:has(.prod-card) {
    --rail-dots-space: 44px;
    position: relative;
    padding: 6px 6px var(--rail-dots-space);
}

.swiper:has(.prod-card) .swiper-pagination {
    position: absolute;
    inset-inline: 0;
    inset-block-end: 10px;
    inline-size: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 0;
}

/* Review carousel: its dots are a plain in-flow element (not
   .swiper-pagination), so they were left-aligned. Centre them, and opt this
   rail out of the product-rail padding above. */
#testimonialSwiper {
    padding: 6px 6px 0;
}

.ts-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-block-start: var(--space-5);
    line-height: 0;
}

.prod-nav-next, .prod-nav-prev,
.prod-nav-next-2, .prod-nav-prev-2,
.rel-nav-next, .rel-nav-prev {
    position: absolute;
    inset-block-start: calc((100% - var(--rail-dots-space)) / 2);
    translate: 0 -50%;
    z-index: 10;
    inline-size: 44px;
    block-size: 44px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.prod-nav-prev, .prod-nav-prev-2, .rel-nav-prev { inset-inline-start: 12px; }
.prod-nav-next, .prod-nav-next-2, .rel-nav-next { inset-inline-end: 12px; }

.prod-nav-next:hover, .prod-nav-prev:hover,
.prod-nav-next-2:hover, .prod-nav-prev-2:hover,
.rel-nav-next:hover, .rel-nav-prev:hover {
    background: var(--brand-primary);
    color: var(--grey-0);
}

.swiper-button-disabled.prod-nav-next, .swiper-button-disabled.prod-nav-prev {
    opacity: 0.4;
    pointer-events: none;
}

/* Swiper sets .swiper-slide { height: 100% } by default, which makes each
   slide size to its own content instead of the tallest one — that's why a
   portrait photo (giraffe) produced a taller card than landscape ones in the
   same rail. height:auto + stretch makes every slide match the tallest, and
   height:100% on the card fills it. */
.swiper-wrapper {
    align-items: stretch;
}

.swiper-slide:has(.prod-card) {
    height: auto;
}

.prod-card__media {
    position: relative;
    background: var(--surface-sunken);
    overflow: clip;
    /* An exact square derived from the card's own width (100cqw), NOT
       aspect-ratio — aspect-ratio has to negotiate with flex sizing and
       was letting some cards' image boxes shrink/grow. Height is pinned
       three ways so no photo, sibling or stretch can change it. */
    block-size: 100cqw;
    min-block-size: 100cqw;
    max-block-size: 100cqw;
    flex: none;
}

.prod-card__media img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    transition: transform var(--duration-base) var(--ease-out);
}

.prod-card:hover .prod-card__media img {
    transform: scale(1.05);
}

.prod-card__badge {
    position: absolute;
    inset-block-start: var(--space-3);
    inset-inline-start: var(--space-3);
    z-index: 1;
}

.prod-card__wish {
    position: absolute;
    inset-block-start: var(--space-3);
    inset-inline-end: var(--space-3);
    z-index: 1;
    inline-size: 38px;
    block-size: 38px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    border: none;
    transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
}

.prod-card__wish:hover,
.prod-card__wish.active {
    color: var(--brand-accent);
}

.prod-card__quick-add {
    position: absolute;
    inset-inline: var(--space-3);
    inset-block-end: var(--space-3);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    background: var(--ink);
    color: var(--grey-0);
    border: none;
    border-radius: var(--radius-pill);
    padding-block: 0.55rem;
    font-weight: 700;
    font-size: 0.85rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out);
}

.prod-card:hover .prod-card__quick-add,
.prod-card:focus-within .prod-card__quick-add {
    opacity: 1;
    transform: translateY(0);
}

@media (pointer: coarse) {
    /* No hover on touch — keep quick-add reachable without a hover state */
    .prod-card__quick-add {
        opacity: 1;
        transform: none;
        position: static;
        margin: var(--space-3);
    }
}

.prod-card__body {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    flex: 1;
}

.prod-card__eyebrow {
    font-size: 0.72rem;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
    /* Category + color text varies a lot in length ("SOFT TOYS & BABY" vs
       "BUILDING BLOCKS & STEM · GREY") — without clamping to 1 line, the
       longer ones wrap to 2 lines and throw off every card height below
       them, which is exactly what title/desc were already fixed for. */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    line-clamp: 1;
    overflow: clip;
    min-block-size: 1.4em;
}

/* Title and description both reserve a FIXED block height regardless of
   actual text length (1-line title still reserves the 2-line box, a short
   description still reserves a full line). That makes every card's natural
   content height identical up front, so the row's equal-height stretch has
   nothing left to fill — no gap, because there's no leftover space to begin
   with, rather than relocating it with margin-top:auto after the fact. */
.prod-card__title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: clip;
    min-block-size: 2.5em;
}

.prod-card__desc {
    font-size: 0.82rem;
    color: var(--ink-soft);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    line-clamp: 1;
    overflow: clip;
    margin-block: 0.2em 0;
    min-block-size: 1.4em;
}

.prod-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    /* Pinned to the bottom: media height is now exact and text rows are all
       fixed-height, so there is no leftover space to become a gap — this
       only guarantees the price row and button sit at the same Y in every
       card. */
    margin-block-start: auto;
    padding-block-start: var(--space-3);
}

/* Wider card contexts (2-up related products, desktop grid) get more
   breathing room for the footer row. */
@container prod-card (inline-size > 220px) {
    .prod-card__body {
        padding: var(--space-5);
    }
}

/* ============ Category card ============ */
.cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    text-align: center;
}

.cat-card__media {
    aspect-ratio: 1 / 1;
    inline-size: 100%;
    border-radius: var(--radius-lg);
    overflow: clip;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
}

.cat-card__media img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    transition: transform var(--duration-base) var(--ease-out);
}

.cat-card:hover .cat-card__media {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.cat-card:hover .cat-card__media img {
    transform: scale(1.04);
}

.cat-card__title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ink);
}

/* ============ Empty state ============ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-3);
    padding-block: var(--space-8);
    color: var(--ink-soft);
}

.empty-state__icon {
    inline-size: 72px;
    block-size: 72px;
    border-radius: var(--radius-pill);
    background: var(--brand-primary-tint);
    color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.empty-state__title {
    font-weight: 800;
    color: var(--ink);
    font-size: 1.15rem;
}

/* ============ Forms ============ */
.form-control,
.form-select {
    border: 2px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.9rem;
    font-family: var(--font-body);
    transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.15);
}

.form-control:user-invalid,
.form-select:user-invalid {
    border-color: var(--brand-accent);
}

label {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--ink);
}

/* Colour swatches — was inline `style="background:..."` per swatch; now
   driven by a --swatch custom property set once per element. */
.swatch {
    --swatch-size: 26px;
    inline-size: var(--swatch-size);
    block-size: var(--swatch-size);
    min-inline-size: 24px;
    min-block-size: 24px;
    border-radius: var(--radius-pill);
    background-color: var(--swatch);
    border: 2px solid var(--surface-border);
    cursor: pointer;
    display: inline-block;
    transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}

.swatch:hover {
    border-color: var(--ink-muted);
}

.swatch.active,
.swatch[aria-pressed="true"] {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand-primary);
}

/* ============ Auth card shell ============ */
.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: clamp(1.5rem, 1rem + 2vw, 3rem);
    max-inline-size: 480px;
    margin-inline: auto;
}

.auth-card__eyebrow {
    text-align: center;
    color: var(--brand-accent);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-card__title {
    text-align: center;
    font-size: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    font-weight: 800;
    margin-block: var(--space-2) var(--space-5);
}

/* Keep a single category from stretching across the page. */
.category-scroll .cat-card { inline-size: 100%; max-inline-size: 260px; }

