/* ======================
   WAB BLOG — MAIN STYLESHEET v2.0
   Calibrated to Figma design export.
   All sizes/spacing from design, all colors via CSS vars.
   ====================== */


/* ======================
   BASE & VARIABLES
   ====================== */
:root {
    --wab-primary: #12a5e9;
    --wab-accent: #6cc7f1;
    --wab-success: #00d492;
    --wab-bg: #ffffff;

    --wab-hero-title-color: #ffffff;
    --wab-hero-title-size: clamp(36px, 3.38vw + 0.5rem, 52px);
    --wab-hero-content-width: 833px;

    --wab-h2-color: #374151;
    --wab-h3-color: #374151;
    --wab-h4-color: #374151;
    --wab-h5-color: #4b5563;
    --wab-h6-color: #6b7280;
    --wab-p-color: #374151;

    --wab-h2-size: clamp(24px, 1.95vw + 0.5rem, 30px);
    --wab-h3-size: clamp(20px, 1.63vw + 0.5rem, 25px);
    --wab-h4-size: clamp(17px, 1.43vw + 0.5rem, 22px);
    --wab-h5-size: clamp(14px, 1.17vw + 0.5rem, 18px);
    --wab-h6-size: clamp(12px, 1.04vw + 0.5rem, 16px);
    --wab-p-size: clamp(16px, 1.17vw + 0.5rem, 18px);

    --wab-content-width: 640px;
    --wab-wide-width: 920px;

    --wab-gray-50: #fafaf9;
    --wab-gray-100: #f3f4f6;
    --wab-gray-200: #e5e7eb;
    --wab-gray-300: #d7d9dc;
    --wab-gray-400: #9ca3af;
    --wab-gray-500: #6b7280;
    --wab-gray-600: #4b5563;
    --wab-gray-700: #374151;
    --wab-gray-800: #1f2937;
    --wab-gray-900: #111827;

    --wab-radius: 16px;
    --wab-radius-sm: 6px;
    --wab-radius-md: 14px;
    --wab-transition: 0.3s ease;
}


/* ======================
   HERO SECTION
   Figma: full-width image, title 52px bold centered,
   meta pill below with dots between items.
   ====================== */
.wab-hero {
    position: relative;
    width: 100%;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    background-image: var(--wab-hero-bg, none);
    background-size: cover;
    background-position: center;
    background-color: var(--wab-gray-900);
    overflow: hidden;
}

.wab-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.75) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
    z-index: 1;
}

.wab-hero__content {
    position: relative;
    z-index: 2;
    max-width: var(--wab-hero-content-width);
    width: 100%;
    text-align: center;
}

/* Figma: 52px, bold, centered */
.wab-hero__title {
    font-size: var(--wab-hero-title-size);
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 20px;
    text-wrap: balance;
    color: var(--wab-hero-title-color);
}

/* Figma: pill with bg image, 16px text, opacity 0.7 */
.wab-hero__meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 400;
    color: #fff;
    background-color: rgba(30, 30, 30, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 8px 20px;
    opacity: 0.7;
}

.wab-hero__meta a,
.wab-hero__meta span,
.wab-hero__meta time {
    color: #fff;
    text-decoration: none;
}

.wab-hero__sep {
    width: 5px;
    height: 5px;
    background-color: #fff;
    border-radius: 50%;
    display: inline-block;
    opacity: 0.7;
    flex-shrink: 0;
}

.wab-hero__meta-link {
    color: #fff !important;
    text-decoration: none;
    transition: opacity var(--wab-transition);
}

.wab-hero__meta-link:hover {
    opacity: 0.8;
}


/* ======================
   TOC WRAPPER — FIXED OVERLAY
   ====================== */
