/* ------------------------------------------------------------------
 * サイトヘッダー（倉敷とことこ本体と同じ紺の帯）
 *
 * **出すのは一覧表示（list-view.php）だけ。** 地図は 2026-09-11 からメニューに一本化して
 * ヘッダーを常に隠しており（style.css の .site-header）、ここは読まない。もとは style.css に
 * あったものを 2026-12-03 にそのまま分けた（一覧を倉敷とことこのヘッダーにそろえる指摘）。
 * 下の寸法の実測と折り返しの下限は、地図でヘッダーを出していたころのもの。
 * ------------------------------------------------------------------ */

/* PC 80px / スマホ 56px、背景 #0f192a、文字 #edf9fc */

.site-header {
    position: relative;
    z-index: 10;
    flex: none;
    background: #0f192a;
    color: #edf9fc;
    font-family: 游ゴシック, "Yu Gothic", 游ゴシック体, YuGothic, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

/* 本体サイトに合わせて、幅を絞らず左右に約1%の余白だけ取る。
   ロゴは左端、メニューは右端に寄る（実測: inner は max-width 98%、
   ロゴ左端が約37px、右端の余白が約25px） */
.site-header__inner {
    display: flex;
    align-items: center;
    gap: 16px;
    box-sizing: border-box;
    width: 100%;
    max-width: 98%;
    height: 80px;
    margin: 0 auto;
    padding: 0 16px;
}

.site-header__logo {
    display: flex;
    flex: none;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.site-header__logo img {
    display: block;
    width: auto;
    height: 50px;
}

.site-header__name {
    font-size: 20px;
    font-weight: bold;
}

.site-header__nav {
    flex: 1;
    min-width: 0;
}

.site-header__nav ul {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-header__nav a {
    display: block;
    padding: 11px 16px;
    color: #edf9fc;
    font-size: 15.8px;
    font-weight: bold;
    letter-spacing: .45px;
    line-height: 30px;
    text-decoration: none;
    white-space: nowrap;
}

.site-header__nav a:hover {
    opacity: .7;
}

/* カテゴリとは別枠のリンク（使い方・情報提供） */
.site-header__links {
    display: flex;
    flex: none;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.site-header__link {
    display: block;
    padding: 8px 12px;
    color: #edf9fc;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: .45px;
    text-decoration: none;
    white-space: nowrap;
}

.site-header__link:hover {
    opacity: .7;
}

.site-header__link.is-button {
    padding: 7px 14px;
    border: 1px solid rgba(237, 249, 252, .6);
    border-radius: 4px;
}

.site-header__link.is-button:hover {
    background: rgba(237, 249, 252, .12);
    opacity: 1;
}

/* Instagramなど、文字を出さずアイコン画像だけにするリンク */
.site-header__link.is-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.site-header__link.is-icon img {
    display: block;
    width: 20px;
    height: 20px;
}

/* ハンバーガー（カテゴリが入り切らない幅で表示） */
.site-header__menu {
    display: none;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-direction: column;
    width: 45px;
    height: 45px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.site-header__menu span {
    display: block;
    width: 22px;
    height: 2px;
    background: #edf9fc;
    transition: transform .2s, opacity .2s;
}

.site-header__menu[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.site-header__menu[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.site-header__menu[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.site-drawer {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100dvh - 56px);
    overflow-y: auto;
    background: #0f192a;
    border-top: 1px solid rgba(237, 249, 252, .18);
    box-shadow: 0 8px 16px rgba(0, 0, 0, .3);
}

.site-drawer[hidden] {
    display: none;
}

.site-drawer ul {
    margin: 0;
    padding: 4px 0 12px;
    list-style: none;
}

.site-drawer a {
    display: block;
    padding: 13px 20px;
    color: #edf9fc;
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
}

.site-drawer a:active {
    background: rgba(237, 249, 252, .1);
}

/* 使い方・情報提供はカテゴリの上に置き、区切り線で分ける */
.site-drawer__link + li:not(.site-drawer__link) {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(237, 249, 252, .18);
}

.site-drawer__home {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(237, 249, 252, .18);
}

.site-drawer__home a {
    font-weight: normal;
    opacity: .8;
}

/* カテゴリ8件が1行に収まる下限は 1385px。
   内訳はロゴ200 + カテゴリ776 + 別枠リンク318 + すき間32 + 余白32 = 1357 で、
   inner が幅の98%のため 1357 / 0.98 ≒ 1385px。
   （以前 1400px にしていたのは、flex で広がったナビ要素の幅 977px を
     必要幅と誤って測っていたため。実際の必要幅は 776px）
   **2026-09-10 に 1224px から2段階で上げた。** 別枠リンクが 159px →
   303px（「運営団体について」を追加）→ 318px（「使い方」を「掲載条件」に
   改名）と伸びたため。折り返しを許すと、高さ 80px 固定のヘッダーから
   カテゴリの2行目がはみ出す。**リンクを増やす・文字を長くするときは必ず
   ここも測り直す**（1文字で 14px 前後動く）。
   これを下回ったら、マップページでは関連の深い掲載条件・運営団体・情報提供を
   残し、カテゴリを先にハンバーガーへ収納する */
@media (max-width: 1384px) {
    .site-header__nav {
        display: none;
    }

    .site-header__menu {
        display: flex;
    }
}

@media (max-width: 980px) {
    .site-header__inner {
        height: 56px;
        gap: 8px;
        padding: 0 12px;
    }

    .site-header__logo img {
        height: 36px;
    }

    .site-header__link {
        padding: 6px 8px;
        font-size: 13px;
    }

    .site-header__link.is-button {
        padding: 6px 10px;
    }
}

/* 小さい端末ではボタンとアイコンだけ残す（テキストリンクはドロワーにある）。
   アイコンリンク（Instagramなど）はボタンではないが、文字より場所を取らず
   ドロワーに逃がす必要が無いのでここでは消さない */
@media (max-width: 599px) {
    .site-header__link:not(.is-button):not(.is-icon) {
        display: none;
    }
}

/* サイト名がテキスト表示（ロゴ画像を持たないマップ）で、かつボタンリンクが
   複数あると、1行では幅が足りず右側が見切れることがある（例: てくてくマップ）。
   通常のロゴ画像＋ボタン1個の組み合わせでは1行に収まるため、ここでは折り返しを
   許すだけにとどめ、収まる場合の見た目（実測済みの80px/56pxの高さ）は変えない */
@media (max-width: 480px) {
    .site-header__inner {
        flex-wrap: wrap;
        height: auto;
        min-height: 56px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    /* リンク欄の幅を100%に固定しない。固定すると、ロゴ＋アイコン1個のように
       本来1行に収まる組み合わせまで無条件に2行目へ折り返されてしまう
       （会場マップのヘッダーで実際に発生）。折り返しが要るときだけ
       flex-wrap 側の自然な折り返しに任せる */
    .site-header__links {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    /* サイト名だけでも長いと（例: 会場マップのタイトル）、それだけで
       画面幅を超えて見切れることがある。折り返して複数行にする */
    .site-header__name {
        display: inline-block;
        max-width: calc(100vw - 32px);
        min-width: 0;
        overflow-wrap: break-word;
        line-height: 1.3;
    }
}

/* ------------------------------------------------------------------
 * 一覧表示で足したもの（JS を持たないので、開け閉めは <details> でする）
 * ------------------------------------------------------------------ */

/* ハンバーガーは <summary>。地図の頃の <button> と同じ見た目にし、開いたら × にする */
.site-header__more {
    flex: none;
}

.site-header__more > summary {
    list-style: none;
}

.site-header__more > summary::-webkit-details-marker {
    display: none;
}

.site-header__more[open] .site-header__menu span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.site-header__more[open] .site-header__menu span:nth-child(2) {
    opacity: 0;
}

.site-header__more[open] .site-header__menu span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ドロワーは .site-header（position: relative）の下端から出る */
.site-header__more > .site-drawer {
    z-index: 30;
}

/* 言語の切り替え（倉敷とことこの「🌐 Language ⌄」と同じ形） */
.site-header__lang {
    position: relative;
    flex: none;
}

.site-header__lang > summary {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid rgba(237, 249, 252, .6);
    border-radius: 999px;
    color: #edf9fc;
    font-size: 13px;
    font-weight: bold;
    list-style: none;
    cursor: pointer;
}

.site-header__lang > summary::-webkit-details-marker {
    display: none;
}

.site-header__lang svg {
    flex: none;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
}

.site-header__lang ul {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    min-width: 140px;
    margin: 0;
    padding: 6px 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    list-style: none;
}

.site-header__lang a {
    display: block;
    padding: 8px 16px;
    color: #0f192a;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
}

.site-header__lang a:hover {
    background: #f1f4f8;
}

/* 狭い画面では「Language」の文字を外し、地球の絵だけにする */
@media (max-width: 599px) {
    .site-header__lang-label {
        display: none;
    }
}

:lang(zh-Hans) .site-header {
    font-family: Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

:lang(zh-Hant) .site-header {
    font-family: Roboto, "Helvetica Neue", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}

:lang(ko) .site-header {
    font-family: Roboto, "Helvetica Neue", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}

/* 一覧の帯（.site-header--plain）は別枠のリンクを並べないぶん、カテゴリが1行に収まる幅が
   広い。**いちばん長いのはベトナム語**で、ロゴ200 + カテゴリ811 + 言語105 + すき間32 +
   余白32 = 1180、inner が幅の98%のため 1180 / 0.98 ≒ 1205px（2026-12-03 に6言語を実測。
   日本語は 1169px）。これより狭ければハンバーガーへ。カテゴリの名前を変えたら測り直す */
.site-header--plain .site-header__lang {
    margin-left: auto;
}

@media (min-width: 1210px) {
    .site-header--plain .site-header__nav {
        display: block;
    }

    .site-header--plain .site-header__more {
        display: none;
    }
}

/* スマホは倉敷とことこと同じ 56px にそろえる。上の 480px 以下の折り返し（地図の頃の、
   リンクが並ぶヘッダー向け）は、リンクを並べない一覧の帯では要らない */
@media (max-width: 480px) {
    .site-header--plain .site-header__inner {
        flex-wrap: nowrap;
        height: 56px;
        padding-top: 0;
        padding-bottom: 0;
    }
}
