/* ============================================================
   KIDSORY RESPONSIVE + CHECKOUT V4
   Mobile-first production polish. Loaded after premium styles.
   ============================================================ */

html,
body {
    max-width: 100%;
    overflow-x: clip;
}

img {
    max-width: 100%;
    height: auto;
}

/* ------------------------------------------------------------
   HEADER / MOBILE NAVIGATION
   ------------------------------------------------------------ */

.ks-menu-toggle {
    cursor: pointer;
}

.ks-submenu-toggle {
    display: none;
}

@media (max-width: 1050px) {
    .ks-header-main {
        position: relative;
        grid-template-columns: auto auto 1fr;
    }

    .ks-nav {
        top: calc(100% + 8px) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100%;
        max-height: calc(100dvh - 130px);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 10px !important;
        border: 1px solid rgba(23, 56, 47, .10) !important;
        border-radius: 24px !important;
        background: rgba(255, 255, 255, .99) !important;
        box-shadow: 0 24px 60px rgba(23, 56, 47, .18) !important;
        -webkit-overflow-scrolling: touch;
    }

    .ks-nav.is-open {
        display: block;
    }

    .ks-menu {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0 !important;
    }

    .ks-menu > li {
        position: relative;
        width: 100%;
        border-bottom: 1px solid rgba(23, 56, 47, .07);
    }

    .ks-menu > li:last-child {
        border-bottom: 0;
    }

    .ks-menu > li > a {
        display: flex;
        align-items: center;
        min-height: 50px;
        padding: 11px 50px 11px 14px;
        border-radius: 14px;
        color: #17382f;
        font-size: 15px;
        font-weight: 850;
        line-height: 1.25;
    }

    .ks-menu > li > a:hover,
    .ks-menu > li.current-menu-item > a,
    .ks-menu > li.current-menu-ancestor > a {
        background: #fff7ef;
        color: #17382f;
    }

    .ks-submenu-toggle {
        position: absolute;
        z-index: 3;
        top: 7px;
        right: 5px;
        display: inline-grid;
        place-items: center;
        width: 38px;
        height: 38px;
        padding: 0;
        border: 0;
        border-radius: 12px;
        background: #f6f1e8;
        color: #17382f;
        font-size: 0;
        cursor: pointer;
    }

    .ks-submenu-toggle::before,
    .ks-submenu-toggle::after {
        content: "";
        position: absolute;
        width: 12px;
        height: 2px;
        border-radius: 99px;
        background: currentColor;
        transition: transform .2s ease;
    }

    .ks-submenu-toggle::after {
        transform: rotate(90deg);
    }

    .menu-item-has-children.is-submenu-open > .ks-submenu-toggle::after {
        transform: rotate(0deg);
    }

    .ks-menu .sub-menu,
    .ks-menu li:hover > .sub-menu,
    .ks-menu li:focus-within > .sub-menu {
        position: static !important;
        display: none !important;
        min-width: 0 !important;
        margin: 0 8px 10px !important;
        padding: 7px !important;
        border: 0 !important;
        border-radius: 14px !important;
        background: #f8f4ec !important;
        box-shadow: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    .ks-menu li.is-submenu-open > .sub-menu {
        display: block !important;
    }

    .ks-menu .sub-menu li {
        position: relative;
    }

    .ks-menu .sub-menu a {
        display: block;
        padding: 10px 42px 10px 12px !important;
        border-radius: 10px;
        color: #29463d;
        font-size: 13px !important;
        font-weight: 750 !important;
        white-space: normal !important;
    }

    .ks-menu .sub-menu a:hover {
        background: #fff;
    }

    body.ks-menu-open {
        overflow: hidden;
    }

    body.ks-menu-open::after {
        content: "";
        position: fixed;
        z-index: 90;
        inset: 0;
        background: rgba(15, 43, 35, .34);
        backdrop-filter: blur(2px);
    }

    body.ks-menu-open .ks-header {
        z-index: 110;
    }
}

@media (max-width: 600px) {
    .ks-container {
        width: min(calc(100% - 28px), var(--ks-container));
    }

    .ks-announcement-inner {
        min-height: 42px;
        padding: 7px 0;
        font-size: 11px !important;
        line-height: 1.3;
    }

    .ks-header-main {
        min-height: 74px !important;
        gap: 10px !important;
    }

    .ks-brand .custom-logo {
        width: auto !important;
        height: auto !important;
        max-width: 132px !important;
        max-height: 44px !important;
    }

    .ks-menu-toggle {
        width: 48px;
        height: 48px;
        padding: 11px;
        border-radius: 16px;
    }

    .ks-cart-link {
        min-height: 44px;
        gap: 8px;
        font-size: 14px;
        font-weight: 850;
        white-space: nowrap;
    }

    .ks-cart-count {
        min-width: 30px;
        height: 30px;
        padding: 0 8px;
        font-size: 13px;
    }

    .ks-nav {
        max-height: calc(100dvh - 132px);
    }
}

/* ------------------------------------------------------------
   HOMEPAGE HERO
   ------------------------------------------------------------ */

@media (max-width: 800px) {
    .ks-fun-hero-grid {
        min-height: 0 !important;
    }
}

@media (max-width: 600px) {
    .ks-fun-hero {
        padding: 34px 0 46px !important;
    }

    .ks-fun-copy {
        max-width: 100%;
    }

    .ks-fun-kicker {
        gap: 7px;
        margin-bottom: 14px;
        font-size: 10px;
        letter-spacing: .14em;
    }

    .ks-fun-kicker span {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .ks-fun-copy h1 {
        max-width: 420px;
        margin-inline: auto;
        font-size: clamp(38px, 11.3vw, 46px) !important;
        line-height: .98;
        letter-spacing: -.045em;
        text-wrap: balance;
    }

    .ks-fun-copy h1 span {
        margin-top: 3px;
    }

    .ks-fun-lead {
        max-width: 360px;
        margin-top: 18px;
        font-size: 15px !important;
        line-height: 1.5;
        text-wrap: balance;
    }

    .ks-fun-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        width: 100%;
        margin-top: 23px;
    }

    .ks-fun-btn {
        width: 100%;
        min-height: 50px;
        padding: 0 12px;
        font-size: 13px;
    }

    .ks-fun-benefits {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
        margin-top: 18px;
    }

    .ks-fun-benefits > span {
        min-width: 0;
        min-height: 52px;
        padding: 7px 5px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 1px;
        text-align: center;
        font-size: 10px;
        line-height: 1.2;
    }

    .ks-fun-visual {
        min-height: 365px !important;
        margin-top: 30px !important;
    }

    .ks-fun-visual::before {
        width: 290px !important;
        height: 290px !important;
    }

    .ks-fun-product {
        width: min(232px, 72vw) !important;
        padding: 13px !important;
        border-radius: 25px !important;
    }

    .ks-fun-product-image {
        height: 198px !important;
        border-radius: 18px !important;
    }

    .ks-fun-product-details {
        padding: 13px 2px 2px !important;
    }

    .ks-fun-product-details small {
        margin-bottom: 4px;
        font-size: 9px;
    }

    .ks-fun-product-details strong {
        font-size: 14px;
    }

    .ks-fun-product-details > span {
        margin-top: 4px;
        font-size: 14px;
    }

    .ks-fun-sticker-new {
        top: 4% !important;
        right: 9% !important;
        width: 62px !important;
        height: 62px !important;
    }

    .ks-fun-sticker-star {
        left: 4% !important;
        bottom: 18% !important;
        width: 49px !important;
        height: 49px !important;
        font-size: 21px !important;
    }

    .ks-fun-age-card {
        display: none !important;
    }

    .ks-orbit-one {
        width: 75px !important;
        height: 75px !important;
    }

    .ks-orbit-two {
        width: 55px !important;
        height: 55px !important;
    }
}

@media (max-width: 360px) {
    .ks-fun-actions {
        grid-template-columns: 1fr;
    }

    .ks-fun-benefits {
        grid-template-columns: 1fr 1fr;
    }

    .ks-fun-benefits > span:last-child {
        grid-column: 1 / -1;
    }

    .ks-fun-copy h1 {
        font-size: 36px !important;
    }
}

/* ------------------------------------------------------------
   HOMEPAGE TRUST / AGE / CATEGORY / FEATURED
   ------------------------------------------------------------ */

@media (max-width: 600px) {
    .ks-premium-trust {
        margin-top: -18px !important;
    }

    .ks-premium-trust-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        border-radius: 20px !important;
    }

    .ks-premium-trust-grid > .ks-trust-card {
        min-height: 92px !important;
        padding: 14px 10px !important;
        gap: 8px !important;
    }

    .ks-premium-trust-grid > .ks-trust-card .ks-trust-icon {
        width: 40px !important;
        height: 40px !important;
        flex-basis: 40px !important;
        font-size: 9px !important;
    }

    .ks-premium-trust-grid > .ks-trust-card strong {
        font-size: 12px !important;
    }

    .ks-premium-trust-grid > .ks-trust-card p > span {
        font-size: 9.5px !important;
    }

    .ks-premium-heading {
        gap: 12px;
        margin-bottom: 24px !important;
    }

    .ks-premium-heading h2 {
        font-size: clamp(32px, 9vw, 42px) !important;
        line-height: 1.02;
    }

    .ks-heading-link {
        white-space: nowrap;
    }

    .ks-age-grid-v2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .ks-age-card-v2,
    .ks-age-card-v2:last-child {
        min-height: 188px !important;
        padding: 13px !important;
        border-radius: 23px !important;
        grid-column: auto;
    }

    .ks-age-card-v2:last-child {
        grid-column: 1 / -1;
        min-height: 160px !important;
    }

    .ks-age-card-v2 .ks-age-circle {
        width: 54px !important;
        height: 54px !important;
        flex-basis: 54px !important;
    }

    .ks-age-card-v2 .ks-age-circle strong {
        font-size: 17px !important;
    }

    .ks-age-icon-v2 {
        width: 50px !important;
        height: 50px !important;
        flex-basis: 50px !important;
        border-radius: 17px !important;
        font-size: 25px !important;
    }

    .ks-age-copy-v2 {
        padding-top: 14px !important;
    }

    .ks-age-card-v2 .ks-age-copy-v2 h3 {
        font-size: 16px !important;
    }

    .ks-age-copy-v2 p {
        font-size: 10.5px !important;
    }

    .ks-age-shop-v2 {
        margin-top: 10px !important;
        font-size: 10px !important;
    }

    .ks-category-grid-v2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .ks-category-card-v2 {
        min-height: 190px !important;
        padding: 16px !important;
        border-radius: 23px !important;
    }

    .ks-category-content-v2 {
        width: 100% !important;
        padding-top: 52px;
    }

    .ks-category-mini-label {
        position: absolute;
        top: 0;
        left: 0;
        min-width: 40px;
        height: 25px;
        margin: 0;
        padding: 0 8px;
        font-size: 8px;
    }

    .ks-category-card-v2 h3 {
        max-width: 100%;
        font-size: 17px !important;
        line-height: 1.08;
    }

    .ks-category-card-v2 p {
        display: none;
    }

    .ks-category-shop-link {
        padding-top: 10px !important;
        font-size: 10px !important;
    }

    .ks-category-visual-v2 {
        top: 10px;
        right: 10px;
        bottom: auto;
        width: 58px;
        height: 58px;
    }

    .ks-category-icon-v2 {
        width: 54px !important;
        height: 54px !important;
        border-radius: 17px !important;
        font-size: 28px !important;
    }

    .ks-category-dot {
        display: none;
    }

    .ks-featured-card {
        padding: 14px !important;
        border-radius: 28px !important;
    }

    .ks-featured-copy {
        padding: 20px 8px 10px !important;
    }

    .ks-featured-copy h3 {
        font-size: 31px !important;
        line-height: 1.03;
    }

    .ks-featured-pills {
        gap: 6px !important;
    }

    .ks-featured-pills span {
        font-size: 9.5px !important;
    }

    .ks-featured-actions {
        display: grid !important;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .ks-featured-actions .ks-premium-btn {
        width: 100%;
    }

    .ks-featured-visual {
        min-height: 320px !important;
    }

    .ks-featured-product-image {
        width: 78% !important;
    }

    .ks-featured-product-image img {
        height: 205px !important;
    }

    .ks-featured-float-card {
        right: 6px !important;
        top: 7px !important;
        max-width: 125px !important;
        font-size: 10px;
    }

    .ks-story-card-v3 {
        padding: 30px 18px !important;
    }

    .ks-story-card-v3 .ks-story-copy h2 {
        font-size: 36px !important;
    }

    .ks-story-values-v3 .ks-story-value-card {
        grid-template-columns: 32px minmax(0, 1fr) 38px !important;
        gap: 9px !important;
        padding: 13px !important;
    }

    .ks-story-values-v3 p {
        font-size: 10.5px !important;
    }

    .ks-why-card-v3 {
        min-height: 175px !important;
        padding: 21px !important;
    }
}

@media (max-width: 350px) {
    .ks-age-grid-v2,
    .ks-category-grid-v2 {
        grid-template-columns: 1fr !important;
    }

    .ks-age-card-v2:last-child {
        grid-column: auto;
    }
}

/* ------------------------------------------------------------
   SHOP / PRODUCT GRID
   ------------------------------------------------------------ */

@media (max-width: 600px) {
    .ks-shop-hero-grid {
        padding-top: 34px !important;
        padding-bottom: 32px !important;
    }

    .ks-shop-hero-copy h1 {
        font-size: clamp(40px, 11vw, 54px) !important;
    }

    .ks-shop-products-inner .woocommerce ul.products,
    .woocommerce-page ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .ks-shop-products-inner .woocommerce ul.products li.product {
        min-width: 0;
        padding: 9px 9px 11px !important;
    }

    .ks-shop-products-inner .woocommerce ul.products li.product img {
        margin-bottom: 11px !important;
        padding: 7px !important;
    }

    .ks-shop-products-inner .woocommerce ul.products li.product .woocommerce-loop-product__title {
        font-size: 13px !important;
        line-height: 1.25;
    }

    .ks-shop-products-inner .woocommerce ul.products li.product .price {
        margin: 6px 0 10px !important;
        font-size: 14px !important;
    }

    .ks-shop-products-inner .woocommerce ul.products li.product .button {
        min-height: 40px !important;
        padding: 8px !important;
        font-size: 11px !important;
        text-align: center;
    }
}

@media (max-width: 340px) {
    .ks-shop-products-inner .woocommerce ul.products,
    .woocommerce-page ul.products {
        grid-template-columns: 1fr !important;
    }
}

/* ------------------------------------------------------------
   SINGLE PRODUCT MOBILE
   ------------------------------------------------------------ */

@media (max-width: 850px) {
    .single-product div.product {
        padding: 30px 16px 50px !important;
    }

    .single-product div.product div.summary {
        margin-top: 22px !important;
    }
}

@media (max-width: 600px) {
    .single-product .woocommerce-product-gallery__wrapper {
        border-radius: 22px !important;
    }

    .single-product .woocommerce-product-gallery__image img {
        max-height: none !important;
        padding: 10px !important;
    }

    .single-product .flex-control-thumbs {
        gap: 7px !important;
    }

    .single-product .flex-control-thumbs img {
        border-radius: 10px !important;
    }

    .ks-product-eyebrow {
        margin-bottom: 12px !important;
    }

    .single-product .product_title {
        margin-bottom: 12px !important;
        font-size: clamp(30px, 9vw, 38px) !important;
        line-height: 1.03 !important;
    }

    .single-product div.product p.price,
    .single-product div.product span.price {
        font-size: 23px !important;
    }

    .single-product div.product .woocommerce-product-details__short-description {
        margin-top: 15px !important;
        font-size: 14px !important;
        line-height: 1.6 !important;
    }

    .single-product form.cart {
        margin-top: 20px !important;
        padding: 15px !important;
        border-radius: 18px !important;
    }

    .single-product table.variations,
    .single-product table.variations tbody,
    .single-product table.variations tr,
    .single-product table.variations th,
    .single-product table.variations td {
        display: block;
        width: 100%;
    }

    .single-product table.variations th {
        padding-bottom: 3px !important;
    }

    .single-product table.variations td {
        padding-top: 3px !important;
    }

    .single-product table.variations select {
        width: 100%;
    }

    .single-product .reset_variations {
        display: inline-block;
        margin: 8px 0 0 !important;
    }

    .ks-color-swatches {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px !important;
    }

    .ks-color-swatch {
        width: 100%;
        min-width: 0;
        padding: 7px !important;
        justify-content: flex-start !important;
        font-size: 11px !important;
    }

    .ks-color-dot {
        width: 25px !important;
        height: 25px !important;
        flex: 0 0 25px;
    }

    .single-product .quantity .qty {
        width: 66px !important;
        min-height: 50px !important;
    }

    .single-product div.product form.cart .button {
        min-height: 50px !important;
        padding-inline: 20px !important;
        font-size: 13px !important;
    }

    .ks-product-trust {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 7px !important;
    }

    .ks-product-trust > div {
        padding: 11px !important;
    }

    .ks-product-trust strong {
        font-size: 10.5px !important;
    }

    .ks-product-trust span {
        font-size: 9px !important;
        line-height: 1.35;
    }

    .single-product .woocommerce-tabs {
        margin-top: 10px !important;
        padding-top: 28px !important;
    }

    .single-product .woocommerce-tabs ul.tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 5px !important;
        -webkit-overflow-scrolling: touch;
    }

    .single-product .woocommerce-tabs ul.tabs li {
        flex: 0 0 auto;
    }

    .single-product .related.products {
        margin-top: 45px !important;
    }

    .single-product .related.products > h2 {
        margin-bottom: 20px !important;
        font-size: 30px !important;
    }
}

