/* ============================================================
   Routine Builder — frontend carousel CSS.
   Migrated from the standalone "Routine Product" plugin
   (v2.1.3 — Danish). Class names preserved verbatim so any
   external CSS overrides (Customizer, Divi modules) keep
   matching after the plugin absorption.

   v1.5.12: Mobile-first overhaul.
     - Slider is now a CSS scroll-snap container (native swipe
       + momentum on touch devices). The JS transform-based
       slider is gone.
     - Arrows: hidden on mobile (swipe replaces them); on
       desktop they sit below the carousel as 44x44 circles.
     - Mobile gains a dot indicator below the slider — one
       dot per step, current = burgundy + scaled.
     - Tabs gain a sun / moon SVG icon and a 44pt min touch
       target.
     - Step card typography tightened to Geologica + brand
       colors; product image gets a soft radius.
   ============================================================ */

/* ============================================================
   HEADING + SUBTITLE — rendered by the shortcode (v1.5.13+).
   Replaces the legacy Divi Theme Builder heading + text
   modules so the strings are editable from the plugin admin.
   The Divi modules are auto-hidden via inline <style> emitted
   by the shortcode when these are non-empty.
   ============================================================ */
.step-routine-heading {
    text-align: center;
    margin: 0 auto 24px auto;
    padding: 0 16px;
    max-width: 760px;
}

.step-routine-title {
    font-family: 'Geologica', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: #1f1f1f;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 8px 0;
}

.step-routine-subtitle {
    font-family: 'Geologica', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #6b6359;
    line-height: 1.55;
    margin: 0 auto;
    max-width: 640px;
}

@media (max-width: 1024px) and (min-width: 601px) {
    .step-routine-title    { font-size: 28px; }
    .step-routine-subtitle { font-size: 14.5px; }
}

@media (max-width: 600px) {
    .step-routine-heading  { margin-bottom: 20px; padding: 0 12px; }
    .step-routine-title    { font-size: 22px; line-height: 1.25; }
    .step-routine-subtitle { font-size: 13.5px; line-height: 1.5; }
}

/* ============================================================
   WRAPPER — note: overflow is NOT hidden here anymore.
   The slider itself owns the scroll, and dots / arrows sit
   below it as siblings.
   ============================================================ */
.step-routine-wrapper {
    width: 100%;
    position: relative;
}

/* ============================================================
   SLIDER TRACK — CSS scroll-snap container.
   The native scrollbar is hidden visually but scrolling
   still works (touch swipe, trackpad, keyboard arrows when
   focused).
   ============================================================ */
.step-routine-slider {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE/Edge legacy */
    padding-bottom: 4px;
    align-items: stretch;
}
.step-routine-slider::-webkit-scrollbar {
    display: none;                /* WebKit */
}

/* ============================================================
   STEP CARD — 4 visible at once on desktop
   total_gap = 3 × 20px = 60px  →  per-item deduction = 15px
   item_width = 25% of wrapper − 15px
   ============================================================ */
