/* Homepage category styles v1 - deliberately isolated from category navigation and app grids. */
.home-category-section { padding-top: 15px; padding-bottom: 8px; }
.home-category-section .home-category-heading { margin: 0 0 11px; align-items: center; }
.home-category-heading-copy { display: flex; align-items: baseline; flex-wrap: wrap; gap: 9px; min-width: 0; }
.home-category-section .home-category-heading h2 { margin: 0; font-size: clamp(18px, 2.5vw, 24px); font-weight: 800; letter-spacing: -.025em; }
.home-category-section .home-category-total { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.home-category-section .home-category-swipe-hint { display: none; color: var(--muted); font-size: 11px; white-space: nowrap; }
.home-category-section .home-category-swipe-hint span { font-size: 16px; margin-left: 4px; color: var(--primary); }
.home-category-empty { font-size: 13px; color: var(--muted); }

/* Base card: legible on dark and light site themes. */
html[data-theme] .home-category-section .home-category-grid { margin: 0; }
html[data-theme] .home-category-section .home-category-card {
    position: relative; display: flex; align-items: center; flex-direction: row; gap: 11px;
    min-width: 0; min-height: 67px; padding: 11px 12px; isolation: isolate;
    border: 1px solid var(--border); border-radius: 15px;
    background: var(--surface); color: var(--text);
    box-shadow: 0 4px 16px rgba(0,0,0,.045);
    text-align: left; transform: none;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.home-category-section .home-category-card::before,
.home-category-section .home-category-card::after { display: none !important; }
.home-category-section .home-category-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.home-category-section .home-category-card:hover { transform: translateY(-2px); border-color: var(--primary); }
html[data-theme] .home-category-section .home-category-icon {
    flex: 0 0 35px; display: grid; place-items: center; width: 35px; height: 35px;
    border-radius: 11px; color: var(--primary);
    background: color-mix(in srgb, var(--primary) 13%, var(--surface));
}
.home-category-section .home-category-icon svg { width: 18px; height: 18px; display: block; }
html[data-theme] .home-category-section .home-category-copy { display: flex; flex-direction: column; flex: 1; gap: 2px; min-width: 0; }
html[data-theme] .home-category-section .home-category-copy strong {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    overflow: hidden; overflow-wrap: anywhere; font-size: 12px; line-height: 1.3;
    font-weight: 800; color: var(--text); margin: 0;
}
html[data-theme] .home-category-section .home-category-count {
    display: block; font-size: 10px; line-height: 1.3; color: var(--muted); margin: 0;
    white-space: nowrap;
}
html[data-theme] .home-category-section .home-category-arrow {
    flex: 0 0 auto; color: var(--primary); font-size: 15px; font-weight: 800; line-height: 1;
}

/* 1. Default: single-row swipe carousel. It remains a carousel even on <=620px.
   This overrides the legacy final @media rule that forces a two-column grid. */
html[data-theme] .home-category-layout-carousel .home-category-grid {
    display: flex; flex-wrap: nowrap; grid-template-columns: none; grid-auto-flow: initial;
    gap: 10px; width: 100%; padding: 4px 2px 11px;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x proximity; scroll-padding-inline: 2px;
    overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; touch-action: pan-x;
    scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--primary) 35%, transparent) transparent;
}
html[data-theme] .home-category-layout-carousel .home-category-card,
html[data-theme="bento_grid"] .home-category-layout-carousel .home-category-card:nth-child(n) {
    flex: 0 0 clamp(162px, 20vw, 212px); grid-column: auto;
    scroll-snap-align: start; min-height: 77px;
}
.home-category-layout-carousel .home-category-swipe-hint { display: block; }

/* 2. Chips: flexible small pills, no horizontal overflow. */
html[data-theme] .home-category-layout-chips .home-category-grid {
    display: flex; flex-wrap: wrap; grid-template-columns: none; grid-auto-flow: initial;
    gap: 8px; overflow: visible; padding: 0;
}
html[data-theme] .home-category-layout-chips .home-category-card,
html[data-theme="bento_grid"] .home-category-layout-chips .home-category-card:nth-child(n) {
    display: inline-flex; flex: 0 1 auto; grid-column: auto; width: auto;
    min-height: 41px; max-width: 100%; padding: 8px 12px; gap: 7px;
    border-radius: 999px;
}
.home-category-layout-chips .home-category-icon { display: none !important; }
html[data-theme] .home-category-layout-chips .home-category-copy { display: flex; flex-direction: row; align-items: center; gap: 7px; }
html[data-theme] .home-category-layout-chips .home-category-copy strong { font-size: 11.5px; -webkit-line-clamp: 1; white-space: nowrap; text-overflow: ellipsis; }
html[data-theme] .home-category-layout-chips .home-category-count { font-size: 9px; opacity: .85; white-space: nowrap; }
.home-category-layout-chips .home-category-arrow { display: none !important; }

