/**
 * Homepage module cards — Custom HTML & Advertisement
 */

.content-section--module {
    padding: 12px 0;
}

.homepage-custom-html-section,
.homepage-advertisement-section {
    margin: 0;
}

/* Base module card — compact mockup style */
.homepage-module-card {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border-base);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
}

.homepage-module-card--light {
    background: #ffffff;
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.08);
}

.homepage-module-card--ad-light {
    background: #ffffff;
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.08);
}

.homepage-module-card--dark {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.98));
}

.homepage-module-card--gradient {
    background: var(--gradient-community);
    border-color: rgba(37, 99, 235, 0.28);
}

.homepage-module-card--glass {
    background: var(--gradient-surface-glass);
    backdrop-filter: blur(14px);
}

.homepage-module-card--plain {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--color-border-base);
}

/* Horizontal row: icon | copy | action */
.homepage-module-card__row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-width: 0;
}

.homepage-module-card__copy {
    flex: 1;
    min-width: 0;
}

.homepage-module-card__title {
    margin: 0 0 2px;
    font-size: 0.92rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--color-text);
}

.homepage-module-card--light .homepage-module-card__title,
.homepage-module-card--ad-light .homepage-module-card__title {
    color: #0f172a;
}

.homepage-module-card__body {
    width: 100%;
    min-width: 0;
}

.homepage-module-card__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: var(--radius-circle);
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
}

.homepage-module-card__cta--muted {
    background: rgba(156, 163, 175, 0.14);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-base);
}

.homepage-module-card--gradient .homepage-module-card__cta--muted {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Advertisement image card */
.homepage-ad-card__media {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    border: 1px solid var(--color-border-base);
    background: rgba(255, 255, 255, 0.06);
}

.homepage-ad-card__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.homepage-ad-card__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.homepage-ad-card__action {
    flex-shrink: 0;
}

.homepage-ad-card .button-secondary {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.78rem;
    border-radius: var(--radius-circle);
}

/* Normalize pasted Custom HTML / Ad HTML into module row layout */
.atlas-module-content {
    color: var(--color-text-secondary);
    line-height: 1.6;
    font-size: 0.9rem;
}

.atlas-module-content > div,
.atlas-module-content > section,
.atlas-module-content > article,
.atlas-module-content > .affiliate-notice,
.atlas-module-content > .homepage-module-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 14px !important;
    width: 100%;
    min-width: 0;
}

.atlas-module-content img,
.atlas-module-content .module-icon,
.atlas-module-content > div > img:first-child,
.atlas-module-content > div > .icon:first-child {
    flex-shrink: 0;
    width: 44px !important;
    height: 44px !important;
    max-width: 44px;
    border-radius: var(--radius-xs);
    object-fit: cover;
    margin: 0 !important;
}

.atlas-module-content h1,
.atlas-module-content h2,
.atlas-module-content h3,
.atlas-module-content h4,
.atlas-module-content strong {
    color: var(--color-text);
}

.atlas-module-content h2,
.atlas-module-content h3,
.atlas-module-content h4 {
    margin: 0 0 4px;
    font-size: 1rem !important;
    line-height: 1.35 !important;
    font-weight: 700 !important;
}

.atlas-module-content p {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--color-text-secondary);
}

.atlas-module-content > div > div:not(:last-child),
.atlas-module-content .module-copy,
.atlas-module-content .text,
.atlas-module-content > div > .content {
    flex: 1;
    min-width: 0;
}

.atlas-module-content a.button,
.atlas-module-content .button,
.atlas-module-content a.btn,
.atlas-module-content > div > a:last-child,
.atlas-module-content > div > button:last-child,
.atlas-module-content .module-action {
    flex-shrink: 0;
    margin-left: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px !important;
    border-radius: var(--radius-circle) !important;
    font-size: 0.86rem !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    white-space: nowrap;
    background: rgba(156, 163, 175, 0.12) !important;
    color: var(--color-text) !important;
    border: 1px solid var(--color-border-base) !important;
    box-shadow: none !important;
}

.homepage-module-card--gradient .atlas-module-content a,
.homepage-module-card--gradient .atlas-module-content .button {
    background: rgba(255, 255, 255, 0.16) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.24) !important;
}

.atlas-module-content a.button-primary,
.atlas-module-content .button-primary {
    background: var(--color-primary) !important;
    color: #fff !important;
    border-color: transparent !important;
}

/* Kill inline white backgrounds from pasted HTML */
.homepage-module-card .atlas-module-content [style*="background:#fff"],
.homepage-module-card .atlas-module-content [style*="background: #fff"],
.homepage-module-card .atlas-module-content [style*="background-color:#fff"],
.homepage-module-card .atlas-module-content [style*="background-color: #fff"],
.homepage-module-card .atlas-module-content [style*="background:white"],
.homepage-module-card .atlas-module-content [style*="background-color:white"] {
    background: transparent !important;
}

