@charset "UTF-8";

@media all and (max-width: 768px) {
    .footer {
        margin-top: 120px;
    }

    figure {
        margin: 1em 0;
    }

    .photo-set {
        margin: 1.5em 0;
    }

    .photo-row,
    .photo-row.columns-2 {
        grid-template-columns: 1fr;
        gap: 0.8em;
    }

    /* レイアウト↓ */
    .chapter-body {
        display: block;
        margin: 0;
        padding: 0 10px 20px;
    }

    .chapter-toc,
    .chapter-content {
        grid-area: auto;
    }

    .chapter-toc {
        position: sticky;
        top: 0;
        z-index: 100;
        box-sizing: border-box;
        width: auto;
        margin: 0 -10px 20px;
        border: 0;
        border-top: 1px solid #ddd;
        background: #3c5d8a;
    }

    .chapter-content {
        width: auto;
        margin: 0;
    }

    /* レイアウト↑ */

    /* ヘッダ↓ */
    .chapter-header {
        height: 100px;
    }

    .chapter-meta {
        line-height: .75em;
    }

    .chapter-header p {
        font-size: 0.75em;
        margin: 24px 0 0;
    }

    .chapter-header h1 {
        font-weight: 500;
        margin: 0;
    }

    .chapter-body {
        width: 95%;
    }

    /* ヘッダ↑ */

    /* 目次↓ */
    /* ボタン本体 */
    .toc-toggle {
        position: relative;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 18px;
        width: 100%;
        min-height: 52px;
        padding: 0 14px;
        border: 0;
        background: #3c5d8a;
        color: #fff;
        font: inherit;
        cursor: pointer;
    }

    .toc-toggle__text {
        font-family: var(--font-gothic);
        font-size: 1em;
    }

    /* ハンバーガー */
    .toc-toggle__icon {
        position: relative;
        display: inline-block;
        width: 28px;
        height: 22px;
        color: #fff;
    }

    .toc-toggle__icon span {
        position: absolute;
        left: 0;
        width: 100%;
        height: 2px;
        background: currentColor;
        transition:
            transform 0.25s ease,
            opacity 0.25s ease,
            top 0.25s ease;
    }

    .toc-toggle__icon span:nth-child(1) {
        top: 2px;
    }

    .toc-toggle__icon span:nth-child(2) {
        top: 10px;
    }

    .toc-toggle__icon span:nth-child(3) {
        top: 18px;
    }

    /* 開いた時は × */
    .chapter-toc.is-open .toc-toggle__icon span:nth-child(1) {
        top: 10px;
        transform: rotate(45deg);
    }


    .chapter-toc.is-open .toc-toggle__icon span:nth-child(2) {
        opacity: 0;
    }

    .chapter-toc.is-open .toc-toggle__icon span:nth-child(3) {
        top: 10px;
        transform: rotate(-45deg);
    }


    /* 開閉パネル：displayではなくmax-heightでスライド */
    .toc-panel {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1;

        overflow: hidden;
        max-height: 0;
        opacity: 0;
        background: #8fa6c8;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);

        transition:
            max-height 0.55s ease,
            opacity 0.35s ease;
    }

    .chapter-toc.is-open .toc-panel {
        max-height: calc(100vh - 52px);
        opacity: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 中のタイトル帯は使わない */
    .toc-title {
        display: none;
    }

    /* リスト全体 */
    .chapter-toc ul {
        margin: 0;
        padding: 0;
        text-align: center;
    }

    /* 各項目 */
    .chapter-toc ul li {
        list-style: none;
        margin: 0;
        padding: 0;
        border-top: 1px solid #a5b7d8;
        border-bottom: 0px;
        font-family: var(--font-gothic);
        font-size: 1em;
        line-height: 1;
    }

    /* PC用の矢印は消す */
    .chapter-toc ul li::before {
        content: none;
        display: none;
    }

    /* リンク */
    .chapter-toc ul li a {
        display: block;
        padding: 0.75em 1em;
        color: #fff;
        text-decoration: none;
    }

    /* visited でも白 */
    .chapter-toc ul li a:link,
    .chapter-toc ul li a:visited {
        color: #fff;
    }

    /* hover / tap 時 */
    .chapter-toc ul li a:hover,
    .chapter-toc ul li a:focus {
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
    }

    /* sticky状態・閉じている時だけ、小さなアイコンボタンにする */
    .chapter-toc.is-stuck:not(.is-open) {
        background: transparent;
        border-top: 0;
        pointer-events: none;
    }

    .chapter-toc.is-stuck:not(.is-open) .toc-toggle {
        width: 52px;
        min-width: 52px;
        height: 52px;
        margin-left: auto;
        padding: 0 12px;
        justify-content: center;
        gap: 0;
        background: #3c5d8a;
        pointer-events: auto;
    }

    /* 「目次」の文字だけ消す */
    .chapter-toc.is-stuck:not(.is-open) .toc-toggle__text {
        display: none;
    }

    /* 開いた時は通常の横長バーに戻す */
    .chapter-toc.is-stuck.is-open {
        background: #3c5d8a;
        border-top: 1px solid #ddd;
    }

    .chapter-toc.is-stuck.is-open .toc-toggle {
        width: 100%;
        min-width: 0;
        margin-left: 0;
        padding: 0 14px;
        justify-content: flex-end;
        gap: 18px;
    }

    .chapter-toc.is-stuck.is-open .toc-toggle__text {
        display: inline;
    }

    .chapter-toc.is-stuck:not(.is-open) {
        pointer-events: none;
    }

    .chapter-toc.is-stuck:not(.is-open) .toc-toggle {
        pointer-events: auto;
    }

    /* 目次↑ */

    /* 本文 */
    .chapter-content>section[id]>h2 {
        font-size: 1.3em;
    }

    article {
        position: relative;
        z-index: 1;
    }
}