/*
Theme Name:   Blocksy Child
Theme URI:    https://makedisi.co.za
Description:  Child theme for Blocksy. Holds custom CSS/PHP for makedisi.co.za so customizations survive parent-theme updates and live under version control. Migrated from the Customizer "Additional CSS" (wp_custom_css post 3754) on 2026-06-03.
Author:       Makedisi dev
Template:     blocksy
Version:      1.0.0
Text Domain:  blocksy-child
*/

/* =========================================================================
   DESIGN TOKENS — single source of truth (colour · spacing · radius · type).
   Defined on :root so both the child theme and the makedisi-sample plugin CSS
   consume the same values. Reduces drift (was 21 colours / 21 spacings / 8 radii).
   ========================================================================= */
:root {
    /* Colour */
    --mk-ink: #16110e;          /* primary text / dark surfaces (replaces pure black) */
    --mk-body: #2b2620;         /* long-form body text */
    --mk-muted: #6b6258;        /* secondary / captions */
    --mk-paper: #ffffff;        /* base surface */
    --mk-paper-2: #faf9f7;      /* raised card surface */
    --mk-paper-3: #f3f1ec;      /* recessed / stage surface */
    --mk-line: #e6e6e6;         /* hairline borders */
    --mk-field-border: #d1d5db; /* form input borders */
    --mk-accent: #d6f5c4;       /* brand green accent */
    --mk-ok: #1a7f37;           /* success */
    --mk-err: #b3261e;          /* error */
    --mk-wa: #25d366;           /* WhatsApp brand */
    --mk-wa-dark: #1ebe57;      /* WhatsApp hover */
    --mk-wa-fab: #0e8a3e;       /* deeper green for the FAB so the white glyph passes WCAG 1.4.11 (≥3:1) */
    --mk-wa-fab-dark: #0b7333;  /* FAB hover */

    /* Spacing scale (4px base) */
    --mk-s1: 4px;  --mk-s2: 8px;  --mk-s3: 12px; --mk-s4: 16px; --mk-s5: 20px;
    --mk-s6: 24px; --mk-s8: 32px; --mk-s10: 40px; --mk-s12: 48px; --mk-s16: 64px; --mk-s20: 80px;

    /* Radius */
    --mk-r-sm: 8px;  --mk-r: 10px; --mk-pill: 999px;

    /* Type scale */
    --mk-fs-xs: 12px; --mk-fs-sm: 14px; --mk-fs-md: 16px; --mk-fs-lg: 19px; --mk-fs-xl: 24px;
}

/* =========================================================================
   WooCommerce checkout / order styling
   Migrated verbatim from Customizer Additional CSS (post ID 3754).
   NOTE: Review the rules flagged "REVIEW" below before deploying — they
   hide customer-facing order pages and may be leftover workarounds.
   ========================================================================= */

/* CRIT-1 (P0, 2026-06-03): the rule that hid the checkout Order Review section
   (.woocommerce-checkout-review-order, #order_review, #order_review_heading)
   was REMOVED. It suppressed the order summary/total, so buyers reached
   "Place order" without seeing what they were paying for. Confirmed
   unintentional by the owner — the classic checkout summary must be visible. */

/* CTA-1 (P0, 2026-06-03): primary WooCommerce button = solid dark (--mk-ink)
   with white text; hover swaps to the green accent. Previously the fill was the
   pale --mk-accent, so the primary buy action (Add to basket / Place order) read
   as the lowest-priority element. Green is now reserved for hover/accents. */
.woocommerce button.button,
.woocommerce button#place_order,
.woocommerce input.button,
.woocommerce a.button {
    background-color: var(--mk-ink) !important;
    color: var(--mk-paper) !important;
    border: 2px solid var(--mk-ink) !important;
    transition: all 0.3s ease;
}

/* Hover state */
.woocommerce button.button:hover,
.woocommerce button#place_order:hover,
.woocommerce input.button:hover,
.woocommerce a.button:hover {
    background-color: var(--mk-accent) !important;
    color: var(--mk-ink) !important;
    border: 2px solid var(--mk-ink) !important;
}

.woocommerce-order {
    max-width: 100%;
    padding: 20px;
}

.woocommerce-order p,
.woocommerce-order li {
    font-size: 14px;
    line-height: 1.5;
}

/* CRIT-1 (P0, 2026-06-03): REMOVED `body.woocommerce-order-pay { opacity: 0 }`,
   which made the order-pay page invisible. */

