/* Overrides when original Dawn theme CSS is loaded */
body.store-theme-active .shopify-payment-button,
body.store-theme-active [data-shopify-buttoncontainer],
body.store-theme-active form[action*="/checkout"]:not([action*="checkout.html"]),
body.store-theme-active a[href*="/checkout"]:not([href*="checkout.html"]) {
    display: none !important;
}

body.store-theme-active a[data-removed="1"] {
    pointer-events: none;
    opacity: 0.35;
}

/* Header/footer wrappers — pass through Dawn layout groups */
#siteHeader,
#siteFooter {
    display: contents;
}

body.store-theme-active #siteHeader:not(:empty),
body.store-theme-active #siteFooter:not(:empty) {
    display: block;
}

body.tks-unified-layout #siteHeader,
body.tks-unified-layout #siteFooter {
    display: block;
}

/* Full-bleed theme pages — do NOT constrain main content */
body.store-theme-active #MainContent,
body.store-theme-active #homeMain,
body.store-theme-active #collectionMain,
body.store-theme-active #productMain,
body.store-theme-active .shopify-section.section {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    width: 100%;
}

.section-contact-form-padding {
    padding-top: 2.7rem;
    padding-bottom: 2.7rem;
}

@media screen and (min-width: 750px) {
    .section-contact-form-padding {
        padding-top: 3.6rem;
        padding-bottom: 3.6rem;
    }
}

/* Demo inner pages that use our own markup */
body.store-theme-active main.tks-inner-page,
body.store-theme-active .cart-page.tks-inner-page {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    max-width: var(--page-width, min(1400px, 100%));
    margin-left: auto;
    margin-right: auto;
    padding-left: max(16px, var(--page-padding, 24px));
    padding-right: max(16px, var(--page-padding, 24px));
}

body.store-theme-active .cart-page.tks-inner-page .page-width {
    max-width: var(--page-width, 120rem);
    margin: 0 auto;
    padding: 36px max(1.5rem, var(--page-padding, 5rem));
}

/* Generic fallback grid (non-themed only) */
body:not(.store-theme-active) .product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    gap: clamp(16px, 2vw, 32px);
}

body.store-theme-active img.lazyload,
body.store-theme-active img.lazyloading {
    opacity: 1;
}

.lazy-loading-image--placeholder {
    display: none !important;
}

.lazy-loading-image--main,
.lazy-loading-image.lazy-loaded-image .lazy-loading-image--main,
figure.lazy-loading-image img.lazy-loading-image--main,
figure.lazy-loading-image.lazy-loaded-image img,
figure.lazy-loading-image--ready img {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    width: 100%;
    height: auto;
    max-width: 100%;
}

figure.lazy-loading-image {
    opacity: 1 !important;
    position: relative;
}

.section-multicolumn-grid__image figure.lazy-loading-image,
.collection-list figure.lazy-loading-image,
.section-multicolumn-grid__media img,
.rte img,
.section-main-page-content img,
.banner__media img,
.card__media img {
    max-width: 100%;
    height: auto;
}

/* Homepage banner — full width */
body.store-theme-active .banner,
body.store-theme-active .banner__media,
body.store-theme-active .section-image-banner {
    max-width: none;
}

body.store-theme-active .banner__media img {
    width: 100%;
    object-fit: cover;
}

/* Hero banner — prevent bottom content box clipping */
body.store-theme-active .banner {
    overflow: visible;
}

body.store-theme-active .banner__content.banner__content--bottom-center {
    padding-bottom: 2.5rem;
    align-items: flex-end;
}

body.store-theme-active .banner__content .banner__box {
    margin-bottom: 0.5rem;
    padding: 1.25rem 1.75rem 1.5rem;
}

body.store-theme-active .banner__buttons {
    margin-top: 0.75rem;
    gap: 0.75rem;
}

/* Footer — contact block link styling */
body.store-theme-active .footer-block .footer-block__details-content.rte p {
    line-height: 1.6;
}

body.store-theme-active .footer-block .footer-block__details-content.rte p a:only-child,
body.store-theme-active .footer-block .footer-block__details-content.rte > p > a {
    text-decoration: none;
}

