/* ==========================================
   PHPアプリケーションの長期運用戦略（仮ページ）
   白基調の下層ページ（.top-v2.page-sub）に、要点カード・時間軸・選択肢を追加
   配色はTOPのパネル・アイコン色（青 #5f9cf6 ／紫 #9b7ff0 ／緑 #4fc79d）に合わせる
   ========================================== */
.page-php-longevity {
    --lg-ink: #142949;
    --lg-text: #3f557d;
    --lg-muted: rgba(84, 105, 142, 0.72);
    --lg-line: rgba(124, 149, 189, 0.24);
    --lg-os: #3e5e9b;
    --lg-php: #5f9cf6;
    --lg-php-strong: #3a74d6;
    --lg-laravel: #9b7ff0;
    --lg-symfony: #4fc79d;
    --lg-eol: #c3ccda;
    --lg-today: #ff20ca;
}

.page-php-longevity .lg-section {
    padding: 4.5rem 1.5rem;
}

/* 相談パネル：直前のセクションと同じだけ上に余白をとる */
.page-php-longevity #cta {
    padding: 4.5rem 1.5rem 6rem;
}

.page-php-longevity .philosophy-contact-panel__button {
    margin-top: 0.75rem;
}

.page-php-longevity .lg-conclusion {
    text-align: center;
    max-width: 1100px;
    margin: 0 auto;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border: 1px solid var(--lg-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 24px rgba(43, 63, 101, 0.08);
    color: var(--lg-text);
    font-size: clamp(1rem, 1.3vw, 1.1rem);
    line-height: 1.9;
}

.page-php-longevity .lg-conclusion p + p {
    margin-top: 1rem;
}

.page-php-longevity .lg-conclusion__emphasis {
    color: var(--lg-ink);
    font-size: 1.12em;
    font-weight: 700;
    line-height: 1.8;
}

.page-php-longevity .lg-section--tint {
    background: linear-gradient(180deg, rgba(95, 156, 246, 0.05), rgba(155, 127, 240, 0.05));
}

.page-php-longevity .lg-lead {
    max-width: 760px;
    margin: -1.5rem auto 2.5rem;
    color: var(--lg-text);
    line-height: 1.9;
    text-align: center;
}

.page-php-longevity .lg-lead--after {
    margin: 2rem auto 0;
}

/* ---------- 要点：3つの期間 ---------- */
.lg-spans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 1.25rem;
    max-width: 1100px;
    margin: 0 auto;
}

.lg-span {
    --c: var(--lg-os);
    position: relative;
    padding: 1.6rem 1.5rem 1.4rem;
    border: 1px solid var(--lg-line);
    border-top: 3px solid color-mix(in srgb, var(--c) 55%, transparent);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 20px rgba(43, 63, 101, 0.08);
}

.lg-span--php { --c: var(--lg-php); }
.lg-span--fw { --c: var(--lg-laravel); }

/* 見出しはアイコンの横に、カードの色で */
.lg-span__head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lg-span__icon {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 70%, white));
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 8px 16px color-mix(in srgb, var(--c) 30%, transparent);
}

.lg-span__title {
    color: var(--c);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
}

.lg-span__value {
    margin-top: 1rem;
    color: var(--lg-ink);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;

    & b {
        margin: 0 0.08em;
        color: var(--c);
        font-size: 4rem;
        font-weight: 900;
        letter-spacing: -0.02em;
    }
}

.lg-span__desc {
    margin-top: 0.9rem;
    color: var(--lg-text);
    font-size: 0.92rem;
    line-height: 1.75;
}

.lg-span__value--text {
    min-height: 4rem;
    display: flex;
    align-items: center;
    color: var(--c);
    line-height: 1.5;
}

/* ---------- 時間軸 ---------- */
.lg-chart-panel {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    border: 1px solid var(--lg-line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 24px rgba(43, 63, 101, 0.08);
}

.lg-legend,
.lg-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.2rem;
    color: var(--lg-text);
    font-size: 0.82rem;
}

.lg-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.lg-key {
    display: inline-block;
    width: 1.6rem;
    height: 0.7rem;
    border-radius: 4px;
}

.lg-key--active { background: var(--lg-php-strong); }
.lg-key--sec { background: var(--lg-php); opacity: 0.55; }
.lg-key--eol { background: var(--lg-eol); }
.lg-key--plan { border: 1.5px dashed var(--lg-muted); }
.lg-key--today { width: 2px; height: 1rem; background: var(--lg-today); }

.lg-filter {
    margin: 1rem 0 0.5rem;
    gap: 0.5rem;
}

