/**
 * Atlas Design System — reusable atlas-ds-* components.
 * Phase 1 foundation. Does not override legacy .button / .card classes.
 */

/* ── Design tokens (semantic aliases) ── */
:root {
    --ds-space-xs: var(--space-8);
    --ds-space-sm: var(--space-12);
    --ds-space-md: var(--space-16);
    --ds-space-lg: var(--space-24);
    --ds-space-xl: var(--space-32);
    --ds-space-2xl: var(--space-48);

    --ds-radius-xs: var(--radius-xs);
    --ds-radius-sm: var(--radius-sm);
    --ds-radius-md: var(--radius);
    --ds-radius-lg: var(--radius-lg);
    --ds-radius-pill: var(--radius-circle);

    --ds-shadow-sm: var(--shadow-sm);
    --ds-shadow-md: var(--shadow-md);
    --ds-shadow-lg: var(--shadow-xl);
    --ds-shadow-card: var(--shadow-card);
    --ds-shadow-button: var(--shadow-button);
    --ds-shadow-focus: var(--shadow-focus-ring);

    --ds-font-family: var(--font-family-sans);
    --ds-font-body: var(--font-size-body);
    --ds-font-small: var(--font-size-small);
    --ds-font-caption: var(--font-size-caption);
    --ds-font-h3: var(--font-size-h3);
    --ds-font-h2: var(--font-size-h2);
    --ds-line-height-body: var(--line-height-body);
    --ds-line-height-tight: var(--line-height-tight);

    --ds-transition: var(--transition);
    --ds-transition-fast: 150ms ease;

    --ds-container-max: var(--container-max-width);
    --ds-container-padding: var(--space-16);

    --ds-color-primary: var(--color-primary);
    --ds-color-secondary: var(--color-secondary);
    --ds-color-success: var(--color-success);
    --ds-color-danger: var(--color-danger);
    --ds-color-accent: var(--color-accent);
    --ds-color-text: var(--color-text);
    --ds-color-muted: var(--color-muted);
    --ds-color-surface: var(--color-surface);
    --ds-color-border: var(--color-border);
    --ds-color-focus: var(--color-focus-ring);

    --atlas-ds-stats-columns: 3;
}

/* ── Button ── */
.atlas-ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-xs);
    min-height: 44px;
    padding: 14px 24px;
    border-radius: var(--ds-radius-pill);
    border: 1px solid transparent;
    font-family: var(--ds-font-family);
    font-size: var(--ds-font-body);
    font-weight: 700;
    line-height: var(--ds-line-height-tight);
    text-decoration: none;
    color: var(--ds-color-text);
    background: var(--gradient-primary);
    cursor: pointer;
    transition:
        transform var(--ds-transition),
        background var(--ds-transition),
        box-shadow var(--ds-transition),
        border-color var(--ds-transition),
        opacity var(--ds-transition);
}

.atlas-ds-btn:hover,
.atlas-ds-btn:focus-visible {
    transform: translateY(-1px);
}

.atlas-ds-btn:focus-visible {
    outline: 2px solid var(--ds-color-focus);
    outline-offset: 2px;
}

.atlas-ds-btn--sm {
    min-height: 40px;
    padding: 0 16px;
    font-size: var(--ds-font-caption);
}

.atlas-ds-btn--lg {
    min-height: 48px;
    padding: 16px 28px;
    font-size: var(--ds-font-small);
}

.atlas-ds-btn--icon,
.atlas-ds-btn--icon-only {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: var(--ds-radius-sm);
}

.atlas-ds-btn--primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--ds-shadow-button);
}

.atlas-ds-btn--secondary {
    background: var(--color-surface-soft);
    color: var(--ds-color-text);
    border-color: var(--color-border-soft);
    backdrop-filter: blur(18px);
    box-shadow: none;
}

.atlas-ds-btn--outline {
    background: transparent;
    color: var(--ds-color-text);
    border-color: var(--ds-color-border);
    box-shadow: none;
}