/* ------------------------------------------------------------
   CART + CHECKOUT (WooCommerce Blocks)
   ------------------------------------------------------------ */

.woocommerce-cart main,
.woocommerce-checkout main {
    background: #fffaf2;
}

.woocommerce-cart .wp-block-woocommerce-cart,
.woocommerce-checkout .wp-block-woocommerce-checkout {
    width: min(calc(100% - 36px), 1180px);
    max-width: 1180px;
    margin-inline: auto;
    padding-top: 46px;
    padding-bottom: 70px;
}

.woocommerce-cart .wc-block-components-sidebar-layout,
.woocommerce-checkout .wc-block-components-sidebar-layout {
    gap: 28px;
}

.woocommerce-cart .wc-block-components-main,
.woocommerce-checkout .wc-block-components-main,
.woocommerce-cart .wc-block-components-sidebar,
.woocommerce-checkout .wc-block-components-sidebar,
.woocommerce-cart .wc-block-components-order-summary,
.woocommerce-checkout .wc-block-components-order-summary,
.woocommerce-checkout .wc-block-checkout__order-notes {
    border-radius: 22px;
}

.woocommerce-cart .wc-block-components-sidebar,
.woocommerce-checkout .wc-block-components-sidebar {
    padding: 22px !important;
    border: 1px solid rgba(23, 56, 47, .09);
    background: #fff;
    box-shadow: 0 12px 34px rgba(23, 56, 47, .06);
}