.lg-filter__item {
    cursor: pointer;

    & input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    & span {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        padding: 0.35rem 0.9rem;
        border: 1px solid var(--lg-line);
        border-radius: 999px;
        color: var(--lg-muted);
        transition: var(--motion-ui-transition);
    }

    & input:checked + span {
        border-color: color-mix(in srgb, var(--c) 45%, transparent);
        background: color-mix(in srgb, var(--c) 10%, white);
        color: var(--lg-ink);
        font-weight: 700;
    }

    & input:focus-visible + span {
        outline: 2px solid var(--lg-php);
        outline-offset: 2px;
    }
}

.lg-filter__item--os, .lg-group--os { --c: var(--lg-os); }
.lg-filter__item--php, .lg-group--php { --c: var(--lg-php); }
.lg-filter__item--laravel, .lg-group--laravel { --c: var(--lg-laravel); }
.lg-filter__item--symfony, .lg-group--symfony { --c: var(--lg-symfony); }

.lg-chart-scroll {
    overflow-x: auto;
    margin-top: 0.5rem;
    padding-bottom: 0.25rem;
}

.lg-chart {
    position: relative;
    min-width: 760px;
    padding-bottom: 0.4rem;
    /* 年の縦線を背景に描き、棒の位置を読み取りやすくする */
    background-image: linear-gradient(90deg, var(--lg-line) 1px, transparent 1px);
    background-size: calc(100% / 12) 100%;
}

.lg-axis {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    padding: 0.5rem 0 0.3rem;
    background: rgba(255, 255, 255, 0.96);
    color: var(--lg-muted);
    font-size: 0.78rem;
    font-weight: 700;
    z-index: 2;

    & span { padding-left: 0.3rem; }
    & .is-now { color: var(--lg-today); }
}

.lg-group {
    padding-top: 0.35rem;

    &[hidden] { display: none; }
}

/* 横スクロールしても分類名が見えるよう左端に固定 */
.lg-group__title {
    position: sticky;
    left: 0;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.3rem 0 0.15rem;
    padding: 0 0.5rem 0 0.2rem;
    background: rgba(255, 255, 255, 0.96);
    color: var(--c);
    font-size: 0.85rem;
    font-weight: 700;
}

/* 1行＝1本の棒。行間は詰めて一覧性を優先 */
.lg-row {
    position: relative;
    height: 1.75rem;
}

.lg-bar {
    --a: 0%;
    position: absolute;
    top: 0.2rem;
    bottom: 0.2rem;
    left: var(--s);
    width: calc(var(--e) - var(--s));
    min-width: 0.5rem;
    display: flex;
    align-items: center;
    border-radius: 6px;
    background: var(--c);
    box-shadow: 0 2px 6px color-mix(in srgb, var(--c) 25%, transparent);
    cursor: pointer;
    transition: filter var(--motion-hover) var(--motion-ease), box-shadow var(--motion-hover) var(--motion-ease);

    &:hover,
    &:focus-visible,
    &.is-tip {
        filter: brightness(1.08);
        box-shadow: 0 0 0 2px #fff, 0 0 0 4px color-mix(in srgb, var(--c) 55%, transparent);
        outline: none;
    }
}

/* PHP本体：通常サポート（濃）とセキュリティサポート（淡）を塗り分け */
.lg-group--php .lg-bar {
    background: linear-gradient(90deg, var(--lg-php-strong) 0 var(--a), color-mix(in srgb, var(--lg-php) 60%, white) var(--a) 100%);
}

.lg-bar__text {
    padding: 0 0.55rem;
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(20, 41, 73, 0.35);
}

