/*
Theme Name: G6 Media Custom Theme
Theme URI: https://g6media.com
Author: G6 Media
Author URI: https://g6media.com
Description: Modern, zero-plugin theme custom-built for high performance, dynamic navigation, and seamless light/dark mode switching.
Version: 1.0.6
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: g6-media
*/

/* ==========================================================================
   1. Theme System Variables (Modern Patriotic Palette + Dark Mode Overrides)
   ========================================================================== */

:root {
    /* Light Theme (Default) */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-surface: #f1f5f9;
    --border-color: #cbd5e1;
    --border-subtle: rgba(14, 165, 233, 0.15);
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    /* Patriotic USA Accents */
    --usa-red: #dc2626;
    --usa-red-hover: #b91c1c;
    --usa-blue: #0284c7;
    --usa-navy: #0f172a;
    --usa-blue-glow: rgba(2, 132, 199, 0.15);
    --usa-red-glow: rgba(220, 38, 38, 0.15);
    
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    --glass-bg: rgba(248, 250, 252, 0.88);
    --topbar-gradient: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-main) 100%);
}

/* Dark Theme Overrides */
[data-theme="dark"],
body.dark-mode {
    --bg-main: #0a0f1d;
    --bg-card: #131b2e;
    --bg-surface: #1e293b;
    --border-color: #1e293b;
    --border-subtle: rgba(255, 255, 255, 0.1);
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --usa-blue: #38bdf8;
    --usa-blue-glow: rgba(56, 189, 248, 0.2);
    --usa-red-glow: rgba(239, 68, 68, 0.25);
    
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(10, 15, 29, 0.88);
    --topbar-gradient: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-main) 100%);
}

/* ==========================================================================
   2. Core Resets & Orientation Stability Fixes
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.g6-demo-container {
    background-color: var(--bg-main);
    color: var(--text-primary);
    width: 100%;
    min-height: 100%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Desktop Default: Mobile Stacked Search Hidden */
.g6-stacked-mobile-search {
    display: none;
}

/* Media & Video Container Resets */
img, video, iframe, object, embed {
    max-width: 100% !important;
    height: auto;
    box-sizing: border-box;
}

