@charset "utf-8";

/* ====================================================================
 共同募金80年の歩み（/bokin/history/80th/）
 1rem = 10px（html が 62.5%）。文字サイズ切替に追従させるため文字は rem で指定。
 時代ごとに箱 1 つ。PC（≥960px）は中央線の左右に交互配置、959px 以下は線を左に寄せて 1 列。
==================================================================== */

#contents.history_80th {
    --h80-red: #e10010;
    --h80-text: #535353;
    --h80-sub: #8a8174;       /* 副題・キャプション */
    --h80-bg: #fffaf3;        /* 年表の地色 */
    --h80-line: #e2dace;      /* 中央線 */
    --h80-dot: #cfc6b9;       /* 点線 */
    --h80-box: #ffffff;
    --h80-box-border: #d9d1c5;
    --h80-nav-text: #6b6352;
    --h80-nav-bg: rgba(255, 255, 255, .96);

    --h80-gap: 96px;          /* PC の左右の箱の間隔（中央線を挟む） */
    --h80-line-x: 20px;       /* 959px 以下での線の位置 */
    --h80-indent: 48px;       /* 959px 以下での箱の左位置 */
}

/* 背景色切替（main.js が body に付けるクラス）
----------------------------------------------------------*/
body.bg-black #contents.history_80th {
    --h80-text: #ffffff;
    --h80-sub: #d0d0d0;
    --h80-bg: transparent;
    --h80-line: #6a6a6a;
    --h80-dot: #8a8a8a;
    --h80-box: #444444;
    --h80-box-border: #6a6a6a;
    --h80-nav-text: #ffffff;
    --h80-nav-bg: rgba(51, 51, 51, .96);
}

body.bg-yellow #contents.history_80th {
    --h80-text: #333333;
    --h80-sub: #5e5540;
    --h80-bg: transparent;
    --h80-line: #ffffff;
    --h80-dot: #8c7a2e;
    --h80-box-border: #c2a800;
    --h80-nav-text: #333333;
    --h80-nav-bg: rgba(254, 215, 0, .96);
}


/* ページタイトル（h1）
   タイトルに <br> を含む。SP で「一緒/に。」「サイ/ト」のように語の途中で折り返さないよう、
   句読点・空白の位置でだけ折り返す（収まらないときは overflow-wrap で任意位置）
----------------------------------------------------------*/
#contents.history_80th h1 {
    word-break: keep-all;
    overflow-wrap: anywhere;
}


/* 年表の見出し（h2「共同募金の歴史」）
   装飾は main.css の #contents h2 のまま。full-width で左右の余白が無いので、
   通常の .editor-output（70th ページ等）と同じ余白を付ける
----------------------------------------------------------*/
#contents .h80 .h80_heading {
    margin: 0 50px 40px;
}

@media print,
screen and (max-width: 959px) {
    #contents .h80 .h80_heading {
        margin: 0 15px 30px;
    }
}


/* h2 の下の右寄せリンク（70 年の歩みへ）。h2 の下余白（40px）に食い込ませて見出しに寄せる */
#contents .h80 .h80_more {
    margin: 24px 50px 30px;
    font-size: 1.5rem;
    text-align: right;
}

@media print,
screen and (max-width: 959px) {
    #contents .h80 .h80_more {
        margin: 16px 15px 24px;
        font-size: 1.4rem;
    }
}


/* 動画（YouTube。16:9 で幅に合わせて伸縮）
----------------------------------------------------------*/
#contents .h80_movie {
    max-width: 800px;
    margin: 0 auto 50px;
    padding: 0 50px;
}

#contents .h80_movie iframe {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
}

@media print,
screen and (max-width: 959px) {
    #contents .h80_movie {
        margin-bottom: 30px;
        padding: 0 15px;
    }
}


/* 80 周年ロゴ（動画の下）
----------------------------------------------------------*/
#contents .h80 .h80_logo {
    margin: 0 0 50px;
    text-align: center;
}

#contents .h80_logo img {
    display: inline-block;
    width: 260px;
    max-width: 60%;
    height: auto;
}

/* 黒背景ではロゴの灰色の文字が沈むので白地に載せる */
body.bg-black #contents .h80_logo img {
    padding: 16px 20px;
    border-radius: 4px;
    background: #ffffff;
    box-sizing: content-box;
}

@media print,
screen and (max-width: 959px) {
    #contents .h80 .h80_logo {
        margin-bottom: 30px;
    }

    #contents .h80_logo img {
        width: 200px;
    }
}


/* 時代ナビ
----------------------------------------------------------*/
#contents .h80_nav {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--h80-nav-bg);
    border-top: 1px solid var(--h80-box-border);
    border-bottom: 3px solid var(--h80-red);
}

