/**
 * Marketing shared layer — hero backdrop, section rhythm, shell chrome
 * ADR-047 · Load after responsive.css, before landing-v2.css
 */

body.marketing-site {
    background-color: var(--pm-bg-primary);
    color: var(--pm-text-primary);
    /* Phone preview (light screen inside dark hero) — independent of data-ui-scheme */
    --pm-mock-text-primary: #0f172a;
    --pm-mock-text-secondary: #475569;
    --pm-mock-text-muted: #64748b;
    --pm-mock-surface: #ffffff;
    --pm-mock-surface-muted: #f8fafc;
    --pm-mock-border: #e2e8f0;
    /* SSOT section rhythm — home, /para/*, static shell */
    --marketing-section-y: clamp(3rem, 7vw, var(--pm-space-32));
    --marketing-section-header-gap: clamp(1.75rem, 4vw, var(--pm-space-16));
    --marketing-anchor-offset: 5.5rem;
    --marketing-nav-clearance: calc(80px + var(--pm-space-8));
    --marketing-nav-clearance-mobile: calc(80px + var(--pm-space-10));
    caret-color: var(--pm-primary-500);
    --landing-section-glow: rgba(168, 85, 247, 0.06);
    --landing-step-halo: var(--pm-bg-primary);
    --landing-table-edge: var(--pm-border-light);
    --landing-table-shadow: 0 16px 40px -20px rgba(15, 23, 42, 0.12);
    --landing-scrollbar-track: var(--pm-bg-tertiary);
}

html[data-ui-scheme="dark"] body.marketing-site {
    --landing-section-glow: rgba(168, 85, 247, 0.14);
    --landing-step-halo: var(--pm-bg-primary);
    --landing-table-edge: var(--pm-border-light);
    --landing-table-shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.45);
    --landing-scrollbar-track: var(--pm-gray-800);
}

body.marketing-site::selection {
    background: rgba(168, 85, 247, 0.28);
    color: var(--pm-text-primary);
}

body.marketing-site .hero-section::selection,
body.marketing-site .cta-section::selection,
body.marketing-site .footer-premium::selection {
    background: rgba(168, 85, 247, 0.45);
    color: var(--pm-white);
}

@supports (scrollbar-color: auto) {
    body.marketing-site {
        scrollbar-color: var(--pm-primary-400) var(--landing-scrollbar-track);
        scrollbar-width: thin;
    }
}

body.marketing-site ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

body.marketing-site ::-webkit-scrollbar-track {
    background: var(--landing-scrollbar-track);
}

body.marketing-site ::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--pm-primary-400), var(--pm-primary-600));
    border-radius: var(--pm-radius-full);
    border: 2px solid var(--landing-scrollbar-track);
}

body.marketing-site section[id] {
    scroll-margin-top: var(--marketing-anchor-offset);
}

body.marketing-site #features,
body.marketing-site #pricing,
body.marketing-site #como-funciona,
body.marketing-site #segment-hero,
body.marketing-site #comparativo {
    scroll-margin-top: var(--marketing-anchor-offset);
}

/* ============================================
   HERO — full-viewport backdrop (brand-dark)
   ============================================ */

.hero-section {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    padding-top: var(--marketing-nav-clearance);
    padding-bottom: var(--pm-space-16);
    isolation: isolate;
    overflow: hidden;
    --hero-base-top: #0b1220;
    --hero-base-mid: #0f172a;
    --hero-base-low: #1a2438;
    --hero-orb-accent: rgba(217, 70, 239, 0.26);
    --hero-orb-primary: rgba(168, 85, 247, 0.3);
    --hero-orb-deep: rgba(124, 58, 237, 0.18);
    background-color: var(--hero-base-top);
    background-image:
        linear-gradient(
            155deg,
            var(--hero-base-top) 0%,
            var(--hero-base-mid) 38%,
            var(--hero-base-low) 72%,
            #1e293b 100%
        ),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
    background-size: auto, 200px 200px;
    background-blend-mode: normal, overlay;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(
            ellipse 120% 90% at 100% 0%,
            var(--hero-orb-accent) 0%,
            transparent 54%
        ),
        radial-gradient(
            ellipse min(95vw, 56rem) min(75vh, 40rem) at 72% 38%,
            var(--hero-orb-primary) 0%,
            transparent 62%
        ),
        radial-gradient(
            ellipse min(80vw, 44rem) min(60vh, 32rem) at 8% 88%,
            var(--hero-orb-deep) 0%,
            transparent 58%
        ),
        radial-gradient(
            ellipse min(50vw, 28rem) min(40vh, 22rem) at 12% 12%,
            rgba(139, 92, 246, 0.11) 0%,
            transparent 55%
        ),
        linear-gradient(
            to bottom,
            transparent 0%,
            transparent 78%,
            rgba(11, 18, 32, 0.45) 100%
        );
    opacity: 1;
}

.hero-section::after {
    content: '';
    position: absolute;
    inset: -30%;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(
        circle at 68% 34%,
        rgba(168, 85, 247, 0.34) 0%,
        rgba(168, 85, 247, 0.08) 38%,
        transparent 68%
    );
    filter: blur(72px);
    transform: translate3d(0, 0, 0);
    animation: marketing-hero-ambient-drift 28s cubic-bezier(0.45, 0, 0.55, 1) infinite;
    will-change: transform;
}