@media (max-width: 768px) {
    .woocommerce {
        padding: 10px !important;
    }
}

@media (max-width: 768px) {
    .woocommerce-order {
        padding: 10px;
    }
}

/* CRIT-1 (P0, 2026-06-03): REMOVED `.woocommerce-order { display: none }`,
   which hid the order-received / thank-you page completely (buyers saw a blank
   page after paying). The .woocommerce-order layout rules above (max-width,
   padding, type) are kept so the now-visible page is styled. */

/* =========================================================================
   UI/UX bug fixes — 2026-06-03 (from local audit at localhost:8080)
   ========================================================================= */

/* FIX 1 — Shop archive product titles rendered pure white on a white card,
   making the book name invisible. Restore the brand text colour. */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    color: var(--mk-ink) !important;
}

/* FIX 2 — h1.page-title was white, so the "My Account" and "CART" headings
   were invisible on their light backgrounds. Scope to WooCommerce pages so we
   don't affect any dark-hero headings elsewhere. */
.woocommerce-account .page-title,
.woocommerce-cart .page-title,
.woocommerce-checkout .page-title,
.post-type-archive-product .page-title,
.tax-product_cat .page-title {
    color: var(--mk-ink) !important;
}

/* FIX 3 — Account / login form inputs had a WHITE 1px border on a transparent
   background, so the fields looked invisible. Give them a visible outline. */
.woocommerce form .form-row input.input-text,
.woocommerce .woocommerce-Input--text,
.woocommerce form .form-row textarea {
    background-color: var(--mk-paper) !important;
    border: 1px solid var(--mk-field-border) !important;
    border-radius: var(--mk-r-sm) !important;
    padding: 10px 12px !important;
}
.woocommerce form .form-row input.input-text:focus,
.woocommerce .woocommerce-Input--text:focus,
.woocommerce form .form-row textarea:focus {
    border-color: var(--mk-ink) !important;
}

/* FIX 6 — Low-contrast faint-grey labels on the cart (result count, cart-block
   column headers, totals heading). Bring up to readable contrast. */
.woocommerce .woocommerce-result-count,
.wc-block-cart-items__header,
.wc-block-cart-items__header *,
.wp-block-woocommerce-cart-order-summary-heading-block {
    color: var(--mk-ink) !important;
}

/* Empty-cart message injected by functions.php (see FIX note there). */
.wc-empty-cart-msg {
    text-align: center;
    padding: 80px 20px;
}
.wc-empty-cart-msg p {
    font-size: 1.25rem;
    color: var(--mk-ink);
    margin-bottom: 24px;
}
.wc-empty-cart-msg .button {
    display: inline-block;
    padding: 12px 30px;
    background: var(--mk-ink);
    color: var(--mk-paper) !important;
    border-radius: var(--mk-r-sm);
    text-decoration: none;
}
.wc-empty-cart-msg .button:hover {
    background: var(--mk-ink);
}

/* =========================================================================
   A11y — tap-target size (WCAG 2.5.8). The WooCommerce password-reveal button
   was 14×14px; give it a comfortable ≥24px target without shifting the icon.
   ========================================================================= */
.show-password-input,
.woocommerce .show-password-input,
.woocommerce-page .show-password-input {
    width: 28px !important;
    height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* =========================================================================
   #4 — WhatsApp sales menu (floating, bottom-left)
   ========================================================================= */
.makedisi-wa {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}
.makedisi-wa__toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    /* A11Y-2 (P1, 2026-06-03): the white glyph on brand green (--mk-wa #25d366)
       was 1.98:1 — fails WCAG 1.4.11 (≥3:1 for graphical objects). Use a deeper
       green for the FAB so the white icon passes; --mk-wa stays the brand token
       for accents/labels elsewhere. */
    background: var(--mk-wa-fab);
    color: var(--mk-paper);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    transition: transform .2s ease, background .2s ease;
}
.makedisi-wa__toggle:hover { transform: scale(1.06); background: var(--mk-wa-fab-dark); }
.makedisi-wa__menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.makedisi-wa[data-open="true"] .makedisi-wa__menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.makedisi-wa__item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--mk-paper);
    color: var(--mk-ink) !important;
    text-decoration: none;
    padding: 10px 16px 10px 12px;
    border-radius: var(--mk-pill);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: transform .15s ease;
}
.makedisi-wa__item:hover { transform: translateX(3px); }
.makedisi-wa__item-icon { font-size: 18px; line-height: 1; }
@media (max-width: 600px) {
    .makedisi-wa { left: 14px; bottom: 14px; }
    .makedisi-wa__item { font-size: 13px; padding: 9px 14px 9px 10px; }
}