.wab-toc-wrapper {
    position: fixed;
    left: 0;
    width: 100%;
    z-index: 998;
    background: var(--wab-bg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: none;
    pointer-events: auto;
    will-change: transform;
    transition: transform 0.3s ease;
}

.wab-toc-wrapper__inner {
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
}

.wab-toc-nav__list {
    list-style: none;
    margin: 0;
    padding: 10px 0;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    gap: 20px;
    scrollbar-width: none;
}

.wab-toc-nav__list::-webkit-scrollbar {
    display: none;
}

/* Figma: 15px, normal weight */
.wab-toc-nav__link {
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
    color: var(--wab-gray-400);
    transition: color var(--wab-transition);
    padding: 4px 0;
}

.wab-toc-nav__link:hover {
    color: var(--wab-primary);
}

.wab-toc-nav__link.is-active {
    color: var(--wab-gray-700);
}

.wab-toc-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--wab-gray-200);
}

.wab-toc-progress__bar {
    height: 100%;
    width: 0%;
    background: var(--wab-primary);
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
}

@media (max-width: 768px) {
    .wab-toc-wrapper {
        display: none !important;
    }
}


/* ======================
   ARTICLE CONTENT
   Figma: content 640px, body 18px/30px, h2 30px/40px
   ====================== */
.wab-article {
    padding: 48px 24px 80px;
    overflow: visible; /* Required for sticky and full-width blocks */
    container-type: inline-size;
}

.wab-article__content {
    max-width: var(--wab-content-width);
    margin: 0 auto;
    font-size: var(--wab-p-size);
    line-height: 30px;
    color: var(--wab-p-color);
    position: relative;
    overflow: visible; /* Required for position:sticky in children */
}

/* ── Block spacing — typographic scale ──
   Implements spacing logic inspired by WordPress is-layout-flow
   with a design-grade typographic multiplier system.
   
   Three admin settings control the rhythm:
   • Block Spacing (rem)     — base gap between all blocks
   • H2 Multiplier (×)      — space above section headings (h2)
   • H3–H6 Multiplier (×)   — space above subsection headings (h3–h6)
   
   Only direct children are affected — headings inside custom blocks
   (timeline, accordion, quote-card, etc.) are not touched. */
.wab-article__content > :is(*, div) {
    margin-block-start: var(--wab-block-margin, 1.5rem) !important;
    margin-block-end: 0 !important;
}
.wab-article__content > :is(h2) {
    margin-block-start: calc(var(--wab-block-margin, 1.5rem) * var(--wab-heading-section-mult, 2.5)) !important;
}
.wab-article__content > :is(h3, h4, h5, h6) {
    margin-block-start: calc(var(--wab-block-margin, 1.5rem) * var(--wab-heading-sub-mult, 1.5)) !important;
}
.wab-article__content > :first-child:first-child {
    margin-block-start: 0 !important;
}
.wab-article__content > :last-child:last-child {
    margin-block-end: 0 !important;
}
/* WAB custom blocks — visual accent elements get their own multiplier
   to breathe more within the content flow.
   Uses attribute selectors on direct children only — inner elements unaffected. */
.wab-article__content > [class*="wab-"]:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6),
.wab-article__content > [class*="wp-block-wab-"],
.wab-article__content > [class*="is-style-wab-"] {
    margin-block-start: calc(var(--wab-block-margin, 1.5rem) * var(--wab-block-mult, 2)) !important;
}

/* Allow blocks to break out of content width.
   Uses the reliable position:relative + negative-margin-vw approach
   that works regardless of parent centering or padding offsets. */

/* ─── WIDE alignment (global) ─── */
.wab-article__content .alignwide {
    position: relative;
    width: var(--wab-wide-width);
    max-width: var(--wab-wide-width);
    left: 50%;
    transform: translateX(-50%);
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
}

/* ─── FULL alignment (global) ─── */
.wab-article__content .alignfull {
    position: relative;
    width: 100vw;
    max-width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    margin-left: 0;
    margin-right: 0;
    clear: both;
    box-sizing: border-box;
}

