/* ===========================================================================
 * ApkFlash Theme — Play Store inspired, fully responsive (320px → 4K)
 * ========================================================================= */

/* ----- Reset & base ------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; }
img, picture, svg, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--apk-link); text-decoration: none; }
a:hover { color: var(--apk-link-hover); }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--apk-accent); outline-offset: 2px; border-radius: 6px; }

/* ----- Design tokens (light mode) ----------------------------------------- */
:root {
    --apk-bg:          #f5f7fb;
    --apk-bg-alt:      #ffffff;
    --apk-surface:     #ffffff;
    --apk-surface-2:   #f1f3f5;
    --apk-border:      #e3e6ec;
    --apk-text:        #1f1f1f;
    --apk-text-muted:  #5f6368;
    --apk-link:        var(--apk-accent);
    --apk-link-hover:  color-mix(in srgb, var(--apk-accent) 80%, #000);
    --apk-shadow-sm:   0 1px 2px rgba(15, 23, 42, .06);
    --apk-shadow:      0 6px 18px rgba(15, 23, 42, .08);
    --apk-shadow-lg:   0 24px 60px rgba(15, 23, 42, .14);
    --apk-header-h:    64px;
    --apk-bottom-nav-h: 60px;
    --apk-radius-pill: 999px;
    --apk-content-w:   72ch;
}

html[data-apk-theme="dark"] {
    --apk-bg:          #0d1117;
    --apk-bg-alt:      #11151c;
    --apk-surface:     #161b22;
    --apk-surface-2:   #1c2129;
    --apk-border:      #2a313a;
    --apk-text:        #e6edf3;
    --apk-text-muted:  #9da7b3;
    --apk-link:        var(--apk-accent-dark);
    --apk-link-hover:  color-mix(in srgb, var(--apk-accent-dark) 85%, #fff);
    --apk-shadow-sm:   0 1px 2px rgba(0, 0, 0, .4);
    --apk-shadow:      0 6px 18px rgba(0, 0, 0, .55);
    --apk-shadow-lg:   0 24px 60px rgba(0, 0, 0, .7);
}
html[data-apk-theme="dark"] {
    color-scheme: dark;
}

/* ----- Font stacks ------------------------------------------------------- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--apk-bg);
    color: var(--apk-text);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color .25s ease, color .25s ease;
}
body.font-inter   { font-family: 'Inter', system-ui, sans-serif; }
body.font-roboto  { font-family: 'Roboto', system-ui, sans-serif; }
body.font-poppins { font-family: 'Poppins', system-ui, sans-serif; }
body.font-dm-sans { font-family: 'DM Sans', system-ui, sans-serif; }

h1, h2, h3, h4, h5 { line-height: 1.25; font-weight: 700; letter-spacing: -.01em; color: var(--apk-text); }
p { color: var(--apk-text); }

/* ----- Helpers ----------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--apk-container, 1240px);
    margin: 0 auto;
    padding-inline: clamp(16px, 4vw, 32px);
}
.screen-reader-text {
    position: absolute !important; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
.skip-link {
    position: absolute; top: -100px; left: 8px; background: var(--apk-accent); color: #fff;
    padding: 10px 16px; border-radius: 6px; font-weight: 600; z-index: 200;
}
.skip-link:focus { top: 8px; }

/* ----- Buttons ----------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px;
    border-radius: var(--apk-radius-pill);
    font-weight: 600; font-size: 14px; line-height: 1;
    border: 1px solid transparent;
    transition: transform .12s ease, background-color .15s ease, color .15s ease, box-shadow .15s ease;
    white-space: nowrap;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--apk-accent); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.05); }
.btn--primary:hover { background: var(--apk-link-hover); color: #fff; }
html[data-apk-theme="dark"] .btn--primary { background: var(--apk-accent-dark); }
.btn--ghost { background: var(--apk-surface-2); color: var(--apk-text); border-color: var(--apk-border); }
.btn--ghost:hover { background: var(--apk-border); color: var(--apk-text); }
.btn--block { display: flex; width: 100%; }
.btn--lg { padding: 14px 28px; font-size: 16px; }

/* ----- Header ------------------------------------------------------------ */
.site-header {
    background: var(--apk-bg-alt);
    border-bottom: 1px solid var(--apk-border);
    z-index: 100;
}
body.header-sticky .site-header {
    position: sticky; top: 0;
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    background-color: color-mix(in srgb, var(--apk-bg-alt) 90%, transparent);
}
body.header-transparent .site-header {
    position: absolute; left: 0; right: 0; background: transparent; border-bottom: 0;
}
.site-header__inner {
    display: grid;
    grid-template-columns: auto auto 1fr auto auto;
    align-items: center;
    gap: 16px;
    min-height: var(--apk-header-h);
}
.menu-toggle {
    display: none;
    width: 40px; height: 40px; align-items: center; justify-content: center;
    color: var(--apk-text); border-radius: 50%;
}
.menu-toggle:hover { background: var(--apk-surface-2); }

.site-branding { display: flex; align-items: center; gap: 10px; }
.site-title {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--apk-text); font-weight: 800; font-size: 20px; letter-spacing: -.02em;
}
.site-title__text { background: linear-gradient(90deg, var(--apk-accent), color-mix(in srgb, var(--apk-accent) 50%, #4f46e5)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.logo-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: var(--apk-accent); color: #fff;
    border-radius: 9px;
}
.custom-logo-link img { max-height: 36px; width: auto; }

.header-search {
    grid-column: 3; max-width: 560px; width: 100%; justify-self: center;
    position: relative;
}
.header-search__icon { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); color: var(--apk-text-muted); }
.header-search input {
    width: 100%;
    background: var(--apk-surface-2);
    border: 1px solid transparent;
    border-radius: var(--apk-radius-pill);
    padding: 10px 16px 10px 42px;
    font-size: 14px;
    transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.header-search input:focus {
    outline: none; background: var(--apk-bg-alt);
    border-color: var(--apk-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--apk-accent) 18%, transparent);
}

.main-navigation { grid-column: 4; }
.main-navigation .menu {
    display: flex; gap: 4px; list-style: none;
}
.main-navigation .menu a {
    display: inline-block; padding: 8px 14px; border-radius: var(--apk-radius-pill);
    font-weight: 500; font-size: 14px; color: var(--apk-text);
}
.main-navigation .menu a:hover { background: var(--apk-surface-2); color: var(--apk-text); }
.main-navigation .menu .current-menu-item > a { background: color-mix(in srgb, var(--apk-accent) 14%, transparent); color: var(--apk-accent); }

.header-actions { display: flex; align-items: center; gap: 6px; grid-column: 5; }
.theme-toggle {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    color: var(--apk-text);
}
.theme-toggle:hover { background: var(--apk-surface-2); }
.theme-toggle .icon-moon { display: none; }
html[data-apk-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-apk-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Mobile drawer */
.mobile-drawer {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 150;
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.mobile-drawer.is-open { opacity: 1; pointer-events: auto; }
.mobile-drawer__panel {
    position: absolute; top: 0; left: 0; bottom: 0;
    width: min(86vw, 320px);
    background: var(--apk-bg-alt); padding: 20px 18px; overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--apk-shadow-lg);
}
.mobile-drawer.is-open .mobile-drawer__panel { transform: translateX(0); }
.mobile-drawer__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.mobile-drawer__close { font-size: 28px; line-height: 1; width: 36px; height: 36px; border-radius: 50%; }
.mobile-drawer__close:hover { background: var(--apk-surface-2); }
.mobile-drawer__search input {
    width: 100%; background: var(--apk-surface-2); border: 1px solid transparent;
    border-radius: var(--apk-radius-pill); padding: 10px 16px; margin-bottom: 14px;
}
.mobile-drawer #mobile-menu, .mobile-drawer__cats { list-style: none; padding: 0; margin: 0 0 18px; }
.mobile-drawer #mobile-menu a, .mobile-drawer__cats a {
    display: block; padding: 10px 12px; border-radius: 10px; color: var(--apk-text); font-weight: 500;
}
.mobile-drawer #mobile-menu a:hover, .mobile-drawer__cats a:hover { background: var(--apk-surface-2); }
.mobile-drawer h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--apk-text-muted); margin: 0 0 8px; }