/* =========================================================================
   #3 — Buyer reassurance block (product page)
   ========================================================================= */
.makedisi-reassurance {
    list-style: none;
    margin: 24px 0 0;
    padding: 18px 20px;
    border: 1px solid var(--mk-line);
    border-radius: 10px;
    background: var(--mk-paper-2);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
}
.makedisi-reassurance li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    color: var(--mk-ink);
    line-height: 1.35;
}
.makedisi-reassurance__icon { display: inline-flex; flex: 0 0 auto; color: var(--mk-accent); }
.makedisi-reassurance__icon svg { width: 20px; height: 20px; display: block; }
@media (max-width: 600px) {
    .makedisi-reassurance { grid-template-columns: 1fr; padding: 16px; }
}

/* =========================================================================
   #2 — CTA hierarchy utility classes
   Apply in Elementor via the button widget's "CSS Classes" field:
     • Primary action  ("Get Your Copy")     -> makedisi-cta-primary
     • Secondary action("Get the Free Sample")-> makedisi-cta-secondary
   so the buy action visually dominates the preview action.
   ========================================================================= */
.makedisi-cta-primary,
.makedisi-cta-primary .elementor-button,
.makedisi-cta-primary a {
    background-color: var(--mk-ink) !important;
    color: var(--mk-paper) !important;
    border: 2px solid var(--mk-ink) !important;
    border-radius: var(--mk-r-sm) !important;
    font-weight: 700 !important;
    transition: all .25s ease !important;
}
.makedisi-cta-primary:hover,
.makedisi-cta-primary .elementor-button:hover,
.makedisi-cta-primary a:hover {
    background-color: var(--mk-accent) !important;
    color: var(--mk-ink) !important;
    border-color: var(--mk-ink) !important;
}
.makedisi-cta-secondary,
.makedisi-cta-secondary .elementor-button,
.makedisi-cta-secondary a {
    background-color: transparent !important;
    color: var(--mk-ink) !important;
    border: 2px solid var(--mk-ink) !important;
    border-radius: var(--mk-r-sm) !important;
    font-weight: 600 !important;
    transition: all .25s ease !important;
}
.makedisi-cta-secondary:hover,
.makedisi-cta-secondary .elementor-button:hover,
.makedisi-cta-secondary a:hover {
    background-color: var(--mk-ink) !important;
    color: var(--mk-paper) !important;
}

/* =========================================================================
   R2 — 3D book mockup ([makedisi_book_3d]).
   --mk-bw = book width (set inline); --mk-bd = spine/page depth.
   ========================================================================= */
