/* ==========================================================
   WEBZONEBW RESPONSIVE LAYOUT SYSTEM
   ==========================================================
   Covers: 320px → 360px → 375px → 390px → 414px → 768px → 1024px → 1280px+
   ========================================================== */

/* ==========================================================
   BASE — MOBILE FIRST (max-width: 480px)
   ========================================================== */

@media (max-width: 480px) {

    /* --- Main Site --- */
    .sidebar,
    .er-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: min(82vw, 280px);
        height: 100dvh;
        z-index: 1200;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body.sidebar-open .sidebar,
    body.sidebar-open .er-sidebar {
        left: 0;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 1190;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-bar,
    .er-mobile-nav-bar {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 1100;
        padding: 10px 14px;
    }

    .main-content,
    .er-main-content {
        width: 100%;
        margin-left: 0;
        padding: 16px 14px 32px;
    }

    .container,
    .er-layout-container {
        flex-direction: column;
    }

    .top-header,
    .er-top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .top-header h1,
    .er-main-title {
        font-size: 20px;
    }

    .hero {
        padding: 24px 18px;
    }

    .hero h1,
    .hero h2 {
        font-size: 26px;
    }

    .hero h3 {
        font-size: 16px;
    }

    .hero p {
        font-size: 15px;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-buttons .btn {
        min-width: 0;
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }

    .featured-card,
    .quick-info {
        padding: 20px 16px;
    }

    .featured-card h2 {
        font-size: 20px;
    }

    .featured-card h3 {
        font-size: 17px;
    }

    .featured-card p,
    .quick-info p {
        font-size: 14.5px;
    }

    .er-workspace-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .er-camera-card {
        padding: 12px;
        border-radius: 16px;
    }

    .camera-viewport-frame {
        min-height: min(55vh, 420px);
        min-height: min(55dvh, 420px);
        border-radius: 16px;
    }

    .cam-corner-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .cam-corner-btn.top-left {
        top: 10px;
        left: 10px;
    }

    .cam-corner-btn.top-right {
        top: 10px;
        right: 10px;
    }

    .cam-floating-vertical-stack {
        bottom: 80px;
        right: 10px;
        gap: 8px;
    }

    .cam-vertical-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 14px;
    }

    .cam-zoom-badge {
        bottom: 10px;
        left: 10px;
        padding: 6px 10px;
        font-size: 11px;
    }

    .mobile-face-telemetry-bar {
        top: 10px;
        max-width: calc(100% - 100px);
    }

    .face-telemetry-chip {
        padding: 4px 8px;
        font-size: 10px;
    }

    .face-chip-metric {
        padding: 3px 7px;
        font-size: 9px;
    }

    .er-bottom-controls-bar {
        padding: 8px 10px;
    }

    .er-lens-bubble {
        width: 52px;
        height: 52px;
    }

    .er-lens-bubble .lens-bubble-circle {
        width: 42px;
        height: 42px;
    }

    .er-lens-track {
        gap: 8px;
    }

    .how-to-use-card {
        padding: 16px;
    }

    .how-to-steps-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .er-bottom-feature-row {
        grid-template-columns: 1fr;
    }

    .snapshot-modal-card {
        padding: 14px;
        border-radius: 12px;
        margin: 10px;
    }

    .snapshot-preview-img {
        max-height: 50vh;
    }

    .snapshot-btn-row {
        flex-direction: column;
    }

    .snapshot-btn-row .btn {
        width: 100%;
        justify-content: center;
    }

    .permission-alert-card {
        padding: 20px;
        margin: 10px;
        border-radius: 16px;
    }

    .perm-alert-actions {
        gap: 8px;
    }

    .perm-action-btn {
        min-height: 48px;
        font-size: 14px;
    }

    .site-footer {
        padding: 16px 14px;
    }

    .footer-links {
        flex-wrap: wrap;
        gap: 8px;
    }
}


/* ==========================================================
   SMALL PHONES (max-width: 360px)
   ========================================================= */

@media (max-width: 360px) {

    .mobile-nav-bar,
    .er-mobile-nav-bar {
        padding: 8px 12px;
    }

    .mobile-brand-title {
        font-size: 14px;
    }

    .main-content,
    .er-main-content {
        padding: 12px 10px 24px;
    }

    .hero {
        padding: 18px 14px;
    }

    .hero h1,
    .hero h2 {
        font-size: 22px;
    }

    .camera-viewport-frame {
        min-height: min(50vh, 360px);
        min-height: min(50dvh, 360px);
    }

    .er-lens-bubble {
        width: 46px;
        height: 46px;
    }

    .er-lens-bubble .lens-bubble-circle {
        width: 38px;
        height: 38px;
    }
}


/* ==========================================================
   LARGE PHONES (414px – 480px)
   ========================================================= */

@media (min-width: 414px) and (max-width: 480px) {

    .camera-viewport-frame {
        min-height: min(58vh, 480px);
        min-height: min(58dvh, 480px);
    }
}


/* ==========================================================
   TABLETS (768px)
   ========================================================= */

@media (min-width: 481px) and (max-width: 768px) {

    .sidebar,
    .er-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: min(78vw, 280px);
        height: 100dvh;
        z-index: 1200;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body.sidebar-open .sidebar,
    body.sidebar-open .er-sidebar {
        left: 0;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 1190;
    }

    .er-layout-container {
        display: flex;
        flex-direction: column;
    }

    .mobile-nav-bar,
    .er-mobile-nav-bar {
        display: flex;
    }

    .main-content,
    .er-main-content {
        width: 100%;
        margin-left: 0;
        padding: 24px 28px 40px;
    }

    .hero {
        padding: 32px 28px;
    }

    .hero h1,
    .hero h2 {
        font-size: 30px;
    }

    .er-workspace-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .camera-viewport-frame {
        min-height: min(60vh, 500px);
        min-height: min(60dvh, 500px);
    }

    .how-to-steps-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ==========================================================
   SMALL DESKTOP (1024px)
   ========================================================= */

@media (min-width: 769px) and (max-width: 1024px) {

    .er-workspace-grid {
        grid-template-columns: minmax(0, 1fr) 280px;
        gap: 18px;
    }

    .main-content,
    .er-main-content {
        padding: 28px 32px 44px;
    }
}


/* ==========================================================
   WIDESCREEN DESKTOP (1280px+)
   ========================================================= */

@media (min-width: 1280px) {

    .er-workspace-grid {
        grid-template-columns: minmax(0, 1fr) 380px;
    }

    .main-content,
    .er-main-content {
        padding: 34px 48px 50px;
    }
}


/* ==========================================================
   SAFE AREA (Notch devices)
   ========================================================= */

@supports (padding: env(safe-area-inset-top)) {

    .mobile-nav-bar,
    .er-mobile-nav-bar {
        padding-top: calc(10px + env(safe-area-inset-top));
        padding-left: calc(14px + env(safe-area-inset-left));
        padding-right: calc(14px + env(safe-area-inset-right));
    }

    .er-bottom-controls-bar {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .site-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}


/* ==========================================================
   REDUCED MOTION — RESPECT USER PREFERENCE
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .sidebar,
    .er-sidebar {
        transition: none;
    }
}