/**
 * Embedded storefront (iframe on partner sites): fluid type, tighter chrome, no wide min-width traps.
 */
html[data-cf-embed="1"] {
    font-size: clamp(14px, 2.5vw, 16px);
}

html[data-cf-embed="1"] body {
    overflow-x: hidden;
}

html[data-cf-embed="1"] .navbar,
html[data-cf-embed="1"] .navbar.nav-checkout {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 10px;
}

html[data-cf-embed="1"] .brand img {
    max-height: 36px;
    max-width: min(160px, 42vw);
}

html[data-cf-embed="1"] .brand-badge,
html[data-cf-embed="1"] .brand-mark {
    width: 38px;
    height: 38px;
}

html[data-cf-embed="1"] .hero {
    padding: clamp(20px, 4vw, 40px) clamp(14px, 3vw, 28px);
}

html[data-cf-embed="1"] .hero-inner {
    grid-template-columns: 1fr;
    gap: clamp(14px, 3vw, 22px);
}

html[data-cf-embed="1"] .hero h1 {
    font-size: clamp(1.2rem, 4.2vw, 1.85rem);
    line-height: 1.2;
}

html[data-cf-embed="1"] .hero p {
    font-size: clamp(0.88rem, 2.4vw, 1rem);
}

html[data-cf-embed="1"] .hero-card {
    padding: clamp(14px, 3vw, 20px);
}

html[data-cf-embed="1"] .container,
html[data-cf-embed="1"] .section-shell {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
}

html[data-cf-embed="1"] .grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: 14px;
}

html[data-cf-embed="1"] .shell,
html[data-cf-embed="1"] .checkout-main,
html[data-cf-embed="1"] .flow-shell {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
}

html[data-cf-embed="1"] .layout,
html[data-cf-embed="1"] .checkout-layout {
    grid-template-columns: 1fr;
}

html[data-cf-embed="1"] .page-title,
html[data-cf-embed="1"] .checkout-title {
    font-size: clamp(1.25rem, 4vw, 1.65rem);
}

html[data-cf-embed="1"] .nav-links {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

html[data-cf-embed="1"] .btn,
html[data-cf-embed="1"] .btn-buy {
    padding: 10px 16px;
    font-size: 0.9rem;
}

html[data-cf-embed="1"] .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

html[data-cf-embed="1"] .price-row {
    flex-wrap: wrap;
    gap: 10px;
}

html[data-cf-embed="1"] .vendor-brand {
    flex-wrap: wrap;
}

html[data-cf-embed="1"] .meta-grid {
    grid-template-columns: 1fr;
}

html[data-cf-embed="1"] .form-grid,
html[data-cf-embed="1"] .checkout-account .form-group {
    max-width: 100%;
}

html[data-cf-embed="1"][data-cf-transparent="1"] body,
html[data-cf-embed="1"][data-cf-transparent="1"] .page-shell,
html[data-cf-embed="1"][data-cf-transparent="1"] .hero {
    background: transparent !important;
}

html[data-cf-embed="1"] .btn,
html[data-cf-embed="1"] .btn-buy,
html[data-cf-embed="1"] .flow-card,
html[data-cf-embed="1"] .course-card {
    border-radius: var(--radius, 14px);
}

html[data-cf-embed="1"] .hero-card {
    border-radius: var(--radius-lg, 24px);
}

/* IFRAME LAYOUT FIXES ---------------------------------------- */
/* Sticky positions never behave inside an iframe whose parent owns the scroll. */
html[data-cf-embed="1"] .navbar,
html[data-cf-embed="1"] .navbar.nav-checkout,
html[data-cf-embed="1"] .sticky-card {
    position: static !important;
    top: auto !important;
}

/* 100vh is the iframe's own viewport; when the parent auto-sizes the iframe this
   produces huge empty whitespace. Let content drive the height. */
html[data-cf-embed="1"],
html[data-cf-embed="1"] body,
html[data-cf-embed="1"] .page-shell,
html[data-cf-embed="1"] .flow-shell,
html[data-cf-embed="1"] .simple-shell,
html[data-cf-embed="1"] .auth-shell,
html[data-cf-embed="1"] .auth-card-wrap {
    min-height: 0 !important;
    height: auto !important;
}

html[data-cf-embed="1"] .flow-shell,
html[data-cf-embed="1"] .simple-shell,
html[data-cf-embed="1"] .auth-shell {
    padding-top: clamp(14px, 3vw, 26px);
    padding-bottom: clamp(14px, 3vw, 26px);
    align-items: flex-start;
}

/* Split auth screens (signin / signup) collapse to a single column in embed
   so the brand visual doesn't waste half the width on narrow iframes. */
html[data-cf-embed="1"] .auth-card {
    flex-direction: column;
    max-width: 100%;
    border-radius: var(--radius-lg, 24px);
    box-shadow: var(--shadow-soft);
}

html[data-cf-embed="1"] .auth-visual,
html[data-cf-embed="1"] .auth-form {
    width: 100%;
    padding: clamp(20px, 4vw, 36px);
}

html[data-cf-embed="1"] .auth-visual {
    display: none;
}

/* Most embed parents already give the page-shell its own backdrop; drop our
   gradient stacked-on-gradient so the iframe blends cleanly with the host. */
html[data-cf-embed="1"] body {
    background:
        linear-gradient(180deg, var(--body-bg-top, var(--bg)) 0%, var(--bg) 100%);
}

/* Two-column shells (course details, checkout) get cramped at iframe widths;
   prefer single column unless the viewport is reasonably wide. */
html[data-cf-embed="1"] .shell {
    padding: clamp(18px, 4vw, 36px) clamp(12px, 3vw, 22px) clamp(28px, 5vw, 60px);
}

@media (max-width: 880px) {
    html[data-cf-embed="1"] .hero {
        padding: clamp(18px, 3vw, 28px);
    }
}

/* Hide chrome that points away from the iframe (back to marketplace, etc.). */
html[data-cf-embed="1"] .nav-links a[href*="index.php"]:not(.btn),
html[data-cf-embed="1"] .nav-back,
html[data-cf-embed="1"] .global-footer,
html[data-cf-embed="1"] .marketing-footer {
    display: none !important;
}

/* External anchors should always pop a new tab from inside an iframe. */
html[data-cf-embed="1"] a[target="_blank"]::after {
    content: " ↗";
    font-size: 0.8em;
    opacity: 0.7;
}
