/* ==========================================================================
   DISCOVER POPUP — smart bottom-sheet menu (v2)
   Palette locked to blue / white / silver.
   ========================================================================== */

/* --------------------------------------------------------- tab trigger */
.app-tabbar button.tab-discover {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 9px;
    font-weight: 600;
    color: #8493B0;
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.app-tabbar button.tab-discover .td-ico {
    display: grid;
    place-items: center;
    transition: transform .32s cubic-bezier(.2, .9, .25, 1.1);
}

.app-tabbar button.tab-discover .td-label { transition: color .18s; }

.app-tabbar button.tab-discover:hover,
.app-tabbar button.tab-discover.is-active { color: var(--blue-700, #1D4ED8); }

.app-tabbar button.tab-discover.is-active {
    background: rgba(37, 99, 235, .07);
}

.app-tabbar button.tab-discover.is-active .td-label { font-weight: 800; }

.app-tabbar button.tab-discover[aria-expanded="true"] { color: var(--blue-700, #1D4ED8); }

.app-tabbar button.tab-discover[aria-expanded="true"] .td-ico {
    transform: translateY(-1px) rotate(180deg) scale(1.05);
}

.app-tabbar button.tab-discover:focus-visible {
    outline: 2px solid var(--blue-600, #2563EB);
    outline-offset: 1px;
}

/* --------------------------------------------------------------- shell */
.discover-pop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.discover-pop[hidden] { display: none; }

.dp-scrim {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(29, 78, 216, .18) 0%, rgba(11, 21, 51, .44) 100%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
    backdrop-filter: blur(6px) saturate(120%);
    opacity: 0;
    transition: opacity .3s ease;
}

/* --------------------------------------------------------------- panel */
.dp-panel {
    position: relative;
    width: min(100%, 480px);
    max-height: min(84vh, 620px);
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 28px 28px 0 0;
    background:
        radial-gradient(520px 240px at 88% -6%, rgba(147, 197, 253, .34) 0%, rgba(147, 197, 253, 0) 62%),
        radial-gradient(360px 200px at 4% 104%, rgba(191, 219, 254, .3) 0%, rgba(191, 219, 254, 0) 66%),
        linear-gradient(168deg, rgba(255, 255, 255, .985) 0%, rgba(247, 251, 255, .95) 52%, rgba(238, 245, 255, .93) 100%);
    border: 1px solid rgba(255, 255, 255, .96);
    border-bottom: 0;
    box-shadow:
        0 -2px 6px rgba(15, 35, 95, .05),
        0 -22px 56px -26px rgba(15, 35, 95, .44),
        inset 0 1px 0 #fff;
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    backdrop-filter: blur(30px) saturate(160%);
    transform: translateY(103%);
    opacity: 0;
    transition:
        transform .4s cubic-bezier(.22, .9, .24, 1),
        opacity .26s ease;
    will-change: transform;
}

@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    .dp-panel { background: linear-gradient(168deg, #ffffff 0%, #f4f9ff 55%, #eaf2ff 100%); }
}

.discover-pop.is-open .dp-scrim { opacity: 1; }
.discover-pop.is-open .dp-panel { transform: translateY(0); opacity: 1; }

/* grab handle */
.dp-grab {
    width: 44px;
    height: 5px;
    margin: 0 auto 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(15, 35, 95, .1), rgba(15, 35, 95, .22), rgba(15, 35, 95, .1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}

/* ---------------------------------------------------------------- head */
.dp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 4px;
    margin-bottom: 15px;
}

.dp-head-txt { min-width: 0; }

.dp-kicker {
    display: block;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: #55637D;
    margin-bottom: 3px;
}

.dp-h {
    display: block;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.038em;
    color: var(--ink, #0B1533);
    margin: 0;
    text-wrap: balance;
}

.dp-count {
    width: 34px;
    height: 34px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--blue-700, #1D4ED8);
    background: linear-gradient(150deg, rgba(255, 255, 255, .96), rgba(233, 242, 255, .9));
    border: 1px solid rgba(255, 255, 255, .98);
    box-shadow: 0 8px 18px -12px rgba(29, 78, 216, .5), inset 0 1px 0 #fff;
}

/* ---------------------------------------------------------------- grid */
.dp-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.dp-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 11px 12px;
    border-radius: 17px;
    text-decoration: none;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(158deg, rgba(255, 255, 255, .95) 0%, rgba(246, 250, 255, .74) 100%);
    border: 1px solid rgba(255, 255, 255, .98);
    box-shadow:
        0 1px 2px rgba(15, 35, 95, .04),
        0 10px 24px -20px rgba(15, 35, 95, .38),
        inset 0 1px 0 #fff;
    transition:
        transform .24s cubic-bezier(.2, .85, .25, 1),
        box-shadow .24s ease,
        border-color .24s ease;
    -webkit-tap-highlight-color: transparent;
}

/* gradient sheen that sweeps in on hover / press */
.dp-item::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(140deg, rgba(147, 197, 253, .28) 0%, rgba(219, 234, 254, .12) 58%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity .24s ease;
}

@media (hover: hover) {
    .dp-item:hover {
        transform: translateY(-2px);
        border-color: rgba(37, 99, 235, .22);
        box-shadow:
            0 2px 4px rgba(15, 35, 95, .05),
            0 20px 36px -22px rgba(29, 78, 216, .46),
            inset 0 1px 0 #fff;
    }
    .dp-item:hover::before { opacity: 1; }
}

.dp-item:active {
    transform: scale(.972);
    background: #fff;
}

.dp-item:active::before { opacity: 1; }

.dp-item:focus-visible {
    outline: 2px solid var(--blue-600, #2563EB);
    outline-offset: 2px;
}

/* icon tile */
.dp-ico {
    position: relative;
    width: 40px;
    height: 40px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    box-shadow:
        0 10px 20px -12px rgba(29, 78, 216, .72),
        inset 0 1px 0 rgba(255, 255, 255, .42);
    transition: transform .24s cubic-bezier(.2, .85, .25, 1);
}

.dp-item:active .dp-ico { transform: scale(.94); }

/* sheen */
.dp-ico::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(160deg, rgba(255, 255, 255, .42) 0%, rgba(255, 255, 255, 0) 52%);
    pointer-events: none;
}

.dp-fm       { background: linear-gradient(140deg, #1E3A8A 0%, #2563EB 52%, #3B82F6 100%); }
.dp-music    { background: linear-gradient(140deg, #1D4ED8 0%, #3B82F6 55%, #60A5FA 100%); }
.dp-stories  { background: linear-gradient(140deg, #0B1533 0%, #1E3A8A 55%, #2F62D8 100%); }
.dp-shorts   { background: linear-gradient(140deg, #2563EB 0%, #60A5FA 58%, #93C5FD 100%); }
.dp-social   { background: linear-gradient(140deg, #1D4ED8 0%, #4B7BE5 55%, #7FA8EE 100%); }
.dp-articles { background: linear-gradient(140deg, #334155 0%, #64748B 55%, #94A3B8 100%); }

/* text block */
.dp-txt { min-width: 0; flex: 1 1 auto; }

.dp-txt strong {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.22;
    letter-spacing: -.014em;
    color: var(--ink, #0B1533);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dp-txt small {
    display: block;
    margin-top: 1px;
    font-size: 9.5px;
    line-height: 1.3;
    color: #55637D;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* chevron affordance */
.dp-go {
    flex: none;
    color: rgba(100, 116, 139, .55);
    transition: transform .24s cubic-bezier(.2, .85, .25, 1), color .2s;
}

@media (hover: hover) {
    .dp-item:hover .dp-go {
        transform: translateX(2px);
        color: var(--blue-700, #1D4ED8);
    }
}

/* ---------------------------------------------------------------- CTA */
.dp-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    padding: 15px 18px;
    border-radius: 17px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: #fff;
    background:
        radial-gradient(220px 90px at 82% 0%, rgba(147, 197, 253, .42) 0%, rgba(147, 197, 253, 0) 62%),
        linear-gradient(135deg, #1E3A8A 0%, #1D4ED8 48%, #3B82F6 100%);
    box-shadow:
        0 2px 4px rgba(15, 35, 95, .1),
        0 16px 32px -16px rgba(29, 78, 216, .72),
        inset 0 1px 0 rgba(255, 255, 255, .32);
    transition: transform .24s cubic-bezier(.2, .85, .25, 1), box-shadow .24s ease;
    -webkit-tap-highlight-color: transparent;
}

.dp-all-ico {
    display: grid;
    place-items: center;
    opacity: .92;
}

@media (hover: hover) {
    .dp-all:hover {
        transform: translateY(-1px);
        box-shadow:
            0 3px 6px rgba(15, 35, 95, .11),
            0 22px 40px -18px rgba(29, 78, 216, .8),
            inset 0 1px 0 rgba(255, 255, 255, .34);
    }
}

.dp-all:active { transform: scale(.985); }

.dp-all:focus-visible {
    outline: 2px solid var(--blue-700, #1D4ED8);
    outline-offset: 2px;
}

/* body scroll lock */
body.dp-open { overflow: hidden; }

/* ------------------------------------------------------ desktop / wide */
@media (min-width: 900px) {
    .discover-pop { display: none; }
    .app-tabbar { display: none; }
}

/* ------------------------------------------------------ small phones */
@media (max-width: 400px) {
    .dp-panel { padding: 10px 13px calc(16px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; }
    .dp-grid { gap: 8px; }
    .dp-item { min-height: 60px; padding: 10px; gap: 9px; border-radius: 15px; }
    .dp-ico { width: 36px; height: 36px; border-radius: 11px; }
    .dp-ico svg { width: 17px; height: 17px; }
    .dp-txt strong { font-size: 11.8px; }
    .dp-txt small { font-size: 9px; }
    .dp-go { display: none; }
    .dp-h { font-size: 20px; }
    .dp-all { padding: 13px 16px; font-size: 12.5px; }
}

@media (max-width: 350px) {
    .dp-panel { padding: 9px 11px calc(14px + env(safe-area-inset-bottom)); }
    .dp-grid { gap: 7px; }
    .dp-item { padding: 9px; gap: 8px; }
    .dp-txt small { display: none; }
    .dp-h { font-size: 19px; }
}

/* ---------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
    .dp-scrim,
    .dp-panel,
    .dp-item,
    .dp-all,
    .dp-ico,
    .dp-go,
    .app-tabbar button.tab-discover .td-ico { transition: none; }

    .discover-pop.is-open .dp-panel { transform: none; opacity: 1; }

    .dp-item:active,
    .dp-all:active,
    .dp-item:active .dp-ico { transform: none; }

    .app-tabbar button.tab-discover[aria-expanded="true"] .td-ico { transform: none; }
}