.atlas-ds-btn--ghost {
    background: transparent;
    color: var(--ds-color-text);
    box-shadow: none;
}

.atlas-ds-btn--success {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.28);
}

.atlas-ds-btn--danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.28);
}

.atlas-ds-btn--disabled,
.atlas-ds-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

.atlas-ds-btn__icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

/* ── Card ── */
.atlas-ds-card {
    display: block;
    background: var(--ds-color-surface);
    border: 1px solid var(--color-border-base);
    border-radius: var(--ds-radius-md);
    box-shadow: var(--ds-shadow-card);
    padding: var(--ds-space-lg);
    color: inherit;
    text-decoration: none;
    transition:
        transform var(--ds-transition),
        box-shadow var(--ds-transition),
        border-color var(--ds-transition);
}

.atlas-ds-card--interactive:hover,
.atlas-ds-card--interactive:focus-visible,
.atlas-ds-card:focus-within {
    transform: translateY(-1px);
    box-shadow: var(--ds-shadow-md);
}

.atlas-ds-card--glass {
    background: var(--gradient-surface-glass);
    backdrop-filter: blur(16px);
}

.atlas-ds-card--dark {
    background: var(--color-dark-2);
    border-color: var(--color-border-base);
}

.atlas-ds-card--gradient {
    background: var(--gradient-promo), var(--ds-color-surface);
    border-color: rgba(37, 99, 235, 0.22);
}

.atlas-ds-card--compact {
    padding: var(--ds-space-md);
    border-radius: var(--ds-radius-sm);
}

.atlas-ds-card__body {
    min-width: 0;
}

/* ── Badge ── */
.atlas-ds-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--ds-radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.atlas-ds-badge--verified {
    background: rgba(37, 99, 235, 0.16);
    color: #93c5fd;
    border: 1px solid rgba(37, 99, 235, 0.28);
}

.atlas-ds-badge--trending {
    background: rgba(245, 158, 11, 0.16);
    color: var(--ds-color-accent);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.atlas-ds-badge--editors-choice {
    background: rgba(139, 92, 246, 0.16);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.32);
}

.atlas-ds-badge--new {
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
}

.atlas-ds-badge--hot {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.28);
}

.atlas-ds-badge--bonus {
    background: rgba(34, 197, 94, 0.14);
    color: var(--ds-color-success);
    border: 1px solid rgba(34, 197, 94, 0.28);
}

.atlas-ds-badge--muted {
    background: rgba(156, 163, 175, 0.12);
    color: var(--ds-color-muted);
    border: 1px solid var(--color-border-base);
}

/* ── Chip ── */
.atlas-ds-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--ds-radius-pill);
    border: 1px solid var(--color-border-base);
    background: rgba(17, 24, 39, 0.72);
    color: var(--ds-color-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition:
        border-color var(--ds-transition),
        color var(--ds-transition),
        background var(--ds-transition);
}

.atlas-ds-chip--link:hover,
.atlas-ds-chip--link:focus-visible {
    border-color: var(--ds-color-primary);
    color: #fff;
    background: rgba(37, 99, 235, 0.16);
}

.atlas-ds-chip--category {
    background: var(--ds-color-surface);
    color: var(--ds-color-text);
}

.atlas-ds-chip--popular-search {
    background: rgba(17, 24, 39, 0.72);
}

.atlas-ds-chip--tag {
    background: var(--color-surface-soft);
    border-color: var(--color-border-soft);
}

.atlas-ds-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
}

/* ── Section Header ── */
.atlas-ds-section-header {
    display: flex;
    align-items: flex-start;
    gap: var(--ds-space-sm);
    margin-bottom: var(--ds-space-md);
}

.atlas-ds-section-header__accent {
    width: 4px;
    min-height: 44px;
    border-radius: 4px;
    background: var(--ds-color-secondary);
    flex-shrink: 0;
}

.atlas-ds-section-header__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--ds-radius-xs);
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.22), rgba(124, 58, 237, 0.18));
    color: #15803d;
    font-weight: 800;
    font-size: 0.9rem;
    flex-shrink: 0;
}

