body {
    overflow-x: hidden;
    width: 100%;
}

/* Base styles for all screen sizes */
.mobile-menu-container {
    display: none;
}

main rt {
    font-size: 0.5em;
    color: inherit;
}

.page-hero {
    position: relative;
    padding: 80px 0;
    text-align: center;
    overflow: hidden;
    min-height: 150px;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 110%;
    height: 110%;
    opacity: 0.3;
    z-index: 1;
    background-image: url('../img/hero-bg.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

.section-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 30px;
    margin-top: 40px;
}

.section-text {
    flex: 1;
}

.section-image {
    flex: 1;
    max-width: 50%;
}

.section-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

h2 {
    font-size: 28px;
    margin-bottom: 20px;
    line-height: 1.3;
    position: relative;
}

h2 ruby {
    display: inline-flex;
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
}

h2 rt {
    font-size: 0.5em;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    margin-bottom: 0.25em;
}


/* レスポンシブスタイル */
@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }

    .mobile-menu-container {
        display: block;
    }

    /* モバイルメニュー */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        width: 30px;
        height: 20px;
        position: relative;
        cursor: pointer;
        z-index: 1001;
    }

    .mobile-menu-toggle span {
        display: block;
        width: 100%;
        height: 3px;
        background-color: #333;
        position: absolute;
        left: 0;
        transition: all 0.3s ease;
    }

    .mobile-menu-toggle span:nth-child(1) { top: 0; }
    .mobile-menu-toggle span:nth-child(2) { top: 9px; }
    .mobile-menu-toggle span:nth-child(3) { bottom: 0; }

    .menu-open .mobile-menu-toggle span {
        background-color: #fff;
    }

    .menu-open .mobile-menu-toggle span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .menu-open .mobile-menu-toggle span:nth-child(2) {
        opacity: 0;
    }

    .menu-open .mobile-menu-toggle span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    .mobile-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: #69a1cc;
        display: none;
        z-index: 1000;
        overflow-y: auto;
        padding-top: 100px; /* この行を追加 */
    }

    .menu-open .mobile-nav {
        display: block;
    }

    /* モバイルメニューリスト */
    .mobile-nav .menu {
        list-style-type: none;
        padding: 0;
        margin: 0;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: flex-start; /* この行を変更 */
        height: 100%;
    }

    .mobile-nav .menu li {
        width: 100%;
        text-align: center;
        padding: 0;
    }

    .menu-link {
        color: #fff;
        text-decoration: none;
        font-size: 20px;
        font-weight: 700;
        display: flex;
        align-items: center;
        padding: 20px 40px;
        position: relative;
        transition: opacity 0.3s ease;
        line-height: 1.4;
    }

    .menu-link:hover {
        opacity: 0.8;
    }

    .menu-link img {
        width: 40%;
    }

    .menu-text {
        display: inline-block;
        text-align: center;
        white-space: nowrap;
    }

    .menu-text ruby {
        display: inline-flex;
        flex-direction: column-reverse;
        align-items: center;
        margin: 0 2px;
        line-height: 1.4;
        position: relative;
    }

    .menu-text rt {
        position: absolute;
        top: -1em;
        font-size: 0.5em;
        line-height: 1;
        text-align: center;
        white-space: nowrap;
        left: 0;
        right: 0;
    }

    .arrow-icon {
        position: absolute;
        right: 40px;
        width: 24px;
        height: 24px;
        stroke: #fff;
        stroke-width: 3;
        opacity: 0.7;
    }

    /* 言語切り替え */
    .mobile-language-switcher {
        margin-top: 40px; /* この値を調整 */
        display: flex;
        justify-content: center;
        gap: 20px;
    }

    .mobile-lang-button {
        background: none;
        border: 2px solid #fff;
        color: #fff;
        font-size: 16px;
        cursor: pointer;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.3s ease, color 0.3s ease;
    }

    .mobile-lang-button.active {
        background-color: #fff;
        color: #69a1cc;
    }

    /* Home page styles */
    .home-page .hero-content {
        width: 45%;
    }

    .home-page .circle-images {
        width: 55%;
    }

    .home-page .hero h1 {
        font-size: 2.1rem;
        white-space: normal;
        position: relative;
        z-index: 3;
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.9); /* 追加: 白いシャドウ */
    }

    .home-page .subtitle {
        font-size: 1rem;
        position: relative;
        z-index: 3;
    }

    .home-page .mv-line {
        width: 200%;
    }

    .home-page .blue-heading {
        font-size: 2rem;
        line-height: 1.6;
        margin-bottom: 25px;
        padding: 0 15px;
    }

    /* Companies and Foreigners page styles */
    .companies-page .faq-section{
        margin-left: 20px;
        margin-right: 20px;
    }
    .foreigners-page .faq-section {
        margin-left: 0px;
        margin-right: 0px;
    }

    .companies-page .industry-types-grid,
    .foreigners-page .job-types-grid,
    .foreigners-page .support-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .job-types-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .job-type-item {
        margin-bottom: 0;
    }

    .foreigners-page .support-item.wide,
    .foreigners-page .support-grid > .support-item:nth-child(4),
    .foreigners-page .support-grid > .support-item:nth-child(5) {
        grid-column: auto;
        justify-self: stretch;
    }

    /* Support plans styles */
    .support-plans {
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .support-plan-box {
        width: 100%;
        padding: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        background-color: #f9f9f9;
        box-sizing: border-box;
    }

    .support-plan-title {
        font-size: 1.3rem;
        margin-bottom: 10px;
        text-align: center;
        color: #333;
    }

    .support-plan-list {
        list-style-type: none;
        font-size: 1.1em;
        padding: 0;
        margin: 0;
    }

    .support-plan-item {
        display: flex;
        align-items: flex-start;
        margin-bottom: 8px;
        font-size: 1rem;
        line-height: 1.4;
    }

    .support-plan-number {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 24px;
        height: 24px;
        background-color: #69a1cc;
        color: white;
        border-radius: 50%;
        margin-right: 10px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    /* Full-width image styles */
    .full-width-image {
        width: 100vw;
        height: 50vh;
        min-height: 300px;
        max-height: 600px;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        position: relative;
        overflow: hidden;
    }

    .full-width-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        position: absolute;
        top: 0;
        left: 0;
    }

    /* Page hero styles */
    .page-hero {
        padding: 60px 0;
    }
    /*.home-page .hero {
        min-height: 360px;
        max-height: none;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: hidden;
        padding: 40px 20px;
        background-color: var(--background-color, #fbf9f3);
    }*/
}