/* ----- Hero -------------------------------------------------------------- */
.hero {
    background:
        radial-gradient(1200px 400px at 80% -10%, color-mix(in srgb, var(--apk-accent) 25%, transparent), transparent 60%),
        radial-gradient(800px 400px at 0% 0%, color-mix(in srgb, var(--apk-accent) 15%, transparent), transparent 60%),
        var(--apk-bg-alt);
    border-bottom: 1px solid var(--apk-border);
    padding: clamp(40px, 7vw, 80px) 0 clamp(48px, 8vw, 96px);
}
.hero__content { max-width: 760px; }
.hero__eyebrow {
    display: inline-block;
    padding: 4px 12px;
    background: color-mix(in srgb, var(--apk-accent) 16%, transparent);
    color: var(--apk-accent);
    border-radius: var(--apk-radius-pill);
    font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    margin-bottom: 18px;
}
.hero__title {
    font-size: clamp(28px, 5vw, 52px);
    letter-spacing: -.025em;
    margin-bottom: 14px;
}
.hero__subtitle { font-size: clamp(15px, 2vw, 18px); color: var(--apk-text-muted); margin-bottom: 28px; max-width: 560px; }
.hero__search {
    display: flex; align-items: center; gap: 8px;
    background: var(--apk-bg-alt); border: 1px solid var(--apk-border);
    border-radius: var(--apk-radius-pill); padding: 6px 6px 6px 18px;
    box-shadow: var(--apk-shadow); max-width: 560px;
}
.hero__search input { flex: 1; border: 0; background: transparent; padding: 10px 6px; font-size: 15px; min-width: 0; }
.hero__search input:focus { outline: none; }
.hero__search button {
    background: var(--apk-accent); color: #fff;
    padding: 10px 20px; border-radius: var(--apk-radius-pill); font-weight: 600; font-size: 14px;
}
.hero__search button:hover { background: var(--apk-link-hover); }
.hero__stats { display: flex; flex-wrap: wrap; gap: clamp(20px, 4vw, 48px); margin-top: 32px; }
.hero__stats div { display: flex; flex-direction: column; }
.hero__stats strong { font-size: clamp(20px, 3vw, 28px); color: var(--apk-text); font-weight: 800; }
.hero__stats span { color: var(--apk-text-muted); font-size: 13px; }