.step-item {
    flex: 0 0 calc(25% - 15px);
    max-width: calc(25% - 15px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    scroll-snap-align: start;
}

/* Step badge — burgundy pill above each product. */
.step-item h3 {
    background-color: #851625;
    color: #fff !important;
    font-family: 'Geologica', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 4px 14px;
    border-radius: 30px;
    margin: 0 0 8px 0;
    display: inline-block;
    white-space: nowrap;
    line-height: 1.4;
}

/* Short description shown beneath the badge. */
.step-description {
    margin: 0 0 12px 0;
    color: #555 !important;
    font-family: 'Geologica', sans-serif;
    font-size: 13px;
    line-height: 1.55;
    text-align: center;
}

/* ============================================================
   WOOCOMMERCE PRODUCT CONTAINER
   WC's ul.products uses floats/percentages that break inside
   our flex column. Force everything to stack full-width.
   ============================================================ */
.woo-product {
    width: 100%;
}

.woo-product ul.products {
    display: block !important;
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    columns: 1 !important;
    column-count: 1 !important;
    -webkit-columns: 1 !important;
}

.woo-product ul.products li.product,
.woo-product ul.products li.type-product {
    float: none !important;
    clear: both !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 12px 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.woo-product .wc-block-grid__products {
    grid-template-columns: 1fr !important;
    column-gap: 0 !important;
}

.woo-product .wc-block-grid__product {
    width: 100% !important;
}

/* Soften the product image corners — brand cohesion. */
.woo-product ul.products li.product img,
.woo-product ul.products li.product .et_shop_image img {
    border-radius: 10px;
}

/* Product title — brand font, 2-line clamp so cards align. */
.woo-product ul.products li.product .woocommerce-loop-product__title {
    font-family: 'Geologica', sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    color: #1f1f1f !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 10px 0 4px 0 !important;
    min-height: 2.7em;
    text-align: center;
}

/* Star rating — center under title.
   Routine-scoped: the .woo-product wrapper only exists inside
   .step-routine-wrapper, so this leaves all other star ratings on
   the site untouched.

   Centering strategy:
   - WC renders the stars via two absolute-positioned layers: a
     ::before pseudo with the 5 empty stars, and an inner <span>
     with the filled overlay at width:100%. Because both layers are
     out of normal flow, `width: fit-content` measured 0 in-flow
     content and collapsed the container to nothing (v1.5.32 bug
     where the stars disappeared).
   - Instead: keep the .star-rating as inline-block at its natural
     WC width (~5.4em), and center it via `text-align: center` on
     the parent <a>. That sidesteps the width-vs-out-of-flow trap
     entirely. */
.woo-product ul.products li.product .woocommerce-LoopProduct-link {
    text-align: center !important;
}

.woo-product .star-rating,
.woo-product .star-rating.wlpp-sr {
    display: inline-block !important;
    margin: 4px 0 !important;
    float: none !important;
}

/* Price — brand burgundy, brand font. */
.woo-product ul.products li.product .price {
    font-family: 'Geologica', sans-serif !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    color: #851625 !important;
    margin: 4px 0 !important;
    display: block !important;
    text-align: center;
}
/* Two-line price: struck original on line 1, promo on line 2 — matches
   the shared "unified price block" in product-pages.css. !important on
   display beats core woocommerce.css's .price del/ins { inline-block }. */
.woo-product ul.products li.product .price del {
    display: block !important;
    margin: 0 0 1px;
    font-size: 0.82em;
    font-weight: 400;
    color: #b8a99a !important;
    opacity: 1 !important;
    text-decoration: line-through !important;
}
.woo-product ul.products li.product .price ins {
    display: block !important;
    background: transparent !important;
    text-decoration: none;
    font-weight: 700;
    color: #851625 !important;
}
/* Keep a "RM x – RM y" range together on its line. */
.woo-product ul.products li.product .price .woocommerce-Price-amount,
.woo-product ul.products li.product .price span[aria-hidden="true"] {
    display: inline !important;
}
/* Reserve the "was" line for non-sale steps so slides stay aligned. */
.woo-product ul.products li.product .price:not(:has(del)) {
    padding-top: 1.07em;
}

/* Hover lift — desktop only, subtle. */
@media (min-width: 1025px) {
    .step-item .woo-product {
        transition: transform 0.2s ease;
    }
    .step-item:hover .woo-product {
        transform: translateY(-2px);
    }
}

/* ============================================================
   NAVIGATION ARROWS — 44x44 circles below the carousel on
   desktop / tablet. Hidden on mobile (swipe replaces them).
   ============================================================ */
.step-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.step-arrow {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    color: #1f1f1f;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, transform 0.15s, background-color 0.2s;
    padding: 0;
}

.step-arrow:hover:not(:disabled) {
    background: #f8f5f1;
    transform: scale(1.04);
}

.step-arrow:disabled {
    opacity: 0.3;
    cursor: default;
    box-shadow: none;
}

/* ============================================================
   DOT INDICATOR — mobile-only progress affordance.
   ============================================================ */
.step-dots {
    display: none;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 0;
    list-style: none;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d6d2cd;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s, transform 0.2s;
}

.step-dot.active {
    background: #851625;
    transform: scale(1.3);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet — 2 items: gap = 1 × 20px → per-item deduction = 10px */
@media (max-width: 1024px) and (min-width: 601px) {
    .step-item {
        flex: 0 0 calc(50% - 10px);
        max-width: calc(50% - 10px);
    }
}

/* Mobile — 1 item with slight peek to signal swipe affordance. */
@media (max-width: 600px) {
    .step-routine-slider {
        gap: 14px;
        scroll-padding-left: 0;
    }
    .step-item {
        flex: 0 0 82%;
        max-width: 82%;
    }
    .step-item h3 {
        font-size: 12.5px;
        padding: 4px 12px;
    }
    .step-description {
        font-size: 13.5px;
    }

    /* Arrows out, dots in. */
    .step-nav { display: none; }
    .step-dots { display: flex; }
}

/* ============================================================
   TABS — Morning / Night switcher above the carousel.
   ============================================================ */
.tabs-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.steps-routine-tabs {
    margin-bottom: 20px;
}

.steps-routine-tab-buttons {
    display: flex;
    gap: 0;
    flex-wrap: nowrap;
    margin-bottom: 20px;
    background: #f0ede8;
    border-radius: 999px;
    padding: 4px;
    width: fit-content;
}

.steps-routine-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 22px;
    min-height: 44px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: #8A7F78;
    cursor: pointer;
    font-family: 'Geologica', sans-serif;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.2s ease;
    line-height: 1.2;
}

.steps-routine-tab-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.steps-routine-tab-btn.active {
    background: #fff;
    color: #851625;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.steps-routine-tab-btn:not(.active):hover {
    color: #E8A9B8;
    background: transparent;
}

/* Hides the inactive routine wrapper while keeping its DOM
   available for re-show when the tab is switched back. */
.hidden-routine {
    display: none !important;
}