@media (max-width: 768px) {
    .intro .content-container{
        margin-top: -80px;
    }

    .content-container .section-title {
        font-size: 1.8em;
        margin-bottom: 20px;
    }

    .section-content {
        flex-direction: column;
        gap: 20px;
    }

    .home-page .blue-heading {
        font-size: 1.8rem;
        line-height: 1.6;
        margin-bottom: 20px;
        padding: 0 10px;
        letter-spacing: 0.03em;
    }

    /* Section title styles */
    .section-title {
        font-size: 1.3rem;
        line-height: 1.2;
        margin-bottom: 15px;
        letter-spacing: 0.03em;
        word-break: keep-all;
        overflow-wrap: break-word;
    }

    .section-title svg {
        width: 24px;
        height: 24px;
        margin-right: 8px;
    }

    .section-image {
        order: -1;
        max-width: 100%;
        margin-bottom: 20px;
    }

    .section-text {
        width: 100%;
    }

    h2 {
        font-size: 24px;
        margin-bottom: 15px;
    }

    h2 rt {
        font-size: 0.4em;
        margin-bottom: 0.2em;
    }

    /* Home page styles */
    .home-page .hero {
        height: auto;
        min-height: 360px;
        max-height: none;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow: hidden;
        padding: 40px 20px;
        background-color: var(--background-color, #fbf9f3);
      
    }
    .home-page .main-visual {
        flex-direction: column;
        height: auto;
        position: relative;
    }

    .home-page .hero-content {
        width: 100%;
        padding: 40px 0;
        order: 1;
        text-align: center;
        position: relative;
        z-index: 3;
    }

    .home-page .circle-images {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
    }

    .home-page .circle-images .image-wrapper {
        position: absolute !important;
        width: 23% !important;
        height: auto !important;
    }

    /* 四隅に配置 */
    .home-page .circle-images .image-wrapper:nth-child(1) { top: -6% !important; left: 1% !important;}
    .home-page .circle-images .image-wrapper:nth-child(2) { top: -20% !important; left: 80% !important; }
    .home-page .circle-images .image-wrapper:nth-child(3) { display: none !important; }
    .home-page .circle-images .image-wrapper:nth-child(4) { bottom: 5% !important; left: 80% !important; }

    /* h1の下に配置 */
    .home-page .circle-images .image-wrapper:nth-child(5) { bottom: 5% !important; left: 5% !important; }
    .home-page .circle-images .image-wrapper:nth-child(6) { display: none !important; }
    .home-page .circle-images .image-wrapper:nth-child(7) {
        top: auto !important;
        top: 95% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 23% !important;
    }

    .home-page .circle-images .image-wrapper:not(.background) {
        z-index: 2 !important;
    }

    .home-page .image-wrapper {
        opacity: 0;
        filter: blur(5px);
        transform: translateY(15px);
        transition: opacity 0.8s ease-out, filter 0.8s ease-out, transform 0.8s ease-out;
    }

    .home-page.loaded .image-wrapper {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
        visibility: visible;
    }

    .home-page.loaded .image-wrapper.visible {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }

    @keyframes fadeInMobile {
        to {
            opacity: 1;
            filter: blur(0);
            transform: translateY(0);
        }
    }

    .home-page .image-wrapper.background {
        opacity: 0;
        filter: blur(3px);
        transform: scale(0.95);
        animation: fadeInBackgroundMobile 1.2s ease-out forwards;
        animation-play-state: paused;
    }

    @keyframes fadeInBackgroundMobile {
        to {
            opacity: 0.7;
            filter: blur(0);
            transform: scale(1);
        }
    }

    .home-page .cta .content-container {
        flex-direction: column;
        align-items: center;
    }

    .home-page .cta-button {
        width: 100%;
    }

    .home-page .about-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .home-page .about-content .about-image {
        margin-bottom: 0px;
        max-width: 100%;
        height: auto;
    }

    .home-page .about-content .about-text {
        text-align: center;
    }

    .home-page .about-content .about-text h2 {
        margin-top: 0;
        font-size: 1.8em;
    }

    .home-page .about-image,
    .home-page .about-text {
        width: 90%;
    }

    .home-page .mv-line {
        width: 250%;
    }

    .content-container h2 {
        font-size: 1.6em;
    }

    /* Companies and Foreigners page styles */
    .companies-page .section-content,
    .foreigners-page .section-content {
        flex-direction: column;
    }

    .companies-page .section-image,
    .foreigners-page .section-image {
        order: -1;
        margin-bottom: 20px;
    }

    /* Support plans styles */
    .support-plans {
        gap: 15px;
    }

    .support-plan-box {
        padding: 12px;
    }

    .support-plan-title {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .support-plan-list {
        font-size: 1.1em;
    }

    .support-plan-item {
        margin-bottom: 6px;
        font-size: 1em;
    }

    .support-plan-number {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
        margin-right: 8px;
    }

    .support-section .support-item li {
        font-size: 1.1em;
        line-height: 1.6;
    }

    /* Foreigners page styles */
    .foreigners-page .support-grid {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .foreigners-page .timeline-title {
        font-size: 1.3rem;
        padding: 12px 20px;
    }

    .foreigners-page .support-item {
        padding: 15px;
    }

    .foreigners-page .support-image {
        height: 140px;
    }

    /* About page styles */
    .about-page .info-table {
        border-collapse: collapse;
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    .about-page .info-table th,
    .about-page .info-table td {
        display: block;
        width: 95%;
        margin-left: auto;
        margin-right: auto;
    }

    .about-page .info-table th {
        background-color: #e3eaed;
    }

    .requirements-list li {
        font-size: 1rem;
    }

    /* Full-width image styles */
    .full-width-image {
        height: 40vh;
        min-height: 200px;
        max-height: 400px;
    }

    /* Page hero styles */
    .page-hero {
        padding: 60px 0;
    }

    .page-hero::before {
        background-position: center center;
        background-size: contain;
        background-repeat: no-repeat;
    }

    .hero-content {
        position: relative;
        z-index: 2;
    }

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

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

    /* Section content styles */
    .section-content {
        display: flex;
        flex-direction: column;
        margin-top: 30px;
    }

    .section-text {
        order: 1;
    }

    .section-text p {
        font-size: 18px;
        line-height: 1.7;
        margin-bottom: 20px;
    }

    .section-image {
        order: 2;
        width: 100%;
        margin-top: 20px;
        overflow: hidden;
        border-radius: 8px;
    }

    .section-image img {
        width: 100%;
        height: auto;
        display: block;
        object-fit: cover;
    }

    .section-content > * {
        width: 100% !important;
        max-width: 100% !important;
    }

    .section-image {
        margin-top: 0 !important;
        margin-bottom: 20px !important;
    }

    h2 {
        clear: both;
        padding-top: 10px;
    }

    .faq-container {
        padding: 20px;
    }

    .faq-question {
        font-size: 1rem;
        letter-spacing: 0.03em;
        padding-left: 0;
        min-height: 25px;
    }

    .faq-answer {
        font-size: 0.9rem;
        padding-left: 40px;
    }

    .faq-question::before {
        width: 25px;
        height: 25px;
        min-width: 25px;
        min-height: 25px;
        font-size: 0.8rem;
        margin-right: 8px;
    }

    .faq-answer::before {
        width: 25px;
        height: 25px;
        min-width: 25px;
        min-height: 25px;
        font-size: 0.8rem;
    }

    .faq-question ruby {
        margin-right: 0.05em;
    }

    .faq-question rt {
        font-size: 0.4em;
    }

    .about-page .flow-chart {
        
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
    


    footer {
        padding: 40px 0;
        display: flex;
        flex-direction: column;
        background-color: #b3b3b3;
        color: white;
        width: 100%;
        box-sizing: border-box;
    }

    footer .content-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        width: 100%;
        padding: 0 20px; /* コンテンツに左右のパディングを追加 */
        box-sizing: border-box;
        background-color: #b3b3b3;
    }

    .footer-left {
        margin-bottom: 20px;
    }

    .company-name {
        font-size: 1.1em;
        font-weight: bold;
        margin-bottom: 15px;
        margin-top: 0;
    }

    .footer-info {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .footer-info p {
        margin: 0;
    }

    .copyright {
        width: 100%;
        padding: 20px;
        box-sizing: border-box;
        margin-top: 10px;
        text-align: center;
        background-color: #b3b3b3;
    }
  
  /* foreigners-section と companies-section のスペース調整 */
  .foreigners-page .section-title,
    .about-page .section-title {
      font-size: 2rem;
    }

  .foreigners-section .section-title,
  .companies-section .section-title {
  margin-bottom: 30px; /* モバイル表示時は少し狭くする */
  }
}


@media (max-width: 480px) {

    .companies-page .industry-types-grid,
    .foreigners-page .job-types-grid {
        grid-template-columns: 1fr;
    }

    .home-page .hero h1 {
        font-size: 1.6rem;
        white-space: normal;
        position: relative;
        z-index: 3;
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.9); /* 追加: 白いシャドウ */
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }


    .home-page .blue-heading {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 15px;
        padding: 0 5px;
        letter-spacing: 0.02em;
    }

    .support-plan-box {
        padding: 10px;
    }

    .support-plan-title {
        font-size: 1rem;
    }

    .support-plan-item {
        font-size: 0.8rem;
    }

    .support-plan-number {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
        margin-right: 6px;
    }

    .full-width-image {
        height: 30vh;
        min-height: 150px;
        max-height: 300px;
    }

    .section-content {
        margin-top: 30px;
        gap: 15px;
    }

    .section-image {
        margin-bottom: 15px;
    }

    h2 {
        font-size: 20px;
        margin-bottom: 12px;
    }

    h2 rt {
        font-size: 0.35em;
        margin-bottom: 0.15em;
    }

    .page-hero {
        padding: 40px 0;
        min-height: 100px;
    }

    .content-container .section-title {
        font-size: 1.5em;
        margin-bottom: 20px;
    }


/* h2のルビのずれ修正 */
.about-section .section-title,
    .foreigners-section .section-title,
    .section-title {
        font-size: 1.5rem; /* モバイル用にフォントサイズを調整 */
        padding-top: 0.9em; /* モバイル用にパディングを調整 */
    }

    .about-section .section-title rt,
    .foreigners-section .section-title rt,
    .section-title rt {
        top: -1.4em; /* モバイル用に位置をさらに調整 */
    }

}



/* Ruby text alignment fix */
h2 ruby > span {
    display: inline-block;
}

h2 ruby > rt {
    display: block;
    text-align: center;
}

/* Scroll lock for mobile menu */
.scroll-lock {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Responsive mv-line */
.mv-line-wrapper {
    width: 100%;
    overflow: hidden;
}

.mv-line {
    width: 100%;
    height: auto;
    display: block;
}

@supports not (height: 100svh) {
    .home-page .hero {
        height: 100vh;
    }
}
