/* ===== RESPONSIVE DESIGN ===== */

/* Extra Large Devices (Large Desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .hero-title .title-chinese {
        font-size: 4rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
}

/* Large Devices (Desktops, 992px and up) */
@media (max-width: 1199.98px) {
    .container {
        max-width: 1140px;
    }
    
    .definition-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .nav-menu {
        gap: 1.5rem;
    }
}

/* Medium Devices (Tablets, 768px and up) */
@media (max-width: 991.98px) {
    .container {
        max-width: 720px;
    }
    
    .hero-title .title-chinese {
        font-size: 3rem;
    }
    
    .hero-title .title-english {
        font-size: 1rem;
        letter-spacing: 2px;
    }
    
    .mission-text {
        font-size: 1.3rem;
    }
    
    .section-title {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .title-number {
        font-size: 1rem;
    }
    
    .platform-grid {
        grid-template-columns: 1fr;
    }
    
    .tasks-grid {
        grid-template-columns: 1fr;
    }
    
    .requirements-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }
    
    .dev-grid {
        grid-template-columns: 1fr;
    }
    
    .centers-grid {
        grid-template-columns: 1fr;
    }
    
    .sections-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .programs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Small Devices (Landscape Phones, 576px and up) */
@media (max-width: 767.98px) {
    .container {
        max-width: 540px;
        padding: 0 15px;
    }
    
    /* Navigation Mobile */
    .hamburger {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 3rem;
        transition: var(--transition-smooth);
        gap: 2rem;
        box-shadow: var(--shadow-medium);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-link {
        font-size: 1.1rem;
        padding: 1rem 0;
    }
    
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active .bar:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    
    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
    
    /* Hero Section Mobile */
    .hero {
        height: 100vh;
        padding-top: 80px;
    }

    .hero-title .title-chinese {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero-title .title-english {
        font-size: 0.9rem;
        letter-spacing: 1px;
    }
    
    .mission-text {
        font-size: 1.2rem;
        letter-spacing: 1px;
    }
    
    .mission-subtitle {
        font-size: 1rem;
    }
    
    .hero-tags {
        gap: 0.5rem;
    }
    
    .tag {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }
    
    .hero-cta {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .btn-primary, .btn-secondary {
        width: 80%;
        max-width: 250px;
    }
    
    /* Section Spacing */
    .section {
        padding: 60px 0;
    }
    
    .section-header {
        margin-bottom: 2rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    /* Cards and Grids Mobile */
    .definition-card,
    .platform-item,
    .task-item,
    .requirement-card,
    .activity-card,
    .dev-card,
    .center-card,
    .section-card,
    .program-item {
        padding: 1.5rem;
    }
    
    .activity-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .activity-card {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem;
    }
    
    .activity-images {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: space-between;
    }
    
    .activity-image,
    .image-placeholder {
        width: calc(33.333% - 0.4rem);
        height: 80px;
    }
    
    .image-placeholder {
        font-size: 0.8rem;
    }
}

@media (max-width: 575.98px) {
    .requirements-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
}

@media (max-width: 640px) {
    .county-program {
        flex-direction: column;
    }

    .county-program .program-item {
        flex: 1 1 100%;
    }
}

    .image-placeholder {
        font-size: 0.8rem;
    }

    .sections-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .programs-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.8rem;
    }
    
    .program-card {
        padding: 1rem;
    }
    
    .program-card i {
        font-size: 1.5rem;
    }
    
    /* Typography Mobile */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.8rem; }
    h3 { font-size: 1.4rem; }
    h4 { font-size: 1.2rem; }
    
    .card-icon {
        font-size: 2rem;
    }
    
    .platform-number {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    /* Contact Mobile */
    .contact-card {
        padding: 1.5rem;
        margin: 0 1rem;
    }
    
    .contact-header h3 {
        font-size: 1.2rem;
        line-height: 1.4;
    }
    
    .contact-header h4 {
        font-size: 0.9rem;
    }
    
    /* Footer Mobile */
    .footer {
        padding: 1.5rem 0 1rem;
    }
    
    .footer-logo .logo-text {
        font-size: 1.3rem;
    }
    
    .footer-mission p {
        font-size: 1rem;
    }
}

/* Extra Small Devices (Portrait Phones, less than 576px) */
@media (max-width: 575.98px) {
    .container {
        padding: 0 10px;
    }
    
    /* Navigation Extra Small */
    .nav-container {
        padding: 0.8rem 10px;
    }
    
    .logo-text {
        font-size: 1.2rem;
    }
    
    .logo-image {
        width: 50px;
        height: 50px;
    }
    
    .nav-logo {
        gap: 0.5rem;
    }
    
    .logo-subtitle {
        font-size: 0.7rem;
    }
    
    .logo-image {
        width: 45px;
        height: 45px;
    }
    
    .nav-logo {
        gap: 0.4rem;
    }
    
    .nav-menu {
        top: 70px;
        height: calc(100vh - 70px);
        padding-top: 2rem;
        gap: 1.5rem;
    }
    
    /* Hero Extra Small */
    .hero {
        padding-top: 70px;
    }
    
    .hero-bg-layer {
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }
    
    .hero-bg-image {
        min-width: 100%;
        min-height: 100%;
        object-fit: cover;
        object-position: center;
    }
    
    .hero-title .title-chinese {
        font-size: 2rem;
        line-height: 1.1;
    }
    
    .hero-title .title-english {
        font-size: 0.8rem;
        letter-spacing: 0.5px;
    }
    
    .mission-text {
        font-size: 1.1rem;
        letter-spacing: 0.5px;
    }
    
    .mission-subtitle {
        font-size: 0.95rem;
        line-height: 1.4;
    }
    
    .hero-features {
        gap: 0.6rem;
    }
    
    .feature-item {
        font-size: 0.8rem;
        padding: 0.6rem 1.2rem;
        max-width: 320px;
    }
    
    /* Section Spacing Extra Small */
    .section {
        padding: 40px 0;
    }
    
    .section-header {
        margin-bottom: 1.5rem;
    }
    
    .section-title {
        font-size: 1.3rem;
        text-align: center;
    }
    
    .title-number {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    /* Cards Extra Small */
    .definition-card,
    .platform-item,
    .task-item,
    .requirement-card,
    .activity-card,
    .dev-card,
    .center-card,
    .section-card,
    .program-item {
        padding: 1rem;
    }
    
    .activity-images {
        gap: 0.6rem;
        flex-wrap: wrap;
    }
    
    .activity-image,
    .image-placeholder {
        flex: 1;
        height: 100px;
        min-width: calc(33.333% - 0.4rem);
    }
    
    .image-placeholder {
        font-size: 0.8rem;
    }
    
    .activity-card h4 {
        font-size: 1.1rem;
    }
    
    .activity-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .activity-location {
        font-size: 0.9rem;
    }
    
    .task-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .task-item span {
        font-size: 0.9rem;
    }
    
    .programs-grid {
        grid-template-columns: 1fr;
    }
    
    .program-card {
        padding: 0.8rem;
    }
    
    /* Typography Extra Small */
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.6rem; }
    h3 { font-size: 1.3rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    
    p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    .intro-text {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .venue-info p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    /* Contact Extra Small */
    .contact-card {
        margin: 0 0.5rem;
        padding: 1rem;
    }
    
    .contact-header h3 {
        font-size: 1.1rem;
        line-height: 1.3;
    }
    
    .contact-header h4 {
        font-size: 0.8rem;
        margin-bottom: 1.5rem;
    }
    
    .contact-item {
        font-size: 0.9rem;
    }
    
    .qr-placeholder {
        padding: 1.5rem;
    }
    
    .qr-placeholder i {
        font-size: 2.5rem;
    }
    
    /* Button Adjustments */
    .btn-primary, .btn-secondary {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
        width: 90%;
        max-width: 200px;
    }
}

/* Landscape Phone Adjustments */
@media (max-width: 767.98px) and (orientation: landscape) {
    .hero {
        height: auto;
        min-height: 100vh;
        padding: 100px 0 50px;
    }
    
    .hero-bg-layer {
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }
    
    .hero-bg-image {
        min-width: 100%;
        min-height: 100%;
        object-fit: cover;
        object-position: center;
    }
    
    .hero-content {
        padding: 2rem 0;
    }
    
    .hero-title .title-chinese {
        font-size: 2.2rem;
    }
    
    .mission-text {
        font-size: 1.1rem;
    }
    
    .section {
        padding: 50px 0;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-pattern {
        background-size: 25px 25px;
    }
    
    .traditional-pattern::before {
        background-image: 
            repeating-linear-gradient(
                45deg,
                transparent,
                transparent 5px,
                rgba(114, 47, 55, 0.02) 5px,
                rgba(114, 47, 55, 0.02) 10px
            );
    }
}

/* Print Styles */
@media print {
    .navbar,
    .hamburger,
    .scroll-indicator,
    .hero-cta {
        display: none;
    }
    
    .hero {
        height: auto;
        padding: 2rem 0;
        background: white;
    }
    
    .hero-pattern,
    .hero-overlay,
    .hero-bg-layer {
        display: none;
    }
    
    .section {
        padding: 1rem 0;
        break-inside: avoid;
    }
    
    .definition-card,
    .activity-card,
    .dev-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    * {
        color: black !important;
        background: white !important;
    }
}

/* Reduced Motion Preferences */
@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;
    }
    
    .scroll-indicator {
        animation: none;
    }
    
    .fade-in,
    .slide-left,
    .slide-right {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Focus Styles for Accessibility */
@media (min-width: 768px) {
    .nav-link:focus,
    .btn-primary:focus,
    .btn-secondary:focus {
        outline: 3px solid var(--accent-gold);
        outline-offset: 2px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .nav-link:hover::after {
        width: 0;
    }
    
    .nav-link:active::after {
        width: 100%;
    }
    
    .definition-card:hover,
    .platform-item:hover,
    .task-item:hover,
    .requirement-card:hover,
    .activity-card:hover,
    .dev-card:hover,
    .center-card:hover,
    .section-card:hover,
    .program-card:hover {
        transform: none;
        box-shadow: var(--shadow-light);
    }
    
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none;
    }
    
    .btn-primary:active {
        transform: scale(0.98);
    }
    
    .btn-secondary:active {
        background: var(--primary-burgundy);
        color: var(--white);
    }
}

/* Dark Mode Support (if system preference) */
@media (prefers-color-scheme: dark) {
    /* Note: This website maintains its traditional Chinese aesthetic 
       regardless of system dark mode preference */
}

/* Animation Performance Optimization */
@media (max-width: 767.98px) {
    .fade-in,
    .slide-left,
    .slide-right {
        transition-duration: 0.3s;
    }
    
    .definition-card,
    .platform-item,
    .activity-card,
    .section-card {
        transition-duration: 0.2s;
    }
}

@media (min-width: 1025px) {
    .sections-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
/* Tablet Specific Adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .hero-cta {
        gap: 1rem;
    }
    
    .platform-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tasks-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sections-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .programs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .centers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 767.98px) {
    .programs-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: auto;
    }
}
@media (max-width: 575.98px) {
    .programs-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
}

/* Large Tablet Landscape */
@media (min-width: 1024px) and (max-width: 1199px) and (orientation: landscape) {
    .hero-title .title-chinese {
        font-size: 3.5rem;
    }
    
    .definition-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Very Small Screens (less than 350px) */
@media (max-width: 349px) {
    .container {
        padding: 0 5px;
    }
    
    .hero-title .title-chinese {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 1.2rem;
    }
    
    .title-number {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .nav-container {
        padding: 0.5rem 5px;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
}
