/* Small layout safeguards kept separate from the base theme for easy review. */
.table-wrap {
    width: 100%;
    max-width: 100%;
    contain: paint;
    overscroll-behavior-inline: contain;
}

body {
    overflow-x: clip;
}

.image-placeholder__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-logo {
    display: block;
    width: 148px;
    height: 54px;
    object-fit: cover;
    object-position: center;
}

.product-image {
    overflow: hidden;
    background: var(--blue-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.product-image--card { aspect-ratio: 1 / 1; }
.product-image--detail { aspect-ratio: 1 / 1; }
.product-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Product photography includes intentional whitespace.  Containing card images
   preserves tall aids such as canes instead of cropping them at the edge. */
.product-image--card img { object-fit: contain; }

.cards.product-catalogue {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 24px;
}

.product-card {
    overflow: hidden;
    padding: 0 !important;
    min-width: 0;
    border: 0 !important;
    box-shadow: 0 10px 28px rgba(17, 61, 69, .08) !important;
}

.product-card h2 {
    margin: 0 0 8px;
    font-size: clamp(1.2rem, 1.8vw, 1.45rem);
    line-height: 1.25;
    letter-spacing: -.015em;
}

.product-card__content { flex: 1; padding: 18px 18px 0; }

.product-card__content > p:not(.price) {
    margin-bottom: 12px;
    color: var(--muted);
    font-size: .96rem;
    line-height: 1.5;
}

.product-card .price { margin: 0; font-size: 1.12rem; }

.product-card__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 18px;
    margin-top: 14px;
}

.product-card__actions .button {
    min-height: 42px;
    padding: 8px 10px;
    font-size: .94rem;
}

.sold-out { align-self: center; color: var(--muted); font-weight: 700; }
.product-stock { margin: 8px 0 0; color: var(--muted); font-size: .86rem; }

.catalogue-section { padding-top: 34px; }
.catalogue-search-intro { max-width: 620px; margin: 0 auto 18px; text-align: center; }
.catalogue-search-intro .eyebrow { color: var(--teal); }
.catalogue-search-intro h2 { margin: 4px 0 6px; font-size: clamp(1.45rem, 2.2vw, 1.8rem); }
.catalogue-search-intro p { margin: 0; color: var(--muted); }

.product-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    max-width: 620px;
    gap: 8px;
    align-items: center;
    margin: 0 auto 24px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(17, 61, 69, .07);
}

.product-search input { min-height: 46px; font-size: 1rem; border: 0; border-radius: 9px; background: transparent; }
.product-search input:focus { outline-offset: 0; }
.product-search button { min-width: 112px; min-height: 46px; padding: 8px 18px; border-radius: 9px; }
.search-count { display: flex; justify-content: center; align-items: center; gap: 12px; max-width: 1200px; margin: 0 auto 20px; color: var(--muted); text-align: center; }
.clear-search { padding-left: 12px; border-left: 1px solid var(--line); color: var(--teal); font-weight: 750; text-decoration: none; }
.clear-search:hover { text-decoration: underline; }
.search-empty { max-width: 680px; margin: 40px auto; }

@media (max-width: 1100px) {
    .cards.product-catalogue { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 850px) {
    .cards.product-catalogue { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cart-product {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.cart-product__image {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 10px;
    background: var(--blue-soft);
}

.cart-product__image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 28px;
    align-items: start;
}

.cart-items {
    display: grid;
    gap: 18px;
}

.cart-product__content h2 {
    margin-top: 0;
}

.cart-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 14px;
}

.cart-actions form {
    grid-template-columns: minmax(110px, 160px) auto;
    align-items: end;
    gap: 12px;
}

.cart-summary {
    position: sticky;
    top: 24px;
}

.cart-total {
    margin: 8px 0 20px;
    color: var(--teal);
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 800;
}

.checkout-button {
    display: block;
    width: 100%;
    text-align: center;
}

.checkout-note {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: .92rem;
    line-height: 1.5;
}

.confirmation-wrap {
    max-width: 760px;
}

.confirmation-card {
    padding: clamp(28px, 5vw, 52px);
    text-align: center;
}

.confirmation-icon {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    place-items: center;
    border-radius: 50%;
    background: var(--sage);
    color: #fff;
    font-size: 2rem;
    font-weight: 800;
}

/* Keep the enquiry status compact beside its heading. */
.detail-title {
    align-items: flex-start;
}

.detail-title .badge {
    align-self: flex-start;
    margin-top: 4px;
    white-space: nowrap;
}

/* Form controls share a deliberate vertical rhythm instead of relying on
   browser/widget defaults.  This also keeps the CAPTCHA visually connected
   to the action it protects. */
.login-card form,
.panel form {
    display: grid;
    gap: 20px;
}

.login-card .input,
.panel .input,
.login-card .check {
    margin-bottom: 0;
}

.g-recaptcha {
    width: 304px;
    max-width: 100%;
    margin: 2px 0;
}

/* A capped form column reads more comfortably on wide screens and prevents
   the login image from feeling disconnected from the form. */
.login-grid {
    grid-template-columns: minmax(0, 620px) minmax(360px, 1fr);
    gap: clamp(32px, 5vw, 64px);
}

.login-section {
    padding: clamp(40px, 5vw, 72px) 0;
}

.login-card {
    padding: clamp(28px, 4vw, 44px);
}

@media (max-width: 850px) {
    .login-grid {
        grid-template-columns: 1fr;
    }

    .cart-grid {
        grid-template-columns: 1fr;
    }

    .cart-summary {
        position: static;
    }
}

@media (max-width: 560px) {
    .brand-logo { width: 126px; height: 46px; }
    .cart-product { grid-template-columns: 92px minmax(0, 1fr); gap: 14px; }
    .cart-actions,
    .cart-actions form { display: grid; grid-template-columns: 1fr; width: 100%; }
    .product-card__actions { grid-template-columns: 1fr; }
    .cards.product-catalogue { grid-template-columns: 1fr; }
    .product-search { grid-template-columns: 1fr; }
    .product-search button { width: 100%; }
    .search-count { flex-direction: column; gap: 4px; }
    .clear-search { padding-left: 0; border-left: 0; }
    .header-inner {
        align-items: flex-start;
        padding: 14px 0;
        gap: 8px;
    }

    .brand {
        font-size: 1.0625rem;
    }

    .primary-nav {
        justify-content: space-between;
    }

    .admin-login-link {
        padding: 8px 12px;
    }

    .login-section {
        min-height: auto;
        padding: 32px 0 48px;
    }

    .login-card {
        padding: 24px 20px;
        border-radius: 12px;
    }

    .login-card form,
    .panel form {
        gap: 18px;
    }

    .table-wrap {
        overflow-x: auto;
    }
}

/* reCAPTCHA's normal widget is 304px wide. Scale it only on the few
   viewports narrower than the page gutter can accommodate. */
@media (max-width: 360px) {
    .g-recaptcha {
        transform: scale(.9);
        transform-origin: left top;
        height: 70px;
        margin-bottom: -6px;
    }
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 32px;
}

.footer-grid a {
    color: #dcebea;
}

.footer-grid a:hover {
    color: #fff;
}

.footer-nav {
    display: grid;
    align-content: start;
    gap: 4px;
}

.footer-nav a {
    width: max-content;
}

@media (max-width: 560px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}
