#presale-root, #presale-root * { box-sizing: border-box; }

#presale-root {
    font-family: Arial, Helvetica, sans-serif;
    max-width: 780px;
    margin: 0 auto 30px;
    color: #2d2d2d;
    overflow-x: hidden;  /* safety net: stops any future layout edge-case
                             (long text, an image, etc.) from ever pushing
                             the whole page into horizontal scroll again */
}

/* ---- Title: always black ---- */
.book-title {
    font-family: BebasNeueRegular, Arial, sans-serif;
    font-size: 38px;
    font-weight: 400;
    line-height: 1.05;
    margin-bottom: 4px;
    color: #2d2d2d;
}
.presale-subtitle {
    font-size: 13px;
    color: #888;
    margin-bottom: 14px;
    font-style: italic;
}

/* ---- Urgency banner ---- */
.presale-banner {
    background: #fffaf2;
    border: 1px solid #f9c06a;
    border-radius: 3px;
    padding: 10px 16px;
    margin-top: 0;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #7a4800;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}
.presale-banner::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0; width: 5px;
    background: #f9c06a;
}
.presale-banner .banner-icon { font-size: 20px; flex-shrink: 0; }
.presale-banner .banner-text { line-height: 1.4; }
.presale-banner .banner-text span { font-weight: 400; color: #a06010; }

.notice-box {
    background: #fcb040;
    border-radius: 3px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #fff;
    line-height: 1.5;
}
.notice-box a { color: #fff; text-decoration: underline; }

/* ============================================================
   HERO — desktop
   Cover column is 40% and content column is 60% of the hero
   width (flex-grow ratio 4:6 on a 0 flex-basis, so the split
   stays exact regardless of the gap between them).
   ============================================================ */
.ps-hero {
    display: flex;
    gap: 20px;
    background: #fff;
    border-radius: 3px;
    border: 1px solid #ececec;
    border-top: 3px solid transparent;
    padding: 20px;
    margin-bottom: 16px;
    align-items: flex-start;
    position: relative;
}
.ps-hero::before {
    content: '';
    position: absolute;
    top: -3px; left: -1px; right: -1px; height: 3px;
    background: #fcb040;
    border-radius: 3px 3px 0 0;
}

/* Desktop: left column with cover image — 40% of the hero width */
.ps-cover-col { flex: 4 1 0; min-width: 0; }
.ps-cover-col img { width: 100%; border-radius: 3px; display: block; }

/* Row of 5 spread thumbnails below the cover image — square crops.
   Clicking the cover or a spread opens the same lightbox
   gallery ("bookspreads"), separate from the individual
   pattern-design gallery ("bookimages") below. */
.ps-spreads-row {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}
.ps-spread-thumb {
    flex: 1 1 0;
    max-width: 25%;
    min-width: 0;
    aspect-ratio: 1 / 1;
    display: block;
    line-height: 0;
    border-radius: 3px;
    overflow: hidden;
    border: 1.5px solid #ececec;
    transition: border-color 0.18s, transform 0.18s;
}
.ps-spread-thumb:hover {
    border-color: #fcb040;
    transform: scale(1.04);
}
.ps-spread-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video thumbnail — sits first among the spread thumbs, styled
   like a spread thumb but with a play-button overlay. Clicking it
   opens the video inside the same lightbox gallery as the cover
   and spreads (data-type="video" forces an iframe embed). */
.ps-video-thumb { position: relative; }
.ps-play-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 34%;
    max-width: 28px;
    min-width: 16px;
    pointer-events: none;
}
.ps-play-icon svg {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.45));
}

/* Desktop: right column with title, buy cards — 60% of the hero width */
.ps-content-col { flex: 6 1 0; min-width: 0; }

/* ============================================================
   BUY CARDS
   Desktop: paperback + PDF sit side by side. Each card stacks
   its own content top-to-bottom (label/note, then price/button)
   so the label text gets the card's full width to breathe,
   instead of competing with a fixed-width price/button block.
   ============================================================ */
.buy-options { margin: 12px 0 10px; display: flex; flex-direction: column; gap: 8px; }

