/* === 基本設定と変数 === */
:root {
    --primary-color: #005A9C;
    --secondary-color: #3f88c5;
    --accent-color: #e67e22;
    --bg-color: #f8f9fa;
    --text-color: #343a40;
    --light-text-color: #6c757d;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --font-family: 'Noto Sans JP', sans-serif;
    --transition-speed: 0.4s;
}

body {
    font-family: var(--font-family);
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    /* ▼▼▼ 初期状態ではアニメーション要素を隠す ▼▼▼ */
    opacity: 0;
    transition: opacity 0.5s ease-in;
}
/* ▼▼▼ JSで読み込み完了後に追加されるクラス ▼▼▼ */
body.loaded {
    opacity: 1;
}

.container {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto;
}

/* === ヘッダー === */
.site-header {
    background-color: var(--card-bg);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* === ヘッダー === */
.site-branding-link {
    text-decoration: none; /* リンクの下線を削除 */
    color: inherit; /* 親要素の色を継承（h1の色指定が有効になる） */
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo-area { display: flex; align-items: center; gap: 1rem; }
.logo-placeholder { width: 100px; height: 50px; display: flex; align-items: center; justify-content: center; font-weight: bold; border-radius: 50%; font-size: 1em; }
.logo-placeholder img { width: -webkit-fill-available; }
.logo-area h1 { font-size: 1.25rem; font-weight: 700; margin: 0; line-height: 1.4; color: var(--primary-color); }
.logo-area h1 span { font-size: 0.75rem; color: var(--light-text-color); font-weight: 400; display: block; }

.header-button {
    background-color: #2d76ab;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 90, 156, 0.3);
}
.header-button:hover { background-color: var(--secondary-color); transform: translateY(-3px) scale(1.05); box-shadow: 0 6px 15px rgba(0, 90, 156, 0.4); }

/* === ナビゲーション === */
.main-nav { background-color: var(--card-bg); border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; }
.main-nav ul { margin: 0; padding: 0; list-style: none; display: flex; justify-content: space-around; }
.main-nav li a { display: block; padding: 1rem 1.2rem; color: var(--text-color); font-weight: 700; font-size: 0.95rem; position: relative; transition: color 0.3s ease; }
.main-nav li a::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 0; height: 3px; background-color: #e18c8c; transition: width var(--transition-speed) cubic-bezier(0.25, 1, 0.5, 1); }
.main-nav li a:hover { color: var(--primary-color); }
.main-nav li a:hover::after { width: 100%; }
.menu-toggle { display: none; }

.main-nav li.current a {
    color: var(--primary-color);
    font-weight: 700;
}

.main-nav li.current a::after {
    width: 80%; /* ホバー時と同じ幅の下線を表示 */
}


/* === ヒーローセクション === */
.hero {
    background-image: linear-gradient(to right, rgba(166, 193, 255, 60%), rgba(164, 209, 250, 45%)), url('../img/main.jpg');
    background-size: cover;
    background-position: center;
    padding: 5rem 1rem;
    text-align: center;
    overflow: hidden; /* 背景アニメーションのため */
    position: relative;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    transform: scale(1.1);
    animation: ken-burns 20s infinite alternate; /* 背景を動かす */
    z-index: -1;
}
@keyframes ken-burns {
    to { transform: scale(1); }
}

.hero-content {
    animation: fade-in-up 1s ease-out 0.5s forwards;
    opacity: 0;
}
.hero-content h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 700; color: #ffffff; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); margin: 0; line-height: 1.6; }

/* === コンテンツアニメーション設定 === */
.main-content { padding: 3rem 0; }
.content-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
.news-section { background-color: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; height:350px; }
.news-section h3 { background: linear-gradient(to right, #ea0202a3, #fd39397a); color: white; padding: 1rem 1.5rem; margin: 0; font-size: 1.3rem; }
.news-content { padding: 1.5rem; }
.news-item { border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; margin-bottom: 1rem; }
.news-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.news-item h4 { margin: 0 0 0.25rem 0; font-size: 0.9rem; color: var(--light-text-color); font-weight: 400; }
.news-item p { margin: 0; font-size: 1rem; }

/* === サイドバー === */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }
.sidebar-box { padding: 2rem; border-radius: 12px; font-size: 1.1rem; font-weight: 700; color: var(--primary-color); position: relative; transition: all 0.3s ease; box-shadow: var(--shadow); display: flex; justify-content: center; align-items: center; text-align: center; }
.sidebar-box:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12); }
.sidebar-box::after { content: '→'; position: absolute; right: 20px; font-size: 1.8em; opacity: 0.5; transition: all 0.3s ease; }
.sidebar-box:hover::after { opacity: 1; transform: translateX(5px); }
.blue-box { background-color: #eaf4ff; }
.green-box { background-color: #e8f5e9; }



/* === フッター === */
.site-footer { background-color: #343a40; color: #e9ecef; text-align: center; padding: 2rem 0; font-size: 0.9rem; margin-top: 2rem; }


/* === 汎用スタイル === */
.red { color:#fc1515; }


/* === 汎用アニメーションクラス === */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === レスポンシブ対応 (768px以下) === */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: center; 
        gap: 1rem;
    }

    .logo-area {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
        padding: 0 4rem 0 0;
    }

    .logo-placeholder {
        width: 80px;
        flex-shrink: 0;
    }

    .logo-area h1 {
        font-size: 1.1rem;
        text-align: center;
        word-break: break-all;
    }
    .main-nav {
        position: static; 
    }


    .menu-toggle {
        display: block;
        position: absolute;
        top: 1rem; /* ボタン自体の位置を少し調整（0でも可） */
        right: 1rem;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 1000;
        width: 25px;
        height: 21px;
    }

    .menu-toggle span {
        display: block;
        width: 25px;
        height: 3px;
        background-color: #333;
        transition: all 0.4s ease;
        position: absolute;
        left: 0;
        /* marginは削除 */
    }

    .menu-toggle span:nth-child(1) {
        top: 0;
    }

    .menu-toggle span:nth-child(2) {
        top: 9px; /* 中央 */
    }

    .menu-toggle span:nth-child(3) {
        top: 18px; /* 以前の bottom: 0; から変更 */
    }

    /* メニューが開いた時のアニメーション（変更なし） */
    .menu-toggle.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    .main-nav ul {
        display: flex; /* 常時flexにしておく */
        flex-direction: column; width: 100%; background-color: #fff;
        border-top: 1px solid var(--border-color); box-shadow: 0 5px 10px rgba(0,0,0,0.05);
        /* ▼▼▼ メニューの開閉アニメーション ▼▼▼ */
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.5s ease-out;
    }
    .main-nav ul.active { max-height: 300px; /* メニュー項目数に応じて調整 */ }
    .main-nav li a { text-align: center; border-bottom: 1px solid #f1f1f1; padding: 1rem; }
    .main-nav li a:hover::after { width: 40%; }
    .content-grid { grid-template-columns: 1fr; }
    .hero-content h2 { font-size: 1.3rem; }
}


/* === TOPへ戻るボタン === */
.back-to-top-btn {
    position: fixed; /* 画面に固定 */
    bottom: 25px;
    right: 25px;
    z-index: 1000;

    /* デザイン */
    background-color: var(--primary-color);
    color: white;
    font-size: 1rem; /* 文字サイズを調整 */
    font-weight: bold;
    text-decoration: none;
    padding: 12px 25px; /* 内側の余白でボタンの大きさを確保 */
    border-radius: 50px; /* 角を丸めてカプセル型に */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    white-space: nowrap; /* 文言が改行されないようにする */

    /* 表示・非表示のアニメーション */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}

/* 表示された時のスタイル */
.back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* カーソルを合わせた時のスタイル */
.back-to-top-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px);
}