/* ========================================
   中高部専用CSS
   ======================================== */

/* ページ固有のヒーロー画像 */
.page-junior-high .hero-background img {
    content: url('../images/courses-junior-high.jpg');
}

/* ページ固有のスタイル調整（必要に応じて） */
/* （タイトル/テキスト個別調整が必要になればここに追加） */

/* PC版：中高部のヒーロータイトル調整 */
@media (min-width: 880px) {
    .page-junior-high .hero-title {
        text-align: center;
    }
    
    .page-junior-high .hero-title br:first-of-type {
        display: block;
        margin-bottom: 8px;
    }
}

/* テキストシャドウは使用しない（統一のため） */

/* ========================================
   2段構成合格実績表示用CSS
   ======================================== */

/* 合格実績セクション全体 */
.achievements-section {
    margin-bottom: 40px;
}

.achievements-section:last-of-type {
    margin-bottom: 30px;
}

/* セクションタイトル */
.achievements-section-title {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--main-color);
    text-align: center;
    margin-bottom: 25px;
    padding: 15px 20px;
    background-color: var(--cream-color);
    border-radius: 8px;
    border-left: 5px solid var(--main-color);
}

/* PC表示：2段構成 */
@media (min-width: 960px) {
    .page-junior-high #achievements .achievements-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        margin-bottom: 0;
    }
    
    /* 高校セクションと大学セクションの間隔調整 */
    .achievements-section:first-of-type {
        margin-bottom: 50px;
    }
}

/* モバイル表示：縦並び */
@media (max-width: 959px) {
    .page-junior-high #achievements .achievements-list {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .achievements-section-title {
        font-size: 1.3em;
        margin-bottom: 20px;
        padding: 12px 15px;
    }
}

/* ========================================
   style.css から移行: コースカード / 画像セクション / 概要カード / ギャラリー
   ======================================== */

/* 画像セクション */
/* 画像セクション（共通 section padding 内で中央配置） */
/* 画像セクション（下余白をさらに極小化） */
.page-junior-high .image-section { text-align: center; margin: 34px auto 0; }
.page-junior-high .image-section img { width: 100%; max-width: 410px; height: auto; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); display: inline-block; }

/* --- セクション間余白微調整（about→overview の空き過多を是正） --- */
/* 他ページ基準: セクション間は視覚的に ~40〜50px 程度確保。
    極端に詰めた結果狭くなり過ぎたので適度に戻す */
.page-junior-high #about { padding-bottom: 50px !important; /* 共通95pxを標準50pxへ統一 */ }
.page-junior-high #overview { padding-top: 50px; /* 他セクション同様 50px 上余白 */ }
/* about 内の画像の上マージンは少し残しつつ、下余白は section の padding に依存しない形で 0 */
.page-junior-high #about .image-section { margin: 26px auto 0; }

/* "6年間一貫中高の概要" 見出し装飾（分割後に消失した擬似要素を復旧） */
.page-junior-high #overview .section-title::before { background-image: url('../images/star-moon.svg'); transform: translateY(-50%) rotate(-15deg); }
.page-junior-high #overview .section-title::after  { background-image: url('../images/blocks.svg'); transform: translateY(-50%) rotate(15deg); width: 90px; height: 90px; }

/* コースカードグリッド */
.junior-high-courses-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 40px 0;
}

.junior-high-courses-grid .course-card {
    background-color: var(--cream-color);
    padding: 30px 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.junior-high-courses-grid .course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.junior-high-courses-grid .course-card h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.4;
}

/* 概要カード */
.junior-high-overview-container { margin-top: 30px; }

.junior-high-overview-grid {
    display: grid;
    /* PCでは常に3カラム表示 */
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.junior-high-overview-card {
    text-align: center;
    padding: 0;
    background-color: var(--cream-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 240px;
    min-height: 240px;
}

.junior-high-overview-card h3 {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 20px 15px 10px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    font-size: 1.6rem;
    color: var(--main-color);
}

.junior-high-overview-card p {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 10px 15px 20px 15px;
    min-height: 0;
    text-align: center;
    font-size: 1rem;
}

/* ギャラリー（額縁復元 & 余白調整） */
/* PCギャラリー：視認性向上のため横幅と画像高さを抑制 */
.junior-high-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-top: 24px;
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    align-items: start;
}

.junior-high-gallery .gallery-item {
    background: var(--white);
    border-radius: 12px;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    transition: transform 0.3s ease, box-shadow .3s ease;
    padding: 14px; /* 額縁内側余白 */
    border: 5px solid #faf8f4; /* 外枠 */
    outline: 1px solid #e5dfd3; /* 額縁ライン */
    background-image: linear-gradient(145deg,#ffffff,#f7f3ee);
}

.junior-high-gallery .gallery-item:hover { transform: translateY(-4px); box-shadow: 0 8px 18px rgba(0,0,0,0.18); }

.junior-high-gallery .gallery-item img {
    width: 100%;
    max-height: 280px; /* 以前より圧縮 */
    object-fit: cover;
    display: block;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}

/* 各コースのご紹介 新レイアウト */
.junior-high-about-layout { display: flex; gap: 40px; align-items: stretch; margin: 10px 0 0; }
.junior-high-about-layout .about-image { flex: 0 0 45%; display: flex; align-items: center; }
.junior-high-about-layout .about-image img { width: 100%; height: auto; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,0.12); }
.junior-high-courses-stack { flex: 1; display: flex; flex-direction: column; gap: 22px; }
.junior-high-courses-stack .course-card { flex: 1; background: var(--cream-color); padding: 26px 20px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); text-align: center; display: flex; align-items: center; justify-content: center; transition: transform .3s, box-shadow .3s; }
.junior-high-courses-stack .course-card h3 { margin: 0; font-size: 1.15em; font-weight: 700; line-height: 1.4; color: var(--text-color); }
.junior-high-courses-stack .course-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }

/* モバイル/タブレットでは従来の縦積み */
@media (max-width: 900px) {
    .junior-high-about-layout { flex-direction: column; gap: 28px; }
    /* 表示順: 見出し -> カード -> 画像 にするため order 指定 */
    .junior-high-courses-stack { order: 1; gap: 18px; }
    .junior-high-about-layout .about-image { order: 2; flex: none; }
    .junior-high-courses-stack .course-card { padding: 24px 18px; }
    .junior-high-courses-stack .course-card h3 { font-size: 1.08em; }
    /* モバイル余白圧縮 */
    .junior-high-about-layout .about-image img { margin-bottom: 0; }
    /* モバイルも他ページと同等リズムを確保（詰め過ぎ防止） */
    .page-junior-high #about { padding-bottom: 18px !important; }
    .page-junior-high #overview { padding-top: 28px !important; }
}
/* achievements セクションのスタイルは common.css に統一（重複削除） */

/* モバイル調整 */
@media (max-width: 879px) {
    .junior-high-courses-grid { grid-template-columns: 1fr; gap: 15px; margin: 30px 0; }
    .junior-high-courses-grid .course-card { padding: 25px 15px; }
    .junior-high-courses-grid .course-card h3 { font-size: 1em; }
    .page-junior-high #about { text-align: center; }
    .page-junior-high .image-section { margin: 28px auto 0; }
    .page-junior-high .image-section img { width: 100%; max-width: 380px; }
    .page-junior-high #about { padding-bottom: 18px; }
    .page-junior-high #overview { padding-top: 28px; }
    .junior-high-overview-grid { grid-template-columns: 1fr; gap: 20px; }
    /* 概要カード：モバイルで可読性向上 */
    .junior-high-overview-card { height: auto; min-height: 0; }
    .junior-high-overview-card h3 {
        font-size: clamp(1.4rem, 5vw, 1.8rem);
        line-height: 1.3;
        padding: 18px 12px 10px;
    }
    .junior-high-overview-card p {
        font-size: clamp(1.05rem, 4.2vw, 1.25rem);
        line-height: 1.55;
        padding: 10px 14px 20px;
    }
    .page-junior-high .button-container { width:100%; max-width:100%; }
    .page-junior-high .button-container .btn { width:100%; max-width:100%; box-sizing:border-box; }
    .junior-high-gallery { grid-template-columns:1fr; gap:20px; margin-top:22px; }
    .junior-high-gallery .gallery-item { padding:12px; border-width:4px; }
    .junior-high-gallery .gallery-item img { max-height:260px; object-fit: cover; }
}

/* ========================================
   モバイルヘッダ表示/ヒーローレイアウト調整（commonから独立）
   ======================================== */
@media (max-width: 879px) {
  body.page-junior-high header {
    background-color: #fef7f7 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  }
  body.page-junior-high main { padding-top: 100px !important; }
  body.page-junior-high .hero {
    padding: 25px 15px 0 15px;
    min-height: 400px;
  }
  body.page-junior-high .hero .container { flex-direction: column; gap: 20px; }
    body.page-junior-high .hero-title {
        font-size: 1.8rem;
        margin-top: 25px !important;
        margin-bottom: 5px;
    }
    body.page-junior-high .hero-background { order: 2; margin-top: -5px; }
    body.page-junior-high .hero-text { order: 3; padding: 5px 0 0 0; }
}

/* 超小幅端末（~430px）でのナビゲーション調整：最下部メニュー（アクセス/お問い合わせ）が隠れないように */
@media (max-width: 430px) {
    body.page-junior-high header nav {
        overflow-y: auto;
        padding-bottom: 70px; /* 下部に余白を追加して最後の項目を確実に表示 */
    }
    .junior-high-about-layout .about-image { order: 2; flex: none; }
    /* モバイルで画像直後の余白を圧縮 */
    .junior-high-about-layout .about-image img { margin-bottom: 0; display: block; }
    /* 次セクション(#overview)との距離をさらに縮める */
    .page-junior-high #overview { padding-top: 0 !important; }
    .page-junior-high #about { padding-bottom: 0 !important; }
    body.page-junior-high header nav ul::after { content: ''; display: block; height: 40px; }
    body.page-junior-high header nav li { margin: 10px 0; }
    body.page-junior-high header nav a { font-size: 1.3rem; line-height: 1.3; padding: 8px 10px; }
}

/* 431px〜879px：小型タブレット/大型スマホ向け 読みやすさ優先で再配置 */
@media (min-width: 431px) and (max-width: 879px) {
    body.page-junior-high header nav {
        padding-top: 110px; /* 画面上部に詰まり過ぎないよう余白拡大 */
        padding-bottom: 80px; /* 下部にも余白を追加 */
    }
    body.page-junior-high header nav li { margin: 20px 0; }
    body.page-junior-high header nav a { font-size: 1.65rem; line-height: 1.35; }
}

.centered-text {
    text-align: center !important;
}