/* ─── Scroll Video & Sticky Stack: no special overrides needed ─── */
/* The global .alignwide/.alignfull rules above handle positioning.
   The outer wrapper gets position:relative + left:50% + translateX(-50%).
   The inner sticky/section elements stay at width:100% of their parent.
   The JS expandOnScroll effect works on top by using getBoundingClientRect(). */

/* WP Layout system: blocks with inline max-width from settings. */
.wab-article__content > .wp-block-group,
.wab-article__content > .wp-block-columns,
.wab-article__content > .wp-block-cover,
.wab-article__content > .wp-block-media-text,
.wab-article__content > .wab-cta-banner,
.wab-article__content > .wab-comparison,
.wab-article__content > .wab-callout-box,
.wab-article__content > .wab-feature-card,
.wab-article__content > .wab-related,
.wab-article__content > .wp-block-wab-sticky-stack,
.wab-article__content > .wab-scroll-video,
.wab-article__content > .wab-timeline-h {
    max-width: none;
}

/* Blocks with custom inline width — center them */
.wab-article__content > [style*="max-width"]:not(.alignfull):not(.alignwide) {
    margin-left: auto;
    margin-right: auto;
}

/* Allow custom widths wider than content to break out */
.wab-article__content > .has-global-padding,
.wab-article__content > .is-layout-constrained,
.wab-article__content > .is-layout-flow {
    max-width: none;
}

@media (max-width: 1100px) {
    .wab-article__content .alignwide {
        width: 100%;
        max-width: 100%;
        left: auto;
        transform: none;
    }
}

/* Ensure wide/full children of article content can expand */

/* Figma: h2 = 30px, regular weight, line-height 40px */
.wab-article__content > h2,
.wab-article__content > .wp-block-group > h2 {
    font-size: var(--wab-h2-size);
    font-weight: 400;
    line-height: 40px;
    color: var(--wab-h2-color);
    scroll-margin-top: 120px;
}

/* Figma: h3 = 25px, regular weight, line-height 40px */
.wab-article__content > h3,
.wab-article__content > .wp-block-group > h3 {
    font-size: var(--wab-h3-size);
    font-weight: 400;
    line-height: 40px;
    color: var(--wab-h3-color);
}

.wab-article__content > h4,
.wab-article__content > .wp-block-group > h4 {
    font-size: var(--wab-h4-size);
    font-weight: 400;
    color: var(--wab-h4-color);
}

.wab-article__content > h5,
.wab-article__content > .wp-block-group > h5 {
    font-size: var(--wab-h5-size);
    font-weight: 400;
    color: var(--wab-h5-color);
}

