/**
 * 중등영어인강 - Responsive Stylesheet
 * https://middle.soritune.com/
 *
 * Mobile-first responsive design
 * @version 1.0.0
 */

/* ==========================================================================
   Extra Large Devices (1400px and up)
   ========================================================================== */
@media (min-width: 1400px) {
    :root {
        --container-max: 1400px;
    }

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

    .section-title {
        font-size: var(--text-5xl);
    }
}

/* ==========================================================================
   Large Devices (1200px and up)
   ========================================================================== */
@media (min-width: 1200px) {
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }

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

/* ==========================================================================
   Medium-Large Devices (992px - 1199px)
   ========================================================================== */
@media (max-width: 1199px) {
    :root {
        --header-height: 70px;
    }

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

    .hero-gradient {
        width: 400px;
        height: 400px;
    }

    .hero-gradient-3 {
        width: 600px;
        height: 600px;
    }

    .footer-top {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

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

    .footer-logo {
        justify-content: center;
    }
}

/* ==========================================================================
   Medium Devices (Tablets - 768px - 991px)
   ========================================================================== */
@media (max-width: 991px) {
    /* Header */
    .main-nav {
        display: none;
    }

    .header-actions {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    /* Hero */
    .hero-section {
        min-height: auto;
        padding: var(--space-12) var(--space-4);
    }

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

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

    .hero-stats {
        gap: var(--space-6);
    }

    .hero-stat-value {
        font-size: var(--text-3xl);
    }

    /* Sections */
    .section {
        padding: var(--space-12) var(--space-4);
    }

    .section-header {
        margin-bottom: var(--space-8);
    }

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

    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }

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

    /* Course Cards */
    .course-card-content {
        padding: var(--space-4);
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }

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

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

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

    /* Slider */
    .slider-controls {
        gap: var(--space-3);
    }

    .slider-btn {
        width: 40px;
        height: 40px;
    }

    /* CTA */
    .cta-section {
        padding: var(--space-16) var(--space-4);
    }

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

    /* Utility Grid Overrides */
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

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

/* ==========================================================================
   Small Devices (Landscape Phones - 576px - 767px)
   ========================================================================== */
@media (max-width: 767px) {
    :root {
        --header-height: 60px;
        --space-section: var(--space-10);
    }

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

    h2 {
        font-size: var(--text-2xl);
    }

    h3 {
        font-size: var(--text-xl);
    }

    /* Header */
    .header-inner {
        padding: 0 var(--space-4);
    }

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

    .logo-icon {
        width: 32px;
        height: 32px;
    }

    /* Mobile Navigation */
    .mobile-nav {
        max-width: 100%;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
    }

    .mobile-nav-link {
        font-size: var(--text-base);
        padding: var(--space-3) 0;
    }

    /* Hero */
    .hero-section {
        padding: var(--space-10) var(--space-4);
    }

    .hero-badge {
        padding: var(--space-1) var(--space-3);
        margin-bottom: var(--space-4);
    }

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

    .hero-title {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
        margin-bottom: var(--space-4);
    }

    .hero-subtitle {
        font-size: var(--text-sm);
        margin-bottom: var(--space-6);
    }

    .hero-actions {
        flex-direction: column;
        gap: var(--space-3);
    }

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

    .hero-stats {
        flex-direction: column;
        gap: var(--space-4);
        margin-top: var(--space-8);
    }

    .hero-stat {
        display: flex;
        align-items: center;
        gap: var(--space-3);
    }

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

    /* Features */
    .features-grid {
        grid-template-columns: 1fr;
    }

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

    .card-icon {
        width: 50px;
        height: 50px;
        font-size: var(--text-xl);
    }

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

    /* Course Cards */
    .course-card-title {
        font-size: var(--text-base);
    }

    .course-card-meta {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-item {
        padding: var(--space-4);
    }

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

    /* Testimonials */
    .testimonial-card {
        padding: var(--space-6);
    }

    .testimonial-avatar {
        width: 60px;
        height: 60px;
    }

    .testimonial-content {
        font-size: var(--text-base);
    }

    /* CTA */
    .cta-section {
        padding: var(--space-12) var(--space-4);
    }

    .cta-title {
        font-size: var(--text-xl);
    }

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

    /* Footer */
    .footer-top {
        gap: var(--space-6);
    }

    .footer-links {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-4);
    }

    .footer-heading {
        font-size: var(--text-xs);
        margin-bottom: var(--space-3);
    }

    .footer-menu a {
        font-size: var(--text-xs);
    }

    .footer-bottom {
        padding: var(--space-6) 0;
    }

    .footer-legal {
        flex-wrap: wrap;
        gap: var(--space-3);
    }

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

    .blog-card-content {
        padding: var(--space-4);
    }

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

    /* Form */
    .form-input,
    .form-textarea,
    .form-select {
        padding: var(--space-3);
        font-size: var(--text-sm);
    }

    /* FAQ */
    .faq-question {
        font-size: var(--text-base);
        padding: var(--space-4) 0;
    }

    /* Level Test */
    .level-test-question {
        padding: var(--space-5);
    }

    .level-test-question-text {
        font-size: var(--text-lg);
    }

    .level-test-option {
        padding: var(--space-3);
        font-size: var(--text-sm);
    }

    /* Slider */
    .slider-controls {
        margin-top: var(--space-4);
    }

    .slider-btn {
        width: 36px;
        height: 36px;
    }

    .slider-btn svg {
        width: 16px;
        height: 16px;
    }

    .slider-dot {
        width: 8px;
        height: 8px;
    }

    .slider-dot.active {
        width: 24px;
    }

    /* Scroll to Top */
    .scroll-to-top {
        width: 44px;
        height: 44px;
        bottom: var(--space-4);
        right: var(--space-4);
    }

    /* Utility Grid Overrides */
    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Spacing Overrides */
    .py-20 {
        padding-top: var(--space-12);
        padding-bottom: var(--space-12);
    }

    .py-16 {
        padding-top: var(--space-10);
        padding-bottom: var(--space-10);
    }

    .mt-12 {
        margin-top: var(--space-8);
    }

    .mb-12 {
        margin-bottom: var(--space-8);
    }
}

/* ==========================================================================
   Extra Small Devices (Portrait Phones - below 576px)
   ========================================================================== */
@media (max-width: 575px) {
    :root {
        --header-height: 56px;
    }

    body {
        font-size: 14px;
    }

    /* Header */
    .header-inner {
        padding: 0 var(--space-3);
    }

    .logo-text {
        font-size: var(--text-sm);
    }

    .logo-icon {
        width: 28px;
        height: 28px;
    }

    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
    }

    .hamburger-line {
        width: 20px;
    }

    /* Hero */
    .hero-section {
        padding: var(--space-8) var(--space-3);
    }

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

    .hero-subtitle {
        font-size: var(--text-sm);
        line-height: 1.5;
    }

    .hero-gradient {
        width: 250px;
        height: 250px;
    }

    .hero-gradient-3 {
        width: 350px;
        height: 350px;
    }

    /* Buttons */
    .btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-xs);
    }

    .btn-lg {
        padding: var(--space-3) var(--space-6);
        font-size: var(--text-sm);
    }

    /* Sections */
    .section {
        padding: var(--space-8) var(--space-3);
    }

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

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

    .section-description {
        font-size: var(--text-sm);
    }

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

    .card-icon {
        width: 44px;
        height: 44px;
        font-size: var(--text-lg);
        margin-bottom: var(--space-3);
    }

    .card-title {
        font-size: var(--text-base);
    }

    .card-description {
        font-size: var(--text-xs);
    }

    /* Stats */
    .stat-value {
        font-size: var(--text-2xl);
    }

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

    /* Footer */
    .site-footer {
        padding-top: var(--space-10);
    }

    .footer-inner {
        padding: 0 var(--space-3);
    }

    .footer-links {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-legal {
        flex-direction: column;
        gap: var(--space-2);
    }

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

    .blog-card-title {
        font-size: var(--text-base);
    }

    .blog-card-excerpt {
        font-size: var(--text-xs);
    }

    /* Course Cards */
    .course-card-content {
        padding: var(--space-3);
    }

    .course-card-title {
        font-size: var(--text-sm);
    }

    .course-card-description {
        font-size: var(--text-xs);
    }

    /* Testimonials */
    .testimonial-card {
        padding: var(--space-4);
    }

    .testimonial-avatar {
        width: 50px;
        height: 50px;
    }

    .testimonial-content {
        font-size: var(--text-sm);
    }

    /* CTA */
    .cta-title {
        font-size: var(--text-lg);
    }

    .cta-description {
        font-size: var(--text-sm);
    }

    /* FAQ */
    .faq-question {
        font-size: var(--text-sm);
    }

    .faq-answer-inner {
        font-size: var(--text-sm);
    }

    /* Level Test */
    .level-test-question {
        padding: var(--space-4);
    }

    .level-test-question-text {
        font-size: var(--text-base);
    }

    /* Form */
    .form-group {
        margin-bottom: var(--space-4);
    }

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

    .form-input,
    .form-textarea,
    .form-select {
        padding: var(--space-3);
        font-size: var(--text-sm);
    }

    /* Slider */
    .slider-controls {
        gap: var(--space-2);
    }

    .slider-btn {
        width: 32px;
        height: 32px;
    }

    .slider-btn svg {
        width: 14px;
        height: 14px;
    }

    .slider-dot {
        width: 6px;
        height: 6px;
    }

    .slider-dot.active {
        width: 20px;
    }

    /* Scroll to Top */
    .scroll-to-top {
        width: 40px;
        height: 40px;
    }

    .scroll-to-top svg {
        width: 20px;
        height: 20px;
    }
}