body:not(.light-mode) .atlas-ds-section-header__icon {
    color: #fff;
}

.atlas-ds-section-header__content {
    flex: 1;
    min-width: 0;
}

.atlas-ds-section-header__title {
    margin: 0 0 4px;
    color: var(--ds-color-text);
    font-size: 1.35rem;
    line-height: var(--ds-line-height-tight);
}

.atlas-ds-section-header__subtitle {
    margin: 0;
    color: var(--ds-color-muted);
    font-size: 0.92rem;
    line-height: var(--ds-line-height-body);
}

.atlas-ds-section-header__action {
    flex-shrink: 0;
    margin-left: auto;
}

/* ── Search Bar ── */
.atlas-ds-search-bar {
    display: flex;
    align-items: center;
    gap: var(--ds-space-sm);
    min-height: var(--search-height-desktop);
    padding: 6px 6px 6px var(--ds-space-md);
    border-radius: var(--ds-radius-md);
    border: 1px solid var(--color-border-base);
    background: var(--ds-color-surface);
    box-shadow: var(--ds-shadow-card);
    transition:
        border-color var(--ds-transition),
        box-shadow var(--ds-transition);
}

.atlas-ds-search-bar:focus-within {
    border-color: var(--ds-color-primary);
    box-shadow: var(--ds-shadow-focus);
}

.atlas-ds-search-bar__icon {
    display: inline-flex;
    color: var(--ds-color-muted);
    flex-shrink: 0;
}

.atlas-ds-search-bar__input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--ds-color-text);
    font-size: var(--ds-font-body);
    padding: 0;
}

.atlas-ds-search-bar__input:focus {
    outline: none;
}

.atlas-ds-search-bar__input::placeholder {
    color: var(--ds-color-muted);
}

.atlas-ds-search-bar__submit {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    color: #fff;
    -webkit-text-fill-color: #fff;
    -webkit-appearance: none;
    appearance: none;
}

.atlas-ds-search-bar__submit-icon {
    display: block;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    max-width: 18px;
    color: #fff;
    stroke: #fff;
}

.atlas-ds-search-bar__submit-label {
    display: inline;
    color: #fff;
    -webkit-text-fill-color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Legacy class — never hide search label if old cached rules target btn__text */
.atlas-ds-search-bar__submit .atlas-ds-btn__text {
    display: inline !important;
    color: #fff !important;
}

.atlas-ds-search-bar--category {
    min-height: 48px;
}

.atlas-ds-search-bar--search {
    min-height: 52px;
    max-width: var(--ds-container-max);
}

@media (max-width: 768px) {
    .atlas-ds-search-bar {
        min-height: var(--search-height-mobile);
        padding-left: var(--ds-space-sm);
    }

    .atlas-ds-search-bar__submit {
        min-width: 96px;
        min-height: 40px;
        padding: 0 12px;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        background: #16a34a !important;
        background-image: none !important;
    }

    .atlas-ds-search-bar__submit-icon {
        display: block !important;
        width: 18px !important;
        height: 18px !important;
        max-width: 18px !important;
        color: #fff !important;
    }

    .atlas-ds-search-bar__submit-label {
        display: inline !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        font-size: 0.875rem !important;
        font-weight: 700 !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* ── Tab Navigation ── */
.atlas-ds-tab-nav__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ds-space-xs);
    margin-bottom: var(--ds-space-md);
}

.atlas-ds-tab-nav__tab {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: var(--ds-radius-pill);
    border: 1px solid var(--color-border-base);
    background: var(--ds-color-surface);
    color: var(--ds-color-muted);
    text-decoration: none;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--ds-transition);
}

.atlas-ds-tab-nav__tab:hover,
.atlas-ds-tab-nav__tab:focus-visible {
    color: var(--ds-color-text);
    border-color: var(--color-border-medium);
}

.atlas-ds-tab-nav__tab.is-active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-button);
}

