/**
 * Mobile-first unified layout — matches approved mockup (Task 51.1).
 */

:root {
    --app-shell-max-width: 800px;
    --shell-backdrop: linear-gradient(160deg, #070b14 0%, #0f172a 45%, #111827 100%);
    --shell-shadow: 0 0 0 1px rgba(31, 41, 55, 0.9), 0 28px 80px rgba(0, 0, 0, 0.55);
}

/* ── Global frame ── */
body.atlas-mobile-first {
    background: var(--shell-backdrop);
    overflow-x: hidden;
    padding-bottom: 0;
    --header-height: 56px;
    --type-hero-title: clamp(1.375rem, 4.6vw, 1.875rem);
    --type-hero-subtitle: 0.875rem;
}

body.light-mode.atlas-mobile-first {
    --shell-backdrop: linear-gradient(160deg, #e8f5ec 0%, #eef2ef 50%, #f5f7f6 100%);
    --shell-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08), 0 24px 64px rgba(15, 23, 42, 0.12);
}

.site-app-shell {
    width: min(100%, var(--app-shell-max-width));
    margin: 0 auto;
    min-height: 100dvh;
    background: var(--color-background);
    color: var(--color-text);
    box-shadow: none;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow-x: hidden;
}

@media (min-width: 481px) {
    .site-app-shell {
        box-shadow: var(--shell-shadow);
        border-radius: 12px;
        margin-top: 12px;
        margin-bottom: 12px;
        min-height: calc(100dvh - 24px);
    }
}

.site-app-shell .site-container,
.site-app-shell .container {
    width: 100%;
    max-width: 100%;
    padding-left: 20px;
    padding-right: 20px;
}

/* ── Header (compact top bar) ── */
body.atlas-mobile-first .site-header {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 90;
    height: auto;
    min-height: var(--header-height);
    max-height: none;
    background: rgba(15, 23, 42, 0.96);
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    backdrop-filter: blur(12px);
    box-sizing: border-box;
    overflow: visible;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}

body.atlas-mobile-first .site-header.site-header--static {
    position: relative;
    top: auto;
}

body.atlas-mobile-first .site-header.site-header--with-quick-nav {
    position: relative;
    top: auto;
}

body.light-mode.atlas-mobile-first .site-header {
    background: #ffffff;
    border-bottom: none;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

body.atlas-mobile-first .site-header .hero-top-nav {
    width: 100%;
    margin: 0;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    border-bottom: none;
    flex-shrink: 0;
}

body.light-mode.atlas-mobile-first .site-header .hero-top-nav {
    border-top-color: rgba(15, 23, 42, 0.06);
}

body.admin-bar .site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
}

body.atlas-mobile-first .site-header__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    height: var(--header-height);
    min-height: var(--header-height);
    max-height: var(--header-height);
    padding-block: 0;
    padding-inline: 12px;
    box-sizing: border-box;
}

body.atlas-mobile-first .site-header__menu {
    display: none !important;
}

body.atlas-mobile-first .site-brand {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
}

body.atlas-mobile-first .site-logo {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
    height: 100%;
    padding: 0;
    text-decoration: none;
    color: inherit;
}

body.atlas-mobile-first .site-logo__image,
body.atlas-mobile-first .site-logo .custom-logo,
body.atlas-mobile-first .site-logo img {
    display: block;
    flex-shrink: 0;
    width: auto;
    height: auto;
    max-height: 36px;
    max-width: 132px;
    object-fit: contain;
    object-position: center center;
}

body.atlas-mobile-first .site-logo__text {
    font-size: 1.1875rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

body.atlas-mobile-first .site-controls {
    position: static;
    transform: none;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
    height: 100%;
    z-index: auto;
}

body.atlas-mobile-first .search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    box-sizing: border-box;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.14);
    color: var(--color-primary);
    cursor: pointer;
}

body.atlas-mobile-first .search-toggle:hover,
body.atlas-mobile-first .search-toggle:focus-visible {
    background: rgba(34, 197, 94, 0.22);
}

body.light-mode.atlas-mobile-first .search-toggle {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

body.atlas-mobile-first .toggle-theme {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    box-sizing: border-box;
    flex-shrink: 0;
    transform: none;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text);
}

