/* Custom CSS variables for easier color management */
:root {
    --color-custom-blue: #008CBA;
    --color-custom-blue-dark: #006F8F;
    --color-text-dark: #1F2937; /* Tailwind gray-900 equivalent */
    --color-text-medium: #4B5563; /* Tailwind gray-700 equivalent */
    --color-gray-50: #F9FAFB;
    --color-gray-100: #F3F4F6;
    --color-white: #FFFFFF;
    --color-black: #000000;
    --header-height-mobile: 4.5rem; /* モバイルヘッダーの高さの目安 */
    --header-height-desktop: 5.5rem; /* デスクトップヘッダーの高さの目安 */
}

/* --- Base Styles --- */
body {
    font-family: 'Open Sans', sans-serif;
    color: #333;
    line-height: 1.6; 
    font-size: 17px; 
    margin: 0;
    padding: 0;
    /* ページ全体の横スクロールを強制的に禁止し、幅をビューポートに固定 */
    overflow-x: hidden; 
    width: 100vw; 
    box-sizing: border-box; 
}
*, *::before, *::after {
    box-sizing: border-box;
}

@media (min-width: 768px) {
    body {
        font-size: 18px; 
        width: auto; /* デスクトップでは通常の幅に戻す */
    }
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
}

.body-bg {
    background-color: var(--color-gray-50); 
}

.container-main {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem; 
    padding-right: 1rem; 
    max-width: 1280px; 
}

@media (min-width: 768px) {
    .container-main {
        padding-left: 3rem; 
        padding-right: 3rem; 
    }
}

.section-padding {
    padding-top: 5rem; 
    padding-bottom: 5rem; 
}
@media (min-width: 768px) {
    .section-padding {
        padding-top: 7rem; 
        padding-bottom: 7rem; 
    }
}

/* 各セクションの文字を画面中央に配置 */
.text-center {
    text-align: center;
}
.text-left {
    text-align: left; 
}

/* --- Utility Classes (Tailwind replacements) --- */
.text-custom-blue { color: var(--color-custom-blue); }
.hover-text-custom-blue:hover { color: var(--color-custom-blue); }

.text-gray-700 { color: var(--color-text-medium); }
.text-gray-800 { color: #1F2937; } 
.text-gray-600 { color: #4B5563; } 
.text-gray-900 { color: var(--color-text-dark); } 
.bg-gray-100 { background-color: var(--color-gray-100); }
.bg-white { background-color: var(--color-white); }

.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.transition { transition: all 0.3s ease; }
.duration-300 { transition-duration: 0.3s; }

.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.025em; }

/* Custom text shadow utility for hero section */
.text-shadow-xl {
    text-shadow: 0 6px 15px rgba(0, 0, 0, 0.6);
}
.text-shadow-lg {
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

/* Image Aspect Ratios */
.img-aspect-video {
    width: 100%;
    aspect-ratio: 16 / 9; 
    object-fit: cover;
}

/* --- Grid Layouts --- */
.grid-services, .grid-portfolio {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem; 
}
@media (min-width: 768px) { 
    .grid-services, .grid-portfolio {
        grid-template-columns: repeat(3, 1fr);
        gap: 4rem; 
    }
}
@media (min-width: 640px) { 
    .grid-portfolio {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem; 
    }
}
@media (min-width: 1024px) { 
    .grid-portfolio {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem; 
    }
}

/* Text alignment for service/portfolio cards (サービス・施工事例の文字は中央揃えを維持) */
.service-card, .portfolio-item > div {
    text-align: center;
}


/* --- Header & Navigation --- */
.fixed-header {
    position: fixed;
    width: 100%;
    top: 0; 
    z-index: 50;
    background-color: var(--color-white);
    overflow-x: hidden; 
}

.header-main {
    background-color: var(--color-white);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); 
    padding-top: 0.75rem; 
    padding-bottom: 0.75rem; 
    /* 最終調整1: モバイル時の水平パディングを最小化 (0.4rem) */
    padding-left: 0.4rem; 
    padding-right: 0.4rem; 
}
@media (min-width: 768px) {
    .header-main {
        padding-top: 1rem; 
        padding-bottom: 1rem; 
        padding-left: 3rem; 
        padding-right: 3rem; 
    }
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center; 
    width: 100%;
    /* 最終調整2: ヘッダーコンテナが絶対に画面幅を超えないようにする */
    max-width: 100%; 
}

/* ロゴのサイズ調整 */
.logo-link {
    width: 4rem; 
    height: auto;
    flex-shrink: 0; 
}
@media (min-width: 768px) {
    .logo-link {
        width: 6rem; 
    }
}
.logo-img {
    height: auto;
    width: 100%;
    object-fit: contain;
}

.nav-desktop {
    display: none; 
    gap: 2.5rem; 
}
@media (min-width: 768px) {
    .nav-desktop {
        display: flex; 
    }
}

.nav-link {
    padding: 0.5rem 0;
    transition: color 0.3s ease;
    font-size: 1.1rem; 
}

/* モバイルメニューアイコン */
.mobile-menu-icon {
    /* 最終調整3: アイコンがタップしやすいように最小パディングを再設定 (0.1rem) */
    padding: 0.1rem; 
    color: var(--color-text-dark); 
    display: block; 
    flex-shrink: 0; 
}
@media (min-width: 768px) {
    .mobile-menu-icon {
        display: none; 
    }
}

.hamburger-icon {
    width: 1.5rem; 
    height: 1.5rem; 
    stroke: currentColor; 
}

.mobile-menu {
    position: absolute;
    top: 100%; 
    left: 0;
    width: 100%;
    background-color: var(--color-white);
    padding: 1rem 0; 
    margin-top: 0.75rem; 
    border-radius: 0.75rem; 
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1); 
    z-index: 40;
}

