/* ========================================
   HaqotePad Landing Page - Responsive Styles
   Bootstrap 5.3.3 Compatible
   Optimized for all devices and resolutions
   ======================================== */

/* Base Responsive Utilities */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Large Screens - Custom Adjustments */
@media screen and (max-width: 1200px) {
    .hero-title {
        font-size: 2.75rem;
    }
}

/* Tablet Styles - Custom Adjustments */
@media screen and (max-width: 1024px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    /* Improve button sizes for touch */
    .btn {
        min-height: 44px;
    }
}

/* Mobile & Tablet (max-width: 768px) */
@media screen and (max-width: 768px) {
    /* Bootstrap navbar handles mobile menu */
    .navbar-brand.logo {
        font-size: 1.125rem;
    }
    
    .navbar-brand.logo img {
        width: 28px !important;
        height: 28px !important;
    }
    
    /* Container adjustments */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Hero Section */
    .hero {
        padding-top: 80px;
        padding-bottom: 2rem;
        min-height: auto;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
        word-wrap: break-word;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem !important;
    }
    
    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    .hero .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    
    /* Section spacing */
    section {
        padding: 3rem 0 !important;
    }
    
    .section-header {
        margin-bottom: 2rem !important;
    }
    
    .section-title {
        font-size: 1.75rem !important;
        word-wrap: break-word;
        margin-bottom: 1rem !important;
    }
    
    .section-subtitle {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    /* Features grid */
    .features-grid .col-12 {
        padding: 0 0.5rem;
    }
    
    .feature-card {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .feature-title {
        font-size: 1.25rem;
    }
    
    .feature-description {
        font-size: 0.9rem;
    }
    
    /* Steps */
    .step {
        flex-direction: column;
        text-align: center;
    }
    
    .step-number {
        margin: 0 auto 1rem;
    }
    
    /* Native Architecture lists */
    .native-architecture ul {
        padding-left: 1rem;
    }
    
    /* Masonry items responsive */
    .masonry-item {
        margin-bottom: 1rem;
    }
    
    /* CTA section */
    .cta-title {
        font-size: 2rem !important;
        line-height: 1.2;
    }
    
    .cta-description {
        font-size: 1rem;
    }
    
    /* Footer */
    .footer-content {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-logo {
        justify-content: center;
    }
    
    .footer-bottom {
        text-align: center;
    }
    
    .footer-bottom-links {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
    }
    
    /* Carousel */
    .carousel-caption {
        display: none !important;
    }
    
    /* Team section buttons */
    .team-section .btn {
        margin: 0.25rem;
    }
    
    /* CTA section buttons */
    .cta-section .d-flex {
        flex-direction: column;
        width: 100%;
    }
    
    .cta-section .btn {
        width: 100%;
    }
    
    /* Feedback section */
    .feedback-section .btn {
        width: 100%;
    }
    
    /* Technology stack adjustments */
    .tech-stack .col-lg-6,
    .native-architecture .col-md-4 {
        margin-bottom: 1rem;
    }
}

/* Small Mobile (max-width: 480px) */
@media screen and (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    /* Container */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Logo */
    .navbar-brand.logo {
        font-size: 1rem;
    }
    
    .navbar-brand.logo img {
        width: 24px !important;
        height: 24px !important;
    }
    
    /* Hero */
    .hero {
        padding-top: 70px;
        padding-bottom: 1.5rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Demo Card */
    .demo-card {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .card-excerpt {
        font-size: 0.85rem;
    }
    
    /* Sections */
    section {
        padding: 2rem 0 !important;
    }
    
    .section-header {
        margin-bottom: 1.5rem !important;
    }
    
    .section-title {
        font-size: 1.5rem !important;
        line-height: 1.3;
        margin-bottom: 0.75rem !important;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
    }
    
    /* Row spacing */
    .row.g-4 {
        row-gap: 1rem !important;
    }
    
    /* Feature cards */
    .feature-card {
        padding: 1.25rem;
    }
    
    .feature-title {
        font-size: 1.1rem;
    }
    
    .feature-description {
        font-size: 0.85rem;
    }
    
    .feature-icon i {
        font-size: 2rem !important;
    }
    
    /* Step numbers */
    .step-number {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .step-title {
        font-size: 1rem;
    }
    
    .step-description {
        font-size: 0.85rem;
    }
    
    /* CTA */
    .cta-title {
        font-size: 1.5rem !important;
        line-height: 1.3;
    }
    
    .cta-description {
        font-size: 0.9rem;
    }
    
    /* Buttons */
    .btn {
        font-size: 0.9rem;
        padding: 0.65rem 1rem;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.75rem 1.25rem;
    }
    
    /* Footer */
    .footer {
        padding: 2rem 0 1rem;
    }
    
    .footer-description {
        font-size: 0.85rem;
    }
    
    .footer-text {
        font-size: 0.85rem;
    }
    
    /* Back to Top */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hero-card-demo {
        animation: none;
    }
    
    .blob {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .mobile-menu-toggle,
    .back-to-top,
    .hero-background {
        display: none;
    }
    
    .hero {
        padding-top: 0;
    }
    
    body {
        background: white;
        color: black;
    }
    
    a {
        text-decoration: underline;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn-secondary {
        border-width: 3px;
    }
    
    .feature-card,
    .preview-item {
        border: 2px solid var(--color-gray-400);
    }
}

/* Dark Mode Support (Optional - for future implementation) */
@media (prefers-color-scheme: dark) {
    /* This section can be expanded if dark mode is needed in the future */
}

/* Landscape Orientation Optimization */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 80px 0 40px;
    }
    
    .hero-content {
        grid-template-columns: 1fr 1fr;
    }
    
    .hero-text {
        text-align: left;
    }
    
    .hero-image {
        order: initial;
    }
    
    .section-header {
        margin-bottom: var(--spacing-2xl);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-links a {
        padding: var(--spacing-sm) 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .back-to-top {
        width: 56px;
        height: 56px;
    }
}

/* Very Large Screens (min-width: 1440px) */
@media screen and (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .section-title {
        font-size: 3rem;
    }
    
    .cta-title {
        font-size: 3.5rem;
    }
}

/* Ultra Wide Screens (min-width: 1920px) */
@media screen and (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
}

/* Extra Small Devices (max-width: 360px) */
@media screen and (max-width: 360px) {
    html {
        font-size: 13px;
    }
    
    body {
        overflow-x: hidden;
    }
    
    .container {
        padding: 0 0.5rem;
        max-width: 100%;
    }
    
    .hero-title {
        font-size: 1.4rem;
        line-height: 1.2;
        word-break: break-word;
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
    }
    
    .section-title {
        font-size: 1.3rem;
        word-break: break-word;
    }
    
    .section-subtitle {
        font-size: 0.85rem;
    }
    
    .btn {
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }
    
    .btn-lg {
        font-size: 0.9rem;
        padding: 0.7rem 1.1rem;
    }
    
    .logo {
        font-size: 0.9rem;
    }
    
    .card-title {
        font-size: 0.95rem;
    }
    
    .feature-card {
        padding: 1rem;
    }
    
    .feature-title {
        font-size: 1rem;
    }
    
    .feature-description {
        font-size: 0.8rem;
    }
    
    .cta-title {
        font-size: 1.3rem !important;
    }
    
    .footer-heading {
        font-size: 0.9rem;
    }
}

/* Flexible Images & Media */
@media screen and (max-width: 768px) {
    img {
        width: 100%;
        height: auto;
    }
    
    .preview-image {
        object-fit: cover;
    }
}

/* Orientation-Specific Optimizations */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .hero {
        padding: 60px 0 30px;
    }
    
    section {
        padding: var(--spacing-xl) 0;
    }
    
    .section-header {
        margin-bottom: var(--spacing-lg);
    }
}

/* High DPI Displays (Retina) */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    /* Ensure crisp images on high-DPI displays */
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Container Queries Support (Progressive Enhancement) */
@supports (container-type: inline-size) {
    .feature-card {
        container-type: inline-size;
    }
    
    @container (max-width: 300px) {
        .feature-title {
            font-size: 1.125rem;
        }
    }
}

/* Flexible Grid Fallbacks */
@supports not (display: grid) {
    .features-grid,
    .feedback-content,
    .footer-content {
        display: flex;
        flex-wrap: wrap;
        gap: var(--spacing-md);
    }
    
    .feature-card,
    .feedback-info,
    .footer-section {
        flex: 1 1 300px;
    }
}

/* Safe Area Insets (iOS Notch Support) */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(var(--spacing-lg), env(safe-area-inset-left));
        padding-right: max(var(--spacing-lg), env(safe-area-inset-right));
    }
    
    .navbar {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Improve Readability on All Devices */
@media screen and (max-width: 768px) {
    body {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* Ensure clickable elements are accessible */
@media (pointer: coarse) {
    .btn,
    .mobile-menu-toggle {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-links a {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Reduce animations on low-end devices */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