/* Policy pages — match Shopify policy template (narrow centered column) */
.shopify-policy__container {
    max-width: 560px;
    max-width: 65ch;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

.shopify-policy__title {
    text-align: center;
}

.shopify-policy__body {
    margin-bottom: 20px;
}

/* CMS main page (Accessibility Statement) — match Dawn section-main-page */
.section-main-page-padding {
    padding-top: 21px;
    padding-bottom: 21px;
}

@media screen and (min-width: 750px) {
    .section-main-page-padding {
        padding-top: 28px;
        padding-bottom: 28px;
    }
}

body.store-theme-active .page-width--narrow {
    max-width: var(--page-width, 72.6rem);
    margin: 0 auto;
    padding: 0 9rem;
}

@media screen and (max-width: 749px) {
    body.store-theme-active .page-width--narrow {
        padding: 0 max(1.5rem, var(--page-padding, 2rem));
    }
}

body.store-theme-active .footer-block .footer-block__details-content.rte p a:hover {
    text-decoration: underline;
}

body.store-theme-active .footer-block--newsletter {
    padding-bottom: 1.5rem;
}

body.store-theme-active .footer-block--newsletter .footer-badge {
    margin-top: 0.5rem;
}

body.store-theme-active .footer-block--newsletter .footer-badge img {
    max-width: 125px;
    height: auto;
}

/* Collection list on homepage */
body.store-theme-active .collection-list,
body.store-theme-active .section-collection-list {
    max-width: none;
}

/* Slideshow sections if present */
.section-slideshow .section-slideshow-slide {
    background-color: transparent !important;
}

.section-slideshow .tks-hero-slide,
.section-slideshow .section-slideshow-slide-background {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: var(--theme-slideshow-custom-height-mobile, 600px);
    background-size: cover !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

@media (min-width: 768px) {
    .section-slideshow .tks-hero-slide,
    .section-slideshow .section-slideshow-slide-background {
        min-height: var(--theme-slideshow-custom-height, 780px);
    }
}

.section-slideshow .section-slideshow-slide-background-media {
    display: none !important;
}

.section-slideshow .splide__track,
.section-slideshow .splide__list,
.section-slideshow .section-slideshow-slide {
    height: 100%;
}

.section-slideshow .splide__slide.is-active .tks-hero-slide {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Demo cart drawer — overlay, hidden by default (legacy fallback) */
#cartDrawer.cart-drawer:not(.tks-cart-drawer) {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    visibility: hidden;
}

#cartDrawer.cart-drawer:not(.tks-cart-drawer).open,
#cartDrawer.tks-cart-drawer.is-open {
    pointer-events: auto;
    visibility: visible;
}

#cartDrawer .cart-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#cartDrawer.cart-drawer.open .cart-backdrop {
    opacity: 1;
}

#cartDrawer .cart-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(420px, 100vw);
    height: 100%;
    background: #fff;
    padding: 24px;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    overflow: auto;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s ease;
    font-family: var(--font-body-family, inherit);
}

#cartDrawer.cart-drawer.open .cart-panel {
    transform: translateX(0);
}

#cartDrawer .cart-close {
    align-self: flex-end;
    font-size: 28px;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

#cartDrawer .cart-panel h3 {
    margin: 0 0 16px;
    font-size: 1.125rem;
}

#cartDrawer .cart-drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
}

#cartDrawer .btn-outline {
    display: inline-block;
    border: 1px solid currentColor;
    padding: 12px 20px;
    text-align: center;
    font-size: 13px;
    text-decoration: none;
}

#cartDrawer .cart-empty,
.cart-page .cart-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #666;
    padding: 24px 0;
}

/* Hide Shopify native cart drawer — demo uses cart.html */
body.store-theme-active cart-drawer,
body.store-theme-active .cart-drawer:not(#cartDrawer):not(.tks-cart-drawer) {
    display: none !important;
}

body.store-theme-active .btn-shop,
body.store-theme-active .btn-outline,
body.store-theme-active .checkout-btn {
    font-family: inherit;
}

.tks-related-products {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(var(--color-foreground, 18 18 18), 0.08);
}

.tks-related-products .related-products__heading {
    margin: 0 0 1.5rem;
    text-align: center;
}

.tks-product-section .product-form__input--dropdown .select {
    position: relative;
    width: 100%;
    max-width: 28rem;
}

.tks-product-section .product-form__input--dropdown .select__select {
    width: 100%;
}

/* Homepage Featured Collections slider fallback */
body.store-theme-active slider-component .collection-list {
    scroll-behavior: smooth;
}

