/*
Theme Name: Minshaka
Theme URI: https://example.com
Author: Your Name
Description: みんなの社会科見学テーマ
Version: 1.0
*/


/* ============================================================
   リセット・基本設定
============================================================ */

html {
    overflow-x: hidden;
}

body, input, select, textarea {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 400;
    margin: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'M PLUS Rounded 1c', 'Noto Sans JP', sans-serif;
    font-weight: 700;
    margin: 0 0 10px 0;
}

ul, ol {
    margin: 0;
    padding-left: 1.5em;
}

p {
    margin: 0 0 1em 0;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
}


/* ============================================================
   フォント指定
============================================================ */

.article-card,
.slot-card,
.card-content,
.card-meta {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 400;
}

.site-logo,
.category-button,
.industry-menu-bar a {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
}

.card-title {
    font-family: 'M PLUS Rounded 1c', 'Noto Sans JP', sans-serif;
    font-weight: 700;
    font-size: 16px;
    word-break: break-word;
}


/* ============================================================
   ヘッダー
============================================================ */

.site-header {
    background: #001E5B;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1300px;
    padding: 20px 40px;
    margin: 0 auto;
    position: relative;
}

.site-logo img {
    height: 60px;
}

/* カテゴリーボタン（PC用・右端） */
.category-menu-wrapper {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

.category-button {
    background: #001E5B;
    color: #fff;
    border: none;
    padding: 10px 24px 8px;
    font-size: 28px;
    font-family: 'Dela Gothic One', sans-serif;
    font-weight: 400;
    border-radius: 4px;
    cursor: pointer;
}

/* ハンバーガーボタン（スマホ用・右端） */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 25px;
    height: 50px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 0;
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #fff;
    margin: 4px 0;
    transition: all 0.3s ease;
}

.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
    color: #001E5B;
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
    color: #001E5B;
}


/* ============================================================
   PC版 業界ナビ（ヘッダー下スライドイン）
============================================================ */

/*
 * 仕組み：ヘッダーを sticky にし、その直後に overflow:hidden の
 * ラッパーを sticky で重ねる。ラッパーの max-height を 0 → 展開し、
 * 内側の .industry-menu-bar を translateY で押し出すことで
 * 「ヘッダーが下に伸びる」ように見せる。
 */

