/* ==========================================================================
   Basuto UX — Components
   Subnav, sticky CTA bar, key facts sidebar/bar, review cards, CTA strip,
   process steps. Loaded when any component feature is enabled.
   ========================================================================== */

/* ── Mobile Sticky CTA Bar ── */
@media (max-width: 768px) {
    .basuto-sticky-cta {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 999;
        display: flex;
        gap: 0;
        background: var(--wp--preset--color--forest, #4A5E52);
        /* Safe area padding on container — avoids doubling per button */
        padding-bottom: env(safe-area-inset-bottom, 0px);
        transform: translateY(100%);
        transition: transform 300ms ease;
    }

    .basuto-sticky-cta.visible {
        transform: translateY(0);
    }

    .basuto-sticky-cta.hidden {
        transform: translateY(100%);
    }

    .basuto-sticky-cta__btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px 12px;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        text-decoration: none;
        font-family: var(--wp--preset--font-family--sans, 'DM Sans', sans-serif);
    }

    .basuto-sticky-cta__book {
        background: var(--wp--preset--color--forest, #4A5E52);
        color: #fff;
    }

    .basuto-sticky-cta__call {
        background: #fff;
        color: #2A2D2B;
    }

    .basuto-sticky-cta__whatsapp {
        background: #25D366;
        color: #fff;
    }
}

@media (min-width: 769px) {
    .basuto-sticky-cta {
        display: none;
    }
}

/* ── CTA Bar Content Offset ──
   CSS padding on the content wrapper, scoped to a JS-toggled body class.
   Only active when the bar is visible AND not hidden near the footer.
   JS toggles body.basuto-cta-visible in sync with bar state. */
@media (max-width: 768px) {
    body.basuto-cta-visible .wp-site-blocks {
        padding-bottom: calc(38px + env(safe-area-inset-bottom, 0px));
    }
}

/* ── On-Page Subnav ──
   Uses position:sticky — browser compositor handles sticking natively,
   including during iOS momentum scrolling. No JS needed for show/hide.
   Hub injects the subnav before the first H2 inside .entry-content.
   ── */
.basuto-subnav {
    position: sticky;
    top: 0;
    z-index: 990; /* Below main nav dropdowns (999) */
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid #E5E0D8;
}

body.admin-bar .basuto-subnav {
    top: 32px;
}

@media (max-width: 782px) {
    body.admin-bar .basuto-subnav {
        top: 46px;
    }
}

.basuto-subnav__track {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.basuto-subnav__track::-webkit-scrollbar {
    display: none;
}

.basuto-subnav__link {
    flex-shrink: 0;
    padding: 20px 24px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: #888;
    position: relative;
    transition: color 200ms ease;
    font-family: var(--wp--preset--font-family--sans, 'DM Sans', sans-serif);
    white-space: nowrap;
}

/* GPU-composited underline via opacity on pseudo-element */
.basuto-subnav__link::after {
    content: '';
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 0;
    height: 2px;
    background: var(--wp--preset--color--gold, #C5A96A);
    opacity: 0;
    transition: opacity 200ms ease;
}

.basuto-subnav__link.active,
.basuto-subnav__link:hover {
    color: #2A2D2B;
}

.basuto-subnav__link.active::after,
.basuto-subnav__link:hover::after {
    opacity: 1;
}

@media (max-width: 768px) {
    .basuto-subnav__link {
        padding: 16px 18px;
        font-size: 12px;
    }
    .basuto-subnav__link::after {
        left: 18px;
        right: 18px;
    }
}

/* ── Sticky Sidebar ── */
@media (min-width: 960px) {
    .basuto-sidebar-sticky {
        position: sticky;
        top: calc(var(--basuto-subnav-top, 80px) + 60px);
        align-self: start;
    }
}

body.admin-bar .basuto-sidebar-sticky {
    top: calc(var(--basuto-subnav-top, 80px) + 60px + 32px);
}

@media (max-width: 959px) {
    .basuto-sidebar-sticky {
        position: static;
    }
}

/* ── Key Facts Card ── */
.basuto-key-facts {
    background: #fff;
    border: 1px solid #E5E0D8;
    border-radius: 14px;
    padding: 32px 28px;
}

.basuto-key-facts__heading {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--wp--preset--color--forest, #4A5E52);
    margin-bottom: 20px;
    font-family: var(--wp--preset--font-family--sans, 'DM Sans', sans-serif);
}

.basuto-key-facts__row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #E5E0D8;
    font-size: 14px;
    line-height: 1.5;
}

.basuto-key-facts__row:last-of-type {
    border-bottom: none;
}

.basuto-key-facts__label {
    font-weight: 600;
    color: #2A2D2B;
}

.basuto-key-facts__value {
    color: #666;
    text-align: right;
}

/* ── Key Facts Horizontal Bar ── */
.basuto-facts-bar {
    display: flex;
    justify-content: center;
    background: #fff;
    border-top: 1px solid #E5E0D8;
    border-bottom: 1px solid #E5E0D8;
}

.basuto-facts-bar__item {
    flex: 1;
    text-align: center;
    padding: 20px 16px;
    border-right: 1px solid #E5E0D8;
}

.basuto-facts-bar__item:last-child {
    border-right: none;
}

.basuto-facts-bar__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2A2D2B;
    margin-bottom: 4px;
    font-family: var(--wp--preset--font-family--sans, 'DM Sans', sans-serif);
}

.basuto-facts-bar__value {
    display: block;
    font-size: 14px;
    color: #666;
}

@media (max-width: 600px) {
    .basuto-facts-bar {
        flex-direction: column;
    }
    .basuto-facts-bar__item {
        border-right: none;
        border-bottom: 1px solid #E5E0D8;
    }
    .basuto-facts-bar__item:last-child {
        border-bottom: none;
    }
}

/* ── Review Cards (dark background upgrade) ── */
.basuto-reviews {
    background: #2A2D2B;
    padding: 60px 0;
}

.basuto-reviews .wp-block-column {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 32px 28px;
}

.basuto-reviews blockquote,
.basuto-reviews .review-text {
    font-family: var(--wp--preset--font-family--serif, 'Cormorant Garamond', serif);
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.basuto-reviews .review-stars {
    color: var(--wp--preset--color--gold, #C5A96A);
    letter-spacing: 0.15em;
}

.basuto-reviews .review-author {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 16px;
}

/* ── CTA Strip (refined) ── */
.basuto-cta-strip {
    padding: 40px 0 !important;
}

.basuto-cta-strip .wp-block-button__link {
    letter-spacing: 0.08em;
    font-size: 14px;
}

/* ── Process Steps ── */
.basuto-process-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
}

.basuto-process-step__number {
    font-family: var(--wp--preset--font-family--serif, 'Cormorant Garamond', serif);
    font-size: 3rem;
    color: var(--wp--preset--color--forest, #4A5E52);
    line-height: 1;
    margin-bottom: 16px;
}

.basuto-process-step__title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
    font-family: var(--wp--preset--font-family--sans, 'DM Sans', sans-serif);
}

.basuto-process-step__text {
    font-size: 15px;
    line-height: 1.7;
    color: #666;
}

@media (max-width: 600px) {
    .basuto-process-steps {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

/* ==========================================================================
   Service Page Layout
   Two-column grid with sticky Key Facts sidebar on desktop.
   Single column with inline Key Facts card on tablet/mobile.
   Subnav is position:fixed (outside content flow) — managed by JS.
   ========================================================================== */

/* ── Desktop: two-column grid (960px+) ── */
/* The grid has exactly TWO direct children:
   1. .basuto-service-content  — column 1 (all blocks + subnav flow normally)
   2. .basuto-service-sidebar  — column 2 (sticky Key Facts card)
   The subnav is INSIDE the content wrapper at the correct block position.
   It sticks when scrolled to — it does not pin from page load. */
@media (min-width: 960px) {
    .basuto-service-page .entry-content {
        display: grid !important;
        grid-template-columns: 1fr 320px;
        gap: 0 48px;
        align-items: start;
        overflow: visible;
    }

    /* Content wrapper: left column, blocks flow normally inside */
    .basuto-service-page .entry-content > .basuto-service-content {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    /* Sidebar: right column, sticky */
    .basuto-service-page .entry-content > .basuto-service-sidebar {
        grid-column: 2;
        grid-row: 1;
        position: sticky;
        top: 120px;
        align-self: start;
    }

    body.admin-bar.basuto-service-page .entry-content > .basuto-service-sidebar {
        top: 152px;
    }

    /* Override WordPress is-layout-constrained max-width inside content wrapper */
    .basuto-service-content > * {
        max-width: none !important;
    }

    /* Process steps: reflow to single column within the narrower left column */
    .basuto-service-page .basuto-process-steps {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

/* ── Tablet & Mobile: single column (below 960px) ── */
@media (max-width: 959px) {
    .basuto-service-page .entry-content {
        display: block !important;
        /* overflow must stay visible on all axes for position:sticky to work
           inside the content wrapper. iOS Safari has issues with overflow:clip
           breaking sticky. */
        overflow: visible !important;
    }

    .basuto-service-page .entry-content > * {
        max-width: 100%;
    }

    /* Content wrapper: no overflow constraints — sticky subnav needs
       the viewport as the scroll container. */
    .basuto-service-page .basuto-service-content {
        overflow: visible;
    }

    /* Sidebar becomes a full-width inline card */
    .basuto-service-page .entry-content > .basuto-service-sidebar {
        position: static;
        margin: 32px 20px;
    }
}

/* ── Small mobile (below 480px) ── */
@media (max-width: 480px) {
    .basuto-service-page .entry-content > .basuto-service-sidebar {
        margin: 24px 16px;
    }

    .basuto-key-facts {
        padding: 24px 20px;
    }

    .basuto-service-sidebar .basuto-key-facts__cta {
        padding: 12px 16px;
        font-size: 12px;
    }
}

/* ── Key Facts card — Service page sidebar override (dark theme) ──
   Scoped to .basuto-service-sidebar so it only applies in the
   service page sidebar context. Base (light) styles at line ~184. */
.basuto-service-sidebar .basuto-key-facts {
    background: #2A2D2B;
    border: none;
    border-radius: 12px;
}

.basuto-service-sidebar .basuto-key-facts__heading {
    font-size: 11px;
    letter-spacing: 2px;
    color: #C5A96A;
}

.basuto-service-sidebar .basuto-key-facts__row {
    align-items: baseline;
    border-bottom-color: #3A3D3B;
}

.basuto-service-sidebar .basuto-key-facts__label {
    font-size: 13px;
    color: #ffffff;
    font-family: var(--wp--preset--font-family--sans, 'DM Sans', sans-serif);
}

.basuto-service-sidebar .basuto-key-facts__value {
    font-size: 13px;
    color: #B8B5B0;
    font-family: var(--wp--preset--font-family--sans, 'DM Sans', sans-serif);
}

.basuto-service-sidebar .basuto-key-facts__actions {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.basuto-service-sidebar .basuto-key-facts__cta {
    display: block;
    text-align: center;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    font-family: var(--wp--preset--font-family--sans, 'DM Sans', sans-serif);
    transition: transform 200ms ease, box-shadow 200ms ease;
}

@media (hover: hover) {
    .basuto-service-sidebar .basuto-key-facts__cta:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }
}

.basuto-service-sidebar .basuto-key-facts__cta--primary {
    background: #4A5E52;
    color: #ffffff;
}

.basuto-service-sidebar .basuto-key-facts__cta--secondary {
    background: transparent;
    color: #ffffff;
    border: 1px solid #ffffff;
}
