/* ===========================
   RESPONSIVE DESIGN
   Mobile-First Approach
   OPTIMIZED - No Duplicates
   =========================== */

/* ===========================
   GLOBAL MOBILE FIX
   Prevent horizontal overflow
   =========================== */

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* ===========================
   EXTRA SMALL (max-width: 479px)
   =========================== */

@media (max-width: 479px) {
    :root {
        font-size: 13px;
    }

    .container {
        padding: 0 var(--spacing-sm);
        width: 100%;
        box-sizing: border-box;
    }

    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1rem; }

    .btn-large,
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .hero-title { font-size: 1.5rem; }
    .hero-subtitle { font-size: 0.9rem; }
    .section-title { font-size: 1.5rem; }
    .cta-title { font-size: 1.5rem; }
    .cta-text { font-size: 1rem; }

    /* Header */
    .site-header {
        padding: 8px 0;
    }

    .site-logo {
        height: 35px;
    }

    .site-title {
        font-size: 1rem;
    }

    .site-tagline {
        font-size: 0.65rem;
    }

    .branding-text {
        gap: 0;
    }

    /* Contact */
    .contact-details li {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
    }

    .pillar-card {
        padding: var(--spacing-lg);
    }
}

/* ===========================
   SMALL MOBILE (480px - 639px)
   =========================== */

@media (min-width: 480px) and (max-width: 639px) {
    .site-logo {
        height: 40px;
    }

    .site-title {
        font-size: 1.2rem;
    }

    .site-tagline {
        font-size: 0.7rem;
    }
}

/* ===========================
   BASE MOBILE (< 768px)
   All mobile devices
   =========================== */

