/* ========== タブレット・中画面対応 (768px-1024px) ========== */
@media (max-width: 1024px) {
    .container {
        padding: 0 32px;
    }

    .fixed-buttons {
        right: 32px;
    }

    /* Tablet hero image */
    .hero {
        background-image: url('../images/hero/main-table.jpg');
        background-position: center center;
        background-size: contain;
    }

    .hero-title {
        font-size: 52px;
    }

    .section-title {
        font-size: 42px;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    .contact-content {
        gap: 60px;
    }
}

/* ========== CSS Variables for Dynamic Viewport ========== */
:root {
    --vh: 1vh;
}

/* ========== 画面比率による背景サイズ調整 ========== */
@media (max-aspect-ratio: 3/4) {
    .hero {
        background-size: contain !important;
        background-position: center bottom !important;
    }
}

@media (min-aspect-ratio: 2/1) {
    .hero {
        background-size: contain !important;
        background-position: center center !important;
    }
}

/* 極端な縦長画面対応 */
@media (max-aspect-ratio: 9/16) {
    .hero {
        background-size: contain !important;
        background-position: center center !important;
        padding: 100px 0 !important;
    }
}

/* ========== タブレット対応 (768px) ========== */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    .fixed-buttons {
        display: none;
    }
    
    .nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }

    /* モバイルナビゲーション表示時のスタイル */
    .nav.mobile-active {
        display: block !important;
        position: fixed;
        top: 100px;
        left: 0;
        width: 100%;
        height: calc(100vh - 100px);
        background-color: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(20px);
        z-index: 999;
        overflow-y: auto;
    }

    .nav.mobile-active ul {
        flex-direction: column;
        padding: 40px 20px;
        gap: 30px;
        height: 100%;
        align-items: center;
        justify-content: flex-start;
    }

    .nav.mobile-active li {
        width: 100%;
        text-align: center;
    }

    .nav.mobile-active a {
        display: block;
        padding: 15px 20px;
        font-size: 18px;
        color: #ffffff;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        transition: all 0.3s ease;
    }

    .nav.mobile-active a:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }


    .hero-title {
        font-size: 42px;
    }

    .hero-subtitle {
        font-size: 18px;
    }

    
    .section-title {
        font-size: 36px;
    }
    
    /* Smartphone portrait hero image */
    .hero {
        background-image: url('../images/hero/main-mobile.jpg');
        background-position: center center;
        background-size: cover;
        min-height: 100vh;
        height: 100vh;
        height: 100dvh; /* 動的ビューポートに対応 */
        padding: 80px 0 60px;
        background-attachment: scroll;
    }

    section {
        padding: 80px 0;
    }

    .section-header {
        margin-bottom: 60px;
    }

    /* お客様の声 */
    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .testimonial-image img {
        height: 260px;
    }

    /* 商品ラインナップ */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .product-card {
        padding: 24px;
    }

    .product-image img {
        height: 180px;
    }

    /* メンバー */
    .members-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .member-card {
        padding: 40px;
    }

    .member-image img {
        width: 150px;
        height: 150px;
    }

    /* 会社概要 */
    .company-table th,
    .company-table td {
        padding: 20px 24px;
        font-size: 13px;
    }

    /* お問い合わせ */
    .contact-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .contact-form {
        padding: 32px;
    }

    .contact-item {
        padding: 24px;
    }
}