/* 3. Mini-grid: two tidy columns on phones, four on desktop. */
html[data-theme] .home-category-layout-compact .home-category-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px; overflow: visible; padding: 0;
}
html[data-theme="bento_grid"] .home-category-layout-compact .home-category-card:nth-child(n) { grid-column: auto; }
html[data-theme] .home-category-layout-compact .home-category-card { min-height: 55px; padding: 8px 10px; gap: 8px; }
html[data-theme] .home-category-layout-compact .home-category-icon { flex-basis: 28px; width: 28px; height: 28px; border-radius: 8px; }
.home-category-layout-compact .home-category-icon svg { width: 15px; height: 15px; }
html[data-theme] .home-category-layout-compact .home-category-copy strong { font-size: 11.5px; }
html[data-theme] .home-category-layout-compact .home-category-count { font-size: 9px; }
.home-category-layout-compact .home-category-arrow { display: none !important; }

/* 4. Spotlight: distinct cards with a light accent wash instead of the old vertical stripe. */
html[data-theme] .home-category-layout-showcase .home-category-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px; overflow: visible; padding: 0;
}
html[data-theme="bento_grid"] .home-category-layout-showcase .home-category-card:nth-child(n) { grid-column: auto; }
html[data-theme] .home-category-layout-showcase .home-category-card {
    min-height: 99px; align-items: flex-start; flex-direction: column;
    justify-content: space-between; gap: 7px;
    padding: 12px; background: linear-gradient(133deg, color-mix(in srgb,var(--primary) 11%,var(--surface)),var(--surface) 70%);
}
html[data-theme] .home-category-layout-showcase .home-category-card:nth-child(4n+2) { background: linear-gradient(133deg,color-mix(in srgb,var(--primary2) 14%,var(--surface)),var(--surface) 70%); }
html[data-theme] .home-category-layout-showcase .home-category-card .home-category-copy { flex: 0 1 auto; width: 100%; }
html[data-theme] .home-category-layout-showcase .home-category-card .home-category-arrow { position: absolute; right: 12px; top: 13px; }
html[data-theme] .home-category-layout-showcase .home-category-copy strong { font-size: 12px; }

@media(max-width:900px) {
    html[data-theme] .home-category-layout-compact .home-category-grid,
    html[data-theme] .home-category-layout-showcase .home-category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media(max-width:620px) {
    .home-category-section { padding-top: 12px; padding-bottom: 5px; }
    .home-category-section .home-category-heading { margin-bottom: 8px; }
    .home-category-section .home-category-heading h2 { font-size: 19px; }
    .home-category-section .home-category-swipe-hint { font-size: 10px; }
    html[data-theme] .home-category-layout-carousel .home-category-grid { gap: 8px; padding: 2px 2px 11px; }
    html[data-theme] .home-category-layout-carousel .home-category-card,
    html[data-theme="bento_grid"] .home-category-layout-carousel .home-category-card:nth-child(n) {
        flex: 0 0 clamp(151px, 43vw, 190px); width: auto; min-height: 71px;
    }
    html[data-theme] .home-category-layout-carousel .home-category-card { padding: 9px 10px; }
    html[data-theme] .home-category-layout-compact .home-category-grid,
    html[data-theme] .home-category-layout-showcase .home-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    html[data-theme] .home-category-layout-showcase .home-category-card { min-height: 98px; }
}
@media(max-width:360px) {
    .home-category-section .home-category-heading-copy { gap: 5px; }
    .home-category-section .home-category-total { font-size: 10px; }
    .home-category-section .home-category-swipe-hint { font-size: 9px; }
    html[data-theme] .home-category-section .home-category-card { padding: 8px 9px; }
    html[data-theme] .home-category-layout-chips .home-category-card { padding: 7px 10px; }
}
@media(prefers-reduced-motion:reduce) {
    .home-category-section .home-category-card { transition: none; }
}


/* 5/6. Navbar-style category pills. These affect ONLY the home category section. */
.home-category-section .home-category-nav-dot { display: none; }
html[data-theme] .home-category-layout-geser .home-category-grid,
html[data-theme] .home-category-layout-geser_style .home-category-grid {
    display: flex; flex-wrap: nowrap; grid-template-columns: none; grid-auto-flow: initial;
    align-items: center; gap: 9px; width: 100%; margin: 0;
    padding: 4px 3px 13px; overflow-x: auto; overflow-y: hidden;
    overscroll-behavior-x: contain; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; touch-action: pan-x;
}
.home-category-layout-geser .home-category-grid::-webkit-scrollbar,
.home-category-layout-geser_style .home-category-grid::-webkit-scrollbar { display: none; }
html[data-theme] .home-category-layout-geser .home-category-card,
html[data-theme] .home-category-layout-geser_style .home-category-card,
html[data-theme="bento_grid"] .home-category-layout-geser .home-category-card:nth-child(n),
html[data-theme="bento_grid"] .home-category-layout-geser_style .home-category-card:nth-child(n) {
    display: inline-flex; flex: 0 0 auto; grid-column: auto; width: auto;
    min-height: 46px; max-width: min(75vw, 310px); padding: 9px 13px;
    gap: 8px; border-radius: 999px; white-space: nowrap;
    background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--primary) 5%, var(--surface)));
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.home-category-layout-geser .home-category-icon,
.home-category-layout-geser_style .home-category-icon,
.home-category-layout-geser .home-category-arrow,
.home-category-layout-geser_style .home-category-arrow { display: none !important; }
html[data-theme] .home-category-layout-geser .home-category-nav-dot,
html[data-theme] .home-category-layout-geser_style .home-category-nav-dot {
    display: block; width: 8px; height: 8px; flex: 0 0 8px;
    margin: 0; border-radius: 50%; background: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}