@media (max-width: 767px) {
    .container {
        width: 100%;
        max-width: 100%;
        padding: 0 var(--spacing-md);
        box-sizing: border-box;
    }

    /* Header Mobile */
    .site-header {
        padding: 10px 0;
        width: 100%;
        box-sizing: border-box;
        overflow: visible;
    }

    .header-content {
        width: 100%;
        box-sizing: border-box;
        overflow: visible;
        gap: 15px;
    }

    .site-branding {
        min-width: 0;
        flex-shrink: 1;
        gap: 10px;
    }

    .site-logo {
        height: 40px;
        flex-shrink: 0;
    }

    .site-title {
        font-size: 1.2rem;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .site-tagline {
        font-size: 0.7rem;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Mobile Menu Toggle - FIXED */
    .menu-toggle {
        display: block !important;
        flex-shrink: 0;
        background: none;
        border: none;
        cursor: pointer;
        padding: 12px 15px;
        line-height: 1;
        z-index: 1001;
        position: relative;
    }

    .menu-toggle i {
        color: var(--color-light);
        font-size: 28px;
        display: block;
        line-height: 1;
        pointer-events: none;
    }

    .menu-toggle:hover i {
        color: var(--color-accent);
    }

    .menu-toggle:active,
    .menu-toggle.active {
        outline: none;
    }

    /* Mobile Navigation - Dropdown Style */
    .main-navigation {
        position: relative;
        overflow: visible;
    }

    .nav-menu {
        position: fixed;
        top: 70px;
        right: 10px;
        left: auto;
        background: var(--color-primary) !important;
        flex-direction: column;
        gap: 0;
        padding: 0;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
        border-radius: 8px;
        min-width: 180px;
        width: 180px;
        display: none !important;
        z-index: 9999;
        box-sizing: border-box;
        border: 2px solid var(--color-accent);
        overflow-y: auto;
        max-height: 280px;
        margin: 0;
        list-style: none;
    }

    .nav-menu.active {
        display: flex !important;
        background: var(--color-primary) !important;
    }

    .nav-item {
        width: 100%;
        height: auto;
        border-bottom: 1px solid rgba(253, 185, 39, 0.3);
        margin: 0;
        padding: 0;
        list-style: none;
        background: transparent;
        border: none;
        flex-shrink: 0;
    }

    .nav-item:last-child {
        border-bottom: none;
    }

    .nav-link {
        width: 100%;
        padding: 12px 16px;
        border-bottom: none !important;
        border-left: 3px solid transparent;
        box-sizing: border-box;
        white-space: nowrap;
        color: var(--color-light);
        font-weight: 500;
        display: block;
        text-align: left;
        text-decoration: none;
        font-size: 0.9rem;
    }

    .nav-link:hover,
    .nav-item.active .nav-link {
        border-left-color: var(--color-accent);
        border-bottom-color: transparent !important;
        background: rgba(253, 185, 39, 0.15);
        color: var(--color-accent);
    }

    /* Hero Mobile */
    .hero-section {
        min-height: 60vh;
        padding: var(--spacing-xl) 0;
        width: 100%;
        box-sizing: border-box;
    }

    /* CTA Mobile */
    .cta-buttons {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .cta-buttons .btn {
        width: 100%;
    }

    /* Single Column Layouts */
    .pillars-grid,
    .contact-wrapper,
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
}

/* ===========================
   SMALL TABLETS (640px - 767px)
   =========================== */

@media (min-width: 640px) and (max-width: 767px) {
    :root {
        font-size: 15px;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .hero-title { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }
    .section-title { font-size: 1.75rem; }
    .cta-title { font-size: 1.75rem; }
}

/* ===========================
   TABLETS (768px - 1023px)
   Hamburger menu for tablets too
   =========================== */

@media (min-width: 768px) and (max-width: 1023px) {
    :root {
        font-size: 16px;
    }

    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.5rem; }

    .hero-title { font-size: 3rem; }
    .hero-subtitle { font-size: 1.2rem; }

    /* Header - Tablet */
    .site-header {
        padding: 10px 0;
        overflow: visible;
    }

    .site-logo {
        height: 45px;
    }

    .site-title {
        font-size: 1.4rem;
    }

    .site-tagline {
        font-size: 0.75rem;
    }

    /* HAMBURGER MENU ON TABLETS TOO */
    .menu-toggle { 
        display: block !important;
        flex-shrink: 0;
        background: none;
        border: none;
        cursor: pointer;
        padding: 12px 15px;
        line-height: 1;
        z-index: 1001;
        position: relative;
    }

    .menu-toggle i {
        color: var(--color-light);
        font-size: 28px;
        display: block;
        line-height: 1;
        pointer-events: none;
    }

    .menu-toggle:hover i {
        color: var(--color-accent);
    }

    .main-navigation {
        position: relative;
        overflow: visible;
    }

    .nav-menu {
        position: fixed;
        top: 70px;
        right: 10px;
        left: auto;
        background: var(--color-primary) !important;
        flex-direction: column;
        gap: 0;
        padding: 0;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
        border-radius: 8px;
        min-width: 200px;
        width: 200px;
        display: none !important;
        z-index: 9999;
        box-sizing: border-box;
        border: 2px solid var(--color-accent);
        overflow-y: auto;
        max-height: 320px;
        margin: 0;
        list-style: none;
    }

    .nav-menu.active {
        display: flex !important;
        background: var(--color-primary) !important;
    }

    .nav-item {
        width: 100%;
        height: auto;
        border-bottom: 1px solid rgba(253, 185, 39, 0.3);
        margin: 0;
        padding: 0;
        list-style: none;
        background: transparent;
        border: none;
        flex-shrink: 0;
    }

    .nav-item:last-child {
        border-bottom: none;
    }

    .nav-link {
        width: 100%;
        padding: 12px 16px;
        border-bottom: none !important;
        border-left: 3px solid transparent;
        box-sizing: border-box;
        white-space: nowrap;
        color: var(--color-light);
        font-weight: 500;
        display: block;
        text-align: left;
        text-decoration: none;
        font-size: 0.9rem;
    }

    .nav-link:hover,
    .nav-item.active .nav-link {
        border-left-color: var(--color-accent);
        border-bottom-color: transparent !important;
        background: rgba(253, 185, 39, 0.15);
        color: var(--color-accent);
    }

    /* Layout - Two Column */
    .contact-wrapper {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-xl);
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===========================
   DESKTOP (1024px - 1199px)
   =========================== */

@media (min-width: 1024px) and (max-width: 1199px) {
    .site-header {
        padding: 12px 0;
        overflow: visible;
    }

    .site-logo {
        height: 50px;
    }

    .site-title {
        font-size: 1.6rem;
    }

    .site-tagline {
        font-size: 0.8rem;
    }

    /* Desktop Navigation VISIBLE */
    .menu-toggle { 
        display: none !important;
    }

    .main-navigation {
        position: static;
        overflow: visible;
    }

    .nav-menu {
        position: static;
        display: flex !important;
        flex-direction: row;
        gap: 15px;
        padding: 0;
        border-top: none;
        width: auto;
        max-width: none;
        border-bottom: none;
        background: transparent !important;
        box-shadow: none;
        min-width: auto;
        z-index: auto;
        border: none;
        overflow: visible;
        flex-wrap: wrap;
        max-height: none;
        margin: 0;
        list-style: none;
    }

    .nav-item {
        border-bottom: none !important;
        width: auto;
        box-sizing: border-box;
        margin: 0;
        padding: 0;
        list-style: none;
        background: transparent !important;
        border: none !important;
    }

    .nav-link {
        width: auto;
        padding: 8px 12px;
        border-bottom: 2px solid transparent !important;
        border-left: none !important;
        box-sizing: border-box;
        font-size: 0.95rem;
        white-space: nowrap;
        transition: all 0.3s ease;
        background: transparent !important;
        color: var(--color-light);
        font-weight: 500;
        display: inline-block;
        text-align: center;
        text-decoration: none;
    }

    .nav-link:hover,
    .nav-item.active .nav-link {
        color: var(--color-accent);
        border-bottom-color: var(--color-accent) !important;
        background: transparent !important;
    }

    .pillars-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .footer-content {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===========================
   LARGE DESKTOP (1200px - 1919px)
   =========================== */

@media (min-width: 1200px) and (max-width: 1919px) {
    .container {
        max-width: 1200px;
    }

    .site-header {
        padding: 15px 0;
        overflow: visible;
    }

    .site-logo {
        height: 55px;
    }

    .site-title {
        font-size: 1.7rem;
    }

    .site-tagline {
        font-size: 0.82rem;
    }

    /* Desktop Navigation */
    .menu-toggle { 
        display: none !important;
    }

    .main-navigation {
        position: static;
        overflow: visible;
    }

    .nav-menu {
        position: static;
        display: flex !important;
        flex-direction: row;
        gap: 20px;
        padding: 0;
        border-top: none;
        width: auto;
        max-width: none;
        border-bottom: none;
        background: transparent !important;
        box-shadow: none;
        min-width: auto;
        z-index: auto;
        border: none;
        overflow: visible;
        flex-wrap: wrap;
        max-height: none;
        margin: 0;
        list-style: none;
    }

    .nav-item {
        border-bottom: none !important;
        width: auto;
        box-sizing: border-box;
        margin: 0;
        padding: 0;
        list-style: none;
        background: transparent !important;
        border: none !important;
    }

    .nav-link {
        width: auto;
        padding: 8px 15px;
        border-bottom: 2px solid transparent !important;
        border-left: none !important;
        box-sizing: border-box;
        font-size: 1rem;
        white-space: nowrap;
        transition: all 0.3s ease;
        background: transparent !important;
        color: var(--color-light);
        font-weight: 500;
        display: inline-block;
        text-align: center;
        text-decoration: none;
    }

    .nav-link:hover,
    .nav-item.active .nav-link {
        color: var(--color-accent);
        border-bottom-color: var(--color-accent) !important;
        background: transparent !important;
    }
}

/* ===========================
   EXTRA LARGE (1920px+)
   =========================== */

@media (min-width: 1920px) {
    :root {
        font-size: 18px;
    }

    .container {
        max-width: 1600px;
    }

    .site-header {
        padding: 15px 0;
        overflow: visible;
    }

    .site-logo {
        height: 60px;
    }

    .site-title {
        font-size: 1.8rem;
    }

    .site-tagline {
        font-size: 0.85rem;
    }

    /* Desktop Navigation */
    .menu-toggle { 
        display: none !important;
    }

    .main-navigation {
        position: static;
        overflow: visible;
    }

    .nav-menu {
        position: static;
        display: flex !important;
        flex-direction: row;
        gap: 25px;
        padding: 0;
        border-top: none;
        width: auto;
        max-width: none;
        border-bottom: none;
        background: transparent !important;
        box-shadow: none;
        min-width: auto;
        z-index: auto;
        border: none;
        overflow: visible;
        flex-wrap: wrap;
        max-height: none;
        margin: 0;
        list-style: none;
    }

    .nav-item {
        border-bottom: none !important;
        width: auto;
        box-sizing: border-box;
        margin: 0;
        padding: 0;
        list-style: none;
        background: transparent !important;
        border: none !important;
    }

    .nav-link {
        width: auto;
        padding: 10px 18px;
        border-bottom: 2px solid transparent !important;
        border-left: none !important;
        box-sizing: border-box;
        font-size: 1rem;
        white-space: nowrap;
        transition: all 0.3s ease;
        background: transparent !important;
        color: var(--color-light);
        font-weight: 500;
        display: inline-block;
        text-align: center;
        text-decoration: none;
    }

    .nav-link:hover,
    .nav-item.active .nav-link {
        color: var(--color-accent);
        border-bottom-color: var(--color-accent) !important;
        background: transparent !important;
    }
}

/* ===========================
   ACCESSIBILITY
   =========================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    .site-header {
        background-color: rgba(26, 26, 26, 0.95);
        border-bottom-color: #333;
    }

    .pillar-card,
    .card,
    .contact-form {
        background-color: #2a2a2a;
        color: #e0e0e0;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        background-color: #333;
        color: #e0e0e0;
        border-color: #444;
    }

    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        border-color: var(--color-accent);
        background-color: #3a3a3a;
    }

    .site-footer {
        background-color: #0d0d0d;
        border-top-color: #333;
    }

    .nav-menu {
        background-color: rgba(165, 42, 42, 0.95) !important;
        border-color: rgba(253, 185, 39, 0.5);
    }

    .nav-item {
        border-bottom-color: rgba(253, 185, 39, 0.2);
    }

    .nav-link {
        color: #e0e0e0;
    }

    .nav-link:hover,
    .nav-item.active .nav-link {
        background: rgba(253, 185, 39, 0.2) !important;
        color: var(--color-accent);
    }
}

/* ===========================
   PRINT STYLES
   =========================== */

@media print {
    .site-header,
    .site-footer,
    .menu-toggle,
    .scroll-indicator,
    .cta-section,
    .page-cta,
    .btn {
        display: none !important;
    }

    body {
        background-color: #fff !important;
        color: #000 !important;
        font-size: 12pt;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    a {
        color: #000 !important;
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }

    h1, h2, h3 {
        page-break-after: avoid;
    }

    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}
