/* ========================================
   Responsive Design - Mobile First Approach
   Based on Chrome DevTools MCP Analysis
======================================== */

/* ========================================
   Mobile Styles (default)
======================================== */

/* ========================================
   SP版ヘッダー (750px以下)
   参考サイトのデザインに基づく実装
======================================== */
@media (max-width: 750px) {
    :root {
        --header-height-mobile: 48px;
    }

    /* ヘッダーのレイアウト調整 */
    .site-header {
        height: 48px;
    }

    .primary-navigation {
        padding: 0 16px !important;
        height: 48px !important;
        justify-content: space-between;
        gap: 16px !important;
    }

    /* ロゴのサイズ調整 */
    .company-logo {
        flex: 1;
        max-width: 150px;
        min-width: 0;
    }

    .logo-link {
        display: block;
        width: 100%;
    }

    .logo-link img {
        width: 100% !important;
        height: auto !important;
        max-width: 150px !important;
    }

    /* デスクトップナビゲーションを非表示 */
    .nav-list {
        display: none;
    }

    /* ハンバーガーメニューを表示 */
    .hamburger-menu {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 36px;
        padding: 0;
        margin: 0;
        color: #1d4ed8;
        flex-shrink: 0;
        width: 36px;
        height: 36px;
    }

    .hamburger-icon {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    /* メインコンテンツの調整 */
    main {
        padding-top: 48px;
    }
}

/* Mobile-specific CSS variables */
@media (max-width: 750px) {
    /* ========================================
       Problem Section - SP Mobile Layout
    ======================================== */

    .problem-section {
        padding: 0;
    }

    .section-header {
        padding: 60px 20px 0 20px;
        text-align: left;
        align-items: flex-start;
    }

    .section-header:first-of-type {
        padding: 60px 20px 0 20px;
    }

    .section-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .section-subtitle {
        font-size: 26px;
        line-height: 1.4;
        letter-spacing: 0;
    }

    /* カードコンテナ - 相対位置指定 */
    .problem-cards {
        position: relative;
        margin-top: 36px;
    }

    /*
     * カード共通スタイル
     */
    .problem-card,
    .problem-card--reverse {
        position: relative;
        flex-direction: column;
        padding: 24px 20px 40px;
        gap: 24px;
        max-width: 100%;
        display: flex;
        justify-content: flex-start;
        align-items: stretch;
        opacity: 1;
    }

    /* ラッパーのSP版スタイル */
    .problem-card__wrapper {
        flex-direction: column;
        gap: 24px;
        width: 100%;
        max-width: 100%;
        align-items: start;
    }

    .problem-card:nth-child(1),
    .problem-card:nth-child(2) {
        padding-top: 0;
    }

    /* 背景色設定 - 3枚目と5枚目はグレー背景（PC版と同じ） */
    .problem-card:nth-child(3),
    .problem-card:nth-child(5) {
        background: #f6f7f8ff;
    }

    /* 画像を下に配置 */
    .problem-card__image {
        order: 1;
        width: 100%;
        height: auto;
        max-width: 100%;
        margin: 0;
    }

    .problem-card__image img {
        width: 100%;
        height: 260px;
        object-fit: cover;
    }

    /* コンテンツ(テキスト)を上に配置 */
    .problem-card__content {
        order: 0;
        gap: 20px;
    }

    .problem-card__header {
        gap: 8px;
    }

    .problem-card__icon {
        width: 40px;
        height: 40px;
    }

    .problem-card__title {
        font-size: 24px;
    }

    /* カード2のタイトルのみフォントサイズを調整（はみ出し防止） */
    .problem-card--card2 .problem-card__title {
        font-size: 22px;
    }

    .problem-card__list {
        gap: 12px;
    }

    .problem-card__item p {
        font-size: 20px;
        padding: 4px 12px;
    }

    .problem-card__item::before {
        width: 6px;
        height: 6px;
    }

    .problem-card__circle-bg {
        flex-wrap: wrap;
    }

    .service-description {
        padding: 0 16px 0 16px;
    }

    /* ========================================
       Parallax Section - SP Mobile Layout
    ======================================== */

    /* パララックスセクション全体の調整 */
    .parallax-section {
        padding: 24px 16px 40px;

        /* カード変数の上書き */
        --card-gap: 40px;
        --card-padding: 0 0 0 20px;
        --card-icon-size: 100%;
        --card-title-size: 20px;
        --card-text-size: 16px;
        --card-content-gap: 16px;
    }

    .parallax-section--dark {
        padding: 40px 16px 40px;
    }

    /* パララックスコンテナ */
    .parallax-section .parallax-container {
        max-width: 100%;
        padding: 0;
    }

    /* パララックスアイテム間の間隔を調整 */
    .parallax-section .parallax-item {
        gap: 0;
        position: relative;
        top: 0;
        padding: 0;
        height: auto;
    }

    .parallax-section .parallax-item:last-child {
        margin-bottom: 0;
    }

    /* ヘッダー */
    .parallax-section__header {
        padding-left: 0;
        padding-right: 0;
        padding-bottom: 24px;
        max-width: 100%;
        gap: 0;
        margin-bottom: 0;
    }

    .parallax-section__label {
        gap: 8px;
    }

    .parallax-section__number {
        font-size: 18px;
    }

    .parallax-section__name {
        font-size: 18px;
    }

    .parallax-section__title-wrapper {
        gap: 8px;
    }

    .parallax-section__title {
        font-size: 30px;
        margin-bottom: 0;
    }

    .parallax-section__title-sub {
        font-size: 24px;
        letter-spacing: 0.01em;
    }

    .parallax-section__description {
        font-size: 20px;
        line-height: 1.6;
        letter-spacing: 0.04em;
        margin: 0;
    }

    /* カードレイアウト - SP版は縦並び(上:テキスト、下:画像) */
    .parallax-section .parallax-card {
        align-items: center;
        flex-direction: column;
        flex-wrap: nowrap;
        padding: 12px 0 12px 20px;
        gap: 8px;
        margin: 0;
        max-width: 100%;
        border-left: 2px solid var(--card-border-color);
        border-top: none;
        height: 100%;
    }

    /* コンテンツ(テキスト)を上部に配置 */
    .parallax-section .parallax-card__content {
        order: 1;
        gap: 0;
        width: 100%;
        position: sticky;
        top: 0;
        padding: 0;
        margin: 0;
        z-index: 1;
    }

    .parallax-section .parallax-card__title {
        font-size: 24px;
        margin-bottom: 8px;
        font-weight: 700;
        color: var(--section-text-color);
        line-height: 1.4;
        letter-spacing: 0.02em;
    }

    .parallax-section .parallax-card__text {
        font-size: 18px;
        letter-spacing: 0.05em;
        line-height: 1.5;
        color: var(--section-description-color);
    }



    .parallax-section .parallax-card__list {
        gap: 0;
        padding: 0;
    }

    .parallax-section .parallax-card__list-item {
        font-size: 18px;
        letter-spacing: 0.05em;
        line-height: 1.5;
        color: #333333;
    }

    /* アイコン(画像)を下部に配置 */
    .parallax-section .parallax-card__icon {
        order: 2;
        width: 44%;
        height: auto;
        min-height: auto;
        max-width: 44%;
        margin: 0;
        padding: 0;
        flex: none;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .parallax-section .parallax-card__icon img {
        width: 130%;
        height: auto;
        object-fit: contain;
    }

    /* ========================================
        Contact Section
    ======================================== */

    .contact-form-header {
        padding-bottom: 28px;
        padding-top: var(--header-height-mobile);
    }

    .contact-title-japanese {
        font-size: 28px;

        /* windowの横幅が750px以下の指定がないと余白が適用されてしまうため */
        margin-top: 0;
    }

    .contact-title-english {
        padding-top: 48px;
        font-size: 15px;
        color: var(--color-primary);
        font-family: var(--font-accent);
    }

    .form-input::placeholder,
    .form-textarea::placeholder {
        font-size: 16px;
    }

    .contact-form {
        max-width: 100%;
        margin: 0 auto;
        width: 85%;
    }

    .form-field {
        gap: 10px;
    }

    .form-label {
        font-size: 16px;
        letter-spacing: 0.05em;

        /* windowの横幅が750px以下の指定がないと余白が適用されてしまうため */
        margin-bottom: 0;
    }

    .form-field:not(:first-of-type) .form-label {
        margin-top: 24px;
    }

    .form-label.required::before {
        font-size: 13px;
        margin-right: 4px;
        padding: 2px 3px;
    }

    .form-checkbox {
        margin-top: 24px;
    }

    .checkbox-label,
    .privacy-policy-link {
        font-size: 20px;
        font-weight: 700;
        gap: 0;
        margin-bottom: 3px;
    }

    .privacy-link {
        /* windowの横幅が750px以下の指定がないと余白が適用されてしまうため */
        margin-right: 0;
    }

    .contact-form-submit {
        margin-top: 28px;
        margin-bottom: 60px;
    }

    .submit-button {
        max-width: 100%;
        width: 85%;
        font-size: 20px;
        padding: 16px 32px;
        letter-spacing: 2px;
        padding-bottom: 18px;
    }

    /* フッター */

    .copyright {
        font-size: 13px;
        letter-spacing: 0.04em;
    }
}

/* Mobile-specific CSS variables */
@media (max-width: 768px) {
    :root {
        /* Font Sizes - Mobile (from MCP analysis) */
        --font-size-hero: 28px;           /* 48px → 28px */
        --font-size-section-title: 28px;  /* 32px → 28px */
        --font-size-large: 14px;          /* 24px → 14px */
        --font-size-base: 16px;
        --font-size-small: 14px;

        /* Layout - Mobile */
        --container-width: 500px;         /* From MCP: 500px on mobile */
        --header-height: 48px;            /* 64px → 48px */

        /* Spacing - Reduced for mobile */
        --spacing-md: 16px;
        --spacing-lg: 20px;
        --spacing-xl: 24px;
        --spacing-xxl: 32px;
    }

    /* Container adjustment for mobile */
    .container {
        max-width: 500px;
        padding: 0 var(--spacing-md);
    }

    /* ========================================
       Header - Mobile Changes
    ======================================== */

    .site-header {
        height: var(--header-height);
    }

    .primary-navigation {
        padding: 0 var(--spacing-md);  /* From MCP: 0px 16px */
        justify-content: space-between;
        flex-direction: row;
    }

    /* Hide desktop navigation */
    .nav-list {
        display: none;
    }

    /* Show hamburger menu */
    .hamburger-menu {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 36px;  /* From MCP analysis */
        padding: 0;
    }

    /* ========================================
       Main Content - Mobile Adjustments
    ======================================== */

    main {
        padding-top: 0;
    }

    section.hero {
        padding: 0;
        height: calc(90vh + var(--header-height));
    }

    /* ========================================
       Hero Section - Mobile
    ======================================== */

    .hero__container {
        padding: 80px 20px 0 20px;
        justify-content: center;
    }

    .hero__overlay {
        max-width: 100%;
        width: 100%;
        transform: translateY(140px);
    }

    .hero__image {
        object-fit: contain;
        height: calc(105vh + var(--header-height));
    }

    .hero__title-wrapper {
        width: 100%;
        padding: 0;
    }

    .hero__title {
        font-size: 28px;
        gap: 0;
        text-align: center;
    }

    .hero__title-line {
        gap: 4px 0;
        width: auto;
        max-width: 100%;
    }

    .hero__title-text {
        flex: none;
        width: auto;
        max-width: 100%;
    }

    /* ========================================
       Problem Section - Mobile
    ======================================== */

    .problem-title span {
        font-size: var(--font-size-hero);   /* 48px → 28px */
    }

    .problem-items {
        gap: var(--spacing-lg);
    }

    /* 円形背景装飾 - Mobile */
    .problem-card__circle-bg {
        width: 380px;
        height: 380px;
        left: -125px;
        top: -170px;
    }

    /* リソース不足カード（4番目）の円形背景 - Mobile */
    .problem-card:nth-child(4) .problem-card__circle-bg {
        width: 380px;
        height: 380px;
        bottom: 28px;
        left: -191px;
        right: auto;
        top: auto;
        z-index: auto;
    }

    .problem-item-row {
        flex-direction: column !important;
        text-align: center;
        gap: var(--spacing-md);
    }

    .problem-item-image {
        width: 200px;
        order: -1;
    }

    .problem-item {
        padding: var(--spacing-md);
    }

    .problem-item-title {
        font-size: var(--font-size-large);
    }

    /* ========================================
       Process Overview - Mobile
    ======================================== */

    /* New Business Section - Mobile */
    .new-business-section {
        padding: 0;
    }

    /* New Business Process Diagram - Mobile */
    .process-overview {
        gap: 40px;
    }

    .process-diagram {
        flex-direction: column;
        align-items: center;
        gap: 0;
        padding: 0;
        transform: translateX(0);
    }

    .process-circle-container {
        margin-bottom: 24px;
    }

    .process-circle {
        width: 200px;
        height: 200px;
    }

    .process-circle::before {
        width: 280px;
        height: 280px;
    }

    .process-circle span {
        font-size: 18px;
    }

    /* Hide connection lines on mobile */
    .process-connection {
        display: none;
    }

    .process-steps-container {
        width: 100%;
        padding-left: 0;
        gap: 16px;
        align-items: stretch;
    }

    .process-step {
        width: 100%;
    }

    .step-box {
        width: 100%;
        min-width: auto;
        padding: 16px 20px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
    }

    .step-box__number,
    .step-box__name {
        font-size: 18px;
    }

    /* Hide decoration on mobile */
    .step-decoration {
        display: none;
    }

    /* Service Description - Mobile */

    /* .service-description {
        padding: 0 16px;
    } */

    .service-text {
        padding-top: 0;
        font-size: 28px;
        line-height: 1.4;
    }

    .new-business-video--sp {
        /* width: 80%; */

    }

    /* SP版(750px以下)でSP用brを表示 */
    .service-text__br--sp,
    .parallax-section__title-br--sp {
        display: inline;
    }

    /* ========================================
       Service Description - Mobile
    ======================================== */

    .service-subtitle {
        font-size: var(--font-size-large);
    }

    .service-title {
        font-size: var(--font-size-hero);   /* 48px → 28px */
    }

    /* ========================================
       Process Details - Mobile
    ======================================== */

    .process-phase {
        padding: var(--spacing-lg);
    }

    .phase-title {
        font-size: var(--font-size-section-title);  /* 32px → 28px */
    }

    .phase-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .process-item {
        padding: var(--spacing-md);
    }

    .process-item-title {
        font-size: var(--font-size-base);
    }

    /* ========================================
       Company Section - Mobile
    ======================================== */

    .company-description span {
        font-size: var(--font-size-hero);   /* 48px → 28px */
        margin-bottom: var(--spacing-sm);
    }

    .company-info {
        max-width: 100%;
    }

    .company-item {
        padding: var(--spacing-md);
    }

    .company-label {
        font-size: var(--font-size-base);
    }

    /* ========================================
       Company Section - Mobile (750px以下)
    ======================================== */

    @media screen and (max-width: 750px) {
        .company-section {
            align-content: center;
            align-items: center;
            gap: 16px;
            justify-content: flex-start;
            margin: 0;
            padding: 40px 0 80px 0;
        }

        .company-title-container {
            flex: none;
            gap: 16px;
            margin: 0;
            padding: 0;
            width: 90%;
            max-width: 90%;
        }

        .company-section-title {
            font-size: 15px;
            padding-top: 0;
        }

        .company-description {
            gap: 0;
            padding: 0;
        }

        .company-description-first {
            white-space: nowrap;
            overflow: visible;
        }

        .company-description-text.company-description-first,
        .company-description-text.company-description-support {
            font-size: 6vw;
        }

        .company-description .company-highlight {
            display: inline;
            white-space: nowrap;
            font-size: 6vw;
        }

        .company-description-support {
            text-align: left;
            white-space: nowrap;
            font-size: 6vw;
        }

        .company-info {
            flex: none;
            padding: 0;
            width: 90%;
            max-width: 90%;
        }

        .company-item {
            flex-direction: row;
            flex-wrap: wrap;
            gap: 16px 0;
            padding: 16px 8px;
            border-bottom: 1px solid #DCDFE4;
        }

        .company-label {
            font-size: 18px;
            letter-spacing: 0.05em;
            flex: none;
            width: 100%;
            max-width: 100%;
        }

        .company-value {
            font-size: 18px;
            letter-spacing: 0.05em;
            flex: none;
            width: 100%;
            max-width: 100%;
        }

        .company-img {
            bottom: 0;
            flex: none;
            left: auto;
            opacity: 0.2;
            right: 16px;
            top: auto;
            width: 70%;
            max-width: 70%;
            align-content: flex-end;
            align-items: flex-end;
        }

        .company-img .company-image {
            flex: none;
            width: 50%;
            max-width: 50%;
        }

        .company-contact-btn-wrapper {
            width: 90%;
            max-width: 90%;
        }
    }

    /* ========================================
       Contact Section - Mobile
    ======================================== */

    .contact-title {
        font-size: var(--font-size-section-title);  /* 32px → 28px */
    }

    .contact-form {
        max-width: 100%;
    }

    .company-contact-btn {
        width: 180px;
        height: 48px;
        margin-top: 20px;
    }

    .company-contact-btn__text {
        font-size: 16px;
        padding-bottom: 2px;
    }

    .company-contact-btn__icon {
        width: 24px;
        height: 24px;
    }

    /* ========================================
       Mobile Menu - Full Implementation
    ======================================== */

    .mobile-menu-overlay {
        background-color: var(--color-primary);
    }

    .mobile-menu {
        padding: var(--spacing-md);
    }

    .close-menu {
        width: 36px;   /* From MCP: 36px × 36px */
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .close-icon {
        width: 36px;
        height: 36px;
    }

    .mobile-nav {
        gap: 0;
    }

    .mobile-nav-link {
        font-size: 24px;
        padding: var(--spacing-md) 0;
        border-bottom: none;
    }

    /* ========================================
       Touch Targets - Mobile Optimization
    ======================================== */

    /* Ensure all interactive elements meet 44px minimum touch target */
    .hamburger-menu,
    .close-menu,
    .mobile-nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        font-size: 16px;  /* Mobile: 16px */
    }
}

/* ========================================
   Tablet Styles (541px - 840px)
   Based on reference site breakpoints
======================================== */

@media (min-width: 541px) and (max-width: 840px) {
    .nav-link {
        font-size: 18px;  /* Tablet: 18px */
    }
}

/* ========================================
   Tablet Styles (768px - 1024px)
======================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --container-width: 768px;
        --font-size-hero: 40px;
        --font-size-section-title: 30px;
    }

    .container {
        max-width: 768px;
    }

    .problem-item-image {
        width: 240px;
    }

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

    /* 円形背景装飾 - Tablet */
    .problem-card__circle-bg {
        width: 300px;
        height: 300px;
        left: -150px;
    }

    /* リソース不足カード（4番目）の円形背景 - Tablet */
    .problem-card:nth-child(4) .problem-card__circle-bg {
        width: 400px;
        height: 400px;
        bottom: auto;
        left: auto;
        right: 277px;
        top: 78px;
    }

    /* Process Diagram - Tablet */
    .process-diagram {
        padding: 30px;
    }

    .process-circle {
        width: 250px;
        height: 250px;
    }

    .process-circle::before {
        width: 300px;
        height: 300px;
    }

    .process-circle span {
        font-size: 26px;
    }

    /* Adjust connection lines for tablet */
    .process-connection {
        left: 220px;
        display: block;
    }

    .connection-horizontal {
        width: 80px;
    }

    .connection-vertical {
        left: 80px;
        height: 320px;
    }

    .connection-branches {
        left: 80px;
        height: 320px;
    }

    .branch-line {
        width: 250px;
    }

    .process-steps-container {
        padding-left: 150px;
        gap: 20px;
    }

    .step-box {
        min-width: 280px;
        padding: 15px 30px;
    }

    .step-number,
    .step-name {
        font-size: 22px;
    }

    /* Adjust decoration for tablet */
    .step-decoration {
        margin-left: 0;
    }

    .decoration-lines {
        gap: 6px;  /* タブレット用の間隔 */
    }

    .decoration-line {
        width: 35px;
        height: 2px;
    }

    .decoration-circle {
        width: 8px;
        height: 8px;
    }

    /* Show desktop nav on tablet */
    .desktop-nav {
        display: flex;
    }

    .hamburger-menu {
        display: none;
    }
}

/* ========================================
   Desktop Styles (1025px and above)
======================================== */

@media (min-width: 1025px) {
    .container {
        max-width: var(--container-width);
    }

    .problem-item-image {
        width: 280px;
    }

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

    /* Process Diagram - Desktop remains as default */

    /* Ensure desktop navigation is visible */
    .desktop-nav {
        display: flex;
    }

    .hamburger-menu {
        display: none;
    }
}

/* ========================================
   High DPI / Retina Display Support
======================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for high DPI displays */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* ========================================
   Accessibility & Reduced Motion
======================================== */

@media (prefers-reduced-motion: reduce) {
    :root {
        --animation-duration: 0s;
    }

    * {
        animation-duration: 0s !important;
        transition-duration: 0s !important;
    }
}

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

@media print {
    .header,
    .mobile-menu-overlay,
    .hamburger-menu {
        display: none;
    }

    main {
        padding-top: 0;
    }

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

/* ========================================
   390px以下
======================================== */
@media (max-width: 390px) {
    .checkbox-label,
    .privacy-policy-link {
        font-size: 18px;
    }
}
