/* Single product page - "Buy Now above the fold" layout (Erin's 12/2026
   mock-up, desktop). Loaded on product pages only (inc/woo-functions.php).

   - The "← Back" row becomes a small ← in the left margin, so the photos and
     title start straight under the header.
   - The right-hand column is a touch smaller and tighter, as in the mock-up.
   - One Time and Subscribe & Save sit side by side, with the "Auto renews"
     box at the far right.
   - On shorter screens the main photo shrinks a little so the "Nibble Simply
     / Award-winning" line under it stays on screen. */

/* ---- back link: small arrow in the left margin ----
   The box also has the .wrapper class (header.php), so it's exactly as wide
   as the product area at every screen size and the arrow sits just outside
   the thumbnails. It takes no height; z-index keeps it above the product
   area (.single-product .shop-wrapper has z-index 2). */

.single-product .nibble-back-button {
    height: 0;
    padding: 0;
    z-index: 2;
}

.single-product .nibble-back-button a {
    color: #102456;
    font-family: "bikoregular", sans-serif;
    font-size: 22px;
    left: -40px;
    line-height: 1;
    padding: 4px 6px;
    position: absolute;
    text-decoration: none;
    top: 8px;
}

.single-product .nibble-back-button a:hover,
.single-product .nibble-back-button a:focus-visible {
    color: #f8dc54;
    text-decoration: none;
}

/* Phones: no margin for it, and on its own line it pushed the photo (and Buy
   Now) down for little use - the browser's back button does the same. */
@media (max-width: 767px) {
    .single-product .nibble-back-button {
        display: none;
    }
}

/* ---- desktop: everything up to Buy Now on the first screen ---- */

@media (min-width: 1024px) {

    /* Main photo: square, never so tall that the "Nibble Simply / Award-
       winning" line underneath drops off a short screen. 290px = header +
       gaps + that two-line caption. */
    .single-product .nibble-gallery-main {
        max-width: max(380px, calc(100vh - 290px));
    }

    @supports (height: 100svh) {
        .single-product .nibble-gallery-main {
            max-width: max(380px, calc(100svh - 290px));
        }
    }

    .single-product .ct-thumbnail-cat {
        margin-top: 10px;
    }

    .single-product .summary h1.product_title {
        font-size: clamp(22px, 1.72vw, 28.8px);
        line-height: 1.02;
    }

    .single-product .summary .woocommerce-product-details__short-description {
        font-size: clamp(13.5px, 1.05vw, 16px);
        margin: 14px 0 14px;
    }

    .single-product .summary .woocommerce-product-details__short-description p {
        font-size: clamp(16px, 1.25vw, 20px);
        line-height: 1.16;
    }

    .single-product .summary .ct-variable-wrap {
        margin-bottom: 14px;
    }

    .single-product .summary .woocommerce-variation-price {
        margin-bottom: 12px;
    }

    .single-product .summary .wcsatt-options-wrapper {
        margin-bottom: 0;
    }

    .single-product .summary .wcsatt-options-product-prompt {
        margin: 0;
    }

    /* One Time | Subscribe & Save | Auto renews box, on one row. The box is
       allowed to sit a little past the column's right edge, into the page
       margin, as in the mock-up. */
    /* (Selectors match customize.css's own, which sets flex-wrap: wrap.) */
    .single-product .summary .wcsatt-options-wrapper-radio .wcsatt-options-product-prompt-radio ul.wcsatt-options-prompt-radios {
        align-items: flex-start;
        flex-wrap: nowrap;
        margin-right: -3vw;
    }

    .single-product .summary .wcsatt-options-wrapper-radio ul.wcsatt-options-prompt-radios > li.wcsatt-options-prompt-radio {
        flex: 0 0 auto;
        font-size: clamp(13px, 1vw, 16px);
        margin: 0 22px 0 0;
    }

    .single-product .summary .wcsatt-options-wrapper-radio ul.wcsatt-options-prompt-radios > li.wcsatt-options-prompt-radio:last-child {
        align-items: flex-start;
        flex: 1 1 auto;
        margin-right: 0;
    }

    .single-product .summary .wcsatt-options-prompt-label-one-time .wcsatt-options-prompt-action-wrapper br {
        display: none;
    }

    /* "Auto renews. / Cancel, pause, / skip ⓘ" - three short lines, as in
       the mock-up, pushed to the far right of the row. */
    .single-product .summary .wcsatt-options-prompt-action-info {
        font-size: 10.5px;
        line-height: 1.25;
        margin-left: auto;
        padding: 3px 6px;
        width: 70px;
    }

    .single-product .summary .wcsatt-options-wrapper-radio ul.wcsatt-options-prompt-radios > li.wcsatt-options-prompt-radio:last-child .wcsatt-options-prompt-label {
        margin-right: 12px;
        white-space: nowrap;
    }
}

/* 1024-1199px (iPad landscape, small laptops): the column is narrower, so
   tighten the option row a little more to keep the "Auto renews" box on
   screen. */
@media (min-width: 1024px) and (max-width: 1199px) {
    .single-product .summary .wcsatt-options-wrapper-radio ul.wcsatt-options-prompt-radios > li.wcsatt-options-prompt-radio {
        font-size: 12px;
        margin-right: 10px;
    }

    .single-product .summary .wcsatt-options-wrapper-radio ul.wcsatt-options-prompt-radios > li.wcsatt-options-prompt-radio:last-child .wcsatt-options-prompt-label {
        margin-right: 6px;
    }

    .single-product .summary .wcsatt-options-prompt-action-info {
        font-size: 10px;
        padding: 3px 4px;
        width: 62px;
    }
}

/* Short laptop screens (up to ~800px tall): trim the spacing a little more
   so Buy Now still clears the fold under the (unchanged) header. */