body.atlas-mobile-first .toggle-theme:hover,
body.atlas-mobile-first .toggle-theme:focus-visible {
    border-color: rgba(148, 163, 184, 0.45);
    box-shadow: none;
    transform: none;
}

body.light-mode.atlas-mobile-first .site-logo__text {
    color: #0f172a;
}

body.light-mode.atlas-mobile-first .toggle-theme {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.12);
    color: #334155;
}

body.atlas-mobile-first .site-header__nav-wrap {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(2, 6, 23, 0.72);
    padding: 20px 12px;
    align-items: flex-start;
    justify-content: center;
}

body.atlas-mobile-first .site-header__nav-wrap.active {
    display: flex;
}

body.atlas-mobile-first .mobile-search-panel {
    border-top: 1px solid var(--color-border-base);
    padding: 8px 0 10px;
    background: var(--color-surface);
}

/* ── Bottom nav (4 items, labels readable) ── */
body.atlas-mobile-first .mobile-bottom-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    z-index: 95;
    width: min(100%, var(--app-shell-max-width));
    height: var(--mobile-nav-height);
    min-height: var(--mobile-nav-height);
    max-height: var(--mobile-nav-height);
    padding: 0 0 env(safe-area-inset-bottom);
    background: rgba(17, 24, 39, 0.98);
    border-top: 1px solid var(--color-border-base);
    backdrop-filter: blur(12px);
}

body.light-mode.atlas-mobile-first .mobile-bottom-bar {
    background: rgba(255, 255, 255, 0.98);
}

body.atlas-mobile-first .mobile-bottom-bar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 4px 8px;
    border: 0;
    background: transparent;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--type-nav-label);
    font-weight: 600;
    line-height: 1.15;
    min-height: 0;
    height: 100%;
    cursor: pointer;
    overflow: hidden;
}

body.atlas-mobile-first .mobile-bottom-bar__item.is-active {
    color: var(--color-primary);
}

body.atlas-mobile-first .mobile-bottom-bar__icon {
    font-size: var(--type-nav-icon);
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
}

body.atlas-mobile-first .mobile-bottom-bar__label {
    display: block;
    max-width: 100%;
    padding: 0 1px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Hero top nav (above Hero) ── */
body.atlas-mobile-first .hero-top-nav {
    width: 100%;
    max-width: 100%;
    background: #ffffff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-sizing: border-box;
}

body.atlas-mobile-first .site-main > .hero-top-nav,
body.atlas-mobile-first .homepage-builder > .hero-top-nav {
    flex-shrink: 0;
}

body.atlas-mobile-first .hero-top-nav__inner {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.atlas-mobile-first .hero-top-nav__list {
    display: flex;
    align-items: stretch;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
}

body.atlas-mobile-first .hero-top-nav__item {
    flex: 1 1 0;
    min-width: 0;
    border-right: 1px solid rgba(15, 23, 42, 0.1);
}

body.atlas-mobile-first .hero-top-nav__item:last-child {
    border-right: none;
}

body.atlas-mobile-first .hero-top-nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 52px;
    padding: 8px 6px;
    color: #0f172a;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.1;
    text-decoration: none;
    text-align: center;
    box-sizing: border-box;
    position: relative;
    height: 100%;
}

body.atlas-mobile-first .hero-top-nav__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: currentColor;
}

body.atlas-mobile-first .hero-top-nav__icon svg {
    display: block;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

body.atlas-mobile-first .hero-top-nav__label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

body.atlas-mobile-first .hero-top-nav__item.is-active .hero-top-nav__link {
    color: #16a34a;
}

body.atlas-mobile-first .hero-top-nav__item.is-active .hero-top-nav__link::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: #22c55e;
}

body.light-mode.atlas-mobile-first .hero-top-nav {
    background: #ffffff;
}

body.atlas-mobile-first.dark-mode .hero-top-nav {
    background: #f8fafc;
}

body.atlas-mobile-first .page-article__title {
    margin: 0 0 12px;
    font-size: 1.5rem;
    font-weight: 800;
}

body.atlas-mobile-first .page-article__content {
    color: var(--color-text);
    line-height: 1.75;
}

body.atlas-mobile-first .page-article__content p {
    margin: 0 0 1em;
}

/* ── Hero (compact + search fit) ── */
body.atlas-mobile-first .homepage-builder {
    padding: 0;
}

