/**
 * BNI 비저너리 챕터 - Responsive Design
 * Mobile-First Responsive Styles
 */

/* Mobile First Approach - Base styles for mobile */
@media (max-width: 640px) {
    /* Navigation adjustments */
    #navbar {
        padding: 0.5rem 1rem;
    }
    
    /* Hide navigation tooltips on mobile */
    .nav-tooltip {
        display: none !important;
    }
    
    /* Ensure mobile menu works properly */
    #mobile-menu {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    #mobile-menu.active {
        transform: translateX(0);
    }
    
    /* Mobile menu enhancement */
    #mobile-menu .menu-item {
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        transition: background-color 0.2s ease;
    }
    
    #mobile-menu .menu-item:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    #navbar .container {
        padding: 0;
    }
    
    #navbar h1, #navbar .text-2xl {
        font-size: 1.5rem;
    }
    
    /* Hero section mobile optimization */
    #hero {
        min-height: 100vh;
        padding-top: 5rem;
        padding-bottom: 2rem;
    }
    
    #hero .pt-24 {
        padding-top: 5rem;
    }
    
    #hero .text-6xl {
        font-size: 2.5rem !important;
    }
    
    #hero .text-8xl {
        font-size: 3rem !important;
    }
    
    #hero .min-h-\[calc\(100vh-12rem\)\] {
        min-height: calc(100vh - 8rem);
    }
    
    #hero .bg-white\/15 {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }
    
    #hero .space-y-2 > * + * {
        margin-top: 0.5rem;
    }
    
    #hero .rounded-3xl {
        border-radius: 1.5rem;
    }
    
    /* Skeleton adjustments for mobile */
    #hero-skeleton .w-80 {
        width: 90%;
    }
    
    #hero-skeleton .w-96 {
        width: 95%;
    }
    
    #hero-skeleton .w-72 {
        width: 85%;
    }
    
    #hero-skeleton .w-64 {
        width: 80%;
    }
    
    #hero-skeleton .w-60 {
        width: 100%;
    }
    
    #hero-skeleton .w-48 {
        width: 70%;
    }
    
    #hero-skeleton .sm\\:w-60 {
        width: 100%;
    }
    
    #hero-skeleton .sm\\:w-48 {
        width: 100%;
    }
    
    /* Button adjustments */
    #hero .flex-col a,
    .btn-primary {
        width: 100%;
        text-align: center;
        padding: 1rem 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* About section mobile */
    #about .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    #about .bg-gradient-to-br {
        padding: 1.5rem;
    }
    
    #about .w-32.h-32 {
        width: 6rem;
        height: 6rem;
    }
    
    #about .text-3xl {
        font-size: 1.5rem;
    }
    
    #about .text-2xl {
        font-size: 1.3rem;
    }
    
    /* Value chain mobile optimization */
    #valuechain .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    #valuechain .bg-white {
        padding: 1.5rem;
    }
    
    #valuechain .text-4xl {
        font-size: 2rem;
    }
    
    #valuechain .text-xl {
        font-size: 1.1rem;
    }
    
    /* Mission statement mobile */
    .py-20 {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
    
    .py-32 {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }
    
    /* Mandart section mobile */
    #mandart .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    #mandart .bg-white {
        padding: 1.5rem;
    }
    
    #mandart .w-16.h-16 {
        width: 3rem;
        height: 3rem;
    }
    
    #mandart .text-2xl {
        font-size: 1.2rem;
    }
    
    #mandart .text-xl {
        font-size: 1.1rem;
    }
    
    /* Contact section mobile */
    #contact .max-w-4xl {
        max-width: 100%;
    }
    
    #contact .bg-white\/10 {
        padding: 1.5rem;
        margin: 0 1rem;
    }
    
    #contact .text-5xl {
        font-size: 2rem;
    }
    
    #contact .text-3xl {
        font-size: 1.5rem;
    }
    
    #contact .text-2xl {
        font-size: 1.2rem;
    }
    
    /* Footer mobile */
    footer .text-3xl {
        font-size: 1.5rem;
    }
    
    /* Spacing adjustments */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .space-y-6 > * + * {
        margin-top: 1rem;
    }
    
    .mb-16 {
        margin-bottom: 2rem;
    }
    
    .mb-12 {
        margin-bottom: 1.5rem;
    }
    
    .mb-8 {
        margin-bottom: 1rem;
    }
    
    /* Text size adjustments */
    .text-6xl {
        font-size: 2.5rem !important;
    }
    
    .text-5xl {
        font-size: 2rem !important;
    }
    
    .text-4xl {
        font-size: 1.8rem !important;
    }
    
    .text-3xl {
        font-size: 1.5rem !important;
    }
}

/* Tablet styles */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Navigation for tablet */
    #navbar .hidden.lg\\:flex {
        display: none;
    }
    
    /* Hero adjustments for tablet */
    #hero .pt-24 {
        padding-top: 6rem;
    }
    
    #hero .text-6xl {
        font-size: 3.5rem !important;
    }
    
    #hero .text-8xl {
        font-size: 4rem !important;
    }
    
    #hero .min-h-\[calc\(100vh-12rem\)\] {
        min-height: calc(100vh - 10rem);
    }
    
    #hero .bg-white\/15 {
        padding: 2rem;
    }
    
    /* Grid adjustments for tablet */
    .grid.md\\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid.lg\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Value chain for tablet */
    #valuechain .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Mandart for tablet */
    #mandart .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* About section for tablet */
    #about .grid {
        gap: 3rem;
    }
    
    /* Contact section for tablet */
    #contact .grid {
        gap: 2rem;
    }
}

