/* ==========================================================================
   Glopy · Shared desktop app shell (Task 6 Phase A)
   Mobile: full-width column + bottom nav.
   Desktop (≥900px): branded surround, left sidebar nav, optional promo panel,
   centered 480px phone frame.
   ========================================================================== */

/* ---- Mobile shell ------------------------------------------------------- */
.gl-shell-body {
    background: var(--gl-bg);
}

.gl-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100dvh;
}

.gl-app-frame {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    min-height: 0;
    margin: 0 auto;
}

.gl-shell > .anav {
    flex: 0 0 auto;
    order: 10;
}

.gl-app-frame {
    order: 1;
}

/* Mobile: app frame + bottom nav must share one viewport (nav was moved
   outside the frame for desktop sidebar — do not let the frame keep 100dvh). */
@media (max-width: 899px) {
    .gl-shell-body {
        height: 100dvh;
        overflow: hidden;
    }

    .gl-shell {
        height: 100%;
        min-height: 0;
        max-height: 100dvh;
        overflow: hidden;
    }

    .gl-shell .gl-app-frame {
        flex: 1 1 0;
        min-height: 0;
        height: auto;
        max-height: 100%;
        overflow: hidden;
    }

    .gl-shell > .anav {
        overflow: visible;
        z-index: 30;
    }
}

/* Promo panels — hidden on mobile; shown in the shell grid on desktop. */
.gl-promo {
    display: none;
}

/* Shared promo typography (feed-aside, fav-aside, nc-aside, …). */
.gl-promo [class*="__logo"] {
    font-weight: 900;
    font-size: 1.9rem;
    letter-spacing: 0.06em;
    background: linear-gradient(180deg, var(--gl-blue-soft), var(--gl-blue));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--gl-blue);
    filter: drop-shadow(0 4px 18px rgba(16, 96, 255, 0.45));
}

.gl-promo [class*="__title"] {
    margin: 0;
    font-size: clamp(2.4rem, 3.4vw, 3.4rem);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -0.02em;
}

.gl-promo [class*="__sub"] {
    margin: 0;
    color: var(--gl-muted);
    font-size: 1.05rem;
    line-height: 1.5;
    max-width: 34ch;
}

.gl-promo [class*="__list"] {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.gl-promo [class*="__list"] li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 1rem;
}

.gl-promo [class*="__list"] i {
    color: var(--gl-blue-soft);
    font-size: 1.3rem;
}

.gl-promo [class*="__hint"] {
    margin: 6px 0 0;
    color: var(--gl-muted);
    font-size: 0.85rem;
}

/* ---- Desktop shell ------------------------------------------------------ */
@media (min-width: 900px) {
    .gl-shell-body {
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 32px;
        background: var(--gl-shell-bg);
        overflow: auto;
    }

    .gl-shell {
        display: grid;
        grid-template-columns: auto minmax(0, max-content) 480px;
        grid-template-areas: "sidebar promo app";
        align-items: center;
        gap: clamp(24px, 4vw, 72px);
        width: auto;
        min-height: auto;
    }

    .gl-shell:not(:has(.gl-promo)) {
        grid-template-columns: auto 480px;
        grid-template-areas: "sidebar app";
    }

    .gl-shell > .anav {
        grid-area: sidebar;
        order: unset;
    }

    .gl-promo {
        grid-area: promo;
        display: flex;
        flex-direction: column;
        gap: 20px;
        max-width: 380px;
    }

    .gl-app-frame {
        grid-area: app;
        flex: 0 0 auto;
        width: 480px;
        max-width: 480px;
        height: var(--gl-shell-frame-height);
        max-height: 800px;
        margin: 0;
        border-radius: var(--gl-shell-frame-radius);
        border: 1px solid var(--gl-border);
        box-shadow: 0 40px 110px rgba(0, 0, 0, 0.65);
        overflow: hidden;
        order: unset;
    }

    /* Taller frame for chat-heavy screens. */
    .gl-app-frame--tall {
        height: min(880px, 92vh);
        max-height: 880px;
    }

    /* ---- Phase B: wide two-column screens (Feed, Comparar, Filtros, Explorar) */
    .gl-shell--wide:not(:has(.gl-promo)) {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas: "sidebar app";
        width: min(1280px, calc(100vw - 64px));
    }

    .gl-shell--wide:has(.gl-promo) {
        grid-template-columns: auto minmax(220px, 300px) minmax(0, 1fr);
        grid-template-areas: "sidebar promo app";
        width: min(1440px, calc(100vw - 64px));
    }

    .gl-shell--wide .gl-app-frame--wide {
        width: 100%;
        max-width: min(960px, 100%);
        height: min(860px, 92vh);
        max-height: 860px;
    }
}

/* Contador de favoritos de la cabecera. Vive aquí, y no en feed.css, porque la
   cabecera es la misma en el feed de swipe y en el Modo Lista. */
.gl-head-count {
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: var(--gl-red);
    border-radius: 999px;
    padding: 1px 6px;
    margin-left: 2px;
}

/* ==========================================================================
   ESCRITORIO A PANTALLA COMPLETA (.gl-shell--full)
   La maqueta del cliente para el feed no es el "movil enmarcado" del shell
   normal: barra lateral pegada al borde izquierdo, de alto completo, y el
   contenido ocupando todo el resto. Se activa con .gl-shell--full en el shell
   y .gl-shell-body--full en el body, asi que las pantallas que aun usan el
   marco de 480px no se enteran. Nada de esto aplica por debajo de 900px.
   ========================================================================== */
@media (min-width: 900px) {
    .gl-shell-body--full {
        display: block;
        padding: 0;
        height: 100vh;
        min-height: 100vh;
        overflow: hidden;
        background: var(--gl-surface);
    }

    .gl-shell.gl-shell--full,
    .gl-shell.gl-shell--full:not(:has(.gl-promo)) {
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        grid-template-columns: 212px minmax(0, 1fr);
        grid-template-areas: "sidebar app";
        align-items: stretch;
        gap: 0;
    }

    /* La maqueta de escritorio no lleva panel promocional: la pantalla es la
       app entera. Se oculta en vez de borrarlo del marcado para no tocar las
       pantallas que todavia usan el marco de 480px. */
    .gl-shell.gl-shell--full .gl-promo { display: none; }

    /* Sin marco de telefono: el contenido es la pagina. */
    .gl-shell.gl-shell--full .gl-app-frame {
        width: 100%;
        max-width: none;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        overflow: hidden;
        position: relative;   /* ancla de los controles flotantes (feed-vnav) */
    }
}

/* ===== Tema claro (punto 17) =====
Marco de escritorio en tema claro.
   ========================================================================== */

@media (min-width: 900px) {
    :root[data-theme="light"] .gl-app-frame { box-shadow: 0 30px 80px rgba(15, 23, 42, 0.16); }
    :root[data-theme="light"] .gl-promo [class*="__logo"] { filter: drop-shadow(0 4px 14px rgba(16, 96, 255, 0.25)); }
}
