/**
 * Betterly public-site presentation layer.
 *
 * Important: avoid broad selectors such as button {}, input {}, table {}, .card {}
 * so third-party and product-plugin UIs remain isolated.
 */

:root {
    --betterly-blue: #2563EB;
    --betterly-purple: #7C3AED;
    --betterly-ink: #0B132B;
    --betterly-slate: #64748B;
    --betterly-surface: #F5F6FA;
    --betterly-success: #10B981;
    --betterly-warning: #F59E0B;
    --betterly-info: #06B6D4;
    --betterly-accent: #EC4899;
    --betterly-indigo: #6366F1;
    --betterly-border: #E2E8F0;
    --betterly-shadow-sm: 0 4px 16px rgba(15, 23, 42, .05);
    --betterly-shadow-md: 0 12px 32px rgba(15, 23, 42, .08);
    --betterly-radius-sm: 8px;
    --betterly-radius-md: 12px;
    --betterly-radius-lg: 16px;
    --betterly-radius-xl: 24px;
    --betterly-container: 1240px;
}

.betterly-site {
    direction: rtl;
    color: var(--betterly-ink);
}

.betterly-site *,
.betterly-site *::before,
.betterly-site *::after {
    box-sizing: border-box;
}

.betterly-shell {
    width: min(calc(100% - 64px), var(--betterly-container));
    margin-inline: auto;
}

.betterly-section {
    padding-block: 96px;
}

.betterly-surface {
    background: var(--betterly-surface);
}

.betterly-card {
    border: 1px solid var(--betterly-border);
    border-radius: var(--betterly-radius-lg);
    background: #fff;
}

.betterly-card--elevated {
    box-shadow: var(--betterly-shadow-sm);
}

.betterly-btn .wp-block-button__link,
.wp-block-button.betterly-btn .wp-block-button__link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--betterly-radius-md);
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.betterly-btn--primary .wp-block-button__link {
    background: linear-gradient(135deg, var(--betterly-blue), var(--betterly-purple));
    color: #fff;
}

.betterly-btn--secondary .wp-block-button__link {
    background: #fff;
    color: var(--betterly-blue);
    border: 1px solid rgba(37, 99, 235, .35);
}

.betterly-btn .wp-block-button__link:hover {
    transform: translateY(-1px);
    box-shadow: var(--betterly-shadow-sm);
}

.betterly-btn .wp-block-button__link:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .25);
    outline-offset: 3px;
}

.betterly-muted {
    color: var(--betterly-slate);
}