#contents .h80 .h80_nav_list {
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

#contents .h80_nav_list li {
    flex: 0 0 auto;
}

#contents .h80_nav_list li + li {
    border-left: 1px solid var(--h80-box-border);
}

#contents .h80 a.h80_nav_link {
    display: block;
    padding: 14px 16px 12px;
    color: var(--h80-nav-text);
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: color .2s;
}

#contents .h80 a.h80_nav_link:hover,
#contents .h80 a.h80_nav_link:focus-visible,
#contents .h80 a.h80_nav_link.is-current {
    color: var(--h80-red);
}

#contents .h80 a.h80_nav_link.is-current {
    box-shadow: inset 0 -4px 0 var(--h80-red);
}

body.bg-yellow #contents .h80 a.h80_nav_link:hover,
body.bg-yellow #contents .h80 a.h80_nav_link.is-current {
    color: #000000;
}

/* 黒背景では赤文字が読みにくいので白にする（下線の赤で現在地を示す） */
body.bg-black #contents .h80 a.h80_nav_link:hover,
body.bg-black #contents .h80 a.h80_nav_link.is-current {
    color: #ffffff;
}


/* 年表全体・中央線
----------------------------------------------------------*/
#contents .h80_timeline {
    position: relative;
    padding: 50px 0 40px;
    background: var(--h80-bg);
}

#contents .h80_timeline::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    z-index: 1;
    width: 4px;
    margin-left: -2px;
    background: var(--h80-line);
    content: "";
}


/* 時代の箱（PC: 2 列・左右交互）
----------------------------------------------------------*/
#contents .h80 .h80_items {
    display: grid;
    /* 1fr だと画像の実寸が最小幅になり列が広がるため minmax(0, 1fr) */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--h80-gap);
    row-gap: 16px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    list-style: none;
}

/* 箱は --h80-row 行目から 2 行使う（行と左右はテンプレートが決める）。
   行の高さは中身から決まるので、左右の箱が半分ずつずれて並ぶ。
   ※ 最後の箱も 2 行使うため、年表の末尾に「最後の箱の半分」程度の余白ができる。
     1 行にすると直前の箱とずれなくなる（同じ高さに並ぶ）ので、この余白は許容する */
#contents .h80_item {
    position: relative;
    grid-row: var(--h80-row) / span 2;
    align-self: start;
    scroll-margin-top: 70px;   /* JS が無いときのアンカー位置（ナビの高さ分） */
}

#contents .h80_item--left {
    grid-column: 1;
}

#contents .h80_item--right {
    grid-column: 2;
}

/* 箱から中央線への点線（時代名のラベルの高さに合わせる） */
#contents .h80_item::before {
    position: absolute;
    top: 34px;
    width: calc(var(--h80-gap) / 2);
    border-top: 2px dotted var(--h80-dot);
    content: "";
}

/* 中央線上の ◆（border-box なので枠込みで 14px。中心は 7px） */
#contents .h80_item::after {
    position: absolute;
    top: 28px;
    z-index: 2;
    width: 14px;
    height: 14px;
    border: 2px solid var(--h80-box);
    background: var(--h80-red);
    transform: rotate(45deg);
    content: "";
}

#contents .h80_item--left::before {
    left: 100%;
}

#contents .h80_item--left::after {
    left: calc(100% + var(--h80-gap) / 2 - 7px);
}

#contents .h80_item--right::before {
    right: 100%;
}

#contents .h80_item--right::after {
    right: calc(100% + var(--h80-gap) / 2 - 7px);
}


/* 箱の中身
----------------------------------------------------------*/
#contents .h80_box {
    padding: 22px 24px 24px;
    border: 1px solid var(--h80-box-border);
    border-radius: 4px;
    background: var(--h80-box);
    color: var(--h80-text);
}

/* 時代名（h3。main.css の #contents h3 の下線装飾・余白を打消） */
#contents .h80 .h80_box .h80_era {
    clear: none;
    margin: 0 0 16px;
    padding: 0;
    border: 0;
    font-size: 1.4rem;
    font-weight: normal;
    line-height: 1.4;
}

#contents .h80 .h80_box .h80_era::after {
    display: none;
}

#contents .h80_era_label {
    display: inline-block;
    padding: 6px 16px 5px;
    border-radius: 3px;
    background: var(--h80-red);
    color: #ffffff;
    font-size: 2.0rem;
    font-weight: bold;
    letter-spacing: .06em;
}

#contents .h80_era_sub {
    display: block;
    margin-top: 10px;
    color: var(--h80-text);
    font-size: 1.8rem;
    font-weight: bold;
}

