/* 4年間の学びの流れ（帯グラフ）
   「神戸大学」と「一般的な大学」の2つの状態を、ブロックが伸び縮みしながら行き来する。
   各ブロックの高さの比は HTML 側の data-kobe / data-general の数値で決めている。
   同じ列の中での相対比なので、そこだけ書き換えれば配分を調整できる。 */
.yearChart {
    max-width: min(1000px, calc(100% - 40px)); /* 動画・図・時間割と同じ幅 */
    margin: 20px auto 32px;
}

/* --- グラフの上に出す案内の1行 --- */
.yearChart__lead {
    margin: 0 0 8px;
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
    color: #6b7280;
}

/* --- グラフの上に出す状態名 --- */
.yearChart__caption {
    display: grid;          /* 2つの文字を同じ場所に重ねて、入れ替える */
    place-items: center;
    margin: 0 0 10px;
}

.yearChart__captionText {
    grid-area: 1 / 1;
    font-size: 22px;
    font-weight: bold;
    color: #333;
    text-align: center;
}

/* --- 学年の見出し --- */
.yearChart__heads {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.yearChart__head {
    flex: 1;
    min-width: 0;
    background-color: #fff;
    border: 1px solid #333;
    border-radius: 4px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    padding: 9px 0;
}

/* --- 帯本体 --- */
.yearChart__body {
    position: relative; /* 学年をまたぐラベルの基準 */
    display: flex;
    gap: 5px;
    height: 360px;
}

.yearChart__col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.yearChart__seg {
    flex-basis: 0;
    flex-shrink: 1;
    min-height: 0;

    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 0 8px;

    font-size: 28px;
    font-weight: bold;
    color: #333;
    text-align: center;
    line-height: 1.3;

    /* ここが切り替えの本体。高さの比が動くことで、ブロックが伸び縮みして見える。 */
    transition: flex-grow 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 科目区分ごとの色。
   専門科目は1年生から3年生にかけて、青（6C95E8）から明るい青緑（6AD2D9）へ徐々に寄っていく。 */
.yearChart__seg--major1 { background: linear-gradient(100deg, #6c95e8, #67a9e8); }
.yearChart__seg--major2 { background: linear-gradient(100deg, #67a9e8, #68bee1); }
.yearChart__seg--major3 { background: linear-gradient(100deg, #68bee1, #6ad2d9); }
.yearChart__seg--liberal { background-color: #adf9d4; } /* 教養科目 */
.yearChart__seg--thesis  { background-color: #cfa9f2; } /* 卒業研究 */

/* 2つの学年にまたがるラベル。
   幅は「1列ぶん × 2 ＋ 列の間の隙間」＝ 50% - 2.5px。
   左端は、1列ぶんずらすときが 25% + 1.25px。 */
.yearChart__label {
    position: absolute;
    top: 0;
    margin: 0;
    width: calc(50% - 2.5px);

    display: grid;
    place-items: center;

    z-index: 2;
    pointer-events: none;

    transition: left 0.9s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.yearChart__labelText {
    grid-area: 1 / 1;
    font-size: 32px;
    font-weight: bold;
    color: #333;
    text-align: center;
    line-height: 1.5;
}

/* 神戸大学：1年生〜2年生の専門科目にまたがる */
.yearChart[data-state="kobe"] .yearChart__label {
    left: 0;
    height: 80%;
}

/* 一般的な大学：2年生〜3年生の専門科目にまたがる */
.yearChart[data-state="general"] .yearChart__label {
    left: calc(25% + 1.25px);
    height: 85%;
}

/* 3年生の専門科目に食い込む C3 の箱。
   左と上の白い枠が、緑との隙間になっている。 */
.yearChart__seg--major3 {
    position: relative;
}

.yearChart__c3 {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 50%;
    height: 52%;
    box-sizing: border-box;
    border-left: 5px solid #fff;
    border-top: 5px solid #fff;
    border-radius: 6px;
    background-color: #a1c9e4;

    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: #333;

    transform: scale(0.85);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.yearChart[data-state="kobe"] .yearChart__c3 {
    transform: scale(1);
}

.yearChart__c3 sup {
    font-size: 0.6em;
}

/* --- 状態によって出したり消したりする文字 --- */
.yearChart__fade {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.yearChart[data-state="kobe"]    .yearChart__fade[data-show="kobe"],
.yearChart[data-state="general"] .yearChart__fade[data-show="general"] {
    opacity: 1;
}

/* --- 切り替えボタン --- */
.yearChart__switch {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.yearChart__tab {
    padding: 9px 20px;
    border: 1px solid #115;
    border-radius: 4px;
    background-color: #fff;
    color: #115;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.yearChart__tab.is-current {
    background-color: #115;
    color: #fff;
}

/* --- 本文側につける色の凡例 --- */
.yearChart__key {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: -2px;
}

.yearChart__key--major   { background: linear-gradient(100deg, #6c95e8, #6ad2d9); }
.yearChart__key--liberal { background-color: #adf9d4; }
.yearChart__key--c3      { background-color: #a1c9e4; }
.yearChart__key--thesis  { background-color: #cfa9f2; }

/* 色の説明（専門科目・教養科目・C3・卒業研究）が縦に間延びしないよう詰める */
.yearChart-legend .description {
    margin-bottom: 10px;
    line-height: 1.6;
}

.yearChart-legend .description:last-child {
    margin-bottom: 20px;
}

@media (min-width: 1024px) {
    /* PCでは帯グラフが大きすぎるため縮小 */
    .yearChart { max-width: min(820px, calc(100% - 40px)); }
    .yearChart__body { height: 300px; }
    .yearChart__seg { font-size: 22px; }
    .yearChart__labelText { font-size: 25px; }
    .yearChart__c3 { font-size: 25px; }
    .yearChart__captionText { font-size: 19px; }
}

@media (max-width: 1023px) {
    .yearChart__body { height: 300px; }
    .yearChart__seg { font-size: 22px; }
    .yearChart__labelText { font-size: 25px; }
    .yearChart__c3 { font-size: 25px; }
    .yearChart__captionText { font-size: 19px; }
}

@media (max-width: 767px) {
    .yearChart__head { font-size: 12px; padding: 5px 0; }
    .yearChart__body { height: 190px; }
    .yearChart__seg { font-size: 14px; padding: 0 3px; }
    .yearChart__labelText { font-size: 15px; }
    .yearChart__c3 {
        font-size: 13px;
        min-height: 32px;
        border-left-width: 3px;
        border-top-width: 3px;
    }
    .yearChart__captionText { font-size: 15px; }
    .yearChart__tab { font-size: 13px; padding: 7px 12px; }

    /* 色の説明がスマホで縦に伸びすぎないよう、文字と行間・余白を詰める */
    .yearChart-legend .description {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 16px;
    }

    .yearChart-legend .description:last-child {
        margin-bottom: 0;
    }
}

/* 動きを減らす設定にしている人には、切り替えだけ行って動かさない */
@media (prefers-reduced-motion: reduce) {
    .yearChart__seg,
    .yearChart__label,
    .yearChart__c3,
    .yearChart__fade {
        transition: none;
    }
}
