/* AI협동조합 웹사이트 반응형 디자인 CSS */

/* 모바일 우선 접근법 (Mobile First Approach) */

/* 기본 스타일 (320px 이상) */
@media screen and (min-width: 320px) {
    .container {
        padding: 0 16px;
    }
    
    /* 네비게이션 */
    .nav-mobile {
        display: block;
    }
    
    .nav-desktop {
        display: none;
    }
    
    /* 텍스트 크기 조정 */
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
        line-height: 1.4;
    }
    
    .section-title {
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    .section-subtitle {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    /* 버튼 스타일 */
    .btn-mobile {
        width: 100%;
        padding: 12px 16px;
        font-size: 0.875rem;
        margin-bottom: 8px;
    }
    
    /* 카드 레이아웃 */
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* 간격 조정 */
    .section-padding {
        padding: 3rem 0;
    }
    
    /* 모바일 메뉴 */
    .mobile-menu {
        position: fixed;
        top: 76px;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        z-index: 40;
    }
    
    .mobile-menu.open {
        transform: translateY(0);
    }
    
    .mobile-menu ul {
        padding: 1rem 0;
    }
    
    .mobile-menu li {
        border-bottom: 1px solid #f3f4f6;
    }
    
    .mobile-menu a {
        display: block;
        padding: 1rem 1.5rem;
        color: #374151;
        text-decoration: none;
        transition: background-color 0.2s;
    }
    
    .mobile-menu a:hover {
        background-color: #f9fafb;
    }
}

/* 작은 모바일 (375px 이상) */
@media screen and (min-width: 375px) {
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .btn-mobile {
        padding: 14px 20px;
        font-size: 1rem;
    }
}

/* 큰 모바일 (425px 이상) */
@media screen and (min-width: 425px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .card-grid-mobile-large {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .section-padding {
        padding: 4rem 0;
    }
}

/* 태블릿 세로 (768px 이상) */
@media screen and (min-width: 768px) {
    .nav-mobile {
        display: none;
    }
    
    .nav-desktop {
        display: flex;
    }
    
    .container {
        padding: 0 2rem;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-subtitle {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
    
    .section-subtitle {
        font-size: 1.125rem;
    }
    
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .btn-mobile {
        width: auto;
        padding: 16px 32px;
        margin-bottom: 0;
        margin-right: 1rem;
    }
    
    .section-padding {
        padding: 5rem 0;
    }
    
    /* 비즈니스 카드 레이아웃 */
    .business-card-layout {
        grid-template-columns: repeat(2, 1fr);
        align-items: center;
        gap: 3rem;
    }
    
    /* FAQ 레이아웃 */
    .faq-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* 태블릿 가로 (1024px 이상) */
@media screen and (min-width: 1024px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.75rem;
    }
    
    .section-title {
        font-size: 3rem;
    }
    
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
    
    .card-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .section-padding {
        padding: 6rem 0;
    }
    
    /* 네비게이션 호버 효과 강화 */
    .nav-item {
        position: relative;
    }
    
    .nav-item::after {
        content: '';
        position: absolute;
        bottom: -4px;
        left: 0;
        width: 0;
        height: 2px;
        background: linear-gradient(90deg, #3b82f6, #1d4ed8);
        transition: width 0.3s ease;
    }
    
    .nav-item:hover::after {
        width: 100%;
    }
}

/* 데스크탑 (1280px 이상) */
@media screen and (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .hero-subtitle {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 3.5rem;
    }
    
    .card-grid {
        gap: 3rem;
    }
    
    .section-padding {
        padding: 7rem 0;
    }
    
    /* 고급 애니메이션 효과 */
    .advanced-animation {
        animation: slideInUp 0.8s ease-out;
    }
    
    @keyframes slideInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* 대형 데스크탑 (1536px 이상) */
@media screen and (min-width: 1536px) {
    .container {
        max-width: 1536px;
    }
    
    .hero-title {
        font-size: 4.5rem;
    }
    
    .section-padding {
        padding: 8rem 0;
    }
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    /* 터치 디바이스에서 호버 효과 제거 */
    .hover-effect:hover {
        transform: none;
    }
    
    /* 터치 친화적인 버튼 크기 */
    .touch-button {
        min-height: 48px;
        min-width: 48px;
    }
    
    /* 터치 리플 효과 */
    .touch-ripple {
        position: relative;
        overflow: hidden;
    }
    
    .touch-ripple::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }
    
    .touch-ripple:active::after {
        width: 300px;
        height: 300px;
    }
}

/* 고해상도 디스플레이 최적화 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* 레티나 디스플레이용 아이콘 및 이미지 */
    .high-res-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    /* 텍스트 렌더링 최적화 */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* 접근성 향상 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .parallax {
        transform: none !important;
    }
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1f2937;
        --bg-secondary: #374151;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --border-color: #4b5563;
    }
    
    .dark-mode-bg {
        background-color: var(--bg-primary);
        color: var(--text-primary);
    }
    
    .dark-mode-card {
        background-color: var(--bg-secondary);
        border-color: var(--border-color);
    }
}

/* 인쇄 스타일 */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: black !important;
        background: white !important;
    }
    
    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .section-padding {
        padding: 1rem 0;
    }
    
    .page-break {
        page-break-after: always;
    }
    
    .keep-together {
        page-break-inside: avoid;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    a[href^="#"]:after {
        content: "";
    }
}

/* 가로 방향 모바일 */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: 70vh;
    }
    
    .section-padding {
        padding: 2rem 0;
    }
    
    .mobile-menu {
        max-height: calc(100vh - 76px);
        overflow-y: auto;
    }
}