.mk-book3d {
    --mk-bw: 280px;
    --mk-bd: calc(var(--mk-bw) * 0.13);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.mk-book3d__stage {
    perspective: 1800px;
    padding: 10px 0 26px;
}
.mk-book3d__book {
    position: relative;
    width: var(--mk-bw);
    height: calc(var(--mk-bw) * 1.6);
    transform-style: preserve-3d;
    transform: rotateY(-26deg);
    transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}
.mk-book3d:hover .mk-book3d__book { transform: rotateY(-12deg); }
.mk-book3d__cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px 5px 5px 2px;
    transform: translateZ(calc(var(--mk-bd) / 2));
    box-shadow: inset 4px 0 8px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .2);
    backface-visibility: hidden;
}
/* Right edge — the page block (cream, lined) */
.mk-book3d__pages {
    position: absolute;
    top: 4px;
    left: calc(var(--mk-bw) - var(--mk-bd) / 2);
    width: var(--mk-bd);
    height: calc(100% - 8px);
    transform: rotateY(90deg);
    background: repeating-linear-gradient( 90deg, #f6f1e6, #f6f1e6 1px, #e3dcc9 2px, #f6f1e6 3px );
    border-radius: 0 2px 2px 0;
}
/* Left edge — the spine (dark) */
.mk-book3d__spine {
    position: absolute;
    top: 0;
    left: calc(var(--mk-bd) / -2);
    width: var(--mk-bd);
    height: 100%;
    transform: rotateY(90deg);
    background: linear-gradient( var(--mk-body), var(--mk-ink) );
    border-radius: 2px 0 0 2px;
}
/* Ground shadow */
.mk-book3d__shadow {
    position: absolute;
    left: 50%;
    bottom: 4px;
    width: calc(var(--mk-bw) * 0.9);
    height: 18px;
    transform: translateX(-50%);
    background: radial-gradient( ellipse at center, rgba(0, 0, 0, .28), rgba(0, 0, 0, 0) 70% );
    filter: blur(3px);
}
.mk-book3d__badge {
    margin-top: 4px;
    display: inline-block;
    background: var(--mk-accent);
    color: var(--mk-ink);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: var(--mk-pill);
}
@media (prefers-reduced-motion: reduce) {
    .mk-book3d__book { transition: none; }
}

/* =========================================================================
   R2 #8 — Sticky mobile buy bar (mobile only; desktop keeps the header CTA)
   ========================================================================= */
.mk-buybar { display: none; }
@media (max-width: 768px) {
    .mk-buybar {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 9997;
        gap: 8px;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, .12);
        backdrop-filter: saturate(1.1) blur(4px);
    }
    .mk-buybar a {
        flex: 1;
        text-align: center;
        padding: 13px 10px;
        border-radius: var(--mk-r-sm);
        font-weight: 700;
        font-size: 15px;
        text-decoration: none;
        border: 2px solid var(--mk-ink);
    }
    .mk-buybar__sample { flex: 0 0 38%; background: transparent; color: var(--mk-ink) !important; }
    .mk-buybar__buy { background: var(--mk-ink); color: var(--mk-paper) !important; }

    /* Lift the floating buttons so they clear the bar */
    .makedisi-wa { bottom: 78px !important; }
    .moderncart-floating-cart-button,
    .moderncart-floating-cart { bottom: 78px !important; }
    /* Give page content room so the bar never covers the footer/last CTA */
    body { padding-bottom: 64px; }
}

/* =========================================================================
   LAY-2 (P1, 2026-06-03): cap reading line-length on the product tabs.
   The description/reviews panels ran the full content width (~1440px on
   desktop → ~120+ chars per line). Cap to ~680px (~70 chars) for comfortable
   reading. (The sample-reader prose is already ~680px via its block layout.)
   ========================================================================= */
.woocommerce-Tabs-panel--description,
.woocommerce-Tabs-panel--reviews {
    max-width: 680px;
}

/* =========================================================================
   A11y — visible focus states (WCAG 2.4.7).
   Global keyboard-focus ring on every interactive element. Uses :focus-visible
   so mouse clicks don't draw a ring, only keyboard/AT navigation does. This also
   restores focus visibility on form inputs (the input :focus rule above no longer
   suppresses the outline).
   ========================================================================= */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.elementor-button:focus-visible,
.makedisi-wa__toggle:focus-visible,
.makedisi-wa__item:focus-visible,
.mk-buybar a:focus-visible {
    outline: 2px solid var(--mk-ink) !important;
    outline-offset: 2px !important;
    border-radius: var(--mk-r-sm);
}
/* On dark surfaces the ink ring is invisible — use a light ring there. */
.makedisi-cta-primary:focus-visible,
.mk-buybar__buy:focus-visible,
.woocommerce button#place_order:focus-visible {
    outline-color: var(--mk-paper) !important;
}

/* =========================================================================
   A11y — minimum tap-target size (WCAG 2.5.5 / 2.5.8 ≥44px; checkbox ≥24px).
   The mobile header trigger was ~30px tall, the WhatsApp menu items and Woo
   buttons 40px, and the sample consent checkbox 18px. (The password-reveal
   button was fixed earlier — see above.)
   ========================================================================= */
.ct-header-trigger {
    min-width: 44px;
    min-height: 44px;
}
.makedisi-wa__item,
.woocommerce .button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce a.button {
    min-height: 44px;
}
/* Comfortable checkbox target without distorting the layout. */
.makedisi-sample-form input[type="checkbox"],
form input[type="checkbox"] {
    width: 24px;
    height: 24px;
}

/* =========================================================================
   Pass D — sample reader: keep the floating WhatsApp/cart controls from
   competing with the reading area, and give the reader bottom room so its
   end CTA clears the floats. Scoped to .ms-sample-page (set by the plugin).
   (Float positioning is code-owned here; the reader UI itself is the plugin.)
   ========================================================================= */
.ms-sample-page .makedisi-wa { bottom: 16px; }
.ms-sample-page .makedisi-wa__toggle { width: 48px; height: 48px; }
.ms-sample-page .ms-reader { padding-bottom: 72px; }
