/* ================================
   Responsive Design
   Mobile-first approach
   ================================ */

/* Tablet and below (max-width: 1024px) */
@media screen and (max-width: 1024px) {
    /* Container */
    .container {
        padding: 0 var(--space-md);
    }
    
    /* Hero */
    .hero-title {
        font-size: 48px;
    }
    
    .hero-description {
        font-size: 18px;
    }
    
    .hero-stats {
        gap: var(--space-xl);
    }
    
    .stat-number {
        font-size: 36px;
    }
    
    /* About */
    .about-card {
        flex-direction: column;
        text-align: center;
    }
    
    .about-image {
        margin: 0 auto;
    }
    
    /* Services */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }
    
    /* Portfolio */
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }
    
    /* Contact */
    .alternative-buttons {
        grid-template-columns: 1fr;
    }
    
    .trust-indicators {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-xl);
    }
}

/* Mobile (max-width: 768px) */
@media screen and (max-width: 768px) {
    /* Typography */
    h1 {
        font-size: 36px;
    }
    
    h2 {
        font-size: 28px;
    }
    
    h3 {
        font-size: 20px;
    }
    
    /* Section */
    .section {
        padding: var(--space-xxl) 0;
    }
    
    .section-title {
        font-size: 28px;
    }
    
    .section-subtitle {
        font-size: 16px;
    }
    
    /* Navigation */
    .nav-menu {
        position: fixed;
        top: 64px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 64px);
        background: var(--color-white);
        flex-direction: column;
        padding: var(--space-xl);
        gap: var(--space-md);
        transition: var(--transition-base);
        box-shadow: var(--shadow-overlay);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-link {
        display: block;
        padding: var(--space-md);
        border-radius: var(--radius-md);
        font-size: 18px;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
    
    /* Hero */
    .hero {
        padding-top: calc(64px + var(--space-xxl));
        min-height: auto;
    }
    
    .hero-content {
        padding: var(--space-xl);
        margin: 0 var(--space-md);
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .hero-description {
        font-size: 16px;
    }
    
    .hero-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: var(--space-lg);
    }
    
    /* About */
    .avatar-placeholder {
        width: 150px;
        height: 150px;
        font-size: 48px;
    }
    
    .about-name {
        font-size: 24px;
    }
    
    .skills-grid {
        justify-content: center;
    }
    
    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    /* Portfolio */
    .portfolio-filter {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-btn {
        width: 100%;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    
    /* CTA */
    .cta-title {
        font-size: 28px;
    }
    
    .cta-description {
        font-size: 16px;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    /* Back to Top */
    .back-to-top {
        bottom: var(--space-lg);
        right: var(--space-lg);
        width: 40px;
        height: 40px;
    }
}

/* Small Mobile (max-width: 480px) */
@media screen and (max-width: 480px) {
    /* Typography */
    h1 {
        font-size: 28px;
    }
    
    h2 {
        font-size: 24px;
    }
    
    h3 {
        font-size: 18px;
    }
    
    body {
        font-size: 14px;
    }
    
    /* Container */
    .container {
        padding: 0 var(--space-sm);
    }
    
    /* Section */
    .section {
        padding: var(--space-xl) 0;
    }
    
    /* Hero */
    .hero-title {
        font-size: 28px;
    }
    
    .hero-badge {
        font-size: 12px;
        padding: var(--space-xs) var(--space-md);
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    /* About */
    .about-card {
        padding: var(--space-lg);
    }
    
    .avatar-placeholder {
        width: 120px;
        height: 120px;
        font-size: 36px;
    }
    
    .about-name {
        font-size: 20px;
    }
    
    .about-title {
        font-size: 16px;
    }
    
    .skill-tag {
        font-size: 12px;
        padding: var(--space-xs) var(--space-sm);
    }
    
    /* Services */
    .service-card {
        padding: var(--space-lg);
    }
    
    .service-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
    
    .service-title {
        font-size: 18px;
    }
    
    /* Portfolio */
    .portfolio-card {
        border-radius: var(--radius-md);
    }
    
    .portfolio-image {
        height: 150px;
    }
    
    .portfolio-overlay {
        font-size: 36px;
    }
    
    .portfolio-content {
        padding: var(--space-md);
    }
    
    .portfolio-title {
        font-size: 18px;
    }
    
    .portfolio-description {
        font-size: 14px;
    }
    
    /* Contact */
    .cta-benefits {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .cta-headline {
        font-size: 24px;
    }
    
    .cta-subtext {
        font-size: 16px;
    }
    
    .trust-indicators {
        grid-template-columns: 1fr;
        padding: var(--space-lg);
    }
    
    .contact-cta-primary {
        padding: var(--space-lg);
    }
    
    /* Buttons */
    .btn {
        padding: var(--space-sm) var(--space-lg);
        font-size: 14px;
    }
    
    .btn-large {
        padding: var(--space-md) var(--space-xl);
        font-size: 16px;
    }
    
    /* Social Links */
    .social-link {
        width: 40px;
        height: 40px;
    }
    
    .contact-item i {
        width: 40px;
        height: 40px;
    }
}

/* Landscape Mobile (max-height: 600px and orientation: landscape) */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding-top: calc(64px + var(--space-xl));
        padding-bottom: var(--space-xl);
    }
    
    .hero-title {
        font-size: 32px;
    }
    
    .hero-stats {
        display: none;
    }
}

/* Print Styles */
@media print {
    /* Hide unnecessary elements */
    .navbar,
    .hero-actions,
    .back-to-top,
    .mobile-menu-toggle,
    .portfolio-filter,
    .contact-form,
    .social-links {
        display: none !important;
    }
    
    /* Optimize for print */
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1 {
        font-size: 24pt;
    }
    
    h2 {
        font-size: 18pt;
    }
    
    h3 {
        font-size: 14pt;
    }
    
    .section {
        page-break-inside: avoid;
        padding: 20px 0;
    }
    
    .portfolio-card,
    .service-card {
        page-break-inside: avoid;
    }
    
    /* Ensure links are visible */
    a:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
    
    /* Reset colors for print */
    * {
        color: #000 !important;
        background: #fff !important;
    }
}

/* High Resolution Displays */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    /* Optimize borders for retina */
    .service-card,
    .portfolio-card,
    .about-card,
    .contact-form {
        border-width: 0.5px;
    }
}

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

/* Dark Mode Support (Optional - for future enhancement) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here if needed */
}

/* Before After Section */
.before-after {
    display: flex;
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

.comparison-card {
    flex: 1;
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
}

.comparison-card.before {
    background: #FFF4F4;
    border-color: #FFB3B3;
}

.comparison-card.after {
    background: #F0F9F0;
    border-color: #90EE90;
}

.comparison-card h4 {
    margin-bottom: var(--space-md);
    font-size: 16px;
}

.comparison-card ul {
    list-style: none;
    padding: 0;
}

.comparison-card li {
    padding: var(--space-xs) 0;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.comparison-card.before li:before {
    content: "×";
    color: #e74c3c;
    font-weight: bold;
    margin-right: var(--space-sm);
}

.comparison-card.after li:before {
    content: "✓";
    color: #27ae60;
    font-weight: bold;
    margin-right: var(--space-sm);
}

/* Mobile対応 */
@media screen and (max-width: 768px) {
    .before-after {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .comparison-card {
        padding: var(--space-md);
    }
    
    .comparison-card h4 {
        font-size: 14px;
        margin-bottom: var(--space-sm);
    }
    
    .comparison-card li {
        font-size: 13px;
        padding: var(--space-xs) 0;
    }
}

@media screen and (max-width: 480px) {
    .comparison-card {
        padding: var(--space-sm);
    }
    
    .comparison-card h4 {
        font-size: 12px;
    }
    
    .comparison-card li {
        font-size: 12px;
    }
}