/* 극소형 디바이스 (320px 미만) */
@media screen and (max-width: 319px) {
    .container {
        padding: 0 12px;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .btn-mobile {
        padding: 10px 12px;
        font-size: 0.875rem;
    }
    
    .card-padding {
        padding: 1rem;
    }
}

/* 특수 브레이크포인트 */
@media screen and (min-width: 900px) and (max-width: 1023px) {
    /* 태블릿과 데스크탑 사이의 중간 크기 */
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hero-title {
        font-size: 3.25rem;
    }
}

/* 가로세로 비율 기반 스타일 */
@media screen and (aspect-ratio: 16/9) {
    /* 와이드스크린 모니터 최적화 */
    .widescreen-layout {
        max-width: 90vw;
    }
}

/* 높이 기반 스타일 */
@media screen and (min-height: 800px) {
    .full-height-section {
        min-height: 100vh;
        display: flex;
        align-items: center;
    }
}

@media screen and (max-height: 600px) {
    .compact-section {
        padding: 2rem 0;
    }
    
    .hero-section {
        min-height: 80vh;
    }
}

/* 커스텀 그리드 시스템 */
.grid-responsive {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media screen and (min-width: 640px) {
    .grid-responsive {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media screen and (min-width: 768px) {
    .grid-responsive {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

@media screen and (min-width: 1024px) {
    .grid-responsive {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem;
    }
}

/* 플렉스 기반 반응형 레이아웃 */
.flex-responsive {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media screen and (min-width: 768px) {
    .flex-responsive {
        flex-direction: row;
        align-items: center;
        gap: 2rem;
    }
}

/* 컨테이너 쿼리 지원 (미래 대비) */
@container (min-width: 400px) {
    .container-responsive {
        grid-template-columns: repeat(2, 1fr);
    }
}

@container (min-width: 600px) {
    .container-responsive {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 스크롤 스냅 */
.scroll-snap-container {
    scroll-snap-type: x mandatory;
    overflow-x: auto;
    display: flex;
    gap: 1rem;
}

.scroll-snap-item {
    scroll-snap-align: start;
    flex: none;
    width: 280px;
}

@media screen and (min-width: 768px) {
    .scroll-snap-item {
        width: 320px;
    }
}

/* 모바일 네비게이션 개선 */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 39;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 성능 최적화 */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* 터치 피드백 개선 */
.touch-feedback {
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 모바일 양식 최적화 */
@media screen and (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px; /* iOS에서 확대 방지 */
        padding: 12px 16px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* 스크린 리더 전용 텍스트 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}