.atlas-ds-tab-nav__tab.is-disabled,
.atlas-ds-tab-nav__tab:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Info Card ── */
.atlas-ds-info-card {
    display: grid;
    gap: var(--ds-space-xs);
    align-content: start;
    min-width: 0;
    padding: 18px;
    border-radius: var(--ds-radius-md);
    border: 1px solid var(--color-border-base);
    background: var(--ds-color-surface);
    box-shadow: var(--ds-shadow-card);
    overflow-wrap: anywhere;
}

.atlas-ds-info-card--glass {
    background: var(--gradient-surface-glass);
    backdrop-filter: blur(16px);
}

.atlas-ds-info-card--dark {
    background: var(--color-dark-2);
}

.atlas-ds-info-card--compact {
    padding: var(--ds-space-sm);
}

.atlas-ds-info-card__label {
    color: var(--ds-color-muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.atlas-ds-info-card__value {
    font-size: 1.1rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--ds-color-text);
}

/* ── Stats Card ── */
.atlas-ds-stats {
    display: grid;
    grid-template-columns: repeat(var(--atlas-ds-stats-columns), minmax(0, 1fr));
    gap: var(--ds-space-md);
}

.atlas-ds-stats__item {
    padding: 20px 22px;
    border-radius: 20px;
    background: var(--ds-color-surface);
    border: 1px solid var(--ds-color-border);
    box-shadow: inset 0 1px 0 var(--color-border-soft);
}

.atlas-ds-stats__value {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ds-color-text);
    line-height: var(--ds-line-height-tight);
}

.atlas-ds-stats__label {
    display: block;
    margin-top: 6px;
    color: var(--ds-color-muted);
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .atlas-ds-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--ds-space-xs);
    }

    .atlas-ds-stats__item {
        padding: 10px 12px;
        border-radius: 10px;
    }

    .atlas-ds-stats__value {
        font-size: 0.95rem;
    }

    .atlas-ds-stats__label {
        font-size: 0.72rem;
        margin-top: 2px;
    }
}

/* ── CTA Card ── */
.atlas-ds-cta-card {
    border-radius: var(--ds-radius-md);
    box-shadow: var(--ds-shadow-card);
    overflow: hidden;
}

.atlas-ds-cta-card__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: var(--ds-space-md) 18px;
    align-items: center;
    padding: 20px 22px;
}

.atlas-ds-cta-card--default {
    background: var(--ds-color-surface);
    border: 1px solid var(--color-border-base);
}

.atlas-ds-cta-card--community {
    background: linear-gradient(125deg, #1e3a8a 0%, #5b21b6 48%, #0f766e 100%);
    border: 1px solid rgba(129, 140, 248, 0.28);
}

.atlas-ds-cta-card--community .atlas-ds-cta-card__title,
.atlas-ds-cta-card--community .atlas-ds-cta-card__text {
    color: #fff;
}

.atlas-ds-cta-card--community .atlas-ds-cta-card__text {
    opacity: 0.92;
}

.atlas-ds-cta-card--banner {
    background: var(--gradient-promo), var(--ds-color-surface);
    border: 1px solid var(--color-border-base);
}

.atlas-ds-cta-card--gradient {
    background: var(--gradient-community);
    border: 1px solid rgba(37, 99, 235, 0.28);
}

.atlas-ds-cta-card__media {
    flex-shrink: 0;
}

.atlas-ds-cta-card__icon,
.atlas-ds-cta-card__image {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
}

.atlas-ds-cta-card__icon {
    background: rgba(139, 92, 246, 0.42);
    color: #fff;
}

.atlas-ds-cta-card__image {
    border-radius: var(--ds-radius-sm);
    object-fit: cover;
}

.atlas-ds-cta-card__title {
    margin: 0 0 6px;
    font-size: var(--type-small, 0.9375rem);
    font-weight: 800;
    line-height: 1.3;
    color: var(--ds-color-text);
}

.atlas-ds-cta-card__text {
    margin: 0;
    font-size: var(--type-caption, 0.8125rem);
    line-height: 1.55;
    color: var(--ds-color-muted);
}

.atlas-ds-cta-card__actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--ds-space-xs);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .atlas-ds-cta-card__inner {
        grid-template-columns: 1fr;
    }

    .atlas-ds-cta-card__actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* ── Empty State ── */
