/* ==========================================================================
   ONIC - Universal Mobile & Touch Responsive Styles
   Works on ANY screen size - phones, tablets, foldables, watches, TVs
   ========================================================================== */

/* ==========================================================================
   FLUID TYPOGRAPHY - Scales with screen size
   ========================================================================== */
:root {
    --fluid-min-width: 320;
    --fluid-max-width: 1400;
    --fluid-min-size: 14;
    --fluid-max-size: 18;
}

html {
    font-size: clamp(14px, calc(14px + (18 - 14) * ((100vw - 320px) / (1400 - 320))), 18px);
}

/* ==========================================================================
   TOUCH-FRIENDLY BASE
   ========================================================================== */
* {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Minimum touch target size (44x44px per Apple/Google guidelines) */
a, button, .btn, .nav-links a, .impact-tab, .tab-btn, .hero-tag-chip {
    min-height: 44px;
    min-width: 44px;
}

/* ==========================================================================
   MOBILE LOGO HANDLING
   ========================================================================== */
/* Mobile top logo - hidden on desktop */
.mobile-top-logo {
    display: none;
    width: 100%;
    text-align: center;
    padding: 0.6rem 0;
    background: linear-gradient(180deg, #000000 0%, #000510 100%);
    border-bottom: 1px solid rgba(77, 158, 255, 0.15);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1002;
}

.mobile-top-logo img {
    height: 36px;
    filter: none;
}

.mobile-top-logo a {
    display: inline-block;
}

/* Hero right side logo */
.hero-visual-side {
    transition: all 0.3s ease;
}

/* ==========================================================================
   SWIPEABLE CONTAINER STYLES
   ========================================================================== */
.swipe-container {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 1rem;
    margin: 0 -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.swipe-container::-webkit-scrollbar {
    display: none;
}

.swipe-container > * {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* Swipe indicator dots */
.swipe-dots {
    display: none;
    justify-content: center;
    gap: 8px;
    margin-top: 1rem;
}

.swipe-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 102, 255, 0.2);
    transition: all 0.3s ease;
}

.swipe-dot.active {
    background: var(--primary-blue);
    transform: scale(1.3);
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - Mobile First
   ========================================================================== */

/* Extra Small - Watches, small phones (< 360px) */
@media (max-width: 359px) {
    .container { padding: 0 0.75rem; }
    section { padding: 2.5rem 0; }

    .hero h1 { font-size: 1.6rem; letter-spacing: -0.5px; }
    .hero-subtitle { font-size: 0.85rem; }
    .hero-badge { font-size: 0.55rem; padding: 0.4rem 0.8rem; }
    .hero-tagline { font-size: 0.6rem; letter-spacing: 1px; }

    .section-title { font-size: 1.4rem; }
    .section-tag { font-size: 0.6rem; padding: 0.35rem 0.8rem; }

    .btn { padding: 0.7rem 1.2rem; font-size: 0.7rem; }
    .btn-lg { padding: 0.8rem 1.5rem; font-size: 0.75rem; }

    .stat-item h3 { font-size: 1.8rem; }
    .stat-item p { font-size: 0.7rem; }

    .deliverable-number { font-size: 1.8rem; }
    .deliverable-card h3 { font-size: 1rem; }
    .deliverable-card { padding: 1.5rem; }

    .stakeholder-scroll-card { width: 200px; height: 130px; }
    .stakeholder-scroll-card h4 { font-size: 0.75rem; }
}

/* Small phones (360px - 480px) */
@media (max-width: 480px) {
    .container { padding: 0 1rem; }
    section { padding: 3rem 0; }

    .mobile-top-logo { display: none; }

    .navbar {
        top: 0;
    }

    /* Hide hero right logo completely */
    .hero-visual-side { display: none !important; }

    /* Hero adjustments - account for both mobile logo and navbar */
    .hero {
        min-height: auto;
        padding: 7rem 0 2.5rem;
        margin-top: 48px;
    }
    .hero-content {
        padding: 0 1rem;
        text-align: center;
    }
    .hero h1 {
        font-size: 1.8rem;
        line-height: 1.15;
        letter-spacing: -0.5px;
    }
    .hero-subtitle { font-size: 0.9rem; line-height: 1.5; }
    .hero-badge {
        font-size: 0.58rem;
        padding: 0.45rem 0.9rem;
        letter-spacing: 1px;
    }
    .hero-tagline {
        font-size: 0.65rem;
        letter-spacing: 1.5px;
        margin-bottom: 1.5rem;
    }
    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    .hero-buttons .btn { width: 100%; }
    .hero-tags {
        justify-content: center;
        gap: 0.5rem;
    }
    .hero-tag-chip {
        font-size: 0.6rem;
        padding: 0.4rem 0.7rem;
    }

    /* Navbar */
    .navbar { height: 55px; top: 0; }
    .navbar-container { padding: 0 1rem; }
    .logo img { height: 32px; }

    /* Section headers */
    .section-header { margin-bottom: 2rem; }
    .section-title {
        font-size: 1.5rem;
        line-height: 1.2;
        letter-spacing: -0.3px;
    }
    .section-description { font-size: 0.9rem; }
    .section-tag {
        font-size: 0.6rem;
        padding: 0.4rem 0.9rem;
        margin-bottom: 1rem;
    }

    /* Impact tabs - horizontal scroll */
    .impact-tabs {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 0.4rem;
        padding-bottom: 0.5rem;
        margin: 0 -1rem 1.5rem;
        padding-left: 1rem;
        scrollbar-width: none;
    }
    .impact-tabs::-webkit-scrollbar { display: none; }
    .impact-tab {
        flex-shrink: 0;
        scroll-snap-align: start;
        padding: 0.5rem 1rem;
        font-size: 0.72rem;
        white-space: nowrap;
    }

    /* Card grids - swipeable */
    .impact-cards-grid,
    .enables-grid,
    .deliverables-grid,
    .governance-grid,
    .services-grid,
    .features-grid,
    .platform-grid,
    .standard-grid {
        display: flex !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 1rem;
        padding-bottom: 1rem;
        margin: 0 -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        scrollbar-width: none;
    }
    .impact-cards-grid::-webkit-scrollbar,
    .enables-grid::-webkit-scrollbar,
    .deliverables-grid::-webkit-scrollbar,
    .governance-grid::-webkit-scrollbar,
    .services-grid::-webkit-scrollbar,
    .features-grid::-webkit-scrollbar,
    .platform-grid::-webkit-scrollbar,
    .standard-grid::-webkit-scrollbar { display: none; }

    /* Cards in swipeable containers */
    .impact-card-v2,
    .enable-card,
    .deliverable-card,
    .governance-card,
    .service-card,
    .feature-card,
    .platform-card,
    .standard-card {
        flex-shrink: 0;
        scroll-snap-align: start;
        width: 85vw;
        max-width: 300px;
    }

    .impact-card-v2-image { height: 160px; }
    .impact-card-v2-body { padding: 1.2rem; }
    .impact-card-v2-body h3 { font-size: 1rem; margin-bottom: 0.5rem; }
    .impact-card-v2-body p { font-size: 0.82rem; line-height: 1.5; }

    .enable-card-img { height: 140px; }
    .enable-card h4 { padding: 1rem 1.2rem; font-size: 0.85rem; }

    .deliverable-card { padding: 1.5rem; width: 80vw; }
    .deliverable-number { font-size: 2rem; }
    .deliverable-card h3 { font-size: 1.05rem; }
    .deliverable-card p { font-size: 0.85rem; }

    .governance-visual { height: 140px; }
    .governance-content { padding: 1.5rem; }
    .governance-card h3 { font-size: 1.1rem; }
    .governance-card p { font-size: 0.85rem; }

    /* Platform cards - stack vertically in swipe */
    .platform-card {
        grid-template-columns: 1fr !important;
        width: 85vw;
    }
    .platform-card-img {
        min-height: 150px;
        height: 150px;
    }
    .platform-card-body { padding: 1.5rem; }
    .platform-card-body h3 { font-size: 1.1rem; }
    .platform-card-body p { font-size: 0.85rem; }

    /* Stats grid */
    .stats-section { padding: 2.5rem 0; }
    .stats-title { font-size: 1.1rem; margin-bottom: 1.5rem; }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .stat-item h3 { font-size: 2rem; }
    .stat-item p { font-size: 0.72rem; }

    /* Stakeholder scroll */
    .stakeholder-scroll-card {
        width: 220px;
        height: 140px;
    }
    .stakeholder-scroll-card h4 {
        font-size: 0.8rem;
        bottom: 0.8rem;
        left: 1rem;
        right: 1rem;
    }
    .stakeholder-scroll-wrapper::before,
    .stakeholder-scroll-wrapper::after { width: 30px; }

    /* Intelligence grid */
    .intelligence-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }
    .focus-item { padding: 1.2rem 1rem; }
    .focus-item h4 { font-size: 1rem; }
    .focus-item p { font-size: 0.82rem; }
    .intelligence-quote { padding: 2rem 1.5rem; }
    .intelligence-quote .quote-text { font-size: 1.1rem; }

    /* Footer */
    .footer { padding: 3rem 0 1.5rem; }
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }
    .footer-info h3 { font-size: 1.3rem; }
    .footer-links h4 { margin-bottom: 1rem; }
    .footer-bottom p { font-size: 0.65rem; }

    /* CTA */
    .cta-section { padding: 4rem 0; }
    .cta-content h2 { font-size: 1.6rem; }
    .cta-content p { font-size: 0.9rem; }

    /* Page hero adjustments (About, Services, etc.) */
    .page-hero {
        padding: 6rem 0 2.5rem;
        margin-top: 48px;
    }
    .page-hero h1 { font-size: 1.8rem; }
    .page-hero .hero-text { font-size: 0.95rem; }

    /* Show swipe dots on mobile */
    .swipe-dots { display: flex; }
}

/* Medium phones (481px - 640px) */
@media (min-width: 481px) and (max-width: 640px) {
    .container { padding: 0 1.25rem; }

    .mobile-top-logo { display: none; }
    .navbar { top: 0; }
    .hero-visual-side { display: none !important; }

    .hero h1 { font-size: 2.2rem; }
    .section-title { font-size: 1.8rem; }

    .impact-cards-grid,
    .enables-grid,
    .deliverables-grid,
    .governance-grid {
        display: flex !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
    }

    .impact-card-v2,
    .enable-card,
    .deliverable-card,
    .governance-card {
        width: 75vw;
        max-width: 320px;
    }

    .swipe-dots { display: flex; }
}

/* Large phones / Small tablets (641px - 768px) */
@media (min-width: 641px) and (max-width: 768px) {
    .container { padding: 0 1.5rem; }

    .mobile-top-logo { display: none; }
    .navbar { top: 0; }
    .hero-visual-side { display: none !important; }

    .hero h1 { font-size: 2.5rem; }
    .section-title { font-size: 2rem; }

    /* 2-column grids */
    .impact-cards-grid,
    .enables-grid,
    .governance-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        overflow: visible;
    }

    .deliverables-grid {
        display: flex !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
    }
    .deliverable-card { width: 70vw; max-width: 350px; }

    .platform-card {
        grid-template-columns: 1fr !important;
    }

    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container { padding: 0 2rem; }

    .mobile-top-logo { display: none; }
    .hero-visual-side { display: flex !important; }
    .hero-logo-img { max-width: 280px; }

    .hero-content {
        grid-template-columns: 1.2fr 0.8fr;
        gap: 2rem;
    }
    .hero h1 { font-size: 2.8rem; }

    .section-title { font-size: 2.2rem; }

    .impact-cards-grid,
    .enables-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .deliverables-grid,
    .governance-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .platform-card {
        grid-template-columns: 250px 1fr;
    }

    .intelligence-grid {
        grid-template-columns: 1fr !important;
        gap: 3rem;
    }
}