/* 詳細はポップアップにだけ出す（読み上げ・検索用に本文には残す） */
.lg-bar__detail {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* 短い棒は名前を棒の右外に出す */
.lg-bar.is-short .lg-bar__text {
    position: absolute;
    left: 100%;
    color: var(--lg-ink);
    text-shadow: none;
}

/* 期間の終わった棒はグレー */
.lg-row.is-eol .lg-bar,
.lg-group--php .lg-row.is-eol .lg-bar {
    background: var(--lg-eol);
    box-shadow: none;
}

.lg-row.is-eol .lg-bar__text,
.lg-row.is-eol .lg-bar.is-short .lg-bar__text {
    color: #5b6b86;
    text-shadow: none;
}

/* 予定・予測は点線の枠 */
.lg-row.is-plan .lg-bar,
.lg-group--php .lg-row.is-plan .lg-bar {
    border: 1.5px dashed color-mix(in srgb, var(--c) 70%, black);
    background: color-mix(in srgb, var(--c) 12%, white);
    box-shadow: none;
}

.lg-row.is-plan .lg-bar__text {
    color: color-mix(in srgb, var(--c) 70%, black);
    text-shadow: none;
}

/* 右端を越える期間は矢印で示す */
.lg-bar.is-over {
    border-radius: 6px 0 0 6px;

    &::after {
        content: '';
        position: absolute;
        right: -0.6rem;
        border-top: 0.65rem solid transparent;
        border-bottom: 0.65rem solid transparent;
        border-left: 0.6rem solid var(--c);
    }
}

/* ロールオーバーの詳細ポップアップ（位置はJSで計算） */
.lg-tip {
    position: fixed;
    z-index: 1000;
    max-width: 17rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--lg-line);
    border-top: 3px solid var(--c, var(--lg-php));
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 30px rgba(35, 55, 93, 0.18);
    color: var(--lg-text);
    font-size: 0.82rem;
    line-height: 1.6;
    pointer-events: none;

    & b { display: block; margin-bottom: 0.2rem; color: var(--lg-ink); font-size: 0.9rem; }
    & span { display: block; }
}

/* OS：延長保守（Debian LTS など）は、通常保守（濃）と延長分（淡）を1本で塗り分け */
.lg-group--os .lg-bar.has-seg {
    background: linear-gradient(90deg, var(--c) 0 var(--a), color-mix(in srgb, var(--c) 35%, white) var(--a) 100%);
}

.lg-bar__seg {
    position: absolute;
    left: var(--a);
    padding: 0 0.5rem;
    color: color-mix(in srgb, var(--c) 80%, black);
    font-size: 0.72rem;
    font-weight: 700;
    pointer-events: none;
}

/* Debian LTS など延長分は淡く */
.lg-bar--ext {
    background: color-mix(in srgb, var(--c) 25%, white);
    box-shadow: none;
}

/* 現在の線（位置は --t：時間軸上の割合） */
.lg-today {
    position: absolute;
    top: 2.2rem;
    bottom: 0;
    left: calc(100% * var(--t));
    width: 2px;
    /* 棒の文字を隠さないよう半透明にし、見出しの「今日」は不透明で上に出す */
    background: color-mix(in srgb, var(--lg-today) 45%, transparent);
    pointer-events: none;
    z-index: 3;

    & span {
        position: absolute;
        top: -1.6rem;
        left: 50%;
        translate: -50% 0;
        padding: 0.05rem 0.45rem;
        border-radius: 999px;
        background: var(--lg-today);
        color: #fff;
        font-size: 0.7rem;
        font-weight: 700;
        white-space: nowrap;
    }
}

.lg-cake {
    margin-top: 1.5rem;
    padding: 1.1rem 1.25rem;
    border-radius: 14px;
    background: rgba(95, 156, 246, 0.06);

    & ul {
        display: grid;
        gap: 0.4rem;
        margin: 0.6rem 0 0;
        padding: 0;
        list-style: none;
        color: var(--lg-text);
        font-size: 0.88rem;
        line-height: 1.7;
    }

    & b {
        display: inline-block;
        min-width: 2.6rem;
        margin-right: 0.5rem;
        color: var(--lg-ink);
    }
}

.lg-cake__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--lg-ink);
    font-size: 0.95rem;
    font-weight: 700;

    & i { color: #e9795b; }
}

.lg-note {
    margin-top: 1rem;
    color: var(--lg-muted);
    font-size: 0.8rem;
    line-height: 1.7;
}

/* 出典は必要なときに開ける一覧にまとめる */
.lg-summary-note {
    max-width: 1100px;
    margin: 1rem auto 0;
    color: var(--lg-text);
}

/* 出典トグル */
.lg-sources {
    max-width: 1200px;
    margin: 1rem auto 0;
    border: 1px solid var(--lg-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 6px 18px rgba(43, 63, 101, 0.06);
    color: var(--lg-text);
    font-size: 0.85rem;
    line-height: 1.8;

    & summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 1.1rem 1.5rem;
        border-radius: 15px;
        color: var(--lg-ink);
        font-size: 0.95rem;
        font-weight: 700;
        list-style: none;
        cursor: pointer;
    }

    & summary::-webkit-details-marker { display: none; }
    & summary:hover { background: rgba(95, 156, 246, 0.06); }

    & summary::after {
        content: '';
        flex-shrink: 0;
        width: 0.6rem;
        height: 0.6rem;
        margin-right: 0.3rem;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        transition: transform var(--motion-hover) var(--motion-ease);
    }

    &[open] summary::after { transform: rotate(225deg); }

    & summary:focus-visible,
    & a:focus-visible {
        outline: 2px solid var(--lg-php-strong);
        outline-offset: 3px;
    }

    & ul {
        display: grid;
        gap: 0.7rem;
        margin: 0.8rem 0 0;
        padding-left: 1.25rem;
    }

    & a {
        color: var(--lg-php-strong);
        text-decoration: underline;
        text-underline-offset: 0.2em;
    }

    & a:hover { color: var(--lg-ink); }
}