body.atlas-mobile-first .hero-section.homepage-hero,
body.atlas-mobile-first .homepage-hero {
    padding: 10px 0 6px;
    border-bottom: 1px solid var(--color-border-base);
    /* Allow Recent Searches dropdown to float over the carousel below. */
    overflow: visible;
    box-sizing: border-box;
    background: var(--gradient-hero-dark);
}

/* Collapse gap when Hero sits directly above the promo carousel. */
body.atlas-mobile-first .homepage-hero:has(+ .hero-carousel) {
    padding-bottom: 2px;
    border-bottom: none;
}

body.atlas-mobile-first .homepage-hero > .site-container {
    padding-left: 20px;
    padding-right: 20px;
}

body.atlas-mobile-first .homepage-hero .site-container,
body.atlas-mobile-first .homepage-hero__inner,
body.atlas-mobile-first .homepage-hero .hero-grid,
body.atlas-mobile-first .homepage-hero .hero-copy {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

body.atlas-mobile-first .homepage-hero .hero-grid {
    grid-template-columns: 1fr;
    gap: 0;
    align-items: start;
}

body.atlas-mobile-first .homepage-hero .hero-copy {
    order: 1;
}

body.atlas-mobile-first .homepage-hero .hero-promo {
    display: block;
    order: 2;
    margin-top: 16px;
}

body.atlas-mobile-first .homepage-hero .hero-promo-card {
    min-height: auto;
    padding: 16px;
}

body.atlas-mobile-first .homepage-hero .hero-promo-card__title {
    font-size: 1.05rem;
}

body.atlas-mobile-first .homepage-hero .hero-promo-card__text {
    font-size: 0.875rem;
}

body.atlas-mobile-first .hero-badge {
    display: inline-flex;
    padding: 4px 10px;
    margin-bottom: 8px;
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    max-width: 100%;
    box-sizing: border-box;
}

body.atlas-mobile-first .hero-title {
    font-size: var(--type-hero-title);
    line-height: 1.15;
    margin: 0 0 8px;
    font-weight: 800;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-sizing: border-box;
    color: #ffffff;
}

body.atlas-mobile-first .hero-subtitle {
    font-size: var(--type-hero-subtitle);
    line-height: 1.5;
    margin: 0 0 12px;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-sizing: border-box;
    color: rgba(226, 232, 240, 0.82);
}

body.atlas-mobile-first .hero-search {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    box-sizing: border-box;
    position: relative;
    z-index: 80;
}

body.atlas-mobile-first .hero-search .atlas-search-autocomplete {
    position: relative;
    z-index: 80;
}

body.atlas-mobile-first .hero-search .atlas-search-autocomplete__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 90;
}

body.atlas-mobile-first .hero-search .atlas-ds-search-bar {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 3px 3px 3px 12px;
    gap: 4px;
    overflow: hidden;
    box-sizing: border-box;
    border-radius: 12px;
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}

body.atlas-mobile-first .hero-search .atlas-ds-search-bar__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
}

body.atlas-mobile-first .hero-search .atlas-ds-search-bar__input {
    flex: 1 1 0%;
    min-width: 0;
    width: 100%;
    font-size: 0.875rem;
    box-sizing: border-box;
    color: #0f172a;
}

body.atlas-mobile-first .hero-search .atlas-ds-search-bar__input::placeholder {
    color: #94a3b8;
}