/* ----- Category chip row ------------------------------------------------- */
.cat-chip-row { background: var(--apk-bg-alt); border-bottom: 1px solid var(--apk-border); }
body.header-sticky .cat-chip-row { position: sticky; top: var(--apk-header-h); z-index: 90; }
.cat-chip-row__scroll {
    display: flex; gap: 8px; overflow-x: auto; padding: 12px 0;
    scrollbar-width: none;
}
.cat-chip-row__scroll::-webkit-scrollbar { display: none; }
.cat-chip {
    flex: 0 0 auto;
    padding: 8px 16px; border-radius: var(--apk-radius-pill);
    background: var(--apk-surface-2); color: var(--apk-text); font-weight: 500; font-size: 14px;
    border: 1px solid transparent; transition: background-color .15s, color .15s;
}
.cat-chip:hover { background: var(--apk-border); color: var(--apk-text); }
.cat-chip.is-active { background: var(--apk-accent); color: #fff; }

/* ----- Sections --------------------------------------------------------- */
.section, .row-section { padding: clamp(36px, 6vw, 64px) 0; }
.section--alt { background: var(--apk-bg-alt); }
.section__title, .row-section__title {
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 700; margin-bottom: 4px;
}
.row-section__head {
    display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px;
}
.row-section__sub { color: var(--apk-text-muted); font-size: 14px; }
.row-section__link {
    color: var(--apk-link); font-weight: 600; font-size: 14px; flex-shrink: 0;
}

/* ----- Horizontal scroller (Play Store style) -------------------------- */
.row-scroller {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(140px, 1fr);
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--apk-border) transparent;
    margin-inline: calc(-1 * clamp(16px, 4vw, 32px));
    padding-inline: clamp(16px, 4vw, 32px);
}
.row-scroller::-webkit-scrollbar { height: 8px; }
.row-scroller::-webkit-scrollbar-thumb { background: var(--apk-border); border-radius: 8px; }
.row-scroller::-webkit-scrollbar-track { background: transparent; }
.row-scroller > * { scroll-snap-align: start; }