/* Small desktops (1025px - 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
    .container { padding: 0 3rem; }

    .hero h1 { font-size: 3.5rem; }
    .hero-logo-img { max-width: 350px; }

    .impact-cards-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .enables-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .deliverables-grid { grid-template-columns: repeat(3, 1fr) !important; }
}

/* Large screens (1201px - 1600px) */
@media (min-width: 1201px) and (max-width: 1600px) {
    .container { padding: 0 4rem; }
}

/* Extra large / TV screens (> 1600px) */
@media (min-width: 1601px) {
    html { font-size: 20px; }
    .container { max-width: 1600px; padding: 0 5rem; }

    .hero h1 { font-size: 5rem; }
    .hero-logo-img { max-width: 500px; }

    .section-title { font-size: 3.5rem; }

    .impact-card-v2-image { height: 280px; }
    .enable-card-img { height: 250px; }
    .governance-visual { height: 250px; }
    .platform-card-img { min-height: 280px; }
}

/* ==========================================================================
   LANDSCAPE MODE FIXES
   ========================================================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 4rem 0 2rem;
        margin-top: 0;
    }
    .hero h1 { font-size: 2rem; }
    .hero-subtitle { font-size: 0.9rem; }
    .hero-buttons { flex-direction: row; }

    section { padding: 2.5rem 0; }

    .mobile-top-logo { display: none; }
    .navbar {
        height: 50px;
        top: 0;
    }
}

/* Mobile toggle - handled in base.html inline styles */