body.atlas-mobile-first .hero-search .atlas-ds-search-bar__submit {
    flex: 0 0 auto;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-width: 96px;
    max-width: none;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 9px;
    white-space: nowrap;
    overflow: visible;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    background: #16a34a !important;
    background-image: none !important;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

body.atlas-mobile-first .hero-search .atlas-ds-search-bar__submit-icon {
    display: block !important;
    flex: 0 0 18px;
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    color: #fff !important;
}

body.atlas-mobile-first .hero-search .atlas-ds-search-bar__submit-label,
body.atlas-mobile-first .hero-search .atlas-ds-search-bar__submit .atlas-ds-btn__text {
    display: inline !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.atlas-mobile-first .atlas-ds-chip-list,
body.atlas-mobile-first .hero-hot-keywords {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    margin-bottom: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 0;
    box-sizing: border-box;
}

body.atlas-mobile-first .atlas-ds-chip-list::-webkit-scrollbar,
body.atlas-mobile-first .hero-hot-keywords::-webkit-scrollbar {
    display: none;
}

body.atlas-mobile-first .atlas-ds-chip-list__label,
body.atlas-mobile-first .hero-hot-keywords__label {
    flex-shrink: 0;
    font-size: var(--type-caption);
}

body.atlas-mobile-first .atlas-ds-chip-list .atlas-ds-chip,
body.atlas-mobile-first .hero-hot-keyword {
    flex: 0 0 auto;
    padding: 5px 10px;
    font-size: 0.75rem;
}

/* ── Content sections (tight vertical rhythm) ── */
body.atlas-mobile-first .content-section {
    padding: 12px 0;
}

/* Keep promo carousel flush under Hero / header (beats generic .content-section). */
body.atlas-mobile-first .hero-carousel.content-section,
body.atlas-mobile-first .homepage-builder > .hero-carousel.content-section:first-child {
    padding: 4px 0 0;
}

body.atlas-mobile-first .homepage-hero + .hero-carousel.content-section {
    padding-top: 0;
}

body.atlas-mobile-first .top-apps-section,
body.atlas-mobile-first .categories-section,
body.atlas-mobile-first .articles-section,
body.atlas-mobile-first .homepage-banner-section,
body.atlas-mobile-first .homepage-custom-html-section,
body.atlas-mobile-first .homepage-advertisement-section,
body.atlas-mobile-first .cta-section,
body.atlas-mobile-first .faq-section,
body.atlas-mobile-first .homepage-seo-content {
    margin-bottom: 0;
}

body.atlas-mobile-first .faq-section .atlas-ds-section-header {
    margin-bottom: 10px;
    gap: 8px;
}

body.atlas-mobile-first .faq-section .atlas-ds-section-header__accent {
    width: 4px;
    min-height: 34px;
    background: var(--color-secondary);
    border-radius: 4px;
}

body.atlas-mobile-first .faq-section .atlas-ds-section-header__icon {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
    border-radius: 8px;
}

body.atlas-mobile-first .faq-section .atlas-ds-section-header__title {
    font-size: var(--type-section-title);
    margin-bottom: 2px;
}

body.atlas-mobile-first .faq-section .atlas-ds-section-header__subtitle {
    font-size: 0.8125rem;
    line-height: 1.4;
}

body.atlas-mobile-first .faq-section .faq-grid--accordion {
    gap: 6px;
}

body.atlas-mobile-first .faq-section .faq-item--accordion {
    border-radius: 8px;
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
}

body.atlas-mobile-first .faq-section .faq-item--accordion summary {
    padding: 10px 12px;
    font-size: 0.8125rem;
    gap: 8px;
}

body.atlas-mobile-first .faq-section .faq-item--accordion summary::after {
    font-size: 0.95rem;
}

body.atlas-mobile-first .faq-section .faq-item__answer {
    padding: 0 12px 10px;
}

body.atlas-mobile-first .faq-section .faq-item__answer p {
    font-size: 0.75rem;
    line-height: 1.5;
}

body.atlas-mobile-first .content-section--module {
    padding: 8px 0;
}

body.atlas-mobile-first .homepage-seo-content .atlas-ds-section-header {
    margin-bottom: 12px;
}

body.atlas-mobile-first .homepage-seo-content__body {
    padding: 22px 18px;
    font-size: 0.94rem;
    line-height: 1.75;
}

body.atlas-mobile-first .homepage-seo-content__body h2 {
    gap: 10px;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    font-size: 1.02rem;
}

body.atlas-mobile-first .homepage-seo-content__body h3 {
    margin-top: 1.1rem;
    font-size: 0.88rem;
}

/* ── User Picks section ── */
body.atlas-mobile-first .top-apps-section .atlas-ds-section-header {
    margin-bottom: 8px;
    gap: 10px;
}

body.atlas-mobile-first .top-apps-section .atlas-ds-section-header__accent {
    width: 4px;
    min-height: 36px;
    background: var(--color-secondary);
    border-radius: 4px;
}

body.atlas-mobile-first .top-apps-section .atlas-ds-section-header__title {
    font-size: var(--type-section-title);
    margin-bottom: 3px;
}

body.atlas-mobile-first .top-apps-section .atlas-ds-section-header__subtitle {
    font-size: var(--type-section-subtitle);
    margin: 0;
}

body.atlas-mobile-first .top-apps-section .atlas-ds-tab-nav__list {
    margin-bottom: 12px;
    gap: 8px;
}

body.atlas-mobile-first .atlas-ds-tab-nav__tab {
    padding: 7px 14px;
    font-size: var(--type-small);
}

/* ── Articles / Guides ── */
body.atlas-mobile-first .articles-section .atlas-ds-section-header {
    margin-bottom: 10px;
    gap: 8px;
}

body.atlas-mobile-first .articles-section .atlas-ds-section-header__accent {
    width: 4px;
    min-height: 34px;
    background: var(--color-secondary);
    border-radius: 4px;
}

body.atlas-mobile-first .articles-section .atlas-ds-section-header__icon {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
    border-radius: 8px;
}

body.atlas-mobile-first .articles-section .atlas-ds-section-header__title {
    font-size: var(--type-section-title);
    margin-bottom: 2px;
}

body.atlas-mobile-first .articles-section .atlas-ds-section-header__subtitle {
    font-size: 0.8125rem;
    line-height: 1.4;
}

body.atlas-mobile-first .articles-section .article-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

body.atlas-mobile-first .articles-section .article-card {
    border-radius: 10px;
}

body.atlas-mobile-first .articles-section .article-card__body {
    padding: 10px 10px 12px;
    gap: 6px;
}

body.atlas-mobile-first .articles-section .article-card__tag {
    top: 6px;
    left: 6px;
    padding: 2px 8px;
    font-size: 0.625rem;
}

body.atlas-mobile-first .articles-section .article-card h3,
body.atlas-mobile-first .articles-section .article-card__title {
    font-size: 0.8125rem;
}

body.atlas-mobile-first .articles-section .article-card p,
body.atlas-mobile-first .articles-section .article-card__excerpt {
    font-size: 0.6875rem;
    line-height: 1.4;
    -webkit-line-clamp: 2;
}

body.atlas-mobile-first .articles-section .article-card__link {
    min-height: 34px;
    font-size: 0.75rem;
    padding: 0 10px;
}

@media (max-width: 420px) {
    body.atlas-mobile-first .articles-section .article-grid {
        grid-template-columns: 1fr;
    }
}

/* ── App cards — horizontal scroll tiles ── */
body.atlas-mobile-first .app-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    grid-template-columns: unset;
}

body.atlas-mobile-first .app-grid::-webkit-scrollbar {
    display: none;
}

body.atlas-mobile-first .app-card--tile {
    flex: 0 0 160px;
    width: 160px;
    max-width: 160px;
    padding: 14px;
    gap: 10px;
    align-items: center;
    text-align: center;
}

body.atlas-mobile-first .app-card--tile .app-card__logo {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-xs);
    font-size: 1.2rem;
}