/* ラッパー：クリップ用（fixed でヘッダー直下に固定、top はJSでセット） */
.industry-menu-bar-wrap {
    position: fixed;
    /* top は JS でヘッダー高さに合わせて動的にセット */
    left: 0;
    right: 0;
    z-index: 999;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.industry-menu-bar-wrap.is-open {
    max-height: 600px;
}

.industry-menu-bar ul {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0;
    padding: 12px 0 20px;
    margin: 0 auto;
    max-width: 1000px;
    list-style: none;
    max-height: 200px; /* 行数に応じて調整 */
}

.industry-menu-bar li {
    margin: 0;
    padding: 0;
}

.industry-menu-bar a {
    display: block;
    color: #fff;
    font-weight: 400;
    font-size: 18px;
    padding: 10px 14px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.industry-menu-bar a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}


/* ============================================================
   スマホ版 業界ナビ（右スライドイン）
============================================================ */

.industry-menu-bar-mobile {
    position: fixed;
    top: 0;
    right: 0;
    width: 80%;
    height: 100vh;
    background: rgba(240, 240, 240, 0.98);
    overflow-y: auto;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

/* メニューが開いている時 */
.hamburger-menu.active ~ .industry-menu-bar-mobile {
    transform: translateX(0);
}

.hamburger-menu.active ~ .industry-menu-bar-mobile::before {
    opacity: 1;
    pointer-events: auto;
}

.industry-menu-heading {
    font-size: 25px;
    font-family: "Dela Gothic One", sans-serif;
    color: #001E5B;
    margin: 40px 0 10px 30px;
}

/* カテゴリー見出し */
.industry-menu-bar-mobile::after {
    font-family: 'Dela Gothic One', sans-serif;
    display: block;
    position: fixed;
    top: 70px;
    right: 20px;
    font-size: 20px;
    font-weight: bold;
    color: #000;
    z-index: 1001;
    width: calc(80% - 40px);
    padding: 10px 0;
}

.industry-menu-bar-mobile > ul {
    font-size: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 10px 20px 30px;
    margin: 0;
    list-style: none;
}

.industry-menu-bar-mobile li {
    margin: 0;
    padding: 0;
}

.industry-menu-bar-mobile a {
    display: block;
    color: #000;
    font-weight: 500;
    font-size: 14px;
    padding: 12px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.industry-menu-bar-mobile a:hover {
    padding-left: 15px;
    background-color: #e0e0e0;
}


/* ============================================================
   トップスライダー
============================================================ */

.top-slider {
    width: 100%;
    overflow: hidden;
    margin-bottom: 40px;
    position: relative;
}

.slider-track {
    display: flex;
    flex-wrap: nowrap;
    transition: transform 0.6s ease;
}

.slide {
    flex: 0 0 33.333%;
    padding: 10px;
    box-sizing: border-box;
    position: relative;
    aspect-ratio: 3 / 2;
}

.slide a {
    display: block;
    width: 100%;
    height: 100%;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-title {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: #fff;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 16px;
}


/* ============================================================
   トップページ レイアウト
============================================================ */

.top-container {
    width: 100%;
    overflow-x: hidden;
}

.section-title {
    font-size: 36px;
    margin-bottom: 20px;
    text-align: center;
    color: #001E5B;
}

.top-main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    max-width: 1000px;
    margin: 20px auto 0;
    padding: 0 10px;
}


/* ============================================================
   記事カード
============================================================ */

.top-articles {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.article-card {
    display: flex;
    width: 95%;
    border: 1px solid #ddd;
    padding: 10px;
    margin: 0 10px;
    text-decoration: none;
    color: #000;
}

.card-thumb {
    width: 150px;
    aspect-ratio: 5 / 4;
    flex-shrink: 0;
    overflow: hidden;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 15px 0;
    margin-left: 24px;
    flex: 1;
}

.card-title {
    font-size: 20px;
}

.card-meta {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 12px;
    color: #666;
    margin: 5px 0;
}

.card-industry {
    margin-left: 10px;
}


/* ============================================================
   スロット（サイドバー）
============================================================ */

.top-slots {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.slot-card {
    display: block;
    width: 100%;
    position: relative;
    aspect-ratio: 2 / 1;
    overflow: hidden;
    transition: transform 0.2s;
}

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


/* ============================================================
   記事詳細ページ
============================================================ */

.single-layout {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px 20px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.single-main {
    width: 100%;
}

.article-thumb img {
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: 6px;
}

.article-header {
    margin: 15px 0 20px;
}

.article-title {
    font-size: 28px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.article-meta {
    font-size: 13px;
    color: #777;
    margin-bottom: 10px;
}

.article-org {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.article-org a {
    color: #001E5B;
}

.article-industry {
    margin-bottom: 15px;
}

.industry-tag {
    display: inline-block;
    font-size: 11px;
    padding: 4px 8px;
    margin-right: 6px;
    background: #eef2f7;
    border-radius: 4px;
    color: #001E5B;
    text-decoration: none;
}

/* 本文 */
.article-body {
    font-size: 15px;
    line-height: 1.9;
}

.article-body p {
    margin-bottom: 1.3em;
}

.article-body h2 {
    font-size: 20px;
    margin-top: 40px;
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 5px solid #001E5B;
}

.article-body h3 {
    font-size: 20px;
    margin-top: 30px;
    margin-bottom: 10px;
    border-bottom: 2px solid #eee;
    padding-bottom: 4px;
}

.article-body figure {
    margin: 30px auto;
    text-align: center;
}

.article-body img {
    max-width: 100%;
    max-height: 600px;
    width: auto;
    height: auto;
}

.article-body figcaption,
.wp-element-caption,
.wp-caption-text {
    margin-top: 8px;
    font-size: 15px;
    color: #777;
    text-align: center;
    line-height: 1.5;
}

.article-divider {
    margin: 50px 0;
    border: none;
    border-top: 1px solid #ddd;
}

/* 関連記事 */
.related-heading {
    text-align: center;
    font-size: 25px;
    margin-bottom: 15px;
}


/* ============================================================
   タクソノミーページ
============================================================ */

.taxonomy-layout {
    max-width: 1000px;
    margin: 50px auto 0;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.taxonomy-page-title {
    text-align: center;
    margin-bottom: 25px;
}


/* ============================================================
   レスポンシブ：タブレット（768px〜1199px）
============================================================ */

@media (min-width: 768px) {
    /* ハンバーガー非表示、PC用メニュー表示 */
    .hamburger-menu {
        display: none !important;
    }

    .category-menu-wrapper {
        display: block;
    }

    .industry-menu-bar-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .site-logo img {
        height: 55px;
    }

    .slide {
        flex: 0 0 50%;
    }

    .top-main {
        grid-template-columns: 1fr;
    }

    .article-card {
        width: 95%;
        margin: 0;
    }

    .card-thumb {
        width: 150px;
    }

    .slot-card {
        aspect-ratio: 3 / 1;
    }

    .single-layout {
        grid-template-columns: 1fr;
    }

    .taxonomy-layout {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   レスポンシブ：スマホ（〜767px）
============================================================ */

@media (max-width: 767px) {
    /* ハンバーガー表示、PC用メニュー非表示 */
    .hamburger-menu {
        display: flex !important;
    }

    .category-menu-wrapper {
        display: none !important;
    }

    .industry-menu-bar-wrap {
        display: none !important;
    }

    /* ヘッダー */
    .header-inner {
        padding: 12px 8px;
    }

    .site-logo img {
        height: 35px;
    }

    /* スライダー */
    .top-slider {
        margin-bottom: 15px;
    }

    .slide {
        flex: 0 0 100%;
        padding: 8px;
    }

    .slide-title {
        font-size: 12px;
        bottom: 8px;
        left: 8px;
        padding: 3px 6px;
    }

    /* セクション */
    .section-title {
        font-size: 20px;
        margin-bottom: 12px;
        padding: 0 10px;
    }

    .top-main {
        grid-template-columns: 1fr;
        gap: 12px;
        max-width: 100%;
        padding: 0 5px;
        margin-top: 0;
    }

    /* 記事カード */
    .article-card {
        flex-direction: row;
        width: 95%;
        margin: 0;
        gap: 10px;
        border-radius: 4px;
        align-items: center;
        padding: 8px;
    }

    .article-card:hover {
        background-color: #f9f9f9;
        border-color: #001E5B;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }

    .card-thumb {
        width: 80px;
        aspect-ratio: 4 / 3;
        border-radius: 4px;
    }

    .card-content {
        padding: 4px 0;
        margin-left: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .card-title {
        font-size: 13px;
        line-height: 1.3;
        margin: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .card-meta {
        font-size: 10px;
        color: #999;
        margin: 0;
    }

    .card-date {
        white-space: nowrap;
    }

    .card-industry {
        background: #eef2f7;
        color: #001E5B;
        padding: 2px 4px;
        border-radius: 3px;
        font-size: 9px;
        margin-left: 0;
        white-space: nowrap;
    }

    /* スロット */
    .top-slots {
        width: 66.6%;
        margin: 0 auto;
    }

    /* 記事詳細 */
    .single-layout {
        grid-template-columns: 1fr;
        padding: 15px 10px;
        margin: 5px;
        gap: 20px;
    }

    .article-thumb img {
        max-height: 300px;
        border-radius: 4px;
    }

    .article-title {
        font-size: 18px;
    }

    .article-meta {
        font-size: 12px;
    }

    .article-org {
        font-size: 12px;
    }

    .article-body {
        font-size: 13px;
        line-height: 1.8;
    }

    .article-body h2 {
        font-size: 16px;
        margin-top: 25px;
        padding-left: 8px;
        border-left-width: 4px;
    }

    .article-body h3 {
        font-size: 14px;
        margin-top: 20px;
    }

    .article-body figcaption,
    .wp-element-caption,
    .wp-caption-text {
        font-size: 12px;
    }

    .related-heading {
        font-size: 18px;
    }

    /* タクソノミー */
    .taxonomy-layout {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 10px;
        margin: 30px auto 0;
    }

    .taxonomy-page-title {
        font-size: 20px;
    }

    /* フォーム要素（ズーム防止） */
    input,
    textarea,
    select {
        font-size: 16px;
    }
}


/* ============================================================
   レスポンシブ：超小型（〜479px）
============================================================ */

@media (max-width: 479px) {
    .article-title {
        font-size: 16px;
    }

    .card-title {
        font-size: 12px;
    }

    .slide-title {
        font-size: 11px;
    }

    .section-title {
        font-size: 18px;
    }

    .article-body {
        font-size: 12px;
    }
}


/* ============================================================
   プリント用スタイル
============================================================ */

@media print {
    .site-header,
    .category-menu-wrapper,
    .industry-menu-bar,
    .hamburger-menu,
    .top-slider,
    .top-slots {
        display: none;
    }

    body {
        font-size: 12pt;
        color: #000;
    }
}


/* ============================================================
   フッター
============================================================ */

.site-footer {
    background: #001e5b;
    color: #fff;
    text-align: center;
    padding: 0;
    margin-top: 60px;
}

.site-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 20px;
}

.site-footer p {
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.05em;
    color: #fff;
}


/* ============================================================
   PC版 業界ナビ：親子ドロップダウン
============================================================ */

/* PC版 メニューバーの高さ（行数に応じて調整） */
.industry-menu-bar {
    background: rgba(0, 30, 91, 0.95);
    padding: 0 40px;
    transform: translateY(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.industry-menu-bar-wrap.is-open .industry-menu-bar {
    transform: translateY(0);
}

/* 親industry：列の先頭に来るよう強制改行 */
.industry-menu-bar li.industry-parent {
    break-before: column;
    margin-top: 2px;
}

.industry-menu-bar li.industry-parent > a {
    font-weight: 700;
    font-size: 24px;
    color: #fff;
    padding: 6px 14px 4px;
}

/* 子industry */
.industry-menu-bar li.industry-child > a {
    font-weight: 400;
    font-size: 18px;
    color: rgba(255,255,255,0.9);
    padding: 6px 14px 4px 22px;
}

.industry-menu-bar li.industry-child > a::before {
    content: "› ";
    opacity: 0.5;
}


/* ============================================================
   スマホ版 業界ナビ：親子サブメニュー
============================================================ */

.industry-menu-bar-mobile .menu-item-has-children > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    padding: 0 10px 12px;
    color: #001e5b;
}

.industry-menu-bar-mobile .sub-menu {
    list-style: none;
    font-size: 15px;
    padding: 0;
    margin: 0 0 4px 12px;
    border-left: 2px solid #001e5b;
}

.industry-menu-bar-mobile .sub-menu li {
    padding: 0;
    border-bottom: none;
}

.industry-menu-bar-mobile .sub-menu a {
    font-size: 13px;
    padding: 6px 10px;
    color: #333;
    display: block;
    border-bottom: 1px solid rgba(0,30,91,0.1);
}

.industry-menu-bar-mobile .sub-menu a:hover {
    color: #001e5b;
    background: rgba(0,30,91,0.05);
}