.atlas-ds-empty-state {
    padding: 28px 20px;
    border: 1px dashed var(--color-border-base);
    border-radius: var(--ds-radius-md);
    background: rgba(255, 255, 255, 0.02);
    text-align: center;
}

.atlas-ds-empty-state__icon {
    display: inline-flex;
    margin-bottom: var(--ds-space-sm);
    color: var(--ds-color-muted);
}

.atlas-ds-empty-state__title {
    margin: 0 0 var(--ds-space-xs);
    font-size: var(--ds-font-h3);
    color: var(--ds-color-text);
}

.atlas-ds-empty-state__message {
    margin: 0;
    color: var(--ds-color-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.atlas-ds-empty-state__action {
    margin-top: var(--ds-space-md);
}

body.light-mode .atlas-ds-empty-state {
    background: #ffffff;
}

body.light-mode .atlas-ds-chip {
    background: var(--color-surface-soft);
}

body.light-mode .atlas-ds-chip--popular-search {
    background: #f1f5f9;
}

/* ── CTA button presets (App detail / homepage) ── */
.atlas-ds-btn--cta-blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.32);
}

.atlas-ds-btn--cta-green {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--shadow-button);
}

.atlas-ds-btn--cta-red {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.28);
}

.atlas-ds-btn--cta-orange {
    background: linear-gradient(135deg, #ea580c, #c2410c);
    color: #fff;
}

.atlas-ds-btn--cta-purple {
    background: linear-gradient(135deg, #9333ea, #7e22ce);
    color: #fff;
}

.atlas-ds-btn--cta-gray {
    background: var(--color-surface-muted);
    color: var(--ds-color-text);
    border-color: var(--ds-color-border);
    box-shadow: none;
}

.atlas-ds-btn--telegram {
    background: #229ED9;
    color: #fff;
    box-shadow: 0 8px 20px rgba(34, 158, 217, 0.28);
}

.atlas-ds-btn--whatsapp {
    background: #22c55e;
    color: #fff;
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.24);
}

.atlas-ds-btn--banner-light {
    background: #fff;
    color: var(--color-primary-strong, #16a34a);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.12);
}

.atlas-ds-btn--banner-light:hover,
.atlas-ds-btn--banner-light:focus-visible {
    color: var(--color-primary-strong, #16a34a);
}

.hero-promo-card__button.atlas-ds-btn {
    align-self: flex-start;
    border-radius: var(--ds-radius-pill);
}


.cta-buttons--mobile-inline .cta-buttons__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ds-space-xs);
}

/* ── Info grid (App quick info) ── */
.atlas-ds-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--ds-space-md);
    align-items: stretch;
    width: 100%;
    max-width: 100%;
}

/* ── Chip list (hero hot keywords) ── */
.atlas-ds-chip-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ds-space-xs);
    margin-top: 14px;
}