body.atlas-mobile-first .app-card--tile .app-card__title {
    font-size: var(--type-small);
    line-height: 1.25;
    width: 100%;
    margin: 0;
}

body.atlas-mobile-first .app-card--tile .app-card__title-link {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    white-space: normal;
}

body.atlas-mobile-first .app-card--tile .app-card__stats {
    flex-direction: row;
    justify-content: center;
    gap: 0;
}

body.atlas-mobile-first .app-card--tile .app-card__rating {
    font-size: var(--type-caption);
}

body.atlas-mobile-first .app-card--tile .app-card__button {
    width: 100%;
    min-height: 34px;
    padding: 0 10px;
    font-size: var(--type-caption);
    border-radius: var(--radius-circle);
}

body.atlas-mobile-first .app-card--tile:hover {
    transform: none;
}

/* ── Categories — compact horizontal scroll ── */
body.atlas-mobile-first .category-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    grid-template-columns: unset;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
}

body.atlas-mobile-first .category-grid::-webkit-scrollbar {
    display: none;
}

body.atlas-mobile-first .category-card {
    flex: 0 0 168px;
    padding: 10px;
    gap: 8px;
}

body.atlas-mobile-first .category-card__icon {
    width: 40px;
    height: 40px;
    font-size: 0.85rem;
}