@media (min-width: 768px) {
    .row-scroller { grid-auto-columns: minmax(160px, 1fr); }
}

/* ----- App Card --------------------------------------------------------- */
.apk-card {
    background: transparent;
    border-radius: var(--apk-radius-card);
    transition: transform .15s ease;
    min-width: 0;
}
.apk-card:hover { transform: translateY(-2px); }
.apk-card__link { display: block; color: var(--apk-text); }
.apk-card__icon {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--apk-radius-icon);
    overflow: hidden;
    background: var(--apk-surface-2);
    box-shadow: var(--apk-shadow-sm);
    margin-bottom: 10px;
}
.apk-card__icon img { width: 100%; height: 100%; object-fit: cover; }
.apk-card__icon-fallback {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    font-size: 36px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--apk-accent), color-mix(in srgb, var(--apk-accent) 50%, #4f46e5));
}
.apk-badge {
    position: absolute; top: 6px; right: 6px;
    padding: 2px 8px; font-size: 10px; font-weight: 700;
    border-radius: 999px; background: #ef4444; color: #fff; letter-spacing: .04em;
}
.apk-card__title {
    font-size: 14px; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    line-height: 1.3; min-height: 2.6em;
}
.apk-card__cat {
    display: block; font-size: 12px; color: var(--apk-text-muted); margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.apk-card__meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--apk-text-muted); }
.apk-card__rating .star { color: #f59e0b; font-size: 11px; }

/* Card style modifiers */
body.card-style-rectangle .apk-card__icon { border-radius: 6px; }
body.card-style-pill .apk-card__icon { border-radius: 22px; }

/* ----- Top Charts ranked grid ------------------------------------------- */
.rank-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 640px) { .rank-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .rank-grid { grid-template-columns: 1fr 1fr 1fr; } }
.apk-rank {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 12px;
    border-radius: var(--apk-radius-card);
    background: var(--apk-surface);
    border: 1px solid var(--apk-border);
    transition: background-color .15s ease, transform .15s ease;
    color: var(--apk-text);
    min-width: 0;
}
.apk-rank:hover { background: var(--apk-surface-2); transform: translateY(-2px); }
.apk-rank__num { font-size: 22px; font-weight: 800; color: var(--apk-text-muted); width: 28px; text-align: center; flex-shrink: 0; }
.apk-rank__icon { border-radius: 12px; flex-shrink: 0; }
.apk-rank__body { min-width: 0; flex: 1; }
.apk-rank__title { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apk-rank__meta { display: block; font-size: 12px; color: var(--apk-text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----- Categories grid -------------------------------------------------- */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.cat-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--apk-surface); border: 1px solid var(--apk-border);
    border-radius: var(--apk-radius-card);
    padding: 14px;
    transition: transform .15s ease, box-shadow .15s ease;
    color: var(--apk-text); min-width: 0;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--apk-shadow); color: var(--apk-text); }