@keyframes marketing-hero-ambient-drift {
    0%, 100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(-2.5%, 2%, 0) scale(1.04);
    }
}

@media (max-width: 991.98px) {
    .hero-section::before {
        background:
            radial-gradient(
                ellipse 130% 70% at 50% -8%,
                var(--hero-orb-accent) 0%,
                transparent 52%
            ),
            radial-gradient(
                ellipse 110% 80% at 100% 48%,
                var(--hero-orb-primary) 0%,
                transparent 58%
            ),
            radial-gradient(
                ellipse 90% 65% at 0% 92%,
                var(--hero-orb-deep) 0%,
                transparent 56%
            );
    }

    .hero-section::after {
        background: radial-gradient(
            circle at 58% 28%,
            rgba(168, 85, 247, 0.28) 0%,
            transparent 65%
        );
        filter: blur(56px);
    }
}

@media (min-width: 1400px) {
    .hero-section::before {
        background:
            radial-gradient(
                ellipse 100% 85% at 92% 8%,
                var(--hero-orb-accent) 0%,
                transparent 52%
            ),
            radial-gradient(
                ellipse min(80vw, 64rem) min(70vh, 44rem) at 76% 40%,
                var(--hero-orb-primary) 0%,
                transparent 60%
            ),
            radial-gradient(
                ellipse min(70vw, 48rem) min(55vh, 36rem) at 6% 90%,
                var(--hero-orb-deep) 0%,
                transparent 58%
            ),
            radial-gradient(
                ellipse min(45vw, 30rem) min(35vh, 24rem) at 10% 14%,
                rgba(139, 92, 246, 0.1) 0%,
                transparent 52%
            );
    }
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .hero-section {
        align-items: flex-start;
        padding-top: var(--marketing-nav-clearance-mobile);
    }
}

/* Segment + home: hero copy must clear fixed nav (never override with small clamp) */
body.marketing-site .segment-landing .hero-section.segment-hero-section {
    padding-top: var(--marketing-nav-clearance);
}

@media (max-width: 768px) {
    body.marketing-site .segment-landing .hero-section.segment-hero-section {
        padding-top: var(--marketing-nav-clearance-mobile);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-section::after {
        animation: none !important;
        transform: none !important;
    }
}

.marketing-section {
    padding-block: var(--marketing-section-y);
}

body.marketing-site .section-header {
    margin-bottom: var(--marketing-section-header-gap);
}

body.marketing-site .how-it-works-section {
    padding-block: var(--marketing-section-y);
}

@media (max-width: 768px) {
    body.marketing-site .features-grid,
    body.marketing-site .segment-landing .segment-features-grid {
        grid-template-columns: 1fr;
        gap: var(--pm-space-6);
    }

    body.marketing-site .pricing-grid,
    body.marketing-site .segment-landing .segment-pricing .pricing-grid {
        gap: var(--pm-space-6);
    }

    body.marketing-site .feature-card {
        padding: var(--pm-space-6);
    }

    body.marketing-site .static-page-main .container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

@media (max-width: 390px) {
    body.marketing-site .hero-cta .btn,
    body.marketing-site .segment-landing .segment-hero-cta .btn,
    body.marketing-site .cta-buttons .btn {
        width: 100%;
        justify-content: center;
    }
}

.marketing-focus-ring:focus-visible {
    outline: 2px solid var(--pm-border-focus, var(--pm-primary-400));
    outline-offset: 3px;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--pm-primary-400) 25%, transparent);
}

/* ============================================
   SCHEME BRIDGE — content (hero/CTA/footer stay brand-dark)
   ============================================ */

html[data-ui-scheme="dark"] body.marketing-site .navbar-premium-dropdown-menu {
    background: var(--pm-surface-elevated);
    border-color: var(--pm-border-light);
    box-shadow: var(--pm-shadow-lg);
}

html[data-ui-scheme="dark"] body.marketing-site .navbar-premium-dropdown-item {
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] body.marketing-site .navbar-premium-dropdown-item:hover,
html[data-ui-scheme="dark"] body.marketing-site .navbar-premium-dropdown-item.is-active {
    background: var(--pm-bg-tertiary);
    color: var(--pm-primary-300);
}

html[data-ui-scheme="dark"] body.marketing-site .social-proof-section {
    background: linear-gradient(180deg, var(--pm-bg-secondary) 0%, var(--pm-bg-primary) 100%);
}

html[data-ui-scheme="dark"] body.marketing-site .testimonial-card {
    background: var(--pm-surface-elevated);
    border-color: var(--pm-border-light);
}

html[data-ui-scheme="dark"] body.marketing-site .testimonial-info h4 {
    color: var(--pm-text-primary);
}

html[data-ui-scheme="dark"] body.marketing-site .testimonial-info p,
html[data-ui-scheme="dark"] body.marketing-site .testimonial-content {
    color: var(--pm-text-secondary);
}

html[data-ui-scheme="dark"] body.marketing-site .segment-sticky-cta {
    background: color-mix(in srgb, var(--pm-bg-primary) 94%, transparent);
    border-top-color: var(--pm-border-light);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
}