body.atlas-mobile-first .category-card__name {
    font-size: var(--type-small);
    line-height: 1.25;
}

body.atlas-mobile-first .category-card__count {
    font-size: var(--type-caption);
}

body.atlas-mobile-first .categories-section .atlas-ds-section-header {
    margin-bottom: 12px;
}

body.atlas-mobile-first .categories-section .atlas-ds-section-header__title {
    font-size: var(--type-section-title);
}

/* ── Section tabs (generic scroll) ── */
body.atlas-mobile-first .atlas-ds-tab-nav__list,
body.atlas-mobile-first .section-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
}

body.atlas-mobile-first .atlas-ds-tab-nav__list::-webkit-scrollbar,
body.atlas-mobile-first .section-tabs::-webkit-scrollbar {
    display: none;
}

body.atlas-mobile-first .atlas-ds-tab-nav__tab,
body.atlas-mobile-first .section-tab {
    flex: 0 0 auto;
}

/* ── Footer ── */
body.atlas-mobile-first .site-footer.site-footer--legal {
    padding: 0 0 calc(20px + env(safe-area-inset-bottom, 0px));
    margin-top: 0;
    background: var(--color-background);
    color: var(--color-text);
    border-top: 1px solid var(--color-border-base);
}

body.atlas-mobile-first .site-footer--legal .site-footer__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px 16px;
    text-align: center;
}

body.atlas-mobile-first .site-footer__warning,
body.atlas-mobile-first .site-footer__notice {
    width: 100%;
    margin: 0 0 4px;
    padding: 16px 16px 14px;
    border: 0;
    border-radius: 12px;
    background: #fef2f2;
    color: #334155;
    font-size: 0.8125rem;
    line-height: 1.6;
    font-weight: 400;
    text-align: left;
    box-sizing: border-box;
}

body.atlas-mobile-first .site-footer__notice-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    color: #991b1b;
    font-size: 0.9375rem;
    font-weight: 800;
    line-height: 1.3;
}