.atlas-ds-chip-list__label {
    color: var(--ds-color-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

/* ── CTA card variants (migrated from promo-cards) ── */
.atlas-ds-cta-card--banner {
    background: linear-gradient(125deg, #16a34a 0%, #22c55e 48%, #7c3aed 100%);
    border: 1px solid rgba(34, 197, 94, 0.28);
}

.atlas-ds-cta-card--banner .atlas-ds-cta-card__icon {
    background: rgba(34, 197, 94, 0.35);
    color: #fff;
}

.atlas-ds-cta-card--banner .atlas-ds-cta-card__title,
.atlas-ds-cta-card--banner .atlas-ds-cta-card__text {
    color: #fff;
}

.atlas-ds-cta-card--banner .atlas-ds-cta-card__text {
    opacity: 0.92;
}

.atlas-ds-cta-card--notice {
    background: #f3f4f6;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.atlas-ds-cta-card--notice .atlas-ds-cta-card__icon {
    background: rgba(34, 197, 94, 0.16);
    color: var(--color-primary);
}

.atlas-ds-cta-card--notice .atlas-ds-cta-card__title {
    color: #0f172a;
}

.atlas-ds-cta-card--notice .atlas-ds-cta-card__text,
.atlas-ds-cta-card--notice .atlas-ds-cta-card__content,
.atlas-ds-cta-card--notice .atlas-ds-cta-card__content p {
    color: #475569;
}

.cta-section .atlas-ds-cta-card,
.homepage-banner-section .atlas-ds-cta-card,
.homepage-custom-html-section .atlas-ds-cta-card {
    width: 100%;
}

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

/* ── Rank row badge ── */
.app-rank-row__title .atlas-ds-badge.app-rank-row__badge {
    margin-left: 6px;
    vertical-align: middle;
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: var(--ds-radius-pill);
    background: rgba(16, 185, 129, 0.16);
    color: #4ade80;
    font-size: 0.62rem;
    font-weight: 700;
    border: 0;
}

.app-rank-row__title .atlas-ds-badge {
    margin-left: 6px;
    vertical-align: middle;
}

/* ── Page context: category archive ── */
body.tax-app_category .category-archive-apps .atlas-ds-section-header {
    margin-bottom: 12px;
    gap: 4px;
}

body.tax-app_category .category-archive-apps .atlas-ds-section-header__title {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

body.tax-app_category .category-archive-apps .atlas-ds-section-header__subtitle {
    font-size: 0.86rem;
}

body.tax-app_category .category-archive-tabs.atlas-ds-tab-nav .atlas-ds-tab-nav__list {
    margin-bottom: 14px;
}

body.tax-app_category .category-archive-empty.atlas-ds-empty-state {
    padding: 28px 20px;
}

/* ── Page context: single app ── */
body.single-apps .app-detail-section .atlas-ds-section-header {
    margin-bottom: 12px;
    gap: 4px;
}

body.single-apps .app-detail-section .atlas-ds-section-header__title {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

body.single-apps .app-detail-section .atlas-ds-section-header__subtitle {
    font-size: 0.84rem;
}

body.single-apps .app-detail-hero__stats.atlas-ds-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 0;
}

body.single-apps .app-detail-hero__stats .atlas-ds-stats__item {
    padding: 10px 12px;
    border-radius: 10px;
    min-width: 0;
}

body.single-apps .app-detail-hero__stats .atlas-ds-stats__value {
    display: block;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.single-apps .app-detail-hero__stats .atlas-ds-stats__label {
    font-size: 0.72rem;
    margin-top: 2px;
}

body.single-apps .atlas-ds-info-grid {
    gap: 12px;
}

body.single-apps .atlas-ds-info-grid .atlas-ds-info-card {
    padding: 14px;
}

body.single-apps .atlas-ds-info-grid .atlas-ds-info-card__label {
    font-size: 0.78rem;
}

body.single-apps .atlas-ds-info-grid .atlas-ds-info-card__value {
    font-size: 0.98rem;
}

@media (min-width: 769px) {
    body.single-apps .app-detail-hero__stats.atlas-ds-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    body.single-apps .atlas-ds-info-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    body.single-apps .atlas-ds-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .atlas-ds-cta-card__inner {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
            "media body"
            "actions actions";
        padding: 16px 18px;
        gap: 12px 14px;
    }

    .atlas-ds-cta-card__media {
        grid-area: media;
    }

    .atlas-ds-cta-card__body {
        grid-area: body;
    }

    .atlas-ds-cta-card__actions {
        grid-area: actions;
        width: 100%;
    }

    .atlas-ds-cta-card__actions .atlas-ds-btn {
        width: 100%;
    }
}

body.light-mode .atlas-ds-cta-card--notice {
    background: #f8fafc;
}

body.dark-mode .atlas-ds-cta-card--notice,
body.atlas-mobile-first .atlas-ds-cta-card--notice {
    background: #f3f4f6;
}

body.dark-mode .atlas-ds-cta-card--notice .atlas-ds-cta-card__title {
    color: #0f172a;
}

