/* ============================================
   港公認会計士税理士事務所 - Responsive Styles
   ============================================ */

/* ============================================
   Large Desktop (1200px and above)
   ============================================ */

@media (min-width: 1200px) {
    .hero-content h1 {
        font-size: 3rem;
    }
    
    .hero-container {
        gap: 4rem;
    }
}

/* ============================================
   Desktop (1024px - 1199px)
   ============================================ */

@media (max-width: 1199px) {
    :root {
        --container-padding: 1.5rem;
    }
    
    .hero-content h1 {
        font-size: 2.25rem;
    }
    
    .footer-grid {
        grid-template-columns: 1.5fr 1fr 1fr 1fr;
    }
}

/* ============================================
   Tablet Landscape (768px - 1023px)
   ============================================ */

@media (max-width: 1023px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-features {
        justify-content: center;
    }
    
    .hero-image {
        order: -1;
    }
    
    .hero-image img {
        max-height: 300px;
    }
    
    .lead-form-container {
        grid-template-columns: 1fr;
    }
    
    .lead-form-content {
        text-align: center;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
    }
    
    .about-content {
        grid-template-columns: 1fr;
    }
    
    .about-image {
        order: -1;
    }
    
    .service-detail {
        grid-template-columns: 1fr;
    }
    
    .service-detail:nth-child(even) {
        direction: ltr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-xl);
    }
}

/* ============================================
   Tablet Portrait (768px - 1023px)
   ============================================ */

@media (max-width: 768px) {
    :root {
        --spacing-xxl: 2rem;
    }
    
    /* Navigation */
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: var(--spacing-lg);
        gap: var(--spacing-md);
        box-shadow: var(--shadow-md);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-link {
        padding: var(--spacing-sm) var(--spacing-md);
        width: 100%;
        text-align: center;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    /* Hero */
    .hero {
        padding: 6rem 0 3rem;
    }
    
    .hero-content h1 {
        font-size: 1.75rem;
    }
    
    .hero-features {
        flex-direction: column;
        align-items: center;
    }
    
    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-links ul {
        align-items: center;
    }
    
    .footer-contact p {
        justify-content: center;
    }
    
    /* Forms */
    .lead-form {
        padding: var(--spacing-lg);
    }
    
    /* Legal Content */
    .legal-content {
        padding: var(--spacing-xl) var(--spacing-md);
    }
}

/* ============================================
   Mobile (480px - 767px)
   ============================================ */

@media (max-width: 767px) {
    :root {
        --font-size-base: 15px;
        --container-padding: 1rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* Header */
    .header-container {
        padding: var(--spacing-sm) var(--container-padding);
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    .logo-text span {
        font-size: 0.7rem;
    }
    
    /* Hero */
    .hero {
        padding: 5rem 0 2rem;
    }
    
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .hero-image img {
        max-height: 250px;
    }
    
    /* Buttons */
    .btn {
        padding: var(--spacing-sm) var(--spacing-lg);
        font-size: 0.95rem;
    }
    
    .btn-lg {
        padding: var(--spacing-md) var(--spacing-xl);
        font-size: 1rem;
    }
    
    /* Cards */
    .service-card {
        padding: var(--spacing-lg);
    }
    
    .service-icon {
        width: 60px;
        height: 60px;
    }
    
    .service-icon svg {
        width: 30px;
        height: 30px;
    }
    
    /* Contact */
    .contact-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .map-container {
        height: 250px;
    }
    
    /* Page Header */
    .page-header {
        padding: 5rem 0 2rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .page-header p {
        font-size: 1rem;
    }
    
    /* Breadcrumbs */
    .breadcrumbs ul {
        flex-wrap: wrap;
        font-size: 0.85rem;
    }
    
    /* Footer */
    .footer {
        padding: var(--spacing-xl) 0 var(--spacing-md);
    }
    
    .footer-disclaimer {
        font-size: 0.8rem;
    }
    
    .footer-copyright {
        font-size: 0.85rem;
    }
}

/* ============================================
   Small Mobile (below 480px)
   ============================================ */

@media (max-width: 479px) {
    :root {
        --font-size-base: 14px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .hero-content h1 {
        font-size: 1.25rem;
    }
    
    .hero-image img {
        max-height: 200px;
    }
    
    .section {
        padding: var(--spacing-xl) 0;
    }
    
    .section-header {
        margin-bottom: var(--spacing-xl);
    }
    
    .section-header p {
        font-size: 1rem;
    }
    
    /* Service Detail */
    .service-detail-content h3 {
        font-size: 1.125rem;
    }
    
    /* Forms */
    .form-input,
    .form-textarea,
    .form-select {
        padding: var(--spacing-sm);
    }
    
    .lead-form,
    .contact-form {
        padding: var(--spacing-md);
    }
    
    /* Legal Content */
    .legal-content h2 {
        font-size: 1.25rem;
    }
    
    .legal-content h3 {
        font-size: 1.1rem;
    }
}

/* ============================================
   Height-based Media Queries
   ============================================ */

@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        padding: 4rem 0 2rem;
    }
    
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    .hero-image img {
        max-height: 200px;
    }
    
    .page-header {
        padding: 4rem 0 2rem;
    }
}

/* ============================================
   Touch Device Optimizations
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .nav-link {
        padding: var(--spacing-md);
    }
    
    .btn {
        min-height: 44px;
    }
    
    .form-checkbox input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }
    
    /* Remove hover effects */
    .card:hover,
    .service-card:hover {
        transform: none;
    }
    
    .nav-link::after {
        display: none;
    }
}

/* ============================================
   High DPI / Retina Displays
   ============================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure crisp borders */
    .card,
    .service-card,
    .form-input,
    .form-textarea,
    .form-select {
        border-width: 0.5px;
    }
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode support
    :root {
        --white: #1a1a1a;
        --light-gray: #2d2d2d;
        --gray: #a0a0a0;
        --dark-gray: #e0e0e0;
        --black: #ffffff;
    }
    
    .header,
    .footer {
        background: #121212;
    }
    
    .card,
    .service-card,
    .contact-form,
    .lead-form {
        background: #2d2d2d;
    }
    */
}

/* ============================================
   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::before {
        animation: none;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    /* Hide non-essential elements */
    .header,
    .footer,
    .cookie-banner,
    .skip-link,
    .menu-toggle,
    .btn,
    .hero-image,
    .service-detail-image,
    .about-image,
    .map-container {
        display: none !important;
    }
    
    /* Reset colors for print */
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: #000;
        page-break-after: avoid;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    /* Full width container */
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    /* Remove backgrounds */
    .hero,
    .page-header,
    .legal-hero,
    .about-hero,
    .services-hero,
    .business-model-hero,
    .lead-form-section {
        background: #fff !important;
        color: #000 !important;
        padding: 1rem 0;
    }
    
    .hero-content h1,
    .hero-content p,
    .page-header h1,
    .page-header p {
        color: #000 !important;
    }
    
    /* Show URLs for links */
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
    
    /* Page breaks */
    .section {
        page-break-inside: avoid;
    }
    
    /* Forms */
    .form-input,
    .form-textarea,
    .form-select {
        border: 1px solid #000;
    }
}