#contents .h80 .h80_box .h80_text {
    margin: 0 0 1em;
    color: var(--h80-text);
    font-size: 1.5rem;
    line-height: 1.9;
}

#contents .h80 .h80_box .h80_text:last-of-type {
    margin-bottom: 0;
}

/* 画像（1 枚は幅いっぱい、2 枚は横並びで高さを揃える。比率は元画像のまま＝切り抜かない） */
#contents .h80_figs {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    margin-top: 18px;
}

/* 2 枚並び: 幅を各画像の縦横比（--h80-ar = 幅÷高さ。テンプレートが出力）で分けると、
   比率を保ったまま高さが揃う（切り抜かない）。比率が無い画像は 1（正方形扱い） */
#contents .h80_figs--2 {
    display: flex;
    align-items: flex-start;
}

#contents .h80_figs--2 .h80_fig {
    flex: var(--h80-ar, 1) 1 0%;
    min-width: 0;
}

/* underlayer.css の figure { display: table; width: 320px; } を打消 */
#contents .h80_fig {
    display: block;
    width: auto;
    margin: 0;
}

#contents .h80_fig img {
    display: block;
    width: 100%;
    height: auto;
}

/* 1 枚のときは縦長の画像（ポスター等）が大きくなりすぎないよう高さを抑え、左右中央に置く */
#contents .h80_figs--1 .h80_fig img {
    width: auto;
    max-width: 100%;
    max-height: 480px;
    margin: 0 auto;
}

#contents .h80_fig figcaption {
    margin-top: 6px;
    color: var(--h80-sub);
    font-size: 1.3rem;
    line-height: 1.5;
}

#contents .h80_fig figcaption::before {
    margin-right: 3px;
    color: var(--h80-red);
    content: "◆";
}

/* 本文の最後のリンク（右寄せ。70 年の歩みへのリンクと同じ扱い） */
#contents .h80 .h80_box .h80_link {
    margin: 18px 0 0;
    font-size: 1.5rem;
    text-align: right;
    text-wrap: balance;   /* 折り返すときに「こち/ら」のように 1〜2 文字だけ残さない */
}

/* 黒背景では赤い文字が箱の地色（#444）に沈むので白にする */
body.bg-black #contents .h80_link a {
    color: #ffffff;
}


/* フェードイン・フェードアウト
   JS が .h80 に .is-js を付けたときだけ隠す（JS が動かないときは常に表示）。
   画面内に入ると JS が .is-inview を付け、出ると外す。
----------------------------------------------------------*/
#contents .h80.is-js .h80_fade {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity .7s ease, transform .7s ease;
}

#contents .h80.is-js .h80_fade.is-inview {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    #contents .h80.is-js .h80_fade {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

@media print {
    #contents .h80.is-js .h80_fade {
        opacity: 1;
        transform: none;
    }

    #contents .h80_nav {
        display: none;
    }
}


/* 959px 以下: 線を左に寄せて 1 列
----------------------------------------------------------*/
@media print,
screen and (max-width: 959px) {
    #contents .h80_timeline {
        padding-top: 30px;
    }

    #contents .h80_timeline::before {
        left: calc(15px + var(--h80-line-x));
    }

    #contents .h80 .h80_nav_list {
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    #contents .h80 a.h80_nav_link {
        padding: 14px 14px 12px;
        font-size: 1.4rem;
    }

    #contents .h80 .h80_items {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 24px;
        padding: 0 15px 0 calc(15px + var(--h80-indent));
    }

    #contents .h80_item,
    #contents .h80_item--left,
    #contents .h80_item--right {
        grid-column: 1;
        grid-row: auto;
    }

    #contents .h80_item--left::before,
    #contents .h80_item--right::before {
        right: 100%;
        left: auto;
        width: calc(var(--h80-indent) - var(--h80-line-x));
    }

    #contents .h80_item--left::after,
    #contents .h80_item--right::after {
        right: calc(100% + var(--h80-indent) - var(--h80-line-x) - 7px);
        left: auto;
    }

    #contents .h80_box {
        padding: 18px 18px 20px;
    }
}

@media print,
screen and (max-width: 599px) {
    #contents .h80_era_label {
        font-size: 1.8rem;
    }

    #contents .h80_era_sub {
        font-size: 1.6rem;
    }

    #contents .h80 .h80_box .h80_text {
        font-size: 1.4rem;
    }

    #contents .h80 .h80_box .h80_link {
        font-size: 1.4rem;
    }

    #contents .h80_figs {
        gap: 8px;
    }

    #contents .h80_fig figcaption {
        font-size: 1.2rem;
    }
}