.cat-card__icon {
    width: 48px; height: 48px; flex-shrink: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--apk-accent), color-mix(in srgb, var(--apk-accent) 50%, #4f46e5));
    color: #fff; font-weight: 700; font-size: 22px;
    display: flex; align-items: center; justify-content: center;
}
.cat-card__name { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-card__count { color: var(--apk-text-muted); font-size: 12px; }

/* ----- Blog grid -------------------------------------------------------- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 22px;
}
.blog-card {
    background: var(--apk-surface);
    border: 1px solid var(--apk-border);
    border-radius: var(--apk-radius-card);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--apk-shadow); }
.blog-card__media {
    display: block; aspect-ratio: 16/9; background: var(--apk-surface-2); overflow: hidden;
}
.blog-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.blog-card:hover .blog-card__media img { transform: scale(1.04); }
.blog-card__placeholder { display: block; width: 100%; height: 100%;
    background: linear-gradient(135deg, var(--apk-accent), color-mix(in srgb, var(--apk-accent) 50%, #4f46e5)); }
.blog-card__body { padding: 18px; }
.blog-card__meta { display: flex; gap: 10px; font-size: 12px; color: var(--apk-text-muted); margin-bottom: 8px; }
.blog-card__meta a { color: var(--apk-accent); font-weight: 600; }
.blog-card__title { font-size: 18px; line-height: 1.3; margin-bottom: 8px; }
.blog-card__title a { color: var(--apk-text); }
.blog-card__title a:hover { color: var(--apk-accent); }
.blog-card__excerpt { color: var(--apk-text-muted); font-size: 14px; }

/* ----- Single App Hero -------------------------------------------------- */
.app-hero {
    background: var(--apk-bg-alt);
    padding-top: clamp(20px, 3vw, 32px);
    padding-bottom: clamp(24px, 4vw, 40px);
    border-bottom: 1px solid var(--apk-border);
}
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--apk-text-muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--apk-text-muted); }
.breadcrumb a:hover { color: var(--apk-accent); }
.breadcrumb span { opacity: .5; }

.app-hero__inner { display: flex; gap: clamp(16px, 3vw, 28px); align-items: flex-start; }
.app-hero__icon {
    position: relative;
    width: clamp(96px, 18vw, 160px); aspect-ratio: 1/1;
    border-radius: clamp(16px, 3vw, 28px);
    overflow: hidden; flex-shrink: 0;
    box-shadow: var(--apk-shadow);
    background: var(--apk-surface-2);
}
.app-hero__icon img { width: 100%; height: 100%; object-fit: cover; }
.app-hero__icon-fallback {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
    font-size: clamp(40px, 7vw, 64px); font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--apk-accent), color-mix(in srgb, var(--apk-accent) 50%, #4f46e5));
}
.app-hero__body { flex: 1; min-width: 0; }
.app-hero__title { font-size: clamp(22px, 3.5vw, 36px); margin-bottom: 6px; word-wrap: break-word; }
.app-hero__dev { color: var(--apk-text-muted); margin-bottom: 12px; }
.app-hero__dev strong { color: var(--apk-accent); font-weight: 600; }
.app-hero__cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.app-hero__cats a {
    background: var(--apk-surface-2); padding: 4px 10px; border-radius: var(--apk-radius-pill);
    font-size: 12px; font-weight: 500; color: var(--apk-text);
}
.app-hero__cta { display: flex; flex-wrap: wrap; gap: 10px; }

/* App stats strip below CTA — info table near download button */
.app-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 1px;
    margin-top: 24px;
    background: var(--apk-border);
    border: 1px solid var(--apk-border);
    border-radius: var(--apk-radius-card);
    overflow: hidden;
}
.app-stats__cell {
    background: var(--apk-bg-alt);
    padding: 14px 16px;
    text-align: center;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.app-stats__cell strong { font-size: 16px; color: var(--apk-text); display: inline-flex; align-items: center; gap: 4px; }
.app-stats__cell span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--apk-text-muted); font-weight: 600; }

/* ----- App content layout ---------------------------------------------- */
.app-section { padding: clamp(28px, 5vw, 48px) 0; }
.app-grid { display: grid; gap: clamp(20px, 3vw, 32px); grid-template-columns: 1fr; }
@media (min-width: 1024px) { .app-grid { grid-template-columns: 1fr 320px; align-items: start; } }
.app-grid__main { min-width: 0; }
.app-grid__side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (min-width: 1024px) { .app-grid__side { position: sticky; top: calc(var(--apk-header-h) + 16px); } }

.prose { color: var(--apk-text); font-size: 16px; line-height: 1.75; }
.prose h2, .prose h3, .prose h4 { margin: 1.5em 0 .5em; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.4em; }
.prose img { border-radius: var(--apk-radius-card); margin: 1em 0; }
.prose a { color: var(--apk-link); text-decoration: underline; text-underline-offset: 3px; }