.wab-article__content > h6,
.wab-article__content > .wp-block-group > h6 {
    font-size: var(--wab-h6-size);
    font-weight: 400;
    color: var(--wab-h6-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Figma: 18px, line-height 30px */
.wab-article__content p {
    color: var(--wab-p-color);
    font-size: var(--wab-p-size);
    line-height: 30px;
}

/* Figma: underline links, same color as text */
.wab-article__content a {
    color: var(--wab-p-color);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--wab-transition);
}

.wab-article__content a:hover {
    color: var(--wab-primary);
}

/* Images — wide width (only direct content images, NOT inside custom blocks) */
.wab-article .wab-article__content > .wp-block-image img,
.wab-article .wab-article__content > p > img,
.wab-article .wab-article__content > img {
    max-width: var(--wab-wide-width);
    width: var(--wab-wide-width);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    height: auto;
    border-radius: var(--wab-radius);
    margin-top: 1em;
    margin-bottom: 1em;
}

/* Reset: images inside custom blocks stay normal */
.wab-related img,
.wab-cta-banner img,
.wab-callout-box img,
.wab-feature-card img,
.wab-comparison img,
.wab-timeline-h img,
.wab-bio img,
.wab-steps img {
    max-width: 100%;
    width: auto;
    position: static;
    left: auto;
    transform: none;
}

/* Figures — wide width */
.wab-article .wab-article__content > figure,
.wab-article .wab-article__content > .wp-block-image {
    max-width: var(--wab-wide-width);
    width: var(--wab-wide-width);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.wab-article .wab-article__content figure img {
    width: 100%;
    position: static;
    left: auto;
    transform: none;
}

.wab-article .wab-article__content figcaption {
    text-align: center;
    font-size: 0.85rem;
    color: var(--wab-gray-500);
    margin-top: 8px;
}

/* Figma: blockquote = centered, primary color, 36px, line-height 49.5px */
/* Uses high specificity + !important to override any theme (Astra, GeneratePress, Divi, etc.) */
.wab-article .wab-article__content blockquote,
.wab-article .wab-article__content .wp-block-quote {
    max-width: var(--wab-wide-width);
    width: var(--wab-wide-width);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    padding: 26px 0 !important;
    background: none !important;
    border: none !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: none !important;
    font-style: normal !important;
    font-size: 36px;
    line-height: 49.5px;
    color: var(--wab-primary);
    /* Reset browser & theme defaults, then apply WAB spacing */
    margin-block-start: var(--wab-block-margin, 1.5rem) !important;
    margin-block-end: 0 !important;
    margin-inline-start: 0 !important;
    margin-inline-end: 0 !important;
    padding-inline-start: 0 !important;
    padding-inline-end: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: center;
    box-shadow: none !important;
    outline: none !important;
}

/* Figma: thin gradient line above/below quote */
.wab-article .wab-article__content blockquote::before,
.wab-article .wab-article__content blockquote::after,
.wab-article .wab-article__content .wp-block-quote::before,
.wab-article .wab-article__content .wp-block-quote::after {
    content: '' !important;
    display: block !important;
    width: 48px;
    height: 2px;
    margin: 0 auto 26px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--wab-gray-300) 50%,
        transparent 100%
    ) !important;
    position: static !important;
    border: none !important;
    left: auto !important;
    top: auto !important;
}

.wab-article .wab-article__content blockquote::after,
.wab-article .wab-article__content .wp-block-quote::after {
    margin: 26px auto 0;
}

.wab-article .wab-article__content blockquote p,
.wab-article .wab-article__content .wp-block-quote p {
    color: var(--wab-primary);
    font-size: inherit;
    line-height: inherit;
    margin: 0;
    padding: 0 !important;
    border: none !important;
}

.wab-article .wab-article__content blockquote p:last-child,
.wab-article .wab-article__content .wp-block-quote p:last-child {
    margin-bottom: 0;
}

/* Figma: cite = 11px, letter-spacing 2.2px, uppercase, dark */
.wab-article .wab-article__content blockquote cite,
.wab-article .wab-article__content .wp-block-quote cite {
    display: block;
    font-style: normal;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 2.2px;
    color: var(--wab-gray-800);
    margin-top: 27px;
}

/* ── Reset blockquote inside WAB wrapper blocks — wrapper handles all styling ──
   Comprehensive reset to defeat any WordPress theme (Astra, Divi, OceanWP,
   GeneratePress, Flavor, Flavor, Flavor, etc.). The wrapper block controls
   its own layout; the inner blockquote must be completely inert. */
.wab-cta-banner blockquote,
.wab-article .wab-article__content .wab-quote-card blockquote,
.wab-quote-card blockquote,
.wab-cta-banner .wp-block-quote,
.wab-article .wab-article__content .wab-quote-card .wp-block-quote,
.wab-quote-card .wp-block-quote {
    all: unset !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-left: none !important;
    border-right: none !important;
    background: none !important;
    font-style: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
    position: static !important;
    left: auto !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    text-align: inherit !important;
    box-shadow: none !important;
    outline: none !important;
    quotes: none !important;
}
.wab-cta-banner blockquote::before,
.wab-cta-banner blockquote::after,
.wab-article .wab-article__content .wab-quote-card blockquote::before,
.wab-article .wab-article__content .wab-quote-card blockquote::after,
.wab-quote-card blockquote::before,
.wab-quote-card blockquote::after,
.wab-cta-banner .wp-block-quote::before,
.wab-cta-banner .wp-block-quote::after,
.wab-article .wab-article__content .wab-quote-card .wp-block-quote::before,
.wab-article .wab-article__content .wab-quote-card .wp-block-quote::after,
.wab-quote-card .wp-block-quote::before,
.wab-quote-card .wp-block-quote::after {
    content: none !important;
    display: none !important;
}