.lg-sources__label {
    display: flex;
    align-items: center;
    gap: 0.75rem;

    & i {
        flex-shrink: 0;
        color: var(--lg-os);
        font-size: 1.2rem;
    }
}

.lg-sources__body {
    margin: 0 1.5rem;
    padding: 1rem 0 1.25rem;
    border-top: 1px solid var(--lg-line);
    overflow-wrap: anywhere;
}

/* FWの対応PHP・予測の注記は名前より控えめに */
.lg-bar__text small {
    font-size: 0.92em;
    font-weight: 500;
    opacity: 0.85;
}

/* ---------- 4つのアプローチ ---------- */
.lg-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
}

.lg-option {
    --c: var(--lg-os);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.6rem 1.4rem 1.4rem;
    border: 1px solid var(--lg-line);
    border-top: 4px solid var(--c);
    border-radius: 18px;
    background:
        radial-gradient(circle at 100% 0, color-mix(in srgb, var(--c) 14%, transparent), transparent 55%),
        rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 20px rgba(43, 63, 101, 0.08);
    transition: var(--motion-ui-transition);

    &:hover {
        border-color: color-mix(in srgb, var(--c) 40%, transparent);
        border-top-color: var(--c);
        box-shadow: 0 16px 30px color-mix(in srgb, var(--c) 20%, transparent);
        transform: translateY(var(--motion-panel-lift));
    }

    & h3 {
        min-width: 0;
        margin: 0;
        color: color-mix(in srgb, var(--c) 70%, var(--lg-ink));
        font-size: 1.15rem;
        font-weight: 700;
        line-height: 1.5;
    }

    & dl {
        display: grid;
        gap: 0.9rem;
        margin: 0;
    }

    & dl > div {
        padding: 0.75rem 0.85rem;
        border-radius: 12px;
    }

    & dt {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        margin-bottom: 0.25rem;
        font-size: 0.8rem;
        font-weight: 700;
    }

    & dd {
        margin: 0;
        color: var(--lg-text);
        font-size: 0.88rem;
        line-height: 1.7;
    }

    & .is-merit { background: #eef8f4; }
    & .is-merit dt { color: #2f7a63; }
    & .is-note { background: #fdf3ea; }
    & .is-note dt { color: #a2662f; }
}

.lg-option--1 { --c: var(--lg-os); }
.lg-option--2 { --c: var(--lg-php-strong); }
.lg-option--3 { --c: var(--lg-laravel); }
.lg-option--4 { --c: var(--lg-symfony); }

.lg-option__head {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr);
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.1rem;
}

.lg-option__icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 70%, white));
    color: #fff;
    font-size: 1.2rem;
    box-shadow: 0 8px 16px color-mix(in srgb, var(--c) 30%, transparent);
}

.lg-option__ex {
    margin-top: auto;
    padding-top: 1rem;
    color: var(--lg-ink);
    font-size: 0.82rem;
    font-weight: 700;

    &::before {
        content: '';
        display: block;
        margin-bottom: 0.8rem;
        border-top: 1px dashed var(--lg-line);
    }
}

@media (width <= 767px) {
    .page-php-longevity .lg-section { padding: 3rem 1rem; }
    .lg-chart-panel { padding: 1rem; }
    .lg-sources summary { padding: 1rem; }
    .lg-sources__body { margin-inline: 1rem; }
    .page-php-longevity .lg-lead br { display: none; }
    .page-php-longevity .lg-lead { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .lg-option:hover { transform: none; }
    .lg-sources summary::after { transition: none; }
}

/* LaravelとSymfonyの関係の注記 */
.lg-relation {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-top: 1rem;
    padding: 0.8rem 1.1rem;
    border: 1px solid color-mix(in srgb, var(--lg-symfony) 55%, white);
    border-radius: 12px;
    background: color-mix(in srgb, var(--lg-symfony) 9%, white);
    color: color-mix(in srgb, var(--lg-symfony) 55%, black);
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.7;

    & i { flex-shrink: 0; }
}