.boxed-section {
    background: var(--apk-surface);
    border: 1px solid var(--apk-border);
    border-radius: var(--apk-radius-card);
    padding: clamp(18px, 3vw, 28px);
    margin-top: 24px;
}
.boxed-section h3 { font-size: 18px; margin-bottom: 14px; }
.check-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.check-list li { padding-left: 28px; position: relative; }
.check-list li::before {
    content: "✓"; position: absolute; left: 0; top: 0;
    color: var(--apk-accent); font-weight: 800;
}

.faqs { display: flex; flex-direction: column; gap: 10px; }
.faq {
    background: var(--apk-bg-alt);
    border: 1px solid var(--apk-border);
    border-radius: 12px;
    padding: 14px 16px;
    transition: background-color .15s;
}
.faq[open] { background: var(--apk-surface-2); }
.faq summary {
    list-style: none; cursor: pointer; font-weight: 600;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--apk-text-muted); transition: transform .2s; }
.faq[open] summary::after { content: "−"; }
.faq > div { padding-top: 10px; color: var(--apk-text-muted); }

.app-tags { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 6px; }
.app-tags a {
    padding: 4px 10px; border-radius: var(--apk-radius-pill);
    background: var(--apk-surface-2); color: var(--apk-text-muted); font-size: 12px;
}
.app-tags a:hover { background: var(--apk-border); color: var(--apk-text); }

/* Sidebar info card */
.info-card {
    background: var(--apk-surface);
    border: 1px solid var(--apk-border);
    border-radius: var(--apk-radius-card);
    padding: clamp(18px, 3vw, 24px);
}
.info-card h3 { font-size: 16px; margin-bottom: 14px; }
.info-table { width: 100%; font-size: 13px; }
.info-table th, .info-table td { text-align: left; padding: 8px 0; vertical-align: top; }
.info-table th { color: var(--apk-text-muted); font-weight: 500; width: 110px; }
.info-table tr + tr th, .info-table tr + tr td { border-top: 1px solid var(--apk-border); }
.info-table code { font-size: 12px; word-break: break-all; background: var(--apk-surface-2); padding: 2px 6px; border-radius: 4px; }
.info-card .btn { margin-top: 14px; }