.woocommerce-cart .wc-block-cart-items,
.woocommerce-checkout .wc-block-components-checkout-step,
.woocommerce-checkout .wc-block-checkout__terms,
.woocommerce-checkout .wc-block-checkout__actions {
    border-radius: 18px;
}

.woocommerce-checkout .wc-block-components-checkout-step {
    margin-bottom: 14px;
    padding: 20px !important;
    border: 1px solid rgba(23, 56, 47, .08);
    background: #fff;
}

.woocommerce-cart .wc-block-components-button,
.woocommerce-checkout .wc-block-components-button,
.woocommerce-cart .wp-element-button,
.woocommerce-checkout .wp-element-button {
    min-height: 50px;
    border-radius: 999px !important;
    background: #17382f !important;
    color: #fff !important;
    font-weight: 850 !important;
}

.woocommerce-cart .wc-block-components-button:hover,
.woocommerce-checkout .wc-block-components-button:hover {
    background: #f53650 !important;
}

.woocommerce-cart .wc-block-components-text-input input,
.woocommerce-checkout .wc-block-components-text-input input,
.woocommerce-checkout .wc-block-components-combobox .wc-block-components-combobox-control input,
.woocommerce-checkout .kidsory-checkout-city-field select,
.woocommerce-checkout .kidsory-checkout-city-field input {
    min-height: 50px;
    border-radius: 12px !important;
}