body.atlas-mobile-first .site-footer__notice-icon {
    display: inline-flex;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

body.atlas-mobile-first .site-footer__notice-icon svg {
    display: block;
    width: 18px;
    height: 18px;
}

body.atlas-mobile-first .site-footer__notice-body {
    display: grid;
    gap: 8px;
}

body.atlas-mobile-first .site-footer__notice-body p {
    margin: 0;
    color: #334155;
}

body.atlas-mobile-first .site-footer__notice-link {
    color: #dc2626;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

body.atlas-mobile-first .site-footer__notice-link:hover,
body.atlas-mobile-first .site-footer__notice-link:focus-visible {
    color: #b91c1c;
}

body.atlas-mobile-first .site-footer__nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 18px 0 16px;
}

body.atlas-mobile-first .site-footer__nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 16px;
    border: 1px solid var(--color-border-medium);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

body.atlas-mobile-first .site-footer__nav-link:hover,
body.atlas-mobile-first .site-footer__nav-link:focus-visible {
    background: var(--color-surface-strong);
    border-color: var(--color-border-medium);
    color: var(--color-text-primary);
}

body.atlas-mobile-first .site-footer__disclaimer {
    width: 100%;
    padding: 0 0 16px;
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
    line-height: 1.65;
    text-align: justify;
    text-align-last: center;
}

body.atlas-mobile-first .site-footer__disclaimer p {
    margin: 0;
}

body.atlas-mobile-first .site-footer__copyright {
    width: 100%;
    margin: 0;
    padding-top: 14px;
    border-top: 1px solid var(--color-border-base);
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    line-height: 1.55;
}

body.light-mode.atlas-mobile-first .site-footer--legal {
    background: var(--color-background);
    color: var(--color-text);
}

body.light-mode.atlas-mobile-first .site-footer__nav-link {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

/* ── App detail ── */
body.atlas-mobile-first .app-detail-layout__inner {
    grid-template-columns: 1fr;
}

body.atlas-mobile-first .app-detail-layout__sidebar-wrap {
    display: none;
}

body.atlas-mobile-first .app-detail-mobile-cta {
    display: block;
}

body.atlas-mobile-first .app-detail-sticky-download {
    display: block;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    z-index: 88;
    width: min(100%, var(--app-shell-max-width));
    padding: 8px 12px;
    background: transparent;
    border-top: 0;
    backdrop-filter: none;
    pointer-events: none;
}

body.light-mode.atlas-mobile-first .app-detail-sticky-download {
    background: transparent;
}

body.atlas-mobile-first .app-detail-sticky-download__button {
    width: 100%;
    justify-content: center;
}

body.atlas-mobile-first.single-apps .app-detail-layout {
    padding-bottom: calc(var(--body-nav-offset) + 72px + env(safe-area-inset-bottom));
}

body.atlas-mobile-first .app-detail-hero__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.atlas-mobile-first .app-quick-info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ── App detail ── */
body.light-mode.atlas-mobile-first {
    --color-text: #0f172a;
    --color-muted: #475569;
    --color-text-secondary: #64748b;
}

body.light-mode.atlas-mobile-first .site-app-shell {
    background: #f5f7f6;
    color: #0f172a;
}

body.light-mode.atlas-mobile-first .hero-section.homepage-hero,
body.light-mode.atlas-mobile-first .homepage-hero {
    background: #f5f7f6;
    border-bottom-color: rgba(15, 23, 42, 0.06);
    color: #0f172a;
}

body.light-mode.atlas-mobile-first .homepage-hero .hero-title,
body.light-mode.atlas-mobile-first .hero-title {
    color: #0f172a;
}

body.light-mode.atlas-mobile-first .homepage-hero .hero-subtitle,
body.light-mode.atlas-mobile-first .hero-subtitle,
body.light-mode.atlas-mobile-first .homepage-hero .atlas-ds-chip-list__label,
body.light-mode.atlas-mobile-first .homepage-hero .hero-hot-keywords__label {
    color: #64748b;
}

body.light-mode.atlas-mobile-first .homepage-hero .atlas-ds-chip--popular-search,
body.light-mode.atlas-mobile-first .homepage-hero .hero-hot-keyword {
    background: #ffffff;
    color: #475569;
    border-color: rgba(15, 23, 42, 0.1);
}

body.light-mode.atlas-mobile-first .homepage-hero .hero-badge {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.28);
}

body.light-mode.atlas-mobile-first .footer-branding__title,
body.light-mode.atlas-mobile-first .footer-menu-block__title,
body.light-mode.atlas-mobile-first .footer-support-block__title,
body.light-mode.atlas-mobile-first .footer-newsletter__title,
body.light-mode.atlas-mobile-first .atlas-ds-section-header__title {
    color: #0f172a;
}

body.light-mode.atlas-mobile-first .footer-branding__copy,
body.light-mode.atlas-mobile-first .footer-newsletter__text,
body.light-mode.atlas-mobile-first .footer-menu li a,
body.light-mode.atlas-mobile-first .footer-link,
body.light-mode.atlas-mobile-first .atlas-ds-section-header__subtitle {
    color: #64748b;
}

body.light-mode.atlas-mobile-first .app-card,
body.light-mode.atlas-mobile-first .category-card {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
}

body.light-mode.atlas-mobile-first .app-card__title-link,
body.light-mode.atlas-mobile-first .category-card__name {
    color: #0f172a;
}

body.light-mode.atlas-mobile-first .homepage-module-card--light,
body.light-mode.atlas-mobile-first .homepage-custom-html-section .homepage-module-card {
    background: #ffffff;
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.08);
}

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

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

body.light-mode.atlas-mobile-first .cta-section .promo-card__title,
body.light-mode.atlas-mobile-first .cta-section .promo-card__text {
    color: #fff;
}

/* Hide desktop-only patterns */
body.atlas-mobile-first .desktop-only {
    display: none !important;
}

/*
 * Mobile tap targets ≥ 44px (WCAG 2.5.5 / Apple HIG).
 * Keep font-size unchanged; expand hit area with padding / min-height.
 */
@media (max-width: 768px) {
    .atlas-ds-chip--popular-search,
    .atlas-breadcrumb__link,
    .blog-article__toc-link,
    .app-rank-row__title-link,
    .app-card__title-link {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        box-sizing: border-box;
    }

    .atlas-ds-chip--popular-search {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .atlas-breadcrumb__link,
    .blog-article__toc-link {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .app-rank-row__title-link,
    .app-card__title-link {
        padding-top: 8px;
        padding-bottom: 8px;
    }
}