/* ========== スマートフォン対応 (480px) ========== */
@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .header-content {
        padding: 20px 0;
    }

    .logo h1 {
        font-size: 20px;
    }

    .logo p {
        font-size: 12px;
        letter-spacing: 2px;
    }

    .nav a {
        font-size: 14px;
        padding: 8px 12px;
    }

    /* Smartphone specific styling */
    .hero {
        background-image: url('../images/hero/main-mobile.jpg');
        background-position: center center;
        background-size: cover;
        min-height: 100vh;
        height: 100vh;
        height: 100dvh; /* 動的ビューポート */
        background-attachment: scroll;
        padding: 80px 0 40px;
    }

    .hero-title {
        font-size: 32px;
        letter-spacing: 1px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .section-title {
        font-size: 28px;
        letter-spacing: 1px;
    }

    .section-subtitle {
        font-size: 14px;
    }

    section {
        padding: 60px 0;
    }

    .section-header {
        margin-bottom: 40px;
    }

    /* お客様の声 */
    .testimonial-card {
        padding: 24px;
    }

    .testimonial-image img {
        height: 220px;
    }

    .testimonial-content h3 {
        font-size: 18px;
    }

    .testimonial-content p {
        font-size: 13px;
    }

    /* 商品ラインナップ */
    .products-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .product-card {
        padding: 20px;
    }

    .product-image img {
        height: 160px;
    }

    .product-card h3 {
        font-size: 14px;
    }

    /* メンバー */
    .member-card {
        padding: 32px;
    }

    .member-image img {
        width: 120px;
        height: 120px;
    }

    .member-card h3 {
        font-size: 16px;
    }

    .member-card p {
        font-size: 13px;
    }

    /* 会社概要 */
    .company-table {
        font-size: 12px;
    }

    .company-table th,
    .company-table td {
        padding: 16px 20px;
        font-size: 12px;
    }

    .company-table th {
        width: 35%;
    }

    /* お問い合わせ */
    .contact-info h3 {
        font-size: 20px;
        margin-bottom: 24px;
    }

    .contact-form {
        padding: 24px;
    }

    .contact-item {
        padding: 20px;
        margin-bottom: 24px;
    }

    .contact-item strong {
        font-size: 14px;
    }

    .contact-item p {
        font-size: 13px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .form-group input,
    .form-group textarea {
        padding: 14px 16px;
        font-size: 13px;
    }

    .submit-btn {
        padding: 16px;
        font-size: 13px;
    }
}

/* ========== 小画面スマートフォン対応 (320px) ========== */
@media (max-width: 320px) {
    .container {
        padding: 0 12px;
    }

    /* Small smartphone styling */
    .hero {
        background-image: url('../images/hero/main-mobile.jpg');
        background-size: cover;
        background-position: center center;
        background-attachment: scroll;
        min-height: 80vh;
        height: 80vh;
        height: 80dvh; /* 動的ビューポート */
        padding: 60px 0 40px;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero-subtitle {
        font-size: 13px;
    }

    .section-title {
        font-size: 24px;
    }

    .section-subtitle {
        font-size: 13px;
    }

    .product-card {
        padding: 16px;
    }

    .member-card {
        padding: 20px;
    }

    .contact-form {
        padding: 20px;
    }

    .contact-item {
        padding: 16px;
    }

    .company-table th,
    .company-table td {
        padding: 12px 16px;
        font-size: 11px;
    }
}

/* ========== Smartphone Portrait ========== */
@media (max-width: 768px) and (orientation: portrait) {
    .hero {
        background-image: url('../images/hero/main-mobile.jpg');
        background-position: center center;
        background-size: cover;
        min-height: 100vh;
        height: 100vh;
        height: 100dvh; /* 動的ビューポート */
        padding: 80px 0 60px;
    }
}

/* ========== Smartphone Landscape ========== */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        background-image: url('../images/hero/main-desktop.jpg');
        background-position: center center;
        background-size: cover;
        min-height: 100vh;
        height: 100vh;
        height: 100dvh; /* 動的ビューポート */
        padding: 60px 0 40px;
    }

    .hero-title {
        font-size: 32px;
    }

    section {
        padding: 60px 0;
    }
}

/* ========== ホバー効果の調整（タッチデバイス） ========== */
@media (hover: none) and (pointer: coarse) {
    .card:hover,
    .product-card:hover,
    .testimonial-card:hover,
    .member-card:hover {
        transform: none;
        background-color: rgba(255, 255, 255, 0.02);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .tel-button:hover,
    .contact-button:hover,
    .submit-btn:hover {
        background-color: transparent;
        color: inherit;
    }
}

/* ========== 高解像度ディスプレイ対応 ========== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero {
        background-image: url('../images/hero/main@2x.png');
    }
}

/* ========== アクセシビリティ対応 ========== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .fade-in {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .hero-title-line {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .hero-subtitle {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* ========== ダークモード対応（システム設定準拠） ========== */
@media (prefers-color-scheme: light) {
    /* ライトモードでも黒背景を維持（ブランドアイデンティティ） */
    body {
        background-color: #000000;
        color: #ffffff;
    }
}

/* ========== プリント対応 ========== */
@media print {
    .fixed-buttons,
    .mobile-menu-toggle {
        display: none !important;
    }

    .header {
        position: static;
        background-color: transparent;
        border-bottom: 1px solid #333;
    }

    body {
        background-color: white;
        color: black;
    }

    .section-title,
    .hero-title,
    .logo h1 {
        color: black;
    }

    .card,
    .product-card,
    .testimonial-card,
    .member-card {
        border: 1px solid #ccc;
        background-color: white;
    }
}