.woocommerce-cart .wc-block-cart-item__image img,
.woocommerce-checkout .wc-block-components-order-summary-item__image img {
    border-radius: 14px;
    background: #f7f8f6;
}

@media (max-width: 782px) {
    .woocommerce-cart .wp-block-woocommerce-cart,
    .woocommerce-checkout .wp-block-woocommerce-checkout {
        width: min(calc(100% - 28px), 1180px);
        padding-top: 28px;
        padding-bottom: 52px;
    }

    .woocommerce-cart .wc-block-components-sidebar-layout,
    .woocommerce-checkout .wc-block-components-sidebar-layout {
        display: block !important;
    }

    .woocommerce-cart .wc-block-components-main,
    .woocommerce-checkout .wc-block-components-main,
    .woocommerce-cart .wc-block-components-sidebar,
    .woocommerce-checkout .wc-block-components-sidebar {
        width: 100% !important;
        max-width: none !important;
    }

    .woocommerce-cart .wc-block-components-sidebar,
    .woocommerce-checkout .wc-block-components-sidebar {
        margin-top: 18px !important;
        padding: 16px !important;
    }

    .woocommerce-checkout .wc-block-components-checkout-step {
        padding: 16px !important;
    }

    .woocommerce-cart .wc-block-cart-items__row {
        grid-template-columns: 72px minmax(0, 1fr) !important;
        column-gap: 12px !important;
    }

    .woocommerce-cart .wc-block-cart-item__image {
        width: 72px !important;
    }

    .woocommerce-cart .wc-block-cart-item__total {
        font-size: 13px;
    }

    .woocommerce-checkout .wc-block-checkout__actions .wc-block-components-checkout-place-order-button,
    .woocommerce-cart .wc-block-cart__submit-button {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .woocommerce-cart .wc-block-cart-items__row {
        grid-template-columns: 62px minmax(0, 1fr) !important;
    }

    .woocommerce-cart .wc-block-cart-item__image {
        width: 62px !important;
    }

    .woocommerce-cart .wc-block-cart-item__product .wc-block-components-product-name,
    .woocommerce-checkout .wc-block-components-order-summary-item__description .wc-block-components-product-name {
        font-size: 13px !important;
        line-height: 1.25;
    }
}

/* ------------------------------------------------------------
   FOOTER MOBILE
   ------------------------------------------------------------ */

@media (max-width: 600px) {
    .ks-footer {
        padding: 46px 0 22px !important;
    }

    .ks-footer-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 28px 18px !important;
    }

    .ks-footer-grid > div:first-child {
        grid-column: 1 / -1;
    }

    .ks-footer-bottom {
        margin-top: 34px !important;
    }
}