.related-apps { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.related-apps a {
    display: flex; gap: 10px; align-items: center; padding: 8px;
    border-radius: 10px; color: var(--apk-text);
}
.related-apps a:hover { background: var(--apk-surface-2); color: var(--apk-text); }
.related-apps img, .related-apps__placeholder {
    width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; object-fit: cover;
}
.related-apps__placeholder {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--apk-accent), color-mix(in srgb, var(--apk-accent) 50%, #4f46e5));
    color: #fff; font-weight: 700;
}
.related-apps strong { display: block; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-apps small { color: var(--apk-text-muted); font-size: 12px; }

/* Screenshots */
.screenshots {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 1fr);
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-inline: calc(-1 * clamp(16px, 4vw, 32px));
    padding-inline: clamp(16px, 4vw, 32px);
    scroll-snap-type: x mandatory;
}
.screenshots::-webkit-scrollbar { height: 8px; }
.screenshots::-webkit-scrollbar-thumb { background: var(--apk-border); border-radius: 8px; }
.screenshots__item {
    border-radius: 14px; overflow: hidden; background: var(--apk-surface-2);
    aspect-ratio: 9 / 16; box-shadow: var(--apk-shadow-sm);
    scroll-snap-align: start;
}
.screenshots__item img { width: 100%; height: 100%; object-fit: cover; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 200;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.lightbox.is-open { opacity: 1; pointer-events: auto; }
.lightbox__img { max-width: 92vw; max-height: 86vh; border-radius: 8px; }
.lightbox__close { position: absolute; top: 14px; right: 14px; color: #fff; font-size: 36px; line-height: 1; width: 44px; height: 44px; }
.lightbox__nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    color: #fff; font-size: 50px; line-height: 1; width: 56px; height: 56px;
    border-radius: 50%;
}
.lightbox__nav:hover { background: rgba(255,255,255,.1); }
.lightbox__nav--prev { left: 14px; }
.lightbox__nav--next { right: 14px; }

/* Sticky install bar (mobile) */
.sticky-install {
    position: fixed; bottom: var(--apk-bottom-nav-h, 0); left: 0; right: 0;
    padding: 10px 14px;
    background: var(--apk-bg-alt);
    border-top: 1px solid var(--apk-border);
    box-shadow: 0 -4px 14px rgba(0,0,0,.06);
    z-index: 80;
    display: none;
}
@media (max-width: 1023px) { .sticky-install { display: block; } }
body.has-bottom-nav.single-app { padding-bottom: calc(var(--apk-bottom-nav-h) + 60px); }

/* ----- Comments -------------------------------------------------------- */
.comments-area { margin-top: 36px; }
.comments-title { font-size: 20px; margin-bottom: 16px; }
.comments-policy {
    background: color-mix(in srgb, var(--apk-accent) 10%, transparent);
    border-left: 3px solid var(--apk-accent);
    border-radius: 8px;
    padding: 10px 14px; font-size: 13px; color: var(--apk-text); margin-bottom: 18px;
}
.comment-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.comment-list .children { list-style: none; padding-left: clamp(20px, 4vw, 40px); margin-top: 10px; display: flex; flex-direction: column; gap: 12px; }
.apk-comment article {
    background: var(--apk-surface);
    border: 1px solid var(--apk-border);
    border-radius: var(--apk-radius-card);
    padding: 14px 16px;
}
.apk-comment__head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.apk-comment__avatar { border-radius: 50%; }
.apk-comment__author { font-size: 14px; }
.apk-comment__date { display: block; font-size: 12px; color: var(--apk-text-muted); }
.apk-comment__body { font-size: 14px; }
.apk-comment__reply { margin-top: 6px; font-size: 13px; }
.apk-comment__reply a { color: var(--apk-accent); font-weight: 600; }
.comment-awaiting-moderation { color: var(--apk-text-muted); font-style: italic; }

#respond { margin-top: 20px; }
#respond .comment-reply-title { font-size: 18px; margin-bottom: 10px; }
.comment-form { display: grid; gap: 12px; }
.comment-form-comment textarea, .comment-form-author input, .comment-form-email input, .comment-form-url input {
    width: 100%;
    background: var(--apk-bg-alt);
    border: 1px solid var(--apk-border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
}
.comment-form textarea:focus, .comment-form input:focus { outline: none; border-color: var(--apk-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--apk-accent) 18%, transparent); }
.comment-form-cookies-consent { font-size: 13px; color: var(--apk-text-muted); }
.comment-form .submit { justify-self: start; }

/* ----- Footer ---------------------------------------------------------- */
.site-footer {
    background: var(--apk-bg-alt);
    border-top: 1px solid var(--apk-border);
    margin-top: 60px;
    padding: clamp(40px, 6vw, 64px) 0 24px;
}
.site-footer__top {
    display: grid; gap: 32px;
    grid-template-columns: 1fr;
    margin-bottom: 32px;
}
@media (min-width: 640px) { .site-footer__top { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .site-footer__top { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.site-footer__brand { max-width: 360px; }
.site-footer__logo { display: flex; align-items: center; gap: 10px; color: var(--apk-text); font-size: 18px; margin-bottom: 12px; }
.site-footer__tagline { color: var(--apk-text-muted); font-size: 14px; margin-bottom: 16px; }
.site-footer__social { list-style: none; display: flex; gap: 8px; padding: 0; }
.site-footer__social a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--apk-surface-2); color: var(--apk-text);
}
.site-footer__social a:hover { background: var(--apk-accent); color: #fff; }
.site-footer__col h4 { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--apk-text-muted); margin-bottom: 14px; }
.site-footer__col ul { list-style: none; padding: 0; display: grid; gap: 8px; }
.site-footer__col a { color: var(--apk-text); font-size: 14px; }
.site-footer__col a:hover { color: var(--apk-accent); }
.site-footer__bottom {
    display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
    align-items: center; padding-top: 24px; border-top: 1px solid var(--apk-border);
    font-size: 13px; color: var(--apk-text-muted);
}
.site-footer__nav ul { list-style: none; display: flex; gap: 16px; padding: 0; }
.site-footer__nav a { color: var(--apk-text-muted); font-size: 13px; }
.site-footer__nav a:hover { color: var(--apk-accent); }

/* ----- Mobile bottom nav ----------------------------------------------- */
.bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--apk-bottom-nav-h);
    background: var(--apk-bg-alt);
    border-top: 1px solid var(--apk-border);
    z-index: 90;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav__item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--apk-text-muted); font-size: 11px; font-weight: 500;
    padding: 8px 0; border-radius: 0;
}
.bottom-nav__item:hover, .bottom-nav__item:focus-visible { color: var(--apk-accent); }
@media (max-width: 767px) { .bottom-nav { display: flex; } body.has-bottom-nav { padding-bottom: var(--apk-bottom-nav-h); } body.has-bottom-nav .site-footer { padding-bottom: calc(24px + var(--apk-bottom-nav-h)); } }