.wab-article .wab-article__content .wab-quote-card blockquote p,
.wab-quote-card blockquote p,
.wab-article .wab-article__content .wab-quote-card .wp-block-quote p,
.wab-quote-card .wp-block-quote p {
    font-size: inherit !important;
    line-height: inherit !important;
    font-style: inherit !important;
    color: inherit !important;
    margin: 0 0 0.5em 0 !important;
    padding: 0 !important;
    border: none !important;
}
.wab-article .wab-article__content .wab-quote-card blockquote p:last-child,
.wab-quote-card blockquote p:last-child,
.wab-article .wab-article__content .wab-quote-card .wp-block-quote p:last-child,
.wab-quote-card .wp-block-quote p:last-child {
    margin-bottom: 0 !important;
}

/* Video embeds — wide */
.wab-article .wab-article__content iframe,
.wab-article .wab-article__content .wp-block-embed {
    max-width: var(--wab-wide-width);
    width: var(--wab-wide-width);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* Figma: lists with 32px left indent, 10px gap between items */
.wab-article .wab-article__content ul,
.wab-article .wab-article__content ol {
    margin: 0 0 1.5em;
    padding-left: 32px;
}

.wab-article .wab-article__content li {
    margin-bottom: 10px;
    line-height: 30px;
}

/* Figma: bold key terms in lists */
.wab-article .wab-article__content li strong {
    font-weight: 700;
}

.wab-article .wab-article__content code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    background: var(--wab-gray-100);
    padding: 2px 6px;
    border-radius: 3px;
}

.wab-article .wab-article__content pre {
    background: var(--wab-gray-900);
    color: var(--wab-gray-100);
    padding: 24px;
    border-radius: var(--wab-radius);
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.6;
}

.wab-article .wab-article__content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.wab-article .wab-article__content hr {
    border: none;
    height: 1px;
    background: var(--wab-gray-200);
}

@media (max-width: 1100px) {
    .wab-article .wab-article__content img,
    .wab-article .wab-article__content figure,
    .wab-article .wab-article__content blockquote,
    .wab-article .wab-article__content .wp-block-quote,
    .wab-article .wab-article__content iframe,
    .wab-article .wab-article__content .wp-block-embed {
        max-width: 100%;
        width: 100%;
        margin-left: 0;
    }
}


/* ======================
   DARK MODE TOGGLE
   ====================== */
.wab-dark-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--wab-gray-200);
    background: var(--wab-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transition: background var(--wab-transition), border-color var(--wab-transition), transform var(--wab-transition);
}

.wab-dark-toggle:hover {
    transform: scale(1.08);
}

.wab-dark-toggle__sun { display: block; }
.wab-dark-toggle__moon { display: none; }


/* ======================
   ASTRA THEME FIX
   Astra sets max-width on .ast-container at multiple specificity
   levels and media queries. We override each one.
   ====================== */
.ast-container:has(.wab-hero),
.ast-container:has(#wab-article) {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    display: block !important;
}

@media (min-width: 922px) {
    .ast-narrow-container .site-content > .ast-container:has(.wab-hero),
    .ast-narrow-container .site-content > .ast-container:has(#wab-article) {
        max-width: 100% !important;
    }
    .site-content .ast-container:has(.wab-hero),
    .site-content .ast-container:has(#wab-article) {
        display: block !important;
    }
}