@media screen and (max-width: 989px) {
    body.store-theme-active slider-component .collection-list.contains-card {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 1rem;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    body.store-theme-active slider-component .collection-list__item {
        flex: 0 0 min(72vw, 280px);
        scroll-snap-align: start;
    }
}

/* Registry shopping banner (site-wide) */
.tks-registry-shopping-banner {
    background: rgba(var(--color-foreground, 18 18 18), 0.06);
    border-bottom: 1px solid rgba(var(--color-foreground, 18 18 18), 0.1);
    padding: 0.65rem 0;
    font-size: 0.92rem;
}

.tks-registry-shopping-banner__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
}

.tks-registry-shopping-banner .tks-registry-exit {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.tks-registry-active-banner,
.tks-registry-find-result,
.tks-registry-match {
    margin: 1rem 0 1.5rem;
    padding: 1rem 1.25rem;
    background: rgba(var(--color-foreground, 18 18 18), 0.04);
    border-radius: 4px;
}

.tks-registry-demo-hint {
    margin-top: 0.75rem;
    opacity: 0.75;
}

/* Homepage — index template polish */
body.store-theme-active.index footer {
    margin-top: 0;
}

body.store-theme-active.index .collection-list-title.h0,
body.store-theme-active.index .collection-list-title.h2 {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

body.store-theme-active.index .section-collection-list .collection-list.grid {
    row-gap: 1.5rem;
}

body.store-theme-active.index .section-collection-list .card__heading {
    text-align: center;
}

/* Homepage quick-links icon bar (teal strip above footer) */
body.store-theme-active .home-icon-bar.registry-icon-bar {
    background: #5b7378;
    margin-top: 0;
    padding: 1em 0;
}

body.store-theme-active .home-icon-bar.registry-icon-bar .container ul {
    display: flex;
    justify-content: space-evenly;
    flex-wrap: wrap;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
}

body.store-theme-active .home-icon-bar.registry-icon-bar a.icon-bar__block {
    color: #fff;
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 2px;
    transition: background 0.2s ease, color 0.2s ease;
}

body.store-theme-active .home-icon-bar.registry-icon-bar a.icon-bar__block:hover,
body.store-theme-active .home-icon-bar.registry-icon-bar a.icon-bar__block:focus {
    color: #fef5e5;
    background: #4d6166;
}

body.store-theme-active.index .home-icon-bar.registry-icon-bar .kicon {
    height: 1.8em;
    width: 1.8em;
    margin-right: 0.3em;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.store-theme-active.index .home-icon-bar.registry-icon-bar .kicon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

body.store-theme-active.index .home-icon-bar.registry-icon-bar a.icon-bar__block p {
    font-size: 1.15em;
    margin: 0;
}

body.store-theme-active.index .home-icon-bar.registry-icon-bar .page-width {
    padding: 0 0.2em;
}

/* Registry promo banner on homepage */
body.store-theme-active.index .banner--small .banner__heading {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

/* Loading placeholder */
.tks-page-loading {
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(var(--color-foreground, 18 18 18), 0.45);
    font-size: 0.95rem;
    letter-spacing: 0.04em;
}

/* Utility bar — keep announcement readable on narrow screens */
body.store-theme-active .utility-bar__grid {
    gap: 0.5rem;
}

body.store-theme-active .utility-bar .list-social {
    flex-wrap: nowrap;
}

@media screen and (max-width: 749px) {
    body.store-theme-active .utility-bar__grid--3-col {
        grid-template-columns: auto 1fr;
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    body.store-theme-active .utility-bar__grid .announcement-bar {
        grid-column: 1 / -1;
        text-align: center;
        font-size: 0.85rem;
    }
}

/* Homepage featured collections — mobile horizontal scroll */
@media screen and (max-width: 989px) {
    body.store-theme-active.index .section-collection-list slider-component .collection-list.contains-card {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 1rem;
        padding-bottom: 0.75rem;
        -webkit-overflow-scrolling: touch;
    }

    body.store-theme-active.index .section-collection-list slider-component .collection-list__item {
        flex: 0 0 min(72vw, 280px);
        scroll-snap-align: start;
    }
}

@media screen and (max-width: 749px) {
    body.store-theme-active .banner__content .banner__box {
        padding: 1rem 1.25rem;
    }

    body.store-theme-active .banner__buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    body.store-theme-active .banner__buttons .button {
        width: 100%;
        text-align: center;
    }

    body.store-theme-active .home-icon-bar.registry-icon-bar .container ul {
        justify-content: center;
    }

    body.store-theme-active.index .home-icon-bar.registry-icon-bar a.icon-bar__block p {
        font-size: 0.95em;
    }
}
