/* ============================================================
   EXITUS / PORTAL FLOW — Responsive System
   Adaptabilidad precisa para Móviles (320-480px), Tablets,
   Laptops compactas y Monitores de alta resolución.
   ============================================================ */

/* ── 01. Desktop Amplio (> 1024px) ── */
@media (min-width: 1025px) {
    .portal-container {
        padding: 24px 40px;
    }

    .portal-main {
        grid-template-columns: 1.16fr 0.84fr;
        gap: 52px;
        min-height: calc(100dvh - 160px);
        align-items: center;
    }

    .access-panel {
        padding: 34px 32px 28px;
    }
}

/* ── 02. Tablets & Laptops Medianas (641px - 1024px) ── */
@media (max-width: 1024px) {
    .portal-container {
        padding: 20px 24px;
    }

    .portal-main {
        grid-template-columns: 1fr;
        gap: 36px;
        max-width: 600px;
        margin: 16px auto;
    }

    .experience-side {
        order: 2;
        gap: 22px;
    }

    .access-side {
        order: 1;
        justify-content: center;
    }

    .access-panel-wrapper {
        max-width: 100%;
    }

    .orbit-canvas-wrap {
        width: 480px;
        height: 480px;
    }

    .quick-portals-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .community-highlight-card {
        max-width: 100%;
    }
}

/* ── 03. Mobile General (<= 640px) ── */
@media (max-width: 640px) {
    .portal-container {
        padding: 14px 16px 20px;
        min-height: 100dvh;
    }

    .portal-header {
        padding-bottom: 12px;
    }

    .brand-escudo-wrapper {
        width: 38px;
        height: 38px;
    }

    .brand-escudo {
        width: 26px;
        height: 26px;
    }

    .brand-title {
        font-size: 16.5px;
    }

    .brand-subtitle {
        font-size: 9.5px;
    }

    .header-install-btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    .product-badge {
        display: none; /* Oculto en móvil para privilegiar botón instalar y SSL */
    }

    .ssl-capsule {
        padding: 4px 10px;
        font-size: 10.5px;
    }

    .portal-main {
        gap: 26px;
        margin: 6px auto;
        padding: 0;
    }

    /* Access Panel en Móvil: Prioridad y fluidez */
    .access-panel {
        padding: 24px 18px 20px;
        border-radius: 22px;
        background: rgba(13, 22, 41, 0.88);
        box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.6);
    }

    .panel-header {
        margin-bottom: 20px;
    }

    .panel-title {
        font-size: 21px;
    }

    .panel-subtitle {
        font-size: 12.5px;
    }

    .panel-escudo {
        width: 38px;
        height: 38px;
    }

    .panel-escudo img {
        width: 24px;
        height: 24px;
    }

    /* Inputs adaptados a toque (font-size 16px previene auto-zoom en iOS Safari) */
    .input-field {
        height: 54px;
        font-size: 16px;
        padding-left: 48px;
    }

    .btn-submit {
        height: 54px;
        font-size: 15px;
    }

    .form-options-row {
        flex-wrap: wrap;
        gap: 12px;
        margin: 4px 0 18px;
    }

    .hero-headline {
        font-size: 30px;
        line-height: 1.08;
    }

    .hero-subtext {
        font-size: 13.5px;
        line-height: 1.5;
    }

    .community-highlight-card {
        padding: 10px 12px;
        gap: 12px;
        max-width: 100%;
    }

    .community-card-media {
        width: 74px;
        height: 60px;
    }

    /* Quick Portals en Mobile: Carrusel táctil snap */
    .quick-portals-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 12px;
        padding: 4px 2px 14px;
        margin: 0 -16px;
        padding-left: 16px;
        padding-right: 16px;
        scrollbar-width: none;
    }

    .quick-portals-grid::-webkit-scrollbar {
        display: none;
    }

    .quick-portal-card {
        flex: 0 0 240px;
        scroll-snap-align: start;
        min-height: 110px;
    }

    /* Exitus Orbit en Mobile */
    .orbit-canvas-wrap {
        top: 22%;
        width: 320px;
        height: 320px;
        opacity: 0.3;
    }

    /* PWA como Bottom Sheet nativo en Mobile */
    #pwaInstallWidget {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 24px 24px 0 0;
        margin: 0;
    }

    .pwa-sheet-handle {
        display: block !important;
    }

    .pwa-card {
        border-radius: 24px 24px 0 0;
        border-bottom: none;
        padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
    }

    /* Footer en Mobile */
    .portal-footer {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding-top: 16px;
    }

    .footer-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px 14px;
    }
}

/* ── 04. Dispositivos Ultra Compactos (<= 360px) ── */
@media (max-width: 360px) {
    .portal-container {
        padding: 10px 12px 16px;
    }

    .access-panel {
        padding: 20px 14px 18px;
    }

    .input-field {
        height: 50px;
        padding-left: 42px;
        padding-right: 42px;
    }

    .input-icon {
        left: 14px;
    }

    .btn-submit {
        height: 50px;
        font-size: 14px;
    }

    .panel-title {
        font-size: 19px;
    }
}

/* ── 05. Altura de Pantalla Reducida (Laptops <= 768px height) ── */
@media (min-width: 1025px) and (max-height: 768px) {
    .portal-container {
        padding: 14px 32px;
    }

    .portal-main {
        gap: 28px;
        padding: 8px 0 12px;
        min-height: auto;
    }

    .hero-headline {
        font-size: 38px;
    }

    .hero-subtext {
        font-size: 13.5px;
    }

    .community-highlight-card {
        padding: 8px 12px;
    }

    .community-card-media {
        height: 56px;
        width: 70px;
    }

    .quick-portal-card {
        min-height: 92px;
        padding: 12px;
    }

    .access-panel {
        padding: 26px 26px 22px;
    }

    .form-group {
        margin-bottom: 14px;
    }

    .input-field {
        height: 50px;
    }

    .btn-submit {
        height: 50px;
    }
}