/*
 * responsive.css - 반응형 스타일시트
 * 궁금하면클릭해봐용 - 100문 100답 플랫폼
 * 위치: /assets/css/responsive.css
 */

/* ========== TABLET (1024px 이하) ========== */
@media (max-width: 1024px) {
    :root {
        --spacing-xl: 50px;
        --spacing-2xl: 80px;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    .header-inner {
        padding: 0 var(--spacing-sm);
    }

    .main-nav ul {
        gap: var(--spacing-sm);
    }

    .main-nav a {
        padding: var(--spacing-xs) 12px;
        font-size: 0.9rem;
    }

    .hero-title {
        font-size: clamp(2rem, 6vw, 3.5rem);
    }

    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== TABLET PORTRAIT (768px 이하) ========== */
@media (max-width: 768px) {
    :root {
        --spacing-lg: 32px;
        --spacing-xl: 40px;
        --spacing-2xl: 60px;
    }

    /* Header Mobile */
    .header-inner {
        height: 60px;
    }

    .menu-toggle {
        display: flex;
        z-index: 1001;
    }

    .main-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(5, 5, 16, 0.98);
        backdrop-filter: blur(20px);
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

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

    .main-nav ul {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }

    .main-nav a {
        font-size: 1.25rem;
        padding: var(--spacing-sm) var(--spacing-lg);
    }

    /* Menu Toggle Animation */
    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    /* Hero */
    .hero-section {
        min-height: auto;
        padding: var(--spacing-xl) var(--spacing-sm);
    }

    .hero-title {
        font-size: clamp(1.75rem, 7vw, 2.5rem);
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-badge {
        padding: 6px 14px;
    }

    .hero-badge span {
        font-size: 0.8rem;
    }

    /* Buttons */
    .btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .btn-group {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    /* Cards */
    .card {
        padding: var(--spacing-md);
    }

    .template-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .template-header {
        padding: var(--spacing-sm);
    }

    .template-number {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    .template-title {
        font-size: 1rem;
    }

    .template-stats {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .stat-value {
        font-size: 1rem;
    }

    /* Search */
    .search-container {
        margin-bottom: var(--spacing-lg);
    }

    .search-box {
        padding: 6px;
        padding-left: 16px;
    }

    .search-box input {
        font-size: 0.9rem;
        padding: 8px;
    }

    .search-box button {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    /* Section */
    .section {
        padding: var(--spacing-xl) 0;
    }

    .section-title {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        text-align: center;
    }

    .footer-brand {
        max-width: 100%;
    }

    .footer-links ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--spacing-sm);
    }

    .footer-links li {
        margin-bottom: 0;
    }

    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Forms */
    .form-input {
        padding: 12px 14px;
    }

    /* QnA Platform specific */
    .qa-container {
        padding: var(--spacing-sm);
    }

    .qa-question-item {
        padding: var(--spacing-sm);
    }

    .qa-answer-input {
        font-size: 0.95rem;
    }

    /* Template Editor */
    .template-editor {
        padding: var(--spacing-sm);
    }

    .template-preview {
        min-height: 300px;
    }
}

/* ========== MOBILE (480px 이하) ========== */
@media (max-width: 480px) {
    :root {
        --spacing-md: 16px;
        --spacing-lg: 24px;
        --spacing-xl: 32px;
        --spacing-2xl: 48px;
    }

    body {
        font-size: 14px;
    }

    .logo img {
        height: 32px;
    }

    .logo-text {
        font-size: 1rem;
    }

    .hero-section {
        padding: var(--spacing-lg) var(--spacing-sm);
    }

    .hero-title {
        font-size: clamp(1.5rem, 8vw, 2rem);
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    /* Template Cards */
    .template-card {
        border-radius: var(--radius-md);
    }

    .template-number {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
        border-radius: var(--radius-sm);
    }

    .template-stats {
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }

    .stat-item {
        flex: 1;
        min-width: 60px;
    }

    .stat-value {
        font-size: 0.95rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 0.85rem;
        width: 100%;
    }

    .btn-group {
        width: 100%;
    }

    /* Search */
    .search-box {
        flex-direction: column;
        padding: var(--spacing-sm);
        border-radius: var(--radius-md);
    }

    .search-box input {
        width: 100%;
        text-align: center;
        margin-bottom: var(--spacing-xs);
    }

    .search-box button {
        width: 100%;
    }

    /* Tags */
    .tags {
        justify-content: center;
    }

    .tag {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    /* Footer */
    .footer-bottom {
        font-size: 0.8rem;
    }

    /* Modals */
    .modal-content {
        margin: var(--spacing-sm);
        max-height: calc(100vh - 40px);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--spacing-sm);
    }

    /* Slider */
    .slider-arrow {
        width: 36px;
        height: 36px;
    }

    .slider-dots {
        bottom: 10px;
    }

    /* QnA specific */
    .qa-progress {
        height: 6px;
    }

    .qa-question-number {
        font-size: 0.8rem;
    }

    .qa-question-text {
        font-size: 1rem;
    }
}

/* ========== SMALL MOBILE (360px 이하) ========== */
@media (max-width: 360px) {
    .container {
        padding: 0 var(--spacing-xs);
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .template-header {
        gap: var(--spacing-xs);
    }

    .template-number {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .template-title {
        font-size: 0.9rem;
    }
}

/* ========== LANDSCAPE MOBILE ========== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: var(--spacing-lg) var(--spacing-sm);
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: var(--spacing-sm);
    }

    .scroll-indicator {
        display: none;
    }
}

/* ========== LARGE SCREENS (1400px 이상) ========== */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }

    .hero-title {
        font-size: 5rem;
    }

    .template-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========== ULTRA WIDE (1920px 이상) ========== */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }

    :root {
        --spacing-2xl: 120px;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    .site-header,
    .site-footer,
    .menu-toggle,
    .btn,
    .search-container,
    .cosmic-bg,
    .stars {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .site-main {
        padding-top: 0;
    }

    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .template-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .cosmic-bg::before {
        animation: none;
    }

    .btn:hover,
    .card:hover,
    .template-card:hover {
        transform: none;
    }
}

/* ========== HIGH CONTRAST MODE ========== */
@media (prefers-contrast: high) {
    :root {
        --border-glass: 1px solid rgba(255, 255, 255, 0.3);
        --text-muted: #c0c0c0;
    }

    .btn-primary {
        background: var(--primary);
        border: 2px solid white;
    }

    .card {
        border-width: 2px;
    }
}

/* ========== DARK MODE PREFERENCE ========== */
@media (prefers-color-scheme: dark) {
    /* Already using dark theme, but can add specific overrides */
}

/* ========== TOUCH DEVICE OPTIMIZATIONS ========== */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
        box-shadow: var(--shadow-glow);
    }

    .card:hover {
        transform: none;
    }

    .template-card:hover {
        transform: none;
    }

    .main-nav a:hover {
        background: none;
    }

    /* Larger touch targets */
    .btn {
        min-height: 48px;
    }

    .main-nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .tag {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }
}