.buy-card {
    flex: 1 1 0;
    min-width: 0;
    border: 1.5px solid #e8e8e8;
    border-radius: 3px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    background: #fafafa;
    transition: border-color 0.2s;
}
.buy-card.featured { border-color: #fcb040; background: #fffaf2; }
.buy-card-left { width: 100%; max-width: 100%;           
    align-self: stretch; }
.buy-card-label {
    font-size: 14px;
    font-weight: 700;
    color: #2d2d2d;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.badge-popular {
    font-size: 10px;
    font-weight: 700;
    background: #fcb040;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.buy-card-note { font-size: 11px; color: #999; line-height: 1.4; }

/* ---- Inline expand toggle (replaces ? icon) ---- */
.info-expand-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: #fcb040;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    vertical-align: middle;
    margin-left: 2px;
    line-height: 1;
}
.info-expand-toggle:hover { color: #e07800; }
.info-expand-arrow {
    display: inline-block;
    font-size: 10px;
    transition: transform 0.2s;
    line-height: 1;
}
.info-expand-toggle.open .info-expand-arrow { transform: rotate(180deg); }
.info-expand-box {
    display: none;
    background: #f7f7f5;
    border: 1px solid #e8e8e8;
    border-radius: 3px;
    padding: 8px 10px;
    font-size: 11px;
    color: #666;
    line-height: 1.6;
    margin-top: 6px;
}
.info-expand-box.open { display: block; }

.buy-card-right {
        display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 14px;
    width: 100%;
    max-width: 100%;           /* new — hard-caps the box even if Safari
                                   miscomputes the "natural" width */
    min-width: 0;
    align-self: stretch;       /* new */
    justify-content: flex-end;
}
.buy-price {
    font-size: 20px;
    font-weight: 700;
    color: #e07800;
    white-space: nowrap;
    width: auto;
    text-align: left;
}
.buy-price .strike {
    font-size: 13px;
    font-weight: 400;
    color: #bbb;
    text-decoration: line-through;
    white-space: nowrap;  /* keep the struck-through amount itself intact
                              even if the parent wraps on narrow screens */
}
.checkout-button-new {
    background: #fcb040;
    color: #fff;
    border: none;
    border-radius: 3px;
    width: 100px;
    padding: 8px 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
    transition: background 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.checkout-button-new:hover { background: #e07800; }
.checkout-button-new.secondary {
    background: #fff;
    color: #fcb040;
    border: 1.5px solid #fcb040;
}
.checkout-button-new.secondary:hover { background: #fff9ef; }

.no-paperback-note {
    font-size: 12px; color: #999;
    background: #f5f5f5;
    border-radius: 3px;
    padding: 8px 12px;
    margin-top: 6px;
    line-height: 1.5;
}

/* ============================================================
   FEATURES
   ============================================================ */
.features-section {
    background: #fff;
    border-radius: 3px;
    border: 1px solid #ececec;
    padding: 18px 20px;
    margin-bottom: 16px;
}
.features-section .section-intro { font-size: 13px; color: #666; line-height: 1.7; margin-bottom: 16px; }
.features-section .section-intro p { margin-bottom: 8px; }
.features-section .section-intro p:last-child { margin-bottom: 0; }
.features-section .section-intro b { color: #2d2d2d; }
.features-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.feature-item {
    display: flex; align-items: flex-start; gap: 10px;
    background: #faf9f7; border-radius: 3px; padding: 12px;
    border: 1px solid #f0ede8;
}
.feature-icon-wrap {
    width: 36px; height: 36px; flex-shrink: 0;
    background: #fff4e0; border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.feature-text strong { display: block; font-size: 12px; font-weight: 700; color: #2d2d2d; margin-bottom: 2px; }
.feature-text span   { font-size: 11px; color: #888; line-height: 1.4; }

/* ============================================================
   PATTERN THUMBNAILS — no rainbow border on hover
   ============================================================ */
.patterns-section {
    background: #fff; border-radius: 3px;
    border: 1px solid #ececec; padding: 18px 20px; margin-bottom: 16px;
}
.section-heading {
    font-family: BebasNeueRegular, Arial, sans-serif;
    font-size: 18px; font-weight: 700; color: #2d2d2d;
    margin-bottom: 4px;
    padding-bottom: 3px;
    border-bottom: 2px solid #fcb040;
    display: inline-block;
}
.section-subheading { font-size: 12px; color: #999; margin-bottom: 14px; }
.patterns-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; }
.pattern-thumb {
    position: relative; 
    overflow: hidden; border-radius: 3px;
    border: 2px solid #ececec;
    background: #f5f5f5;
    cursor: pointer;
    transition: transform 0.18s, border-color 0.18s;
}
.pattern-thumb:hover {
    transform: scale(1.04);
    border-color: #fcb040;
    z-index: 2; position: relative;
}
.pattern-thumb a {
    display: block;
    line-height: 0;    /* removes phantom gap below inline images */
}
.pattern-thumb img {
    width: 100%;
    height: auto !important;   /* override any global style.css rule */
    display: block;
}.pattern-thumb .thumb-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0); transition: background 0.18s;
    display: flex; align-items: flex-end; padding: 6px;
}
.pattern-thumb:hover .thumb-overlay { background: rgba(0,0,0,0.18); }
.pattern-thumb .thumb-name {
    font-size: 10px; font-weight: 700; color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    opacity: 0; transition: opacity 0.18s; line-height: 1.2;
}
.pattern-thumb:hover .thumb-name { opacity: 1; }
.pattern-thumb.wide { grid-column: span 2; }

/* ============================================================
   REVIEWS CAROUSEL
   ============================================================ */
.reviews-section {
    background: #fff8f0; border-radius: 3px;
    border: 1px solid #f5ddb0; padding: 16px 28px;
    margin-bottom: 16px; position: relative;
}
#ps-carousel { position: relative; }
#ps-slides { overflow: hidden; width: 100%; }
#ps-slides ul { list-style: none; margin: 0; padding: 0; display: flex; }
#ps-slides ul li { flex-shrink: 0; width: 100%; padding: 4px 8px 8px; text-align: center; box-sizing: border-box; }
.review-quote { font-size: 13px; color: #7a4800; font-style: italic; line-height: 1.3; margin-bottom: 6px; display: block; }
.review-quote::before { content: '\201C'; font-size: 1em; font-weight: 700; color: #fcb040; font-style: normal; }
.review-quote::after  { content: '\201D'; font-size: 1em; font-weight: 700; color: #fcb040; font-style: normal; }
.review-author { font-size: 11px; font-weight: 700; color: #b07030; letter-spacing: 0.04em; text-transform: uppercase; display: block; }
.carousel-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: #fcb040; color: #fff; border: none;
    width: 26px; height: 26px; border-radius: 3px;
    font-size: 18px; line-height: 1; text-align: center;
    cursor: pointer; padding: 0 0 2px 0; z-index: 2;
}
.carousel-btn.prev { left: -28px; }
.carousel-btn.next { right: -28px; }

/* ============================================================
   BUNDLE
   4 cover images span the full width of the section as an
   equal-width row, with a buy box below styled just like the
   buy cards in the hero (re-uses .buy-card / .buy-card.featured).
   ============================================================ */
.bundle-section {
    background: #fff; border-radius: 3px;
    border: 1px solid #ececec; padding: 18px 20px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.bundle-books-wrap {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
}
.bundle-book-thumb {
    width: 100%;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid #ececec;
}
.bundle-book-thumb img { width: 100%; display: block; }

/* ============================================================
   CUSTOM ORDER — card grid
   Font matches rest of page (Arial). Updated toggle text.
   ============================================================ */
.custom-order-section {
    background: #fcb040;
    border-radius: 3px;
    padding: 16px 20px;
    margin-bottom: 16px;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
}
.custom-order-section b   { color: #fff; }
.custom-order-section a   { color: #fff; text-decoration: underline; }
.custom-order-toggle-wrap {
    font-family: Arial, Helvetica, sans-serif;
}
.custom-order-toggle-wrap .co-heading {
    display: block;
    font-family: BebasNeueRegular, Arial, sans-serif;
    font-size: 20px;
    font-weight: 400;
    color: #fff;
    line-height: 1.1;
    margin-bottom: 4px;
}
.custom-order-toggle-wrap .co-subline {
    display: block;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}
.custom-order-toggle      { cursor: pointer; text-decoration: underline; color: #fff5e0; font-family: Arial, Helvetica, sans-serif; }
.custom-order-inner       { margin-top: 12px; }
.custom-order-intro       { font-size: 13px; margin-bottom: 14px; line-height: 1.5; font-family: Arial, Helvetica, sans-serif; }

/* search/filter bar */
.co-search-wrap {
    display: flex; gap: 8px; margin-bottom: 14px; align-items: center;
}
.co-search {
    flex: 1;
    padding: 7px 12px;
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 3px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 13px;
    font-family: Arial, Helvetica, sans-serif;
    outline: none;
}
.co-search::placeholder { color: rgba(255,255,255,0.65); }
.co-search:focus { border-color: #fff; background: rgba(255,255,255,0.3); }
.co-filter-count {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    white-space: nowrap;
    flex-shrink: 0;
    font-family: Arial, Helvetica, sans-serif;
}

/* card grid */
.co-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 14px;
}
.co-grid::-webkit-scrollbar       { width: 6px; }
.co-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.1); border-radius: 3px; }
.co-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.4); border-radius: 3px; }

.co-card {
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    padding: 8px 8px 10px;
    text-align: center;
    cursor: default;
    transition: border-color 0.15s, background 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.co-card.selected {
    border-color: #fff;
    background: rgba(255,255,255,0.3);
}
.co-card.hidden { display: none; }

.co-card-img-wrap {
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    border-radius: 3px;
    margin-bottom: 7px;
    background: rgba(255,255,255,0.1);
    position: relative;
}
.co-card-img-wrap img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.co-card-img-wrap::after {
    content: '🔍';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.co-card-img-wrap:hover::after { opacity: 1; }

.co-card-title {
    font-size: 11px; font-weight: 700; color: #fff;
    line-height: 1.3; margin-bottom: 8px;
    flex: 1;
    font-family: Arial, Helvetica, sans-serif;
}

/* +/− stepper */
.co-stepper {
    display: flex; align-items: center;
    justify-content: center; gap: 7px;
}
.co-stepper button {
    width: 24px; height: 24px;
    background: #fff; color: #e07800;
    border: none; border-radius: 3px;
    font-size: 17px; font-weight: 700;
    line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    transition: background 0.15s;
    flex-shrink: 0;
}
.co-stepper button:hover  { background: #fff4d6; }
.co-stepper button:active { background: #ffe0b0; }
.co-qty {
    font-size: 15px; font-weight: 700; color: #fff;
    min-width: 18px; text-align: center;
    display: inline-block;
    font-family: Arial, Helvetica, sans-serif;
}

/* total row */
.co-total-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 4px;
    padding: 14px 16px;
    background: rgba(0,0,0,0.12);
    border-radius: 4px;
    border: 2px solid rgba(255,255,255,0.35);
}
.co-total-left { flex: 1; min-width: 0; }
.co-total-prices {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.co-price-strike {
    font-size: 15px;
    color: rgba(255,255,255,0.55);
    text-decoration: line-through;
    font-family: Arial, Helvetica, sans-serif;
}
.co-discount-badge {
    font-size: 11px;
    font-weight: 700;
    background: #fff;
    color: #e07800;
    padding: 2px 8px;
    border-radius: 3px;
    white-space: nowrap;
    font-family: Arial, Helvetica, sans-serif;
}
.co-price-final {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    font-family: Arial, Helvetica, sans-serif;
}
.co-total-note {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    line-height: 1.4;
    font-family: Arial, Helvetica, sans-serif;
}
.btn-custom-buy {
    background: #fff;
    color: #e07800;
    border: none;
    border-radius: 3px;
    padding: 12px 24px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.btn-custom-buy:hover  { background: #fff4d6; }
.btn-custom-buy:active { transform: scale(0.97); }

/* ============================================================
   FAQ
   ============================================================ */
.faq-section {
    background: #fff; border-radius: 3px;
    border: 1px solid #ececec; margin-bottom: 16px; overflow: hidden;
}
.faq-section-title {
    font-family: BebasNeueRegular, Arial, sans-serif;
    font-size: 20px; font-weight: 700;
    padding: 16px 20px 14px;
    border-bottom: 1px solid #ececec; color: #2d2d2d;
}
.faq-item { border-bottom: 1px solid #f0f0f0; }
.faq-item:last-child { border-bottom: none; }
.faq-item.open { border-left: 3px solid #fcb040; }
.faq-q {
    width: 100%; background: none; border: none; text-align: left;
    padding: 13px 20px; font-family: Arial, Helvetica, sans-serif;
    font-size: 13px; font-weight: 700; color: #2d2d2d;
    cursor: pointer; display: flex; justify-content: space-between;
    align-items: center; gap: 8px;
}
.faq-q:hover { background: #fafaf8; }
.faq-arrow {
    flex-shrink: 0; width: 20px; height: 20px; border-radius: 3px;
    background: #f5f5f5; display: flex; align-items: center;
    justify-content: center; font-size: 12px; color: #888;
    transition: transform 0.25s;
}
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-a { display: none; padding: 0 20px 14px; font-size: 12px; color: #666; line-height: 1.7; }
.faq-a a { color: #e07800; }
.faq-item.open .faq-a { display: block; }

/* ============================================================
   CHECKOUT MODAL
   ============================================================ */
.modal          { display: none; position: fixed; top:0; left:0; right:0; bottom:0; z-index:1040; overflow:auto; }
.modal-backdrop { position: fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.7); z-index:1030; display:none; }
.modal.in, .modal-backdrop.in { display: block; }
.modal-dialog   { position:relative; z-index:1050; margin:30px auto; width:auto; max-width:680px; }
.modal-content  { background:#fff; border-radius:3px; border:1px solid rgba(0,0,0,0.15); overflow:hidden; box-shadow:0 5px 30px rgba(0,0,0,0.3); }

/* ============================================================
   STICKY BUY BAR
   body padding-bottom is set dynamically by JS to match bar height
   ============================================================ */
#sticky-buy-bar {
    position: fixed; bottom:0; left:0; right:0;
    z-index: 600; background: #fff;
    border-top: 3px solid transparent;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.13);
    padding: 10px 16px 12px; display: none;
}
#sticky-buy-bar::before {
    content: ''; position: absolute;
    top: -3px; left: 0; right: 0; height: 3px;
    background: #fcb040;
}
.sticky-bar-inner {
    max-width: 780px; margin: 0 auto;
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.sticky-bar-title {
    font-family: BebasNeueRegular, Arial, sans-serif;
    font-size: 18px; color: #2d2d2d; white-space: nowrap; flex-shrink: 0;
}
.sticky-bar-options { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sticky-bar-option {
    display: grid;
    grid-template-columns: 1fr auto 110px;
    align-items: center; gap: 12px;
    background: #fafafa; border: 1.5px solid #e8e8e8;
    border-radius: 3px; padding: 7px 12px;
}
.sticky-bar-option .checkout-button-new { width: 100%; text-align: center; }
.sticky-bar-option.featured { border-color: #fcb040; background: #fffaf2; }
.sticky-bar-label { font-size: 12px; font-weight: 700; color: #2d2d2d; white-space: nowrap; }
.sticky-bar-price { font-size: 17px; font-weight: 700; color: #e07800; white-space: nowrap; text-align: right; }

/* ============================================================
   RESPONSIVE — MOBILE (≤600px)
   ============================================================ */
@media screen and (max-width: 600px) {

    /* Hero: stack vertically, cover goes full width */
    .ps-hero {
        flex-direction: column;
        gap: 0;
        padding: 0 0 14px;
    }

    /* Full-width cover image at top of hero */
    .ps-cover-col {
        flex: none;
        max-width: 100%;
        width: 100%;
        overflow: hidden;
        padding: 14px 14px 14px;
    }
    .ps-cover-col img {
        width: 100%;
        max-height: 280px;
        object-fit: contain;
        border-radius: 3px;
        display: block;
    }

    .ps-spreads-row { gap: 4px; }

    /* Title + content below cover image, with padding */
    .ps-content-col {
        width: 100%;
        padding: 14px 14px 0;
    }

    /* Title always shown in content col on mobile too */
    .book-title { font-size: 28px; }
    .presale-subtitle { margin-bottom: 10px; }

    /* Buy cards stack full-width on mobile — side-by-side is too
       cramped on a phone screen */
    .buy-options { flex-direction: column; gap: 8px; }

    .buy-card {
        gap: 6px;
        padding: 10px 12px;
    }
    .buy-card-left { width: 100%; }

    .buy-card-right {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 8px 12px;
        width: 100%;
        max-width: 100%;
    }
    .buy-price {
        display: block;
        width: auto;
        min-width: 0;        /* lets the price shrink/wrap instead of forcing the row wider */
        white-space: normal; /* overrides the desktop nowrap so a long discounted price can wrap to 2 lines if needed, rather than pushing the button off-screen */
        text-align: left;
    }
    .checkout-button-new {
        width: 120px;
        justify-self: end;   /* pins button to the right edge of its grid cell */
    }

    .features-grid { grid-template-columns: 1fr; }
    .patterns-grid { grid-template-columns: repeat(3,1fr); }

    /* Bundle: the 4 cover images stay in one full-width row of 4
       equal columns (same grid as desktop) — just tighten the gap */
    .bundle-books-wrap { gap: 6px; }

    .sticky-bar-title { display: none; }
    .sticky-bar-options { justify-content: stretch; width: 100%; }
    .co-grid { grid-template-columns: repeat(auto-fill, minmax(100px,1fr)); }
    .co-total-row { flex-direction: column; align-items: stretch; }
    .btn-custom-buy { width: 100%; text-align: center; }
}

@media screen and (max-width: 400px) {
    .patterns-grid { grid-template-columns: repeat(3,1fr); }
    .buy-price { font-size: 17px; }
    .ps-cover-col img { max-height: 220px; }
    .co-grid { grid-template-columns: repeat(auto-fill, minmax(88px,1fr)); }
}

/* ============================================================
   A/B TEST — VERSION D: larger body text on mobile, everywhere
   in #presale-root's content. Activated by adding class
   "font-test-d" to #presale-root (see PHP: $fonttest cookie/param).
   Version C (no class) = current/original sizes, untouched.
   Desktop sizes are never touched by this test.
   ============================================================ */
@media screen and (max-width: 600px) {
    #presale-root.font-test-d .book-title              { font-size: 32px; }
    #presale-root.font-test-d .presale-subtitle        { font-size: 15px; }
    #presale-root.font-test-d .presale-banner          { font-size: 15px; }
    #presale-root.font-test-d .notice-box              { font-size: 15px; }

    #presale-root.font-test-d .buy-card-label          { font-size: 16px; }
    #presale-root.font-test-d .badge-popular           { font-size: 11px; }
    #presale-root.font-test-d .buy-card-note           { font-size: 13px; }
    #presale-root.font-test-d .info-expand-toggle      { font-size: 13px; }
    #presale-root.font-test-d .info-expand-arrow       { font-size: 12px; }
    #presale-root.font-test-d .info-expand-box         { font-size: 13px; }
    #presale-root.font-test-d .buy-price               { font-size: 23px; }
    #presale-root.font-test-d .buy-price .strike       { font-size: 15px; }
    #presale-root.font-test-d .checkout-button-new     { font-size: 15px; }
    #presale-root.font-test-d .no-paperback-note       { font-size: 14px; }

    #presale-root.font-test-d .features-section .section-intro { font-size: 15px; }
    /* style.css sets #patterndescription_book with an ID selector (12px font,
       16px fixed line-height), which outranks the class-based rule above —
       override both explicitly, or the larger font ends up cramped against
       the unchanged 16px line-height */
    #presale-root.font-test-d #patterndescription_book { font-size: 15px !important; line-height: 1.55 !important; }
    #presale-root.font-test-d .feature-text strong     { font-size: 14px; }
    #presale-root.font-test-d .feature-text span       { font-size: 13px; }

    #presale-root.font-test-d .section-heading         { font-size: 21px; }
    #presale-root.font-test-d .section-subheading      { font-size: 14px; }
    #presale-root.font-test-d .pattern-thumb .thumb-name { font-size: 12px; }

    #presale-root.font-test-d .review-quote            { font-size: 15px; }
    #presale-root.font-test-d .review-author           { font-size: 13px; }

    #presale-root.font-test-d .custom-order-toggle-wrap .co-heading  { font-size: 23px; }
    #presale-root.font-test-d .custom-order-toggle-wrap .co-subline { font-size: 15px; }
    #presale-root.font-test-d .custom-order-toggle     { font-size: 15px; }
    #presale-root.font-test-d .custom-order-intro      { font-size: 15px; }
    #presale-root.font-test-d .co-search               { font-size: 15px; }
    #presale-root.font-test-d .co-filter-count         { font-size: 14px; }
    #presale-root.font-test-d .co-card-title            { font-size: 13px; }
    #presale-root.font-test-d .co-stepper button        { font-size: 19px; }
    #presale-root.font-test-d .co-qty                   { font-size: 17px; }
    #presale-root.font-test-d .co-price-strike          { font-size: 17px; }
    #presale-root.font-test-d .co-discount-badge        { font-size: 13px; }
    #presale-root.font-test-d .co-price-final           { font-size: 30px; }
    #presale-root.font-test-d .co-total-note            { font-size: 13px; }
    #presale-root.font-test-d .btn-custom-buy           { font-size: 16px; }

    #presale-root.font-test-d .faq-section-title       { font-size: 23px; }
    #presale-root.font-test-d .faq-q                   { font-size: 15px; }
    #presale-root.font-test-d .faq-arrow               { font-size: 14px; }
    #presale-root.font-test-d .faq-a                   { font-size: 14px; }

    #presale-root.font-test-d ~ #sticky-buy-bar .sticky-bar-label { font-size: 14px; }
    #presale-root.font-test-d ~ #sticky-buy-bar .sticky-bar-price { font-size: 19px; }
    #presale-root.font-test-d ~ #sticky-buy-bar .checkout-button-new { font-size: 15px; }
}

@media screen and (max-width: 400px) {
    #presale-root.font-test-d .buy-price { font-size: 20px; }
}