.mobile-nav-item {
    display: block;
    padding: 0.75rem 1rem; 
    color: #1F2937; 
    transition: background-color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-radius: 0.375rem; 
    font-size: 1.1rem; 
}

.mobile-nav-item:hover {
    background-color: #F3F4F6; 
}

/* --- Mobile Menu (CSS-only functionality) --- */
.hidden-input {
    position: absolute; 
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none; 
}

/* メニュー本体はデフォルトで非表示 */
.hidden-mobile-menu {
    display: none;
}

/* チェックボックスがチェックされたらメニューを表示 */
#mobile-menu-toggle:checked ~ .header-container > #mobile-menu {
    display: block;
}

/* Ensure mobile menu is hidden by default on desktop */
@media (min-width: 768px) {
    .hidden-mobile-menu {
        display: none !important;
    }
}

/* --- Main Content Padding (ヘッダーの高さ分を空ける) --- */
.main-content {
    padding-top: 0; 
}
@media (min-width: 768px) {
    .main-content {
        padding-top: 0; 
    }
}


/* --- Hero Section --- */
.hero-section {
    position: relative;
    /* ★修正点1: heightをmin-heightに変更し、コンテンツに応じて高さを確保 */
    min-height: 70vh; 
    height: auto;
    background-color: #111827; 
    overflow-x: hidden; 
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white); 
    background-size: cover; 
    background-position: center; 
}
@media (min-width: 768px) {
    .hero-section {
        /* PC画面を小さくした際の切れる問題を回避するためmin-heightを調整 */
        min-height: 80vh; 
    }
}

.hero-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: var(--color-black);
    opacity: 0.65;
}

.hero-content {
    /* ★修正点2: ヘッダーの下にコンテンツを配置するため上部にパディングを追加 */
    padding-top: var(--header-height-mobile); /* モバイルヘッダーの高さ以上 */
    padding-bottom: 3rem; /* 下部にもパディングを追加して余裕を持たせる */
    padding-left: 1.5rem; /* 左右のパディングを増やして文字切れを回避 */
    padding-right: 1.5rem; /* 左右のパディングを増やして文字切れを回避 */
    width: 100%; /* コンテンツが幅いっぱいに広がるように */
    max-width: 100%; /* 念のため */
}

@media (min-width: 768px) {
    .hero-content {
        /* PCヘッダーの高さに合わせてパディングを調整 */
        padding-top: var(--header-height-desktop); 
        padding-left: 3rem; 
        padding-right: 3rem; 
    }
}

/* --- HERO TITLE FONT SIZE FIX (文字切れ解消のための最終調整) --- */
.hero-title {
    /* 修正前: 2rem */
    font-size: 1.7rem; /* デフォルトサイズ（モバイルのベース）をさらに小さく設定 */
    line-height: 1.25;
}

/* **最重要修正:** 非常に狭い画面（360pxなど）に対応 */
@media (max-width: 479px) {
    .hero-title {
        /* 修正前: 1.8rem */
        font-size: 1.6rem; /* 縦画面で確実に収まるようにさらに縮小 */
        line-height: 1.4;
    }
    .hero-content {
        padding-left: 1rem; /* 狭い画面ではパディングを少し削る */
        padding-right: 1rem;
    }
}

/* 中型スマホ（480px～639px） */
@media (min-width: 480px) and (max-width: 639px) {
    .hero-title {
        font-size: 2.2rem; /* 以前の2.5remから少し縮小 */
        line-height: 1.35;
    }
}

/* タブレット（640px～767px） */
@media (min-width: 640px) and (max-width: 767px) {
    .hero-title {
        font-size: 3rem; 
    }
}

/* PCサイズ (768px以上) */
@media (min-width: 768px) {
    .hero-title {
        font-size: 5rem; 
    }
}
/* -------------------------------------------------------- */


.hero-subtitle {
    font-size: 1.1rem; 
    opacity: 0.9;
}
@media (min-width: 640px) {
    .hero-subtitle {
        font-size: 1.3rem; 
    }
}
@media (min-width: 768px) {
    .hero-subtitle {
        font-size: 1.8rem; 
    }
}


/* --- Slider/Slideshow (Crucial: Unchanged from original CSS) --- */
/* アニメーションの定義 */
@keyframes scroll-x {
    0% {
        transform: translateX(0); 
    }
    100% {
        transform: translateX(-100%); 
    }
}

/* 1. 全体を包括するコンテナ */
.slider-container {
    width: 100%; 
    overflow: hidden; 
    white-space: nowrap; 
    display: flex; 
    margin-top: 3rem;
}

/* 2. 画像リストのスタイル（アニメーションを適用する要素） */
.slide-list {
    display: flex;
    animation: scroll-x 30s linear infinite; 
}

/* 3. 画像のスタイル */
.slide-list img {
    width: 200px; 
    height: 150px; 
    object-fit: cover; 
    flex-shrink: 0; 
    margin-right: 10px; 
}

/* （補足）マウスオーバーで一時停止させる場合 */
.slider-container:hover .slide-list {
    animation-play-state: paused;
}

/* --- Primary Button (ヒーローセクションの問い合わせボタン) --- */
.btn-primary {
    background-color: var(--color-custom-blue);
    color: white;
    padding: 0.85rem 2.2rem; 
    border-radius: 9999px; 
    font-weight: 700; 
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-size: 1.2rem; 
}
.btn-primary:hover {
    background-color: var(--color-custom-blue-dark);
    transform: translateY(-3px); 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}
@media (max-width: 479px) {
    .btn-primary {
        font-size: 1.1rem; /* モバイルでボタンの文字も調整 */
        padding: 0.75rem 1.8rem;
    }
}

/* 施工事例セクションのInstagramボタンのスタイル */
.btn-primary-instagram {
    background-color: var(--color-custom-blue);
    color: white;
    padding: 1rem 3rem; 
    border-radius: 9999px;
    font-weight: 700;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-size: 1.2rem; 
    max-width: fit-content; 
    display: flex; 
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}
.btn-primary-instagram:hover {
    background-color: var(--color-custom-blue-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}
.instagram-img-icon-large {
    width: 1.8rem; 
    height: 1.8rem;
    margin-left: 0.5rem; 
}
@media (min-width: 768px) {
    .instagram-img-icon-large {
        width: 2.2rem; 
        height: 2.2rem;
    }
}


/* --- Section Title --- */
.section-title {
    position: relative;
    display: inline-block;
    margin-bottom: 3rem;
    font-size: 3.2rem; 
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-text-dark);
}
.section-title::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%) skewX(-15deg);
    bottom: -15px;
    width: 100px;
    height: 6px;
    background: linear-gradient(to right, #008CBA, #00C2FF);
    border-radius: 4px;
}
@media (max-width: 767px) {
    .section-title {
        font-size: 2.2rem;
    }
}


/* --- Card Shadow (for services and portfolio items) --- */
.card-shadow {
    border: 3px solid #1e3a8a; 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); 
    border-radius: 1.5rem; 
    transition: all 0.3s ease-in-out; 
}
.service-card h3 {
    font-size: 1.8rem; 
}
.service-card p {
    font-size: 1.1rem; 
}

/* --- Portfolio Specific Styles --- */
.portfolio-item {
    border-radius: 1rem; 
    overflow: hidden;
}
.portfolio-img {
    width: 100%;
    aspect-ratio: 16 / 9; 
    object-fit: cover;
    transition-property: transform; 
}
/* group-hover:scale-105 */
.portfolio-item:hover .portfolio-img {
    transform: scale(1.05); 
}
.portfolio-item h3 {
    font-size: 1.25rem; 
}
.portfolio-item p {
    font-size: 1rem; 
}

/* --- About Section Specific Styles --- */
.about-content-wrapper {
    max-width: 64rem; 
    margin-left: auto;
    margin-right: auto;
}
.about-content {
    gap: 4rem; 
    display: flex;
    flex-direction: column;
    align-items: center;
}
@media (min-width: 768px) {
    .about-content {
        flex-direction: row;
        text-align: left; 
    }
    .about-image-wrapper, .about-text-wrapper {
        width: 50%; 
    }
}