/* ----- Star helper ----------------------------------------------------- */
.apk-stars { display: inline-flex; gap: 1px; }
.apk-stars .star { color: #d1d5db; font-size: 14px; line-height: 1; }
.apk-stars .star.full { color: #f59e0b; }
.apk-stars .star.half { color: #f59e0b; opacity: .6; }

/* ----- Archive / Search ----------------------------------------------- */
.page-header { padding: clamp(28px, 5vw, 48px) 0 0; }
.page-title { font-size: clamp(22px, 3vw, 32px); }
.page-description { color: var(--apk-text-muted); margin-top: 6px; }
.archive-grid {
    padding: clamp(20px, 4vw, 32px) 0 60px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 18px;
}
@media (min-width: 768px) {
    .archive-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
.no-results { padding: 60px 0; text-align: center; color: var(--apk-text-muted); }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 32px; }
.pagination .page-numbers {
    padding: 8px 14px; border-radius: var(--apk-radius-pill);
    background: var(--apk-surface-2); color: var(--apk-text); font-weight: 500; font-size: 14px;
}
.pagination .page-numbers.current { background: var(--apk-accent); color: #fff; }
.pagination a:hover { background: var(--apk-border); color: var(--apk-text); }

/* ----- Single Blog Post ------------------------------------------------ */
.single-post .entry-header { padding: clamp(30px, 5vw, 56px) 0; background: var(--apk-bg-alt); border-bottom: 1px solid var(--apk-border); }
.single-post .entry-header .container { max-width: var(--apk-content-w); }
.entry-meta { font-size: 13px; color: var(--apk-text-muted); display: flex; gap: 12px; margin-bottom: 12px; }
.entry-title { font-size: clamp(26px, 4vw, 42px); }
.entry-content { padding: clamp(28px, 5vw, 48px) 0; }
.entry-content .container { max-width: var(--apk-content-w); }
.featured-image { margin: 0 0 24px; border-radius: var(--apk-radius-card); overflow: hidden; }

/* ----- Responsive header tweaks --------------------------------------- */
@media (max-width: 1023px) {
    .menu-toggle { display: inline-flex; }
    .main-navigation { display: none; }
    .site-header__inner { grid-template-columns: auto auto 1fr auto; }
    .header-search { grid-column: 3; }
    .header-actions { grid-column: 4; }
}
@media (max-width: 640px) {
    .site-header__inner { grid-template-columns: auto auto auto 1fr auto; gap: 8px; }
    .header-search { display: none; }
    .header-actions { grid-column: 5; }
    .site-title__text { display: none; }
    .hero__stats { gap: 16px; }
    .hero__stats strong { font-size: 18px; }
    .row-section__head { flex-direction: column; align-items: flex-start; gap: 4px; }
    .app-hero__inner { flex-direction: column; align-items: center; text-align: center; }
    .app-hero__cats, .app-hero__cta { justify-content: center; }
    .app-hero__icon { width: 100px; }
}
@media (min-width: 1600px) {
    :root { --apk-content-w: 80ch; }
}

/* ----- Reduced motion -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; }
    html { scroll-behavior: auto; }
}

/* ----- Print ----------------------------------------------------------- */
@media print {
    .site-header, .site-footer, .bottom-nav, .sticky-install, .row-scroller .apk-card { display: none !important; }
    body { background: #fff; color: #000; }
}
