/**
 * 四柱日和 - 모바일 최적화 CSS
 * 모든 페이지에서 공통으로 사용하는 모바일 최적화 스타일
 *
 * @version 1.0.0
 * @since 2025-12-05
 */

/* ===== 기본 모바일 최적화 ===== */

/* 터치 영역 최소 크기 보장 (44x44px) */
button,
a,
input[type="submit"],
input[type="button"],
.btn,
.clickable {
    min-height: 44px;
    min-width: 44px;
}

/* 텍스트 크기 자동 조정 방지 */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* 터치 하이라이트 제거 */
* {
    -webkit-tap-highlight-color: transparent;
}

/* 스크롤 성능 최적화 */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* 안전 영역 (노치 디스플레이) 대응 */
body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* 입력 필드 줌 방지 (iOS) */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
    font-size: 16px !important;
}

/* ===== 768px 이하 (태블릿/모바일) ===== */
@media (max-width: 768px) {
    /* 폰트 크기 조정 */
    /* html の font-size 縮小は廃止 (2026-10-31): 360px 端末で本文が 10〜11px になり読みにくかった。rem は 16px 基準のまま */

    /* 컨테이너 패딩 */
    .container,
    .section-inner,
    .content-wrapper {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* 버튼 전체 너비 */
    .btn-full-mobile,
    .hero-cta,
    .submit-btn,
    .btn-primary {
        width: 100%;
        display: block;
        text-align: center;
    }

    /* 그리드 1열로 */
    .grid-mobile-1 {
        grid-template-columns: 1fr !important;
    }

    /* 플렉스 세로 정렬 */
    .flex-mobile-column {
        flex-direction: column !important;
    }

    /* 숨김 처리 */
    .hide-mobile {
        display: none !important;
    }

    /* 테이블 스크롤 가능 */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 이미지 최대 너비 */
    img {
        max-width: 100%;
        height: auto;
    }

    /* 모달/팝업 전체화면 */
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }

    /* 고정 헤더 높이 */
    .header,
    .site-header {
        padding: 12px 16px;
    }

    .header-inner {
        padding: 12px 16px;
    }

    /* 입력 폼 */
    .form-group {
        margin-bottom: 16px;
    }

    input,
    textarea,
    select {
        padding: 14px 16px;
        border-radius: 8px;
    }

    /* 카드 스타일 */
    .card,
    .plan-card,
    .result-card {
        padding: 20px 16px;
        border-radius: 12px;
    }
}

/* ===== 480px 이하 (소형 모바일) ===== */
@media (max-width: 480px) {
    /* 폰트 크기 추가 조정 */
    /* html の font-size 縮小は廃止 (2026-10-31): 360px 端末で本文が 10〜11px になり読みにくかった。rem は 16px 基準のまま */

    /* 더 작은 패딩 */
    .container,
    .section-inner,
    .content-wrapper {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* 제목 크기 */
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* 버튼 패딩 */
    button,
    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    /* 카드 더 작은 패딩 */
    .card,
    .plan-card {
        padding: 16px 12px;
    }

    /* 테마 그리드 */
    .themes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* 간격 축소 */
    .section {
        padding: 40px 12px;
    }

    /* 푸터 */
    .footer,
    .site-footer {
        padding: 24px 12px;
        text-align: center;
    }

    .footer-links {
        flex-direction: column;
        gap: 12px;
    }
}

/* ===== 360px 이하 (초소형 모바일) ===== */
@media (max-width: 360px) {
    /* html の font-size 縮小は廃止 (2026-10-31): 360px 端末で本文が 10〜11px になり読みにくかった。rem は 16px 基準のまま */

    .container,
    .section-inner {
        padding-left: 10px;
        padding-right: 10px;
    }

    h1 {
        font-size: 1.4rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .card,
    .plan-card {
        padding: 14px 10px;
    }

    button,
    .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

/* ===== 가로 모드 최적화 ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 60px 20px;
    }

    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ===== 다크 모드 미디어 쿼리 대응 (선택적) ===== */
@media (prefers-color-scheme: dark) {
    /* 다크 모드 지원이 필요한 경우 여기에 추가 */
}

/* ===== 고대비 모드 대응 ===== */
@media (prefers-contrast: high) {
    button,
    .btn {
        border: 2px solid currentColor;
    }

    a:focus,
    button:focus,
    input:focus {
        outline: 3px solid currentColor;
        outline-offset: 2px;
    }
}

/* ===== 애니메이션 감소 설정 대응 ===== */
@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 (hover: none) and (pointer: coarse) {
    /* 호버 효과 제거 */
    button:hover,
    a:hover,
    .btn:hover {
        transform: none;
    }

    /* 터치 피드백 */
    button:active,
    a:active,
    .btn:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* ===== 프린트 스타일 ===== */
@media print {
    .header,
    .footer,
    .nav,
    .btn,
    button,
    .modal-overlay,
    .scroll-indicator {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }
}