/* ==========================================================================
   Very Small Devices (below 360px)
   ========================================================================== */
@media (max-width: 359px) {
    .hero-title {
        font-size: 1.25rem;
    }

    .logo-text {
        display: none;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
    }

    .btn {
        padding: var(--space-2) var(--space-3);
        font-size: 11px;
    }

    .section-title {
        font-size: var(--text-xl);
    }

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

/* ==========================================================================
   Height-based Media Queries
   ========================================================================== */
@media (max-height: 700px) {
    .hero-section {
        min-height: auto;
        padding-top: var(--space-8);
        padding-bottom: var(--space-8);
    }

    .hero-stats {
        margin-top: var(--space-6);
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding-top: var(--space-4);
        padding-bottom: var(--space-4);
    }

    .hero-title {
        font-size: 1.5rem;
        margin-bottom: var(--space-2);
    }

    .hero-subtitle {
        margin-bottom: var(--space-3);
    }

    .hero-actions {
        flex-direction: row;
    }

    .hero-stats {
        display: none;
    }
}

/* ==========================================================================
   Dark Mode Preference (System)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    /* Already dark by default, no changes needed */
}

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

    .hero-gradient {
        animation: none;
    }

    #antigravity-canvas {
        display: none;
    }

    .slider-wrapper {
        transition: none;
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */
@media (prefers-contrast: high) {
    :root {
        --bg-glass: rgba(255, 255, 255, 0.15);
        --text-secondary: #d0d0e0;
        --text-muted: #b0b0c0;
    }

    .btn {
        border-width: 3px;
    }

    .nav-link::after {
        height: 3px;
    }

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

/* ==========================================================================
   Print Overrides
   ========================================================================== */
@media print {
    * {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }

    abbr[title]::after {
        content: " (" attr(title) ")";
    }

    .site-header,
    .site-footer,
    .mobile-nav,
    .scroll-to-top,
    #antigravity-canvas,
    .hero-gradient,
    .slider-controls {
        display: none !important;
    }

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

    .hero-section {
        min-height: auto;
        padding: 2cm 0;
    }

    .section {
        padding: 1cm 0;
        page-break-inside: avoid;
    }

    .card,
    .course-card,
    .blog-card,
    .testimonial-card {
        page-break-inside: avoid;
        border: 1px solid #ccc;
    }

    img {
        max-width: 100% !important;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
}

/* ==========================================================================
   Touch Device Optimizations
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-link {
        padding: var(--space-3) var(--space-4);
    }

    .btn {
        min-height: 44px;
    }

    .slider-btn {
        width: 48px;
        height: 48px;
    }

    .slider-dot {
        width: 12px;
        height: 12px;
    }

    .slider-dot.active {
        width: 32px;
    }

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

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

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

    .btn:hover {
        transform: none;
    }

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

    .btn:active {
        transform: scale(0.95);
    }
}

/* ==========================================================================
   Landscape Tablet Specific
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: var(--space-8) var(--space-6);
    }

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

    .hero-stats {
        gap: var(--space-8);
    }

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

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

    .card-icon {
        width: 40px;
        height: 40px;
    }
}

/* ==========================================================================
   iPad Pro Specific (1024px - 1366px)
   ========================================================================== */
@media (min-width: 1024px) and (max-width: 1366px) {
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--space-4);
    }

    .footer-top {
        grid-template-columns: 1fr 2fr;
    }
}

/* ==========================================================================
   Retina / High DPI Displays
   ========================================================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders */
    .card,
    .course-card,
    .blog-card {
        border-width: 0.5px;
    }

    /* Sharper text rendering */
    body {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* ==========================================================================
   Safe Area Insets (Notched Devices)
   ========================================================================== */
@supports (padding: max(0px)) {
    .site-header {
        padding-left: max(var(--space-6), env(safe-area-inset-left));
        padding-right: max(var(--space-6), env(safe-area-inset-right));
    }

    .header-inner {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
    }

    .mobile-nav {
        padding-bottom: max(var(--space-6), env(safe-area-inset-bottom));
    }

    .site-footer {
        padding-bottom: max(var(--space-8), env(safe-area-inset-bottom));
    }

    .scroll-to-top {
        bottom: max(var(--space-6), calc(env(safe-area-inset-bottom) + var(--space-4)));
        right: max(var(--space-6), calc(env(safe-area-inset-right) + var(--space-4)));
    }
}