/* Override legacy panel card stacking */
.homepage-custom-html-section .homepage-panel-card,
.homepage-advertisement-section .homepage-panel-card {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.homepage-custom-html-title,
.homepage-advertisement-title {
    display: none;
}

body.atlas-mobile-first .homepage-module-card__row,
body.atlas-mobile-first .atlas-module-content > div,
body.atlas-mobile-first .atlas-module-content > section,
body.atlas-mobile-first .atlas-module-content > article {
    flex-direction: row !important;
    align-items: center !important;
}

body.atlas-mobile-first .homepage-ad-card__action,
body.atlas-mobile-first .homepage-module-card__cta,
body.atlas-mobile-first .atlas-module-content a.button,
body.atlas-mobile-first .atlas-module-content .button,
body.atlas-mobile-first .atlas-module-content > div > a:last-child {
    width: auto;
}

body.light-mode .homepage-module-card--dark {
    background: #ffffff;
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .homepage-module-card--dark .homepage-module-card__title,
body.light-mode .homepage-module-card--dark .atlas-module-content h2,
body.light-mode .homepage-module-card--dark .atlas-module-content h3,
body.light-mode .homepage-module-card--dark .atlas-module-content strong {
    color: #0f172a;
}

body.light-mode .homepage-module-card--dark .atlas-module-content,
body.light-mode .homepage-module-card--dark .atlas-module-content p {
    color: #64748b;
}

body.light-mode .homepage-module-card--plain,
body.light-mode .homepage-module-card--light,
body.light-mode .homepage-module-card--ad-light {
    background: #ffffff;
    color: #0f172a;
}

body.light-mode .homepage-module-card--light .atlas-module-content,
body.light-mode .homepage-module-card--light .atlas-module-content p,
body.light-mode .homepage-custom-html-section .atlas-module-content p {
    color: #64748b;
}

body.light-mode .homepage-module-card--light .atlas-module-content h2,
body.light-mode .homepage-module-card--light .atlas-module-content h3,
body.light-mode .homepage-custom-html-section .atlas-module-content strong {
    color: #0f172a;
}

/* Long-form homepage SEO content block */
.homepage-seo-content {
    margin-bottom: 48px;
}

.homepage-seo-content .atlas-ds-section-header {
    margin-bottom: 22px;
}

.homepage-seo-content__card {
    position: relative;
    overflow: hidden;
    padding: 2px;
    border-radius: calc( var(--radius) + 2px );
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.42), rgba(16, 185, 129, 0.28));
    box-shadow: var(--shadow-card);
}

.homepage-seo-content__card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.16), transparent 42%);
    pointer-events: none;
}

.homepage-seo-content__body {
    position: relative;
    padding: 30px 34px;
    border-radius: var(--radius);
    background: var(--gradient-surface-glass);
    backdrop-filter: blur(16px);
    color: var(--color-text);
    font-size: 0.98rem;
    line-height: 1.8;
}

.homepage-seo-content__body > *:first-child {
    margin-top: 0;
}

.homepage-seo-content__body > *:last-child {
    margin-bottom: 0;
}

.homepage-seo-content__body h2 {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 2rem 0 0.85rem;
    padding-top: 1.65rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    color: var(--color-text);
    font-size: 1.14rem;
    line-height: 1.4;
    font-weight: 700;
}

.homepage-seo-content__body h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.homepage-seo-content__body h2::before {
    content: "";
    width: 4px;
    min-height: 1.15em;
    margin-top: 0.12em;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--color-primary), var(--color-secondary));
    flex-shrink: 0;
}

.homepage-seo-content__body h3 {
    display: inline-block;
    max-width: 100%;
    margin: 1.35rem 0 0.65rem;
    padding: 6px 12px 6px 28px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--color-text);
    font-size: 0.92rem;
    line-height: 1.45;
    font-weight: 700;
    position: relative;
}

.homepage-seo-content__body h3::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    width: 7px;
    height: 7px;
    margin-top: -3.5px;
    border-radius: 50%;
    background: var(--color-secondary);
}

.homepage-seo-content__body p {
    margin: 0 0 1rem;
    color: var(--color-text-muted);
}

.homepage-seo-content__body p:last-child {
    margin-bottom: 0;
}

.homepage-seo-content__body ul,
.homepage-seo-content__body ol {
    margin: 0 0 1rem;
    padding-left: 1.4em;
    color: var(--color-text-muted);
}

.homepage-seo-content__body li + li {
    margin-top: 0.45em;
}

.homepage-seo-content__body a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.homepage-seo-content__body a:hover {
    color: var(--color-secondary);
}

body.light-mode .homepage-seo-content__card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(16, 185, 129, 0.14));
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

body.light-mode .homepage-seo-content__body {
    background: #ffffff;
    color: #0f172a;
}

body.light-mode .homepage-seo-content__body h2,
body.light-mode .homepage-seo-content__body h3 {
    color: #0f172a;
}

body.light-mode .homepage-seo-content__body h2 {
    border-top-color: rgba(15, 23, 42, 0.08);
}

body.light-mode .homepage-seo-content__body h3 {
    background: rgba(37, 99, 235, 0.08);
}

body.light-mode .homepage-seo-content__body p,
body.light-mode .homepage-seo-content__body ul,
body.light-mode .homepage-seo-content__body ol {
    color: #475569;
}