@media (min-width: 1024px) and (max-height: 820px) {
    .single-product .summary h1.product_title {
        line-height: 1;
    }

    .single-product .summary .woocommerce-product-details__short-description {
        margin: 10px 0;
    }

    .single-product .summary .woocommerce-product-details__short-description p {
        line-height: 1.12;
    }

    .single-product .summary .ct-variable-wrap {
        margin-bottom: 10px;
    }

    .single-product .summary .woocommerce-variation-price {
        margin-bottom: 8px;
    }
}

/* ==========================================================================
   iPad and iPhone fixes (Erin/Jo's review, 12/2026)
   ========================================================================== */

/* ---- "Nibble Simply / Award-winning, UPF-free chocolate" under the photos --
   customize.css indents it 18.333% (to line up with the main photo) but also
   makes it 100% wide, so it ran 18% past the photo into the text column on
   iPads. Width + indent now add up to 100%; long lines wrap under the photo. */
.single-product .ct-thumbnail-cat {
    flex-basis: 81.667%;
    width: 81.667%;
}

/* ---- Ingredients / Nutritionals tabs and the red circle, when stacked -----
   Up to 900px they stack (main.css). The tab text only took its own width
   and the circle sat against the left edge - customize.css zeroes its auto
   margins from 576px - leaving the right half empty on iPad portrait. */
@media (min-width: 576px) and (max-width: 900px) {
    .single-product .tab-wrapper-flex > .tab-content-area {
        align-self: stretch;
    }

    .single-product .tab-wrapper-flex > .product-bullets-container {
        align-self: center;
    }
}

/* ---- Phones: header ----
   A slimmer shipping bar and less space under it. Once the page is scrolled,
   the header slides up by the shipping bar's height so only the logo row
   stays (js/product-gallery.js measures that height into
   --nibble-header-collapse and adds .nibble-header-compact). It moves with
   `top`, not a transform: a transform would make the slide-out menu, which
   is fixed inside the header, position itself against the header instead of
   the screen. The header's own height never changes, so the page offset that
   main.min.js sets from it stays right. */
@media (max-width: 767px) {
    body.single-product .header-banner-top {
        font-size: 14px;
        line-height: 1.3;
        margin-bottom: 12px;
        padding: 6px 8px;
    }
}

body.single-product.nibble-header-compact header.main-site-header {
    top: calc(-1 * var(--nibble-header-collapse, 0px));
}

body.single-product header.main-site-header {
    transition: top 0.2s ease-in-out, background-color 0.3s ease-in, padding 0.2s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
    body.single-product header.main-site-header {
        transition: none;
    }
}

/* ---- Phones: purchase options at the same size as on iPad ---- */
@media (max-width: 767px) {
    .single-product .summary .wcsatt-options-prompt-radios .price,
    .single-product .summary .wcsatt-options-prompt-radios .wcsatt-options-prompt-action,
    body.single-product .summary .wcsatt-options-prompt-radios .price ins {
        font-size: 16px;
    }
}

/* ---- Phones: "Maybe...?" products two across instead of one under the
   other with full-width photos. */
@media (max-width: 767px) {
    .single-product .related ul.products {
        display: grid;
        gap: 0 16px;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    /* WooCommerce's clearfix pseudo-elements would take up grid cells. */
    .single-product .related ul.products::before,
    .single-product .related ul.products::after {
        display: none;
    }

    .woocommerce.single-product .related ul.products li.product,
    .woocommerce.single-product .related ul.products li.product.first {
        float: none;
        margin: 1em 0;
        width: auto;
    }
}

/* ---- Phones: Buy Now before the bullet list ----
   Where the short description has a bullet list (a <div>), that list and
   everything after it in the description (awards, "Rated 4.8/5...") move
   below the size / options / Buy Now block; the opening paragraph stays
   above it. Descriptions without a list (the other products: just
   paragraphs, incl. the pack size) are left exactly as they were.
   How: the description box is flattened (display: contents) so its
   paragraphs become items of .summary (already a wrapping flex row) and can
   be reordered. Wrapped in :has(), so it only applies when there is a list -
   and browsers without :has() (iOS < 15.4) keep the old order. */
@media (max-width: 767px) {
    .single-product .summary:has(> .woocommerce-product-details__short-description > div) > .woocommerce-product-details__short-description {
        display: contents;
    }

    /* One per line. (Grow allowed: the list has an inline negative right
       margin that makes it a little wider than the column.) */
    .single-product .summary:has(> .woocommerce-product-details__short-description > div) > .woocommerce-product-details__short-description > * {
        flex: 1 1 100%;
    }

    /* The description box's own 20px spacing, now on the paragraph above Buy
       Now and on the last moved line. !important: the description content
       sets its paragraph margins inline (style="margin:0 0 8px"). */
    .single-product .summary:has(> .woocommerce-product-details__short-description > div) > .woocommerce-product-details__short-description > :first-child {
        margin-bottom: 20px !important;
        margin-top: 20px !important;
    }

    .single-product .summary:has(> .woocommerce-product-details__short-description > div) > .woocommerce-product-details__short-description > :last-child {
        margin-bottom: 20px !important;
    }

    .single-product .summary:has(> .woocommerce-product-details__short-description > div) > form.cart,
    .single-product .summary:has(> .woocommerce-product-details__short-description > div) > .first-payment-date {
        order: 1;
    }

    .single-product .summary:has(> .woocommerce-product-details__short-description > div) > .woocommerce-product-details__short-description > div,
    .single-product .summary:has(> .woocommerce-product-details__short-description > div) > .woocommerce-product-details__short-description > div ~ * {
        order: 2;
    }
}