html[data-theme] .home-category-layout-geser .home-category-copy,
html[data-theme] .home-category-layout-geser_style .home-category-copy {
    display: flex; flex-direction: row; align-items: center; flex: 0 1 auto; gap: 8px;
}
html[data-theme] .home-category-layout-geser .home-category-copy strong,
html[data-theme] .home-category-layout-geser_style .home-category-copy strong {
    display: block; max-width: 180px; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.2;
}
html[data-theme] .home-category-layout-geser .home-category-count,
html[data-theme] .home-category-layout-geser_style .home-category-count {
    margin: 0; font-size: 9px; font-weight: 700; white-space: nowrap;
}
.home-category-layout-geser .home-category-swipe-hint { display: block; }

/* Auto variant: stylish colored nav pills and pulse markers, not the old cards. */
html[data-theme] .home-category-layout-geser_style .home-category-card {
    --hc-accent: var(--primary);
    border-color: color-mix(in srgb, var(--hc-accent) 33%, var(--border));
    background: linear-gradient(135deg, color-mix(in srgb, var(--hc-accent) 12%, var(--surface)), var(--surface) 85%);
    box-shadow: 0 4px 13px color-mix(in srgb, var(--hc-accent) 12%, transparent);
}
html[data-theme="classic"] .home-category-layout-geser_style .home-category-card:nth-child(5n+2){--hc-accent:#0e9f80}
html[data-theme="classic"] .home-category-layout-geser_style .home-category-card:nth-child(5n+3){--hc-accent:#e98618}
html[data-theme="classic"] .home-category-layout-geser_style .home-category-card:nth-child(5n+4){--hc-accent:#d54f88}
html[data-theme="classic"] .home-category-layout-geser_style .home-category-card:nth-child(5n){--hc-accent:#2385dd}
html[data-theme] .home-category-layout-geser_style .home-category-nav-dot {
    background: var(--hc-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--hc-accent) 16%, transparent);
}
.home-category-layout-geser_style.home-category-autoplay-active .home-category-nav-dot {
    animation: homeCategoryPulse 2.4s ease-in-out infinite;
}
@keyframes homeCategoryPulse {
    0%,100% {opacity: .78; transform: scale(.9)}
    50% {opacity:1; transform: scale(1.08)}
}
.home-category-section .home-category-motion-toggle {
    display: grid; place-items: center; flex: none; width: 30px; height: 30px;
    padding: 0; border-radius: 50%; border: 1px solid var(--border);
    background: var(--surface); color: var(--primary); cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.home-category-section .home-category-motion-toggle[hidden] {display: none;}
.home-category-section .home-category-motion-toggle:hover { border-color: var(--primary); }
.home-category-section .home-category-motion-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.home-category-section .home-category-motion-icon {font-size: 12px; font-weight: 900; line-height: 1;}
.home-category-layout-geser_style .home-category-swipe-hint {display: none;}
@media(max-width:620px) {
    html[data-theme] .home-category-layout-geser .home-category-grid,
    html[data-theme] .home-category-layout-geser_style .home-category-grid {gap: 8px; padding: 2px 2px 9px;}
    html[data-theme] .home-category-layout-geser .home-category-card,
    html[data-theme] .home-category-layout-geser_style .home-category-card {min-height: 41px; padding: 8px 12px;}
}
@media(prefers-reduced-motion:reduce) {
    .home-category-layout-geser_style .home-category-nav-dot { animation: none !important; }
}

/* Mobile: category selector must stay usable on narrow phones with long titles. */
@media (max-width: 460px) {
  .home-category-section .home-category-heading { gap: 6px; flex-wrap: wrap; }
  .home-category-section .home-category-swipe-hint { margin-left: auto; }
  html[data-theme] .home-category-layout-chips .home-category-copy { min-width: 0; }
}