.betterly-gradient-text {
    background: linear-gradient(135deg, var(--betterly-blue), var(--betterly-purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.betterly-header {
    position: relative;
    z-index: 30;
    border-bottom: 1px solid rgba(226, 232, 240, .75);
    background: rgba(255, 255, 255, .94);
}

.betterly-footer {
    background: var(--betterly-ink);
    color: #fff;
}

.betterly-footer a {
    color: rgba(255, 255, 255, .82);
}

@media (max-width: 1023px) {
    .betterly-shell {
        width: min(calc(100% - 48px), var(--betterly-container));
    }

    .betterly-section {
        padding-block: 72px;
    }
}

@media (max-width: 639px) {
    .betterly-shell {
        width: calc(100% - 32px);
    }

    .betterly-section {
        padding-block: 56px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .betterly-site *,
    .betterly-site *::before,
    .betterly-site *::after {
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* v0.2 component layer */
.betterly-header .wp-block-navigation__submenu-container {
    min-width: 300px;
    padding: 12px;
    border: 1px solid var(--betterly-border);
    border-radius: var(--betterly-radius-lg);
    box-shadow: var(--betterly-shadow-md);
    background: #fff;
}

.betterly-header .wp-block-navigation-item__content {
    border-radius: 10px;
}

.betterly-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
    padding: 10px 12px;
}

.betterly-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover {
    background: var(--betterly-surface);
}

.betterly-section--compact {
    padding-block: 64px;
}

.betterly-center {
    text-align: center;
}

.betterly-eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding-inline: 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .08);
    color: var(--betterly-blue);
    font-size: 13px;
    font-weight: 700;
}

.betterly-grid-2,
.betterly-grid-3,
.betterly-grid-4 {
    display: grid;
    gap: 24px;
}

.betterly-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.betterly-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.betterly-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.betterly-feature-card,
.betterly-solution-card,
.betterly-pricing-card,
.betterly-membership-card,
.betterly-contact-card,
.betterly-security-card {
    min-height: 100%;
    padding: 28px;
    border: 1px solid var(--betterly-border);
    border-radius: var(--betterly-radius-lg);
    background: #fff;
}

.betterly-solution-card h3,
.betterly-feature-card h3,
.betterly-pricing-card h3,
.betterly-membership-card h3,
.betterly-contact-card h3,
.betterly-security-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.betterly-solution-card p,
.betterly-feature-card p,
.betterly-membership-card p,
.betterly-contact-card p,
.betterly-security-card p {
    color: var(--betterly-slate);
}

.betterly-solution-card a,
.betterly-feature-card a,
.betterly-contact-card a {
    font-weight: 700;
    text-decoration: none;
}

.betterly-product-frame {
    overflow: hidden;
    border: 1px solid var(--betterly-border);
    border-radius: var(--betterly-radius-xl);
    background:
        radial-gradient(circle at 20% 20%, rgba(37,99,235,.08), transparent 32%),
        radial-gradient(circle at 80% 80%, rgba(124,58,237,.08), transparent 32%),
        #fff;
    box-shadow: var(--betterly-shadow-sm);
}

.betterly-product-placeholder {
    min-height: 360px;
    display: grid;
    place-items: center;
    color: var(--betterly-slate);
    padding: 32px;
    text-align: center;
}

.betterly-enterprise-band {
    border-radius: var(--betterly-radius-xl);
    background: var(--betterly-ink);
    color: #fff;
    padding: clamp(32px, 6vw, 64px);
}

.betterly-enterprise-band h2,
.betterly-enterprise-band h3,
.betterly-enterprise-band p {
    color: inherit;
}

.betterly-price {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 800;
    line-height: 1.2;
    color: var(--betterly-ink);
}

.betterly-pricing-card--featured {
    border-color: rgba(124, 58, 237, .55);
    box-shadow: 0 16px 42px rgba(124, 58, 237, .12);
}

.betterly-pricing-badge {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(124, 58, 237, .1);
    color: var(--betterly-purple);
    font-size: 12px;
    font-weight: 700;
}

.betterly-trust-band {
    border: 1px solid var(--betterly-border);
    border-radius: var(--betterly-radius-xl);
    background: linear-gradient(135deg, rgba(37,99,235,.05), rgba(124,58,237,.06));
    padding: clamp(28px, 5vw, 48px);
}

.betterly-faq .wp-block-details {
    margin: 0;
    padding: 16px 20px;
    border: 1px solid var(--betterly-border);
    border-radius: var(--betterly-radius-md);
    background: #fff;
}

.betterly-faq .wp-block-details + .wp-block-details {
    margin-top: 10px;
}

.betterly-faq summary {
    cursor: pointer;
    font-weight: 700;
}

.betterly-article-grid .wp-block-post-template {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.betterly-article-card {
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--betterly-border);
    border-radius: var(--betterly-radius-lg);
    background: #fff;
}

.betterly-article-card .wp-block-post-featured-image {
    margin: 0;
}

.betterly-article-card__body {
    padding: 22px;
}

.betterly-article-card__body .wp-block-post-title {
    margin-block: 8px 12px;
}

.betterly-legal-note {
    padding: 20px 24px;
    border-inline-start: 4px solid var(--betterly-warning);
    border-radius: var(--betterly-radius-md);
    background: #fffbeb;
}

@media (max-width: 1023px) {
    .betterly-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .betterly-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .betterly-article-grid .wp-block-post-template { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 782px) {
    .betterly-header__actions {
        display: none !important;
    }
}

@media (max-width: 639px) {
    .betterly-grid-2,
    .betterly-grid-3,
    .betterly-grid-4,
    .betterly-article-grid .wp-block-post-template {
        grid-template-columns: 1fr;
    }

    .betterly-section--compact {
        padding-block: 48px;
    }

    .betterly-feature-card,
    .betterly-solution-card,
    .betterly-pricing-card,
    .betterly-membership-card,
    .betterly-contact-card,
    .betterly-security-card {
        padding: 22px;
    }
}

/* v0.3 accessibility + dynamic header actions */
.betterly-skip-link {
    position: fixed;
    inset-inline-start: 16px;
    top: 12px;
    z-index: 10000;
    padding: 10px 14px;
    border-radius: var(--betterly-radius-md);
    background: var(--betterly-ink);
    color: #fff;
    text-decoration: none;
    transform: translateY(-160%);
}
.betterly-skip-link:focus { transform: translateY(0); }
.betterly-header-actions { display:flex; gap:10px; align-items:center; flex-wrap:nowrap; }
.betterly-header-actions a { min-height:44px; display:inline-flex; align-items:center; justify-content:center; padding:0 16px; border-radius:var(--betterly-radius-md); text-decoration:none; font-weight:700; }
.betterly-header-actions__login { color:var(--betterly-blue); border:1px solid rgba(37,99,235,.3); background:#fff; }
.betterly-header-actions__cta { color:#fff; background:linear-gradient(135deg,var(--betterly-blue),var(--betterly-purple)); }
.betterly-header-actions a:focus-visible { outline:3px solid rgba(37,99,235,.25); outline-offset:3px; }
@media (max-width: 781px) { .betterly-header-actions { display:none; } }

/* =========================================================
 * v0.4.0 — Production assembly / typography / position polish
 * Scope: Betterly theme only. Product-plugin UI remains isolated.
 * ======================================================= */

:root {
    --betterly-font-fa: Dana, IRANSansX, IRANSans, Tahoma, Arial, sans-serif;
    --betterly-font-latin: Poppins, Arial, sans-serif;
    --betterly-header-height: 76px;
    --betterly-section-space: 80px;
    --betterly-section-space-compact: 56px;
}

body.betterly-theme-active,
body.betterly-theme-active .betterly-site,
.editor-styles-wrapper {
    font-family: var(--betterly-font-fa);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body.betterly-theme-active .betterly-site p,
body.betterly-theme-active .betterly-site li,
.editor-styles-wrapper p,
.editor-styles-wrapper li {
    line-height: 1.9;
}

body.betterly-theme-active .betterly-site h1,
body.betterly-theme-active .betterly-site h2,
body.betterly-theme-active .betterly-site h3,
body.betterly-theme-active .betterly-site h4,
.editor-styles-wrapper h1,
.editor-styles-wrapper h2,
.editor-styles-wrapper h3,
.editor-styles-wrapper h4 {
    letter-spacing: -.018em;
}

.betterly-section {
    padding-block: var(--betterly-section-space);
}

.betterly-section--compact {
    padding-block: var(--betterly-section-space-compact);
}

/* Header: stable three-zone desktop layout: brand / navigation / actions. */
.betterly-header {
    position: sticky;
    top: var(--wp-admin--admin-bar--height, 0px);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.betterly-header__inner {
    min-height: var(--betterly-header-height);
    display: grid !important;
    grid-template-columns: minmax(150px, auto) minmax(0, 1fr) minmax(190px, auto);
    gap: clamp(20px, 3vw, 44px);
    align-items: center !important;
    padding-block: 10px !important;
}

.betterly-brand {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.betterly-brand .wp-block-site-logo {
    margin: 0;
    line-height: 0;
}

.betterly-brand .wp-block-site-title {
    margin: 0;
    font-family: var(--betterly-font-latin);
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.betterly-brand .wp-block-site-title a {
    color: var(--betterly-ink);
    text-decoration: none;
}

/* Hide textual fallback when an actual site logo exists. */
.betterly-brand:has(.custom-logo) .wp-block-site-title {
    display: none;
}

.betterly-header .wp-block-navigation {
    width: 100%;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
}

.betterly-header .wp-block-navigation__container {
    gap: clamp(16px, 2vw, 28px);
}

.betterly-header .wp-block-navigation-item__content {
    padding-block: 8px;
    color: var(--betterly-ink);
}

.betterly-header-actions {
    justify-content: flex-end;
    gap: 10px;
}

.betterly-header-actions a {
    padding-inline: 18px;
    white-space: nowrap;
}

/* Home hero: tighter first fold, balanced text/visual columns. */
.betterly-front-page .wp-block-post-content > .betterly-section:first-child {
    padding-top: clamp(56px, 6vw, 88px);
    padding-bottom: clamp(48px, 5vw, 72px);
}

.betterly-front-page .wp-block-post-content > .betterly-section:first-child > .wp-block-columns {
    gap: clamp(44px, 6vw, 88px);
    align-items: center !important;
}

.betterly-front-page .wp-block-post-content > .betterly-section:first-child > .wp-block-columns > .wp-block-column:first-child {
    flex-basis: 48% !important;
}

.betterly-front-page .wp-block-post-content > .betterly-section:first-child > .wp-block-columns > .wp-block-column:last-child {
    flex-basis: 52% !important;
}

.betterly-front-page .wp-block-post-content > .betterly-section:first-child h1 {
    max-width: 650px;
    margin-top: 0;
    margin-bottom: 18px;
    font-size: clamp(42px, 4.25vw, 64px) !important;
    line-height: 1.35;
}

.betterly-front-page .wp-block-post-content > .betterly-section:first-child .betterly-muted {
    max-width: 610px;
    margin-top: 0;
    margin-bottom: 0;
    font-size: clamp(16px, 1.35vw, 19px) !important;
    line-height: 2;
}

.betterly-front-page .wp-block-post-content > .betterly-section:first-child .wp-block-buttons {
    margin-top: 28px;
    gap: 12px;
}

.betterly-front-page .wp-block-post-content > .betterly-section:first-child .betterly-product-frame {
    width: 100%;
    min-height: clamp(300px, 30vw, 390px);
}

/* Make all product placeholders read like intentional product canvases. */
.betterly-product-placeholder {
    min-height: 330px;
    padding: clamp(24px, 4vw, 40px);
    text-align: center;
}

.betterly-product-placeholder > p {
    max-width: 320px;
    margin: 0 auto;
    color: #94A3B8;
    font-size: 14px;
}

/* Home trust strip: compact, evenly distributed, no dead space. */
.betterly-front-page .wp-block-post-content > .betterly-shell.betterly-card:nth-child(2) {
    display: flex !important;
    align-items: stretch;
    gap: 0;
    padding: 18px 20px !important;
    border-radius: 18px;
}

.betterly-front-page .wp-block-post-content > .betterly-shell.betterly-card:nth-child(2) > p {
    flex: 1 1 0;
    margin: 0;
    padding: 6px clamp(12px, 2vw, 28px);
    text-align: center;
    color: var(--betterly-slate);
    font-size: 14px;
}

.betterly-front-page .wp-block-post-content > .betterly-shell.betterly-card:nth-child(2) > p strong {
    color: var(--betterly-ink);
    font-size: 16px;
}

.betterly-front-page .wp-block-post-content > .betterly-shell.betterly-card:nth-child(2) > p + p {
    border-inline-start: 1px solid var(--betterly-border);
}

/* Solutions: wider-feeling cards, less vertical drag, stronger CTA rhythm. */
.betterly-front-page .betterly-grid-4 {
    gap: 18px;
}

.betterly-front-page .betterly-solution-card {
    min-height: 230px;
    display: flex;
    flex-direction: column;
    padding: 26px 24px;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.betterly-front-page .betterly-solution-card:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, .28);
    box-shadow: var(--betterly-shadow-sm);
}

.betterly-front-page .betterly-solution-card h3 {
    margin-bottom: 8px;
    font-size: 21px !important;
    line-height: 1.55;
}

.betterly-front-page .betterly-solution-card p {
    margin-top: 0;
    font-size: 14px;
    line-height: 1.9;
}

.betterly-front-page .betterly-solution-card > p:last-child {
    margin-top: auto;
    margin-bottom: 0;
    padding-top: 18px;
}

/* Product showcase: stable 42/58 composition with less vertical whitespace. */
.betterly-front-page .betterly-section--compact .wp-block-columns.are-vertically-aligned-center {
    gap: clamp(40px, 5vw, 72px);
}

.betterly-front-page .betterly-section--compact .wp-block-columns.are-vertically-aligned-center h2 {
    margin-top: 0;
    margin-bottom: 14px;
    line-height: 1.45;
}

/* Enterprise band: compact B2B block with balanced internal columns. */
.betterly-enterprise-band {
    padding: clamp(40px, 5vw, 58px) clamp(36px, 6vw, 70px);
}

.betterly-enterprise-band .wp-block-columns {
    gap: clamp(44px, 6vw, 84px);
}

.betterly-enterprise-band h2 {
    margin-top: 0;
    margin-bottom: 12px;
}

.betterly-enterprise-band p {
    max-width: 520px;
    margin-bottom: 0;
    color: #CBD5E1;
}

.betterly-enterprise-band ul {
    margin-top: 0;
    margin-bottom: 22px;
    padding-inline-start: 20px;
    line-height: 2;
}

/* Final CTA: stronger closing moment, controlled distance to footer. */
.betterly-front-page .wp-block-post-content > .betterly-shell.betterly-card:last-child {
    margin-top: 24px;
    margin-bottom: 0;
    padding: clamp(42px, 5vw, 58px) !important;
    border-radius: 20px;
}

.betterly-front-page .wp-block-post-content > .betterly-shell.betterly-card:last-child h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-family: var(--betterly-font-latin);
    font-size: clamp(28px, 3vw, 40px) !important;
    line-height: 1.25;
}

/* Footer: remove list bullets and restore a clear RTL information hierarchy. */
.betterly-footer {
    margin-top: 0;
}

.betterly-footer__inner {
    padding-top: 56px !important;
    padding-bottom: 26px !important;
}

.betterly-footer__grid {
    gap: clamp(32px, 5vw, 72px) !important;
    align-items: flex-start;
}

.betterly-footer__brand .wp-block-site-title {
    margin: 0;
    font-family: var(--betterly-font-latin);
    font-size: 26px;
    font-weight: 700;
}

.betterly-footer__brand .wp-block-site-title a {
    color: #fff;
    text-decoration: none;
}

.betterly-footer__brand:has(.custom-logo) .wp-block-site-title {
    display: none;
}

.betterly-footer h4 {
    margin-top: 0;
    margin-bottom: 14px;
    color: #fff;
    font-weight: 700;
}

.betterly-footer ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.betterly-footer li {
    margin: 0 0 8px;
    line-height: 1.75;
}

.betterly-footer a {
    text-decoration: none;
}

.betterly-footer a:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.betterly-footer .wp-block-separator {
    margin-top: 36px;
    margin-bottom: 22px;
    opacity: .45;
}

/* Generic page rhythm: all approved pages become calmer without changing content. */
.betterly-site > .wp-block-post-content > .betterly-shell + .betterly-shell,
.betterly-site > .wp-block-post-content > .betterly-section + .betterly-section {
    margin-top: 0;
}

.betterly-site .betterly-section--compact > h2:first-child,
.betterly-site .betterly-section--compact > .wp-block-heading:first-child {
    margin-top: 0;
    margin-bottom: 28px;
}

@media (max-width: 1023px) {
    :root {
        --betterly-section-space: 64px;
        --betterly-section-space-compact: 48px;
    }

    .betterly-header__inner {
        grid-template-columns: auto 1fr auto;
        gap: 18px;
    }

    .betterly-header .wp-block-navigation__container {
        gap: 14px;
    }

    .betterly-front-page .wp-block-post-content > .betterly-section:first-child > .wp-block-columns {
        gap: 42px;
    }

    .betterly-front-page .betterly-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 781px) {
    .betterly-header {
        position: relative;
        top: auto;
    }

    .betterly-header__inner {
        min-height: 68px;
        display: flex !important;
        justify-content: space-between;
        gap: 14px;
    }

    .betterly-brand .wp-block-site-title {
        font-size: 23px;
    }

    .betterly-header .wp-block-navigation {
        width: auto;
        margin-inline-start: auto;
    }

    .betterly-front-page .wp-block-post-content > .betterly-section:first-child > .wp-block-columns {
        flex-direction: column;
        gap: 36px;
    }

    .betterly-front-page .wp-block-post-content > .betterly-section:first-child > .wp-block-columns > .wp-block-column {
        flex-basis: auto !important;
        width: 100%;
    }

    .betterly-front-page .wp-block-post-content > .betterly-section:first-child h1,
    .betterly-front-page .wp-block-post-content > .betterly-section:first-child .betterly-muted {
        max-width: none;
    }

    .betterly-front-page .wp-block-post-content > .betterly-shell.betterly-card:nth-child(2) {
        flex-direction: column;
        padding: 10px 20px !important;
    }

    .betterly-front-page .wp-block-post-content > .betterly-shell.betterly-card:nth-child(2) > p {
        padding-block: 12px;
    }

    .betterly-front-page .wp-block-post-content > .betterly-shell.betterly-card:nth-child(2) > p + p {
        border-inline-start: 0;
        border-top: 1px solid var(--betterly-border);
    }

    .betterly-enterprise-band .wp-block-columns {
        gap: 24px;
    }
}

@media (max-width: 639px) {
    :root {
        --betterly-section-space: 48px;
        --betterly-section-space-compact: 40px;
    }

    .betterly-front-page .wp-block-post-content > .betterly-section:first-child {
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .betterly-front-page .wp-block-post-content > .betterly-section:first-child h1 {
        font-size: clamp(36px, 10vw, 44px) !important;
    }

    .betterly-front-page .betterly-grid-4 {
        grid-template-columns: 1fr;
    }

    .betterly-front-page .betterly-solution-card {
        min-height: auto;
    }

    .betterly-product-placeholder {
        min-height: 260px;
    }

    .betterly-enterprise-band {
        padding: 32px 24px;
    }

    .betterly-front-page .wp-block-post-content > .betterly-shell.betterly-card:last-child {
        padding: 36px 22px !important;
    }

    .betterly-footer__grid {
        gap: 28px !important;
    }
}

/* =========================================================
 * v0.5.0 — Internal page production assembly
 * ======================================================= */
.betterly-site .betterly-hero-actions {
    margin-top: 26px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

body:not(.betterly-front-page) .betterly-site .wp-block-post-content > .betterly-section:first-child {
    padding-top: clamp(54px, 6vw, 82px);
    padding-bottom: clamp(48px, 5vw, 70px);
}

body:not(.betterly-front-page) .betterly-site .wp-block-post-content > .betterly-section:first-child > .wp-block-columns {
    gap: clamp(40px, 6vw, 76px);
    align-items: center !important;
}

body:not(.betterly-front-page) .betterly-site .wp-block-post-content > .betterly-section:first-child h1 {
    margin-top: 0;
    margin-bottom: 16px;
    max-width: 660px;
    font-size: clamp(40px, 4vw, 58px) !important;
    line-height: 1.4;
}

body:not(.betterly-front-page) .betterly-site .wp-block-post-content > .betterly-section:first-child .betterly-muted {
    max-width: 610px;
    margin-top: 0;
    font-size: clamp(16px, 1.25vw, 18px) !important;
}

body:not(.betterly-front-page) .betterly-site .wp-block-post-content > .betterly-section:first-child .betterly-product-preview,
body:not(.betterly-front-page) .betterly-site .wp-block-post-content > .betterly-section:first-child .betterly-product-entry {
    width: 100%;
}

.betterly-site .betterly-feature-card,
.betterly-site .betterly-card,
.betterly-site .betterly-solution-card {
    height: 100%;
}

.betterly-site .betterly-grid-3,
.betterly-site .betterly-grid-4 {
    align-items: stretch;
}

@media (max-width: 781px) {
    body:not(.betterly-front-page) .betterly-site .wp-block-post-content > .betterly-section:first-child > .wp-block-columns {
        flex-direction: column;
        gap: 34px;
    }

    body:not(.betterly-front-page) .betterly-site .wp-block-post-content > .betterly-section:first-child > .wp-block-columns > .wp-block-column {
        width: 100%;
        flex-basis: auto !important;
    }

    body:not(.betterly-front-page) .betterly-site .wp-block-post-content > .betterly-section:first-child h1,
    body:not(.betterly-front-page) .betterly-site .wp-block-post-content > .betterly-section:first-child .betterly-muted {
        max-width: none;
    }
}

@media (max-width: 639px) {
    .betterly-site .betterly-hero-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .betterly-site .betterly-hero-actions > * {
        width: 100%;
    }
}

/* =========================================================
 * v0.6.0 — Visual refinement / iconography / media system
 * ======================================================= */

.betterly-icon-card {
    position: relative;
    padding-top: 82px !important;
}

.betterly-icon-card::before {
    content: "";
    position: absolute;
    inset-block-start: 24px;
    inset-inline-start: 24px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background-color: rgba(37, 99, 235, .06);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 30px 30px;
}

.betterly-icon-card--contract::before { background-image: url("../icons/document-search.svg"); }
.betterly-icon-card--claims::before { background-image: url("../icons/claims.svg"); }
.betterly-icon-card--defense::before { background-image: url("../icons/briefcase-shield.svg"); }
.betterly-icon-card--enterprise::before { background-image: url("../icons/building.svg"); }
.betterly-icon-card--user::before { background-image: url("../icons/users.svg"); }
.betterly-icon-card--document::before { background-image: url("../icons/document.svg"); }
.betterly-icon-card--document-search::before { background-image: url("../icons/document-search.svg"); }
.betterly-icon-card--spark::before { background-image: url("../icons/spark.svg"); }
.betterly-icon-card--shield::before,
.betterly-icon-card--security::before { background-image: url("../icons/shield.svg"); }
.betterly-icon-card--access::before { background-image: url("../icons/users.svg"); }
.betterly-icon-card--privacy::before { background-image: url("../icons/lock.svg"); }
.betterly-icon-card--support::before { background-image: url("../icons/mail.svg"); }
.betterly-icon-card--sales::before { background-image: url("../icons/building.svg"); }
.betterly-icon-card--collaboration::before { background-image: url("../icons/users.svg"); }
.betterly-icon-card--folder::before { background-image: url("../icons/folder.svg"); }
.betterly-icon-card--scale::before { background-image: url("../icons/scale.svg"); }
.betterly-icon-card--check::before { background-image: url("../icons/check.svg"); }
.betterly-icon-card--eye::before { background-image: url("../icons/eye.svg"); }
.betterly-icon-card--book::before { background-image: url("../icons/book.svg"); }
.betterly-icon-card--clock::before { background-image: url("../icons/clock.svg"); }
.betterly-icon-card--chart::before { background-image: url("../icons/chart.svg"); }
.betterly-icon-card--briefcase-shield::before { background-image: url("../icons/briefcase-shield.svg"); }

.betterly-trust-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.betterly-trust-item::before {
    content: "";
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.betterly-trust-item--shield::before { background-image: url("../icons/shield.svg"); }
.betterly-trust-item--spark::before { background-image: url("../icons/spark.svg"); }
.betterly-trust-item--bolt::before { background-image: url("../icons/bolt.svg"); }

/* Keep visual detail calm: cards gain depth on interaction, not permanent heavy shadow. */
.betterly-feature-card,
.betterly-membership-card,
.betterly-contact-card,
.betterly-security-card,
.betterly-pricing-card {
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.betterly-feature-card:hover,
.betterly-membership-card:hover,
.betterly-contact-card:hover,
.betterly-security-card:hover,
.betterly-pricing-card:hover {
    transform: translateY(-2px);
    border-color: rgba(37,99,235,.24);
    box-shadow: var(--betterly-shadow-sm);
}

.betterly-pricing-card ul {
    list-style: none;
    margin: 20px 0 24px;
    padding: 0;
}

.betterly-pricing-card li {
    position: relative;
    margin-bottom: 10px;
    padding-inline-start: 28px;
    color: var(--betterly-slate);
}

.betterly-pricing-card li::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: .42em;
    width: 18px;
    height: 18px;
    background: url("../icons/check.svg") center / contain no-repeat;
}

/* Editorial media: images are primary on blog/case-study content, never decorative stock by default. */
.betterly-article-card .wp-block-post-featured-image img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.betterly-article-card:not(:has(.wp-block-post-featured-image img))::before {
    content: "";
    display: block;
    aspect-ratio: 16 / 9;
    background:
        radial-gradient(circle at 18% 20%, rgba(37,99,235,.18), transparent 26%),
        radial-gradient(circle at 82% 80%, rgba(124,58,237,.18), transparent 28%),
        linear-gradient(135deg, #F8FAFC, #F5F3FF);
}

/* General two-column marketing heroes. */
.betterly-site .betterly-section > .wp-block-columns.betterly-shell {
    gap: clamp(42px, 6vw, 82px);
}

.betterly-site .betterly-section > .wp-block-columns.betterly-shell > .wp-block-column {
    min-width: 0;
}

/* Contact form has a visual heading but stays minimal. */
.betterly-contact-form {
    box-shadow: 0 10px 30px rgba(15,23,42,.04);
}

/* Legal/utility pages receive restrained visual anchors, not marketing-heavy imagery. */
.betterly-legal-page::before {
    content: "";
    display: block;
    width: 56px;
    height: 56px;
    margin-bottom: 24px;
    border-radius: 18px;
    background: rgba(37,99,235,.06) url("../icons/document.svg") center / 36px no-repeat;
}

.betterly-404 {
    text-align: center;
}

.betterly-404::before {
    content: "";
    display: block;
    width: min(420px, 82vw);
    aspect-ratio: 16 / 10;
    margin: 0 auto 28px;
    background: url("../illustrations/empty-search.svg") center / contain no-repeat;
}

.betterly-search-page .wp-block-query {
    margin-top: 32px;
}

.betterly-search-page .wp-block-post-template {
    display: grid;
    gap: 14px;
}

.betterly-search-page .wp-block-post {
    padding: 22px 24px;
    border: 1px solid var(--betterly-border);
    border-radius: var(--betterly-radius-lg);
    background: #fff;
}

.betterly-search-page .wp-block-post-title {
    margin-top: 0;
    margin-bottom: 8px;
}

@media (max-width: 781px) {
    .betterly-site .betterly-section > .wp-block-columns.betterly-shell {
        gap: 30px;
    }
}

@media (max-width: 639px) {
    .betterly-icon-card {
        padding-top: 76px !important;
    }

    .betterly-icon-card::before {
        inset-block-start: 20px;
        inset-inline-start: 20px;
        width: 40px;
        height: 40px;
        background-size: 28px 28px;
    }

    .betterly-trust-item {
        justify-content: flex-start;
    }
}

.betterly-enterprise-band ul {
    list-style: none;
    padding: 0;
}

.betterly-enterprise-band li {
    position: relative;
    padding-inline-start: 28px;
}

.betterly-enterprise-band li::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: .42em;
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
    opacity: .88;
    background: url("../icons/check.svg") center / contain no-repeat;
}

/* =========================================================
 * v0.6.1 — Final visual production fix
 * Root cause fix is in Site Core render templates; this layer
 * tightens composition once dynamic visuals actually render.
 * ======================================================= */

:root {
    --betterly-section-space: 72px;
    --betterly-section-space-compact: 48px;
}

.betterly-shell,
.wp-site-blocks .betterly-shell {
    width: min(calc(100% - 64px), var(--betterly-container)) !important;
    max-width: var(--betterly-container) !important;
    margin-inline: auto !important;
}

/* Default brand mark from the approved Betterly identity sheet.
 * A Site Logo selected by an admin still overrides this fallback. */
.betterly-brand::before,
.betterly-footer__brand::before {
    content: "";
    display: inline-block;
    width: 30px;
    height: 44px;
    flex: 0 0 30px;
    background: url("../brand/betterly-mark.png") center / contain no-repeat;
}

.betterly-brand:has(.custom-logo)::before,
.betterly-footer__brand:has(.custom-logo)::before {
    display: none;
}

.betterly-footer__brand::before {
    width: 28px;
    height: 40px;
    margin-bottom: 12px;
}

/* Marketing heroes: deliberate 46/54 composition instead of an empty half-page. */
.betterly-page-hero {
    padding-block: clamp(54px, 5.5vw, 82px) !important;
}

.betterly-page-hero > .wp-block-columns.betterly-shell {
    gap: clamp(42px, 5vw, 76px) !important;
    align-items: center !important;
}

.betterly-page-hero > .wp-block-columns.betterly-shell > .wp-block-column:first-child {
    flex-basis: 46% !important;
}

.betterly-page-hero > .wp-block-columns.betterly-shell > .wp-block-column:last-child {
    flex-basis: 54% !important;
}

.betterly-page-hero h1 {
    max-width: 650px;
    margin-top: 0;
    margin-bottom: 16px;
    line-height: 1.35;
}

.betterly-page-hero .betterly-muted {
    max-width: 610px;
    margin-top: 0;
}

.betterly-page-hero .wp-block-buttons,
.betterly-page-hero .betterly-hero-actions {
    margin-top: 24px;
}

.betterly-page-hero .betterly-product-preview,
.betterly-page-hero .betterly-visual-media {
    width: 100%;
    max-width: 620px;
    margin-inline: auto;
}

/* Home first fold gets a little more visual emphasis but stays calm. */
.betterly-home-hero .betterly-product-preview {
    transform: perspective(1200px) rotateY(1.3deg) rotateX(.4deg);
    box-shadow: 0 24px 64px rgba(15, 23, 42, .10);
}

/* Dynamic product preview is a marketing visual, not an empty placeholder. */
.betterly-product-preview {
    min-height: 360px !important;
    border-radius: 22px !important;
}

.betterly-product-preview__main {
    padding: clamp(20px, 2.5vw, 30px) !important;
}

.betterly-product-preview__header strong {
    font-size: 19px !important;
}

.betterly-product-preview__card {
    min-height: 82px !important;
}

.betterly-product-preview__panel {
    min-height: 100px;
    align-content: center;
}

/* Product showcase should read as the second visual anchor on solution pages. */
.betterly-product-showcase {
    padding-block: clamp(50px, 5vw, 72px) !important;
}

.betterly-product-showcase > .wp-block-columns {
    gap: clamp(46px, 5vw, 78px) !important;
}

.betterly-product-showcase .betterly-product-preview {
    min-height: 390px !important;
}

/* Keep cards substantial but not narrow/tall on desktop. */
.betterly-grid-4,
.betterly-grid-3 {
    width: 100%;
}

.betterly-grid-4 {
    gap: 20px !important;
}

.betterly-grid-3 {
    gap: 22px !important;
}

.betterly-solution-card {
    min-height: 248px !important;
    padding: 26px 24px !important;
}

.betterly-feature-card,
.betterly-contact-card,
.betterly-membership-card,
.betterly-security-card {
    min-height: 210px;
}

/* Pricing needs enough visual width for fast comparison. */
.betterly-pricing-card {
    min-height: 430px;
    padding: 30px !important;
}

.betterly-pricing-card .wp-block-buttons {
    margin-top: auto;
}

.betterly-pricing-card {
    display: flex;
    flex-direction: column;
}

/* Contact: make the actual form the visual destination, not a footnote. */
.betterly-contact-form {
    padding: clamp(24px, 3vw, 36px);
    border: 1px solid var(--betterly-border);
    border-radius: var(--betterly-radius-xl);
    background: #fff;
}

.betterly-contact-form__form {
    max-width: none;
}

/* Footer brand identity and spacing. */
.betterly-footer__brand {
    position: relative;
}

.betterly-footer__brand .wp-block-site-title {
    margin-top: 0;
}

.betterly-footer__grid {
    gap: clamp(34px, 5vw, 72px) !important;
}

/* A little less dead space before closing CTA/footer. */
.betterly-site .betterly-section--compact + .betterly-section--compact {
    padding-top: 24px;
}

@media (min-width: 1280px) {
    .betterly-front-page .betterly-grid-4,
    .betterly-site .betterly-grid-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .betterly-site .betterly-grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1023px) {
    .betterly-shell,
    .wp-site-blocks .betterly-shell {
        width: min(calc(100% - 48px), var(--betterly-container)) !important;
    }

    .betterly-page-hero > .wp-block-columns.betterly-shell {
        gap: 34px !important;
    }
}

@media (max-width: 781px) {
    .betterly-page-hero > .wp-block-columns.betterly-shell {
        flex-direction: column !important;
    }

    .betterly-page-hero > .wp-block-columns.betterly-shell > .wp-block-column {
        width: 100%;
        flex-basis: auto !important;
    }

    .betterly-page-hero .betterly-product-preview,
    .betterly-page-hero .betterly-visual-media {
        max-width: 680px;
    }

    .betterly-home-hero .betterly-product-preview {
        transform: none;
    }
}

@media (max-width: 639px) {
    .betterly-shell,
    .wp-site-blocks .betterly-shell {
        width: calc(100% - 32px) !important;
    }

    .betterly-page-hero {
        padding-block: 44px !important;
    }

    .betterly-product-preview {
        min-height: 300px !important;
    }

    .betterly-product-showcase .betterly-product-preview {
        min-height: 320px !important;
    }

    .betterly-pricing-card,
    .betterly-feature-card,
    .betterly-contact-card,
    .betterly-membership-card,
    .betterly-security-card,
    .betterly-solution-card {
        min-height: auto !important;
    }
}
.betterly-icon-card--users::before { background-image: url("../icons/users.svg"); }


/* v0.7 quality gate: accessibility + interaction hardening */
.betterly-header a:focus-visible,
.betterly-footer a:focus-visible,
.betterly-faq summary:focus-visible,
.betterly-contact-form input:focus-visible,
.betterly-contact-form textarea:focus-visible,
.betterly-contact-form select:focus-visible,
.betterly-contact-form button:focus-visible,
.betterly-blog-slider button:focus-visible,
.betterly-blog-slider a:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .28);
    outline-offset: 3px;
}

.betterly-header .wp-block-navigation-item__content,
.betterly-footer li > a,
.betterly-blog-slider__arrow,
.betterly-blog-slider__dot,
.betterly-contact-form__submit {
    min-height: 44px;
}


.betterly-contact-form__notice[role="alert"] {
    border-inline-start: 3px solid var(--betterly-warning);
}

.betterly-contact-form__notice[role="status"] {
    border-inline-start: 3px solid var(--betterly-success);
}

@media (forced-colors: active) {
    .betterly-card,
    .betterly-faq .wp-block-details,
    .betterly-contact-form input,
    .betterly-contact-form textarea,
    .betterly-contact-form select {
        border: 1px solid CanvasText;
    }
}

.betterly-footer li > a { display: inline-flex; align-items: center; }

/* =========================================================
 * v0.9.1 — Post-launch card width & icon harmony polish
 * Wider marketing grids on desktop; no page-content migration needed.
 * ======================================================= */

/* Gutenberg constrained layouts cap default children at contentSize (760px).
 * These marketing grids are intentionally allowed to use more of the 1240px shell. */
@media (min-width: 1024px) {
    .betterly-site .betterly-shell > .betterly-grid-4 {
        width: 100% !important;
        max-width: 1140px !important;
        margin-inline: auto !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 24px !important;
    }

    .betterly-site .betterly-shell > .betterly-grid-3 {
        width: 100% !important;
        max-width: 1080px !important;
        margin-inline: auto !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 26px !important;
    }

    /* Pricing benefits from an even wider comparison canvas. */
    .betterly-site .betterly-shell > .betterly-grid-3:has(> .betterly-pricing-card) {
        max-width: 1160px !important;
        gap: 28px !important;
    }
}

/* Keep the icon in a dedicated visual zone above the title.
 * v0.6.1 card padding could otherwise override the icon-card top padding. */
.betterly-site .betterly-icon-card.betterly-solution-card,
.betterly-site .betterly-icon-card.betterly-feature-card,
.betterly-site .betterly-icon-card.betterly-pricing-card {
    padding-top: 92px !important;
}

.betterly-site .betterly-icon-card::before {
    inset-block-start: 24px;
    inset-inline-start: 24px;
    z-index: 1;
}

/* Wider cards should read horizontally, not become taller than necessary. */
@media (min-width: 1024px) {
    .betterly-site .betterly-solution-card {
        min-height: 232px !important;
        padding-inline: 26px !important;
        padding-bottom: 26px !important;
    }

    .betterly-site .betterly-feature-card {
        min-height: 198px;
        padding-inline: 26px !important;
        padding-bottom: 26px !important;
    }

    .betterly-site .betterly-pricing-card {
        min-height: 420px;
        padding-inline: 34px !important;
        padding-bottom: 32px !important;
    }

    .betterly-site .betterly-solution-card h3,
    .betterly-site .betterly-feature-card h3,
    .betterly-site .betterly-pricing-card h3 {
        text-wrap: balance;
    }
}

/* Tablet remains two-column; mobile remains one-column. */
@media (max-width: 1023px) and (min-width: 640px) {
    .betterly-site .betterly-shell > .betterly-grid-4,
    .betterly-site .betterly-shell > .betterly-grid-3 {
        width: 100% !important;
        max-width: 860px !important;
        margin-inline: auto !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 22px !important;
    }
}

@media (max-width: 639px) {
    .betterly-site .betterly-icon-card.betterly-solution-card,
    .betterly-site .betterly-icon-card.betterly-feature-card,
    .betterly-site .betterly-icon-card.betterly-pricing-card {
        padding-top: 80px !important;
    }
}