/* Responsive Aspect-Ratio Video Container */
.g6-video-wrapper,
div[class*="video"],
.wp-block-video,
.wp-block-embed {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ==========================================================================
   3. Typography & Generic Elements
   ========================================================================== */
a {
    color: inherit;
    transition: color 0.2s ease, background-color 0.2s ease;
}

/* ==========================================================================
   4. Sticky Scroll-Hide Navigation Wrapper & Gradient Transition
   ========================================================================== */
.g6-sticky-nav-wrapper {
    position: sticky;
    top: 0;
    z-index: 999;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    will-change: transform, box-shadow;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, background-color 0.2s ease;
}

/* Top bar gradient styling inside header */
.g6-sticky-nav-wrapper > div:first-child {
    background: var(--topbar-gradient);
    transition: background 0.3s ease;
}

/* Class triggered on scroll down */
.g6-sticky-nav-wrapper.g6-nav-hidden {
    transform: translateY(-100%);
    box-shadow: none;
}

/* Class triggered on scroll up / top */
.g6-sticky-nav-wrapper.g6-nav-visible {
    transform: translateY(0);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

/* Top body glow buffer so content smoothly rolls under nav */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(180deg, var(--bg-main) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    z-index: 998;
    opacity: 0.8;
}

/* ==========================================================================
   5. Global Button & CTA Dark Mode High-Contrast Fixes
   ========================================================================== */
[data-theme="dark"] a[style*="background: white"],
[data-theme="dark"] a[style*="background:#fff"],
[data-theme="dark"] a[style*="background-color: white"],
[data-theme="dark"] a[style*="background-color:#fff"],
[data-theme="dark"] button[style*="background: white"],
[data-theme="dark"] button[style*="background:#fff"],
body.dark-mode a[style*="background: white"],
body.dark-mode a[style*="background:#fff"],
body.dark-mode a[style*="background-color: white"],
body.dark-mode a[style*="background-color:#fff"],
body.dark-mode button[style*="background: white"],
body.dark-mode button[style*="background:#fff"] {
    color: #0f172a !important;
}

[data-theme="dark"] a[style*="background: #dc2626"],
[data-theme="dark"] a[style*="background:#dc2626"],
[data-theme="dark"] a[style*="background-color: #dc2626"],
[data-theme="dark"] a[style*="background-color:#dc2626"],
body.dark-mode a[style*="background: #dc2626"],
body.dark-mode a[style*="background:#dc2626"],
body.dark-mode a[style*="background-color: #dc2626"],
body.dark-mode a[style*="background-color:#dc2626"] {
    color: #ffffff !important;
}

[data-theme="dark"] a[style*="border"],
body.dark-mode a[style*="border"] {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .g6-slug-nav-container a[href*="apply"],
[data-theme="dark"] .g6-nav-menu a[href*="apply"],
[data-theme="dark"] .g6-mobile-drawer a[href*="apply"],
body.dark-mode .g6-slug-nav-container a[href*="apply"],
body.dark-mode .g6-nav-menu a[href*="apply"],
body.dark-mode .g6-mobile-drawer a[href*="apply"] {
    background-color: #dc2626 !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 600 !important;
}

/* ==========================================================================
   6. Header & Navigation Interactive States
   ========================================================================== */
.g6-nav-menu a:hover {
    color: var(--usa-red) !important;
    background: var(--bg-card) !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

/* Custom Modal Animation Classes */
#g6-custom-mobile-modal {
    opacity: 0;
    visibility: hidden;
    will-change: opacity, visibility;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

#g6-custom-mobile-modal.g6-modal-open {
    opacity: 1;
    visibility: visible;
}

#g6-custom-mobile-modal .g6-modal-box {
    transform: translateY(-10px) scale(0.98);
    will-change: transform;
    transition: transform 0.2s ease;
}

#g6-custom-mobile-modal.g6-modal-open .g6-modal-box {
    transform: translateY(0) scale(1);
}

/* ==========================================================================
   7. Global Mobile & Tablet Responsive Styles (Fix Off-Center Video & Image Boxes)
   ========================================================================== */

/* Tablet & Medium Screens (under 992px) */
@media screen and (max-width: 992px) {
    .g6-gemini-nav-bar {
        max-width: 220px;
    }
}

/* All Mobile Devices (<932px) */
@media screen and (max-width: 932px) {
    .g6-gemini-nav-bar {
        display: none !important;
    }

    /* Force all layout containers, video blocks, and image feature cards to stack neatly */
    main, section, header, footer,
    .g6-demo-container,
    div[style*="display: grid"],
    div[style*="display: flex"] {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Fix video placeholder offset */
    div[style*="aspect-ratio"],
    .video-placeholder,
    iframe[src*="youtube"],
    iframe[src*="vimeo"],
    video {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 0 auto !important;
    }

    /* Fix image box and "Safety First" card alignment */
    div[style*="border-radius"],
    .g6-card,
    .card,
    .feature-box,
    div[style*="background"] {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Mobile Portrait Mode */
@media screen and (max-width: 768px) and (orientation: portrait) {
    
    .g6-sticky-nav-wrapper > div:first-child {
        padding: 8px 16px !important;
    }

    .g6-sticky-nav-wrapper > div:first-child > div {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        text-align: center !important;
    }

    .g6-modern-header {
        padding: 0 16px !important;
        width: 100% !important;
    }

    .g6-modern-header > div {
        padding: 10px 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        width: 100% !important;
    }

    .g6-modern-header a:first-child {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 !important;
        text-align: center !important;
    }

    .g6-modern-header h2 {
        font-size: 1.1rem !important;
        white-space: nowrap !important;
        margin: 0 auto !important;
        text-align: center !important;
    }

    .g6-stacked-mobile-search {
        display: block !important;
        width: 100% !important;
        order: 3 !important;
        margin-top: 8px !important;
    }

    /* Grid columns stack vertically on mobile portrait */
    #home,
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
}

/* Mobile Landscape Mode (Phone Turned Sideways) */
@media screen and (max-width: 932px) and (orientation: landscape) {
    
    .g6-sticky-nav-wrapper > div:first-child {
        padding: 4px 16px !important;
        font-size: 0.75rem !important;
    }

    .g6-modern-header > div {
        padding: 6px 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        gap: 12px !important;
    }

    .g6-modern-header a:first-child {
        display: flex !important;
        align-items: center !important;
        flex: 0 0 auto !important;
        text-align: left !important;
    }

    .g6-modern-header h2 {
        font-size: 0.95rem !important;
        margin: 0 !important;
    }

    .g6-stacked-mobile-search {
        display: block !important;
        flex: 1 !important;
        max-width: 280px !important;
        order: 2 !important;
        margin-top: 0 !important;
    }

    .g6-mobile-gemini-bar {
        padding: 4px 10px !important;
    }

    section {
        margin: 15px auto !important;
        padding: 0 16px !important;
    }

    #home {
        padding: 12px 16px 20px 16px !important;
    }
}

/* Common Mobile Element Adjustments */
@media screen and (max-width: 768px) {
    .g6-slug-nav-container,
    #g6-mobile-drawer,
    .g6-nav-menu {
        padding-left: 16px !important;
        padding-right: 16px !important;
        box-sizing: border-box !important;
    }

    section {
        width: 100% !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
        box-sizing: border-box !important;
    }

    #home {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    h1 {
        font-size: 1.85rem !important;
        line-height: 1.2 !important;
        text-align: center !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    p {
        font-size: 0.95rem !important;
    }

    #home div[style*="display: flex"],
    #contact div[style*="display: flex"] {
        flex-direction: column !important;
        width: 100% !important;
        gap: 10px !important;
    }

    #home a, #contact a {
        width: 100% !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }
}

/* Extra Small Phones (<380px) */
@media screen and (max-width: 380px) {
    .g6-modern-header h2 {
        font-size: 0.9rem !important;
    }
}