/* ========================================
   TSOL Website - Responsive Stylesheet
   Mobile & Tablet Optimization
   ======================================== */

/* ========================================
   TABLET: 768px - 1023px
   ======================================== */

@media (max-width: 1023px) {
    
    /* Typography */
    h1 {
        font-size: 36px;
    }
    
    h2 {
        font-size: 32px;
    }
    
    h3 {
        font-size: 24px;
    }
    
    /* Grid adjustments */
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Hero */
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    /* Timeline */
    .timeline::before {
        left: 20px;
    }
    
    .timeline-content {
        width: calc(100% - 60px);
        margin-left: 60px !important;
    }
    
    .timeline-item::after {
        left: 20px;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Problem grid */
    .problem-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   MOBILE: 320px - 767px
   ======================================== */

@media (max-width: 767px) {
    
    /* Root variables adjustment */
    :root {
        --space-xl: 32px;
        --space-2xl: 48px;
        --space-3xl: 64px;
    }
    
    /* Container */
    .container {
        padding: 0 var(--space-sm);
    }
    
    .section {
        padding: var(--space-2xl) 0;
    }
    
    /* Typography */
    h1 {
        font-size: 32px;
    }
    
    h2 {
        font-size: 28px;
    }
    
    h3 {
        font-size: 22px;
    }
    
    h4 {
        font-size: 20px;
    }
    
    p {
        font-size: 16px;
    }
    
    .section-title h2 {
        font-size: 28px;
    }
    
    .section-title p {
        font-size: 16px;
    }
    
    /* Navigation */
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--white);
        flex-direction: column;
        padding: var(--space-md);
        box-shadow: var(--shadow-lg);
        transition: left 0.3s ease-in-out;
        overflow-y: auto;
        z-index: 999;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-link {
        width: 100%;
        padding: var(--space-sm);
        border-bottom: 1px solid var(--gray-light);
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    /* Buttons */
    .btn {
        padding: 12px 24px;
        width: 100%;
        display: block;
    }
    
    .btn-large {
        padding: 14px 28px;
        font-size: 16px;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    /* Grid system */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    /* Hero */
    .hero {
        min-height: auto;
        padding: var(--space-2xl) 0;
    }
    
    .hero-text h1 {
        font-size: 32px;
    }
    
    .hero-text p {
        font-size: 16px;
    }
    
    .hero-image {
        margin-top: var(--space-lg);
    }
    
    /* Problem section */
    .problem-grid {
        grid-template-columns: 1fr;
    }
    
    .problem-card {
        padding: var(--space-sm);
    }
    
    /* Layer model */
    .layer {
        padding: var(--space-sm);
    }
    
    .layer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }
    
    .layer-title {
        font-size: 20px;
    }
    
    .layer-icon {
        font-size: 24px;
    }
    
    .layer-items {
        flex-direction: column;
    }
    
    .layer-item {
        width: 100%;
    }
    
    /* Timeline */
    .timeline::before {
        left: 10px;
    }
    
    .timeline-content {
        width: calc(100% - 40px);
        margin-left: 40px !important;
    }
    
    .timeline-item::after {
        left: 10px;
        width: 16px;
        height: 16px;
    }
    
    .timeline-content {
        padding: var(--space-sm);
    }
    
    /* Cards */
    .card {
        padding: var(--space-sm);
    }
    
    .card-icon {
        font-size: 36px;
    }
    
    /* Case study */
    .case-results {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
    }
    
    .case-result {
        text-align: left;
        padding: var(--space-xs);
        background: var(--gray-light);
        border-radius: var(--radius-sm);
    }
    
    .case-result-value {
        font-size: 18px;
    }
    
    /* Footer */
    .footer {
        padding: var(--space-lg) 0 var(--space-md);
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    /* Utility spacing for mobile */
    .mt-lg-5 { margin-top: var(--space-md); }
    .mb-lg-5 { margin-bottom: var(--space-md); }
    .p-lg-5 { padding: var(--space-md); }
    
    /* Hide desktop elements */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile elements */
    .mobile-only {
        display: block !important;
    }
}

/* ========================================
   EXTRA SMALL MOBILE: < 375px
   ======================================== */

@media (max-width: 374px) {
    h1 {
        font-size: 28px;
    }
    
    h2 {
        font-size: 24px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .container {
        padding: 0 12px;
    }
}

/* ========================================
   LARGE DESKTOP: > 1440px
   ======================================== */

@media (min-width: 1440px) {
    .container {
        max-width: 1320px;
    }
    
    h1 {
        font-size: 56px;
    }
    
    h2 {
        font-size: 42px;
    }
    
    .hero-text h1 {
        font-size: 56px;
    }
    
    .section-title h2 {
        font-size: 42px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    .header,
    .nav,
    .footer,
    .btn,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    .section {
        page-break-inside: avoid;
    }
}

/* ========================================
   LANDSCAPE ORIENTATION (Mobile/Tablet)
   ======================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: var(--space-lg) 0;
    }
    
    .nav-menu {
        height: calc(100vh - 60px);
        top: 60px;
    }
}

/* ========================================
   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;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   DARK MODE PREFERENCE (Future-ready)
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here in future */
    /* Currently maintaining light theme only */
}

/* ========================================
   HIGH CONTRAST MODE (Accessibility)
   ======================================== */

@media (prefers-contrast: high) {
    :root {
        --gray: #000000;
        --gray-light: #CCCCCC;
    }
    
    .btn {
        border-width: 3px;
    }
    
    a {
        text-decoration: underline;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Increase touch target sizes */
    .btn,
    .nav-link,
    a {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Remove hover effects on touch devices */
    .card:hover,
    .btn:hover {
        transform: none;
    }
    
    /* Add active states instead */
    .card:active {
        transform: scale(0.98);
    }
    
    .btn:active {
        transform: scale(0.95);
    }
}

/* ========================================
   END OF RESPONSIVE STYLESHEET
   ======================================== */