.about-text-wrapper {
    text-align: center; 
}
@media (min-width: 768px) {
    .about-text-wrapper {
        text-align: left; 
    }
}

.about-image {
    width: 100%;
    border-radius: 1rem; 
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1); 
}
.about-title {
    font-size: 1.8rem; 
}
.about-text-wrapper p, .about-text-wrapper ul {
    font-size: 1.1rem; 
}


/* --- Contact Section Specific Styles --- */
.contact-intro-text {
    max-width: 48rem; 
    margin-left: auto;
    margin-right: auto;
}

.contact-box {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1); 
    padding: 2.5rem; 
}

/* お問い合わせのメールボタンの再デザイン: 白背景・青い枠線 */
.btn-primary-contact {
    background-color: var(--color-white); 
    color: var(--color-custom-blue); 
    border: 2px solid var(--color-custom-blue); 
    
    padding: 0.8rem 1.8rem; 
    
    border-radius: 9999px;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 250px; 
    width: 100%; 
    font-size: 1.1rem; 
    margin-left: auto; 
    margin-right: auto;
    
    display: block; 
    text-align: center;
}

.btn-primary-contact:hover {
    background-color: var(--color-custom-blue); 
    color: var(--color-white); 
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

/* メールアイコンのスタイル（HTMLからタグを削除したため、この設定は基本的に不要になりましたが残しておきます） */
.contact-icon {
    display: none; 
    width: 1.25rem; 
    height: 1.25rem;
    margin-right: 0.5rem; 
    transition: filter 0.3s ease;
}


.contact-info {
    max-width: 48rem; 
    margin-left: auto;
    margin-right: auto;
}
.contact-info p {
    margin-top: 0.5rem; 
    font-size: 1.1rem; 
}
.contact-info strong {
    color: var(--color-custom-blue); /* 電話番号は強調色に */
}
.contact-info a {
    text-decoration: none;
}
.contact-info a:hover {
    text-decoration: underline;
}


/* --- Instagram Link Styling --- */
.instagram-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease-in-out;
}
.instagram-text-styled {
    font-family: 'Dancing Script', cursive;
    font-size: 2.5rem; 
    font-weight: 700;
    vertical-align: middle;
    color: var(--color-text-medium); 
    transition: color 0.3s ease-in-out;
}
@media (min-width: 768px) {
    .instagram-text-styled {
        font-size: 3rem;
    }
}
/* 施工事例のInstagramアイコン (大型化) */
.instagram-img-icon-large {
    width: 1.8rem; 
    height: 1.8rem;
    margin-left: 0.5rem; 
}
@media (min-width: 768px) {
    .instagram-img-icon-large {
        width: 2.2rem; 
        height: 2.2rem;
    }
}
/* フッターのInstagramアイコン (お問い合わせ欄下) */
.instagram-footer-icon-small {
    width: 1.8rem; 
    height: 1.8rem;
    margin-left: 0.5rem; 
}
@media (min-width: 768px) {
    .instagram-footer-icon-small {
        width: 2.2rem; 
        height: 2.2rem;
    }
}


.instagram-link:hover .instagram-text-styled {
    color: var(--color-custom-blue); 
}
.instagram-link:hover .instagram-img-icon-large,
.instagram-link:hover .instagram-footer-icon-small {
    transform: scale(1.1); 
    transition: transform 0.3s ease-in-out;
}


/* --- Footer --- */
.footer-main {
    background-color: #1C1C1C; 
    color: white;
    padding-top: 2.5rem; 
    padding-bottom: 2.5rem; 
    padding-left: 1.5rem; 
    padding-right: 1.5rem; 
    text-align: center;
}
.footer-main p {
    font-size: 1.1rem; 
}

@media (min-width: 768px) {
    .footer-main {
        padding-left: 3rem; 
        padding-right: 3rem; 
    }
}

/* --- JavaScriptに依存しないアニメーション (CSSのみ) --- */
@keyframes fadeInMoveUp {
    from {
        opacity: 0;
        transform: translateY(100%); 
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ヒーローセクションの要素に直接アニメーションを適用 */
#home .hero-title, #home .hero-subtitle, #home .btn-primary {
    animation: fadeInMoveUp 1.2s ease-out forwards;
    opacity: 0; 
    will-change: transform, opacity; 
}
#home .hero-title { animation-delay: 0.1s; }
#home .hero-subtitle { animation-delay: 0.3s; }
#home .btn-primary { animation-delay: 0.5s; }