@charset 'utf-8';

/* =============================================================
   会社沿革（/about/history/）
   ============================================================= */
.p-history__body {
    padding: 100px 0 147px;
}

/* 縦線・〇・カードの位置の基準
     --line-x … タイムラインの左端から縦線の中心まで
     --card-x … タイムラインの左端からカードの左端まで
     --dot    … 〇の直径
   1200px のコンテンツ幅では、左に 116px あけて置く（年号の左端がデザインの位置） */
.p-history__timeline {
    --line-x: 120.5px;
    --card-x: 235px;
    --dot: 13px;
    position: relative;
    max-width: 933px;
    margin-left: max(0px, (100% - 968px) / 2);
}

/* --- スクロールで描かれる縦線（長さは script.js で最初と最後の〇の中心に合わせる） --- */
.p-history__track {
    position: absolute;
    top: 37.5px;
    bottom: 0;
    left: calc(var(--line-x) - .5px);
    width: 1px;
    background-color: #dcdfe3;
}

.p-history__track-line {
    display: block;
    width: 100%;
    height: 100%;
    background-color: var(--c-green);
    transform: scaleY(var(--hp, 1));
    transform-origin: top center;
}

/* --- 各年 --- */
.p-history__item {
    position: relative;
    padding-left: var(--card-x);
}

.p-history__item + .p-history__item {
    margin-top: 30px;
}

.p-history__date {
    position: absolute;
    top: 25px;
    left: 0;
    font-family: var(--ff-en);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.22;
    letter-spacing: .1em;
    color: var(--c-green);
}

.p-history__marker {
    position: absolute;
    top: 31px;
    left: calc(var(--line-x) - var(--dot) / 2);
    z-index: 2;
    width: var(--dot);
    height: var(--dot);
    border: 1px solid var(--c-green);
    border-radius: 50%;
    background-color: var(--c-green);
}

/* 〇からカードへ伸びる点線（2px 間隔） */
.p-history__dash {
    position: absolute;
    top: 37px;
    left: calc(var(--line-x) + var(--dot) / 2);
    width: calc(var(--card-x) - var(--line-x) - var(--dot) / 2);
    height: 1px;
    background-image: linear-gradient(to right, var(--c-green) 0 2px, transparent 2px 100%);
    background-size: 4px 1px;
    background-repeat: repeat-x;
    transform-origin: left center;
}

/* 左：見出し・本文 / 右：画像（画像は上下中央） */
.p-history__card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 17px 20px 17px 40px;
    border-radius: 10px;
    background-color: var(--c-white);
}

.p-history__card--img {
    grid-template-columns: minmax(0, 1fr) 204px;
    column-gap: 42px;
}

.p-history__content {
    padding: 8px 0 10px;
}

/* 見出しだけの年（創業）はカードの高さ 75px */
.p-history__card:not(.p-history__card--img) .p-history__content {
    padding: 7px 0 6px;
}

.p-history__ttl {
    font-family: var(--ff-head);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.75;
    letter-spacing: .02em;
    color: var(--c-green);
}

.p-history__text {
    margin-top: 12px;
    font-size: 14px;
    line-height: 2;
    letter-spacing: .05em;
}

.p-history__img {
    display: flex;
    justify-content: center;
    align-self: center;
}

/* 幅は HTML の width（PC の表示サイズ）。狭い画面では列に収める */
.p-history__img img {
    max-width: 100%;
}

/* --- スクロールに合わせた表示（参考：hamabo 会社を知る HISTORY）
   script.js が .is-ready を付けてから隠す。JS が動かなければ最初から全部見せる
     .is-dotIn  … 画面に入った：〇を出す（グレーの線・中は白）
     .is-inview … 画面の 85% より上：点線を伸ばし、年号・本文・画像をふわっと出す
     .is-passed … 伸びてきた縦線の先端（画面の 75%）が届いた：〇を緑に塗る */
.is-ready .p-history__marker {
    border-color: var(--c-gray);
    background-color: var(--c-white);
    opacity: 0;
    transform: scale(.4);
    transition: opacity .4s ease, transform .4s ease, border-color .4s ease, background-color .4s ease;
}

.is-ready .is-dotIn .p-history__marker {
    opacity: 1;
    transform: none;
}

.is-ready .is-passed .p-history__marker {
    border-color: var(--c-green);
    background-color: var(--c-green);
}

.is-ready .p-history__dash {
    transform: scaleX(0);
    transition: transform .7s cubic-bezier(.22, .61, .36, 1);
}

.is-ready .is-inview .p-history__dash {
    transform: none;
    transition-delay: .12s;
}

.is-ready .p-history__date,
.is-ready .p-history__card,
.is-ready .p-history__img {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .8s ease, transform .8s ease;
}

.is-ready .is-inview .p-history__date,
.is-ready .is-inview .p-history__card,
.is-ready .is-inview .p-history__img {
    opacity: 1;
    transform: none;
}

.is-ready .is-inview .p-history__card {
    transition-delay: .14s;
}

.is-ready .is-inview .p-history__img {
    transition-delay: .26s;
}

@media (prefers-reduced-motion: reduce) {
    .is-ready .p-history__marker,
    .is-ready .p-history__dash,
    .is-ready .p-history__date,
    .is-ready .p-history__card,
    .is-ready .p-history__img {
        transition: none;
    }
}

/* =============================================================
   1023px 以下：画像は本文の下
   ============================================================= */
@media screen and (max-width: 1023.98px) {
    .p-history__card--img {
        grid-template-columns: minmax(0, 1fr);
    }

    .p-history__img {
        justify-content: flex-start;
        margin-bottom: 10px;
    }
}

@media screen and (min-width: 768px) and (max-width: 1023.98px) {
    .p-history__body {
        padding-top: 80px;
    }
}

/* =============================================================
   SP：年号は縦線の左に右揃え、カードの枠はなし
   ============================================================= */
@media screen and (max-width: 767.98px) {
    .p-history__body {
        padding: calc(53 * var(--u)) 0 calc(104 * var(--u));
    }

    .p-history__timeline {
        --line-x: calc(66.5 * var(--u));
        --card-x: calc(82 * var(--u));
        --dot: calc(7 * var(--u));
        margin-left: 0;
    }

    .p-history__track {
        top: calc(12.5 * var(--u));
    }

    .p-history__item + .p-history__item {
        margin-top: calc(40 * var(--u));
    }

    .p-history__date {
        top: calc(3 * var(--u));
        width: calc(51 * var(--u));
        font-size: calc(12 * var(--u));
        text-align: right;
    }

    .p-history__marker {
        top: calc(9 * var(--u));
    }

    .p-history__dash {
        display: none;
    }

    .p-history__card {
        display: block;
        padding: 0;
        border-radius: 0;
        background: none;
    }

    /* 見出しだけの年（創業）も余白なし。PC の 75px 用の余白（:not(…--img)）が残ると、見出しが年号・〇より下にずれる（2026-11-17 指摘「ズレ」） */
    .p-history__content,
    .p-history__card:not(.p-history__card--img) .p-history__content {
        padding: 0;
    }

    .p-history__ttl {
        font-size: calc(14 * var(--u));
        line-height: 1.57;
    }

    .p-history__text {
        margin-top: calc(10 * var(--u));
        font-size: calc(13 * var(--u));
        line-height: 1.85;
    }

    .p-history__img {
        margin: calc(15 * var(--u)) 0 0;
    }

    .p-history__img img {
        width: auto;
        height: calc(104 * var(--u));
    }

    .is-ready .p-history__date,
    .is-ready .p-history__card,
    .is-ready .p-history__img {
        transform: translateY(calc(12 * var(--u)));
    }
}