/* ==========================================================================
   FOLDABLE DEVICES
   ========================================================================== */
@media (min-width: 280px) and (max-width: 320px) {
    /* Galaxy Fold closed */
    .hero h1 { font-size: 1.4rem; }
    .hero-badge { font-size: 0.5rem; }
    .section-title { font-size: 1.2rem; }

    .impact-card-v2,
    .enable-card,
    .deliverable-card { width: 90vw; }
}

/* ==========================================================================
   DARK MODE SUPPORT
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .swipe-dot { background: rgba(255, 255, 255, 0.2); }
    .swipe-dot.active { background: var(--accent-blue); }
}

/* ==========================================================================
   REDUCED MOTION - Accessibility
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .stakeholder-scroll-track {
        animation: none;
    }

    .swipe-container {
        scroll-behavior: auto;
    }
}

/* Mobile nav - handled in base.html inline styles */

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
    .navbar, .footer, .mobile-top-logo, .swipe-dots { display: none !important; }
    .hero { min-height: auto; padding: 2rem 0; }
    section { padding: 1.5rem 0; page-break-inside: avoid; }
}

/* ==========================================================================
   TOUCH FEEDBACK
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    .impact-card-v2:active,
    .enable-card:active,
    .governance-card:active,
    .platform-card:active,
    .deliverable-card:active,
    .stakeholder-scroll-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .btn:active {
        transform: scale(0.95);
    }

    /* Remove hover effects on touch */
    .impact-card-v2:hover,
    .enable-card:hover,
    .governance-card:hover {
        transform: none;
        box-shadow: inherit;
    }
}

/* ==========================================================================
   NOTCH / SAFE AREA SUPPORT (iPhone X+)
   ========================================================================== */
@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .hero-content,
    .container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .footer {
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
}