/* Desktop optimizations */
@media (min-width: 1025px) {
    /* Large screen optimizations */
    .container {
        max-width: 1200px;
    }
    
    /* Hero enhancements */
    #hero h1 {
        font-size: 4.5rem;
        line-height: 1.1;
    }
    
    /* Grid layouts for desktop */
    .grid.lg\\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Ultra-wide screens */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
    
    #hero h1 {
        font-size: 5rem;
    }
    
    .text-6xl {
        font-size: 5rem;
    }
}

/* Height-based media queries for mobile landscape */
@media (max-height: 500px) and (orientation: landscape) {
    #hero {
        min-height: 100vh;
        padding: 2rem 1rem;
    }
    
    #hero h1 {
        font-size: 1.8rem !important;
        margin-bottom: 1rem;
    }
    
    #hero .bg-white\/10 {
        padding: 1rem;
    }
    
    #hero .text-2xl {
        font-size: 1.2rem;
    }
    
    .py-20,
    .py-32 {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
}

/* Print styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        text-shadow: none !important;
        box-shadow: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3, h4 {
        page-break-after: avoid;
    }
    
    .no-print,
    nav,
    footer,
    .fixed,
    button {
        display: none !important;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    section {
        page-break-inside: avoid;
        margin-bottom: 2rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #f9fafb;
        --text-gray: #d1d5db;
        --bg-light: #111827;
    }
    
    body {
        background-color: #111827;
        color: #f9fafb;
    }
    
    .bg-white {
        background-color: #1f2937 !important;
        color: #f9fafb;
    }
    
    .bg-gray-50 {
        background-color: #111827 !important;
    }
    
    .text-gray-700,
    .text-gray-600,
    .text-gray-800 {
        color: #d1d5db !important;
    }
    
    .shadow-lg {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    }
    
    #navbar {
        background: rgba(17, 24, 39, 0.95) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    #mobile-menu {
        background: rgba(17, 24, 39, 0.98) !important;
    }
}

/* Reduced motion preferences */
@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;
    }
    
    .animate-pulse,
    .animate-bounce,
    .animate-spin {
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary-blue: #0000ff;
        --primary-green: #008000;
        --secondary-blue: #000080;
        --secondary-green: #006400;
    }
    
    .bg-blue-600 {
        background-color: #0000ff !important;
    }
    
    .bg-green-600 {
        background-color: #008000 !important;
    }
    
    .text-blue-600 {
        color: #0000ff !important;
    }
    
    .text-green-600 {
        color: #008000 !important;
    }
    
    button,
    .btn-primary {
        border: 2px solid currentColor;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari viewport height fix */
    #hero {
        min-height: -webkit-fill-available;
    }
    
    /* Fix for iOS Safari bounce effect */
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix for iOS Safari button styling */
    button,
    input[type="button"],
    input[type="submit"] {
        -webkit-appearance: none;
        border-radius: 0;
    }
}

/* Android Chrome specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    /* Android Chrome viewport fix */
    .min-h-screen {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Touch-friendly button sizes */
    button,
    a,
    .clickable {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .hover\\:scale-105:hover {
        transform: none;
    }
    
    .hover\\:-translate-y-2:hover {
        transform: none;
    }
    
    /* Hide navigation tooltips on touch devices */
    .nav-tooltip {
        display: none !important;
    }
    
    /* Enhanced touch targets */
    nav a {
        padding: 0.75rem 1rem;
    }
    
    /* Optimize tap highlighting */
    * {
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.3);
    }
}

/* Accessibility enhancements */
@media (prefers-reduced-transparency) {
    .backdrop-blur-sm,
    .backdrop-blur {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    .bg-white\/95,
    .bg-white\/10 {
        background-color: rgba(255, 255, 255, 1) !important;
    }
}

/* Focus visible for keyboard navigation */
@media (hover: hover) and (pointer: fine) {
    :focus-visible {
        outline: 2px solid var(--primary-blue);
        outline-offset: 2px;
    }
    
    :focus:not(:focus-visible) {
        outline: none;
    }
}

/* Container query support (for modern browsers) */
@supports (container-type: inline-size) {
    .card-container {
        container-type: inline-size;
    }
    
    @container (max-width: 300px) {
        .card-responsive {
            padding: 1rem;
        }
        
        .card-responsive h3 {
            font-size: 1rem;
        }
    }
}

/* Flexible grid system for complex layouts */
.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .responsive-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Utility classes for responsive spacing */
.spacing-responsive {
    padding: clamp(1rem, 4vw, 3rem);
}

.margin-responsive {
    margin: clamp(0.5rem, 2vw, 2rem);
}

.text-responsive {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
}

.heading-responsive {
    font-size: clamp(1.5rem, 5vw, 3rem);
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
    /* Reduce complex animations on mobile */
    .animate-pulse {
        animation-duration: 3s;
    }
    
    /* Optimize images for mobile */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Reduce shadow complexity on mobile */
    .shadow-2xl {
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    }
}