/**
 * 알파벳 단어 (Alphabet Word) - Responsive Styles
 * Mobile-first responsive design breakpoints
 * Version: 1.0.0
 */

/* ============================================
   BREAKPOINT REFERENCE
   - Mobile: < 640px
   - Tablet: 640px - 1023px
   - Desktop: >= 1024px
   - Wide: >= 1280px
   ============================================ */

/* ============================================
   TABLET LANDSCAPE & SMALL DESKTOP (1024px - 1279px)
   ============================================ */
@media (max-width: 1279px) {
    :root {
        --font-size-5xl: 2.5rem;
        --font-size-6xl: 3rem;
    }

    .container {
        max-width: 100%;
    }

    .footer-grid {
        grid-template-columns: 1.5fr repeat(3, 1fr);
        gap: var(--space-xl);
    }

    .hero-title {
        font-size: var(--font-size-4xl);
    }
}

/* ============================================
   TABLET (768px - 1023px)
   ============================================ */
@media (max-width: 1023px) {
    :root {
        --header-height: 64px;
        --font-size-4xl: 2rem;
        --font-size-5xl: 2.25rem;
    }

    /* Header Navigation */
    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--bg-primary);
        padding: var(--space-lg);
        gap: var(--space-xs);
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform var(--transition-base);
        z-index: var(--z-fixed);
    }

    .main-nav.active {
        transform: translateX(0);
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        width: 100%;
        padding: var(--space-md);
        font-size: var(--font-size-base);
        justify-content: space-between;
        border-radius: var(--radius-lg);
        background: var(--bg-secondary);
    }

    .dropdown-menu {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0;
        margin-top: var(--space-xs);
        max-height: 0;
        overflow: hidden;
        transition: max-height var(--transition-base);
    }

    .nav-item.open .dropdown-menu {
        max-height: 500px;
    }

    .dropdown-item {
        padding: var(--space-sm) var(--space-lg);
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hero */
    .hero {
        min-height: auto;
        padding: calc(var(--header-height) + var(--space-3xl)) var(--space-lg) var(--space-3xl);
    }

    .hero-title {
        font-size: var(--font-size-3xl);
    }

    .hero-description {
        font-size: var(--font-size-lg);
    }

    /* Slider */
    .slide-content {
        flex-direction: column;
        text-align: center;
        padding: var(--space-2xl);
        min-height: auto;
    }

    .slide-text {
        max-width: 100%;
    }

    .slide-image {
        max-width: 300px;
        order: -1;
    }

    .slider-arrow {
        width: 40px;
        height: 40px;
        font-size: var(--font-size-base);
    }

    /* Game */
    .game-board {
        padding: var(--space-xl);
    }

    .game-stats {
        flex-wrap: wrap;
        gap: var(--space-lg);
    }

    .stat-item {
        flex: 1 1 calc(50% - var(--space-lg));
        min-width: 100px;
    }

    .letter-tile {
        width: 50px;
        height: 50px;
        font-size: var(--font-size-xl);
    }

    .answer-letter {
        width: 45px;
        height: 45px;
        font-size: var(--font-size-lg);
    }

    /* Blog */
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xl);
    }

    .footer-brand {
        grid-column: span 2;
        max-width: 100%;
        text-align: center;
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
}

/* ============================================
   MOBILE LANDSCAPE & SMALL TABLET (640px - 767px)
   ============================================ */
@media (max-width: 767px) {
    :root {
        --font-size-3xl: 1.5rem;
        --font-size-4xl: 1.75rem;
        --space-2xl: 2rem;
        --space-3xl: 2.5rem;
        --space-4xl: 3rem;
    }

    .container {
        padding: 0 var(--space-md);
    }

    /* Sections */
    .section {
        padding: var(--space-2xl) 0;
    }

    /* Typography */
    h1 { font-size: var(--font-size-3xl); }
    h2 { font-size: var(--font-size-2xl); }
    h3 { font-size: var(--font-size-xl); }

    /* Hero */
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    /* Slider */
    .slide-content {
        padding: var(--space-xl);
    }

    .slide-title {
        font-size: var(--font-size-2xl);
    }

    .slide-description {
        font-size: var(--font-size-base);
    }

    .slider-controls {
        bottom: var(--space-md);
    }

    /* Blog */
    .blog-grid {
        grid-template-columns: 1fr;
    }

    /* Word Grid */
    .word-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }

    .word-card {
        padding: var(--space-md);
    }

    .word-english {
        font-size: var(--font-size-xl);
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-brand {
        grid-column: 1;
    }

    .footer-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--space-md);
    }

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

/* ============================================
   MOBILE PORTRAIT (< 640px)
   ============================================ */
@media (max-width: 639px) {
    :root {
        --header-height: 56px;
        --font-size-2xl: 1.25rem;
        --font-size-3xl: 1.375rem;
    }

    /* Header */
    .logo-text {
        font-size: var(--font-size-base);
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: var(--font-size-base);
    }

    .header-actions .btn {
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--font-size-xs);
    }

    /* Hero */
    .hero {
        padding: calc(var(--header-height) + var(--space-xl)) var(--space-md) var(--space-xl);
    }

    .hero-badge {
        font-size: var(--font-size-xs);
    }

    .hero-title {
        font-size: var(--font-size-2xl);
    }

    .hero-description {
        font-size: var(--font-size-base);
    }

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

    /* Game */
    .game-board {
        padding: var(--space-md);
        border-radius: var(--radius-xl);
    }

    .game-stats {
        gap: var(--space-sm);
    }

    .stat-value {
        font-size: var(--font-size-2xl);
    }

    .stat-label {
        font-size: var(--font-size-xs);
    }

    .letter-tiles {
        gap: var(--space-xs);
    }

    .letter-tile {
        width: 44px;
        height: 44px;
        font-size: var(--font-size-lg);
        border-radius: var(--radius-md);
    }

    .answer-display {
        padding: var(--space-sm);
        min-height: 60px;
    }

    .answer-letter {
        width: 36px;
        height: 36px;
        font-size: var(--font-size-base);
    }

    .game-controls {
        flex-direction: column;
    }

    .game-controls .btn {
        width: 100%;
    }

    /* Word Grid */
    .word-grid {
        grid-template-columns: 1fr;
    }

    /* Blog Card */
    .blog-content {
        padding: var(--space-md);
    }

    .blog-title {
        font-size: var(--font-size-lg);
    }

    .blog-meta {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    /* Buttons */
    .btn-lg {
        padding: var(--space-sm) var(--space-lg);
        font-size: var(--font-size-sm);
    }

    .btn-xl {
        padding: var(--space-md) var(--space-xl);
        font-size: var(--font-size-base);
    }

    /* Slider */
    .slide-content {
        padding: var(--space-lg);
    }

    .slide-image {
        max-width: 200px;
    }

    .slider-arrow {
        width: 36px;
        height: 36px;
        font-size: var(--font-size-sm);
    }

    .slider-arrow.prev {
        left: var(--space-sm);
    }

    .slider-arrow.next {
        right: var(--space-sm);
    }

    /* Footer */
    .site-footer {
        padding: var(--space-2xl) 0 var(--space-lg);
    }

    .footer-title {
        margin-bottom: var(--space-md);
    }
}

/* ============================================
   VERY SMALL SCREENS (< 360px)
   ============================================ */
@media (max-width: 359px) {
    :root {
        --font-size-base: 0.875rem;
    }

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

    .letter-tile {
        width: 38px;
        height: 38px;
        font-size: var(--font-size-base);
    }

    .answer-letter {
        width: 32px;
        height: 32px;
        font-size: var(--font-size-sm);
    }
}

/* ============================================
   LANDSCAPE ORIENTATION ADJUSTMENTS
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding-top: calc(var(--header-height) + var(--space-lg));
        padding-bottom: var(--space-lg);
    }

    .loading-screen {
        flex-direction: row;
        gap: var(--space-lg);
    }

    .game-board {
        padding: var(--space-md);
    }

    .game-stats {
        margin-bottom: var(--space-md);
    }

    .letter-tiles {
        margin: var(--space-md) 0;
    }
}

/* ============================================
   HIGH DPI / RETINA DISPLAYS
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure sharp rendering on retina displays */
    .logo-icon,
    .letter-tile,
    .answer-letter {
        -webkit-font-smoothing: antialiased;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@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;
    }

    .loading-spinner {
        animation: none;
    }

    .slider-track {
        transition: none;
    }
}

/* ============================================
   DARK MODE PREFERENCE
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-muted: #6b7280;
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
        --bg-tertiary: #374151;
        --bg-card: #1f2937;
        --border-light: #374151;
        --border-medium: #4b5563;
    }

    :root:not([data-theme="light"]) .site-header {
        background: rgba(17, 24, 39, 0.95);
    }

    :root:not([data-theme="light"]) .nav-link:hover,
    :root:not([data-theme="light"]) .nav-link.active {
        background: rgba(102, 126, 234, 0.2);
    }

    :root:not([data-theme="light"]) .dropdown-menu {
        background: #1f2937;
        border-color: #374151;
    }

    :root:not([data-theme="light"]) .hamburger span {
        background: #f9fafb;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .site-header,
    .site-footer,
    .mobile-menu-toggle,
    .slider-section,
    .loading-screen,
    .btn,
    .game-controls,
    #antigravity-canvas {
        display: none !important;
    }

    main {
        padding-top: 0 !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .hero {
        background: none !important;
        color: black !important;
        min-height: auto !important;
        padding: var(--space-lg) 0 !important;
    }

    .hero-title,
    .hero-description {
        color: black !important;
        -webkit-text-fill-color: black !important;
    }

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

    .card,
    .word-card,
    .blog-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }

    .word-grid,
    .blog-grid {
        gap: var(--space-sm) !important;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .nav-link,
    .dropdown-item,
    .btn {
        min-height: 44px;
    }

    .letter-tile {
        min-width: 48px;
        min-height: 48px;
    }

    /* Remove hover effects that don't work well on touch */
    .card:hover,
    .word-card:hover,
    .blog-card:hover {
        transform: none;
    }

    .btn-primary:hover {
        transform: none;
    }

    /* Active states for touch feedback */
    .btn:active {
        transform: scale(0.98);
    }

    .letter-tile:active {
        transform: scale(0.95);
    }

    .card:active,
    .word-card:active {
        transform: scale(0.99);
    }
}

/* ============================================
   FOCUS STYLES FOR ACCESSIBILITY
   ============================================ */
@media (pointer: fine) {
    a:focus-visible,
    button:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

    .letter-tile:focus-visible {
        outline: 3px solid white;
        outline-offset: 2px;
    }
}
