.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
}

.history-intro {
    max-width: 52ch;
    color: var(--muted);
    margin-top: 16px;
    font-size: 17px;
    line-height: 1.8
}

.history-story {
    max-width: 980px;
    margin-inline: auto;
    padding: 28px 0 36px
}

.history-story-head {
    margin-bottom: 40px;
    max-width: 65ch
}

.history-story h2 {
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 700
}

.history-story-head p,
.history-location>div>p {
    margin-top: 10px;
    color: var(--muted)
}

/* ---------- แถบตัวเลขเด่น ---------- */
.history-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 64px
}

.history-stat {
    padding: 24px 16px;
    border-radius: 16px;
    text-align: center;
    background: linear-gradient(135deg, #e6f8f2, #f5fafb);
    border: 1px solid var(--line)
}

.history-stat-num {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    color: var(--teal-d);
    font-family: "Plus Jakarta Sans", var(--thai);
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    font-size: clamp(34px, 5vw, 52px)
}

.history-stat-num span {
    display: inline-block
}

.history-stat-num small {
    font-family: var(--thai);
    font-size: clamp(14px, 1.6vw, 17px);
    font-weight: 600
}

.history-stat-label {
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted)
}

/* ---------- ไทม์ไลน์ ---------- */
.history-timeline {
    list-style: none;
    padding: 0;
    margin: 0
}

.history-step {
    --node-x: 208px;
    --node-size: 22px;
    --node-y: 23px;
    position: relative;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    column-gap: 52px;
    padding-bottom: 72px;
    min-height: 210px
}

.history-step::before {
    content: "";
    position: absolute;
    left: calc(var(--node-x) - 1px);
    top: var(--node-y);
    bottom: calc(0px - var(--node-y));
    width: 2px;
    background: var(--line)
}

.history-step::after {
    content: "";
    position: absolute;
    left: calc(var(--node-x) - 1px);
    top: var(--node-y);
    bottom: calc(0px - var(--node-y));
    width: 2px;
    background: var(--teal);
    transform-origin: top;
    transform: scaleY(var(--fill, 0))
}

.history-step:last-child::before,
.history-step:last-child::after {
    display: none
}

.history-date::after {
    content: "";
    position: absolute;
    z-index: 1;
    left: calc(var(--node-x) - var(--node-size) / 2);
    top: 12px;
    box-sizing: border-box;
    width: var(--node-size);
    height: var(--node-size);
    border-radius: 50%;
    border: 3px solid var(--teal);
    background: #fff;
    transition: background .4s ease
}

.history-step.is-reached .history-date::after {
    background: var(--teal);
    animation: history-ping 1.4s ease-out 1
}

.history-step:last-child.is-reached .history-date::after {
    animation: history-ping 2.2s ease-out infinite
}

.history-date {
    text-align: right;
    color: var(--teal-d);
    font-variant-numeric: tabular-nums
}

.history-era {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px
}

.history-year {
    font-size: clamp(38px, 4vw, 50px);
    font-family: "Plus Jakarta Sans", var(--thai);
    font-weight: 800;
    line-height: 1.2;
    display: block;
    min-width: 4ch
}

.history-year > span {
    display: inline-block;
    background: linear-gradient(135deg, var(--teal), var(--teal-d));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    transition: opacity .4s ease
}

.history-year-end {
    display: block;
    font-size: 16px;
    margin-top: 8px;
    font-weight: 600
}

.history-present {
    display: block;
    font-size: 25px;
    font-weight: 700;
    line-height: 1.5
}

/* การ์ดเนื้อหา */
.history-body {
    padding: 22px 26px 24px;
    margin-top: -6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .10);
    transition: opacity .9s ease, translate .9s cubic-bezier(.2, .7, .2, 1), box-shadow .3s ease
}

.history-body:hover {
    translate: 0 -2px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 16px 32px -14px rgba(15, 23, 42, .18)
}

.history-tag {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    background: #e6f8f2;
    color: var(--teal-d);
    font-size: 12.5px;
    font-weight: 600
}

.history-body h3 {
    font-size: clamp(20px, 2.2vw, 24px);
    margin-bottom: 14px
}

.history-body>p {
    font-size: 16px;
    line-height: 1.95;
    max-width: 65ch;
    color: var(--muted);
    text-wrap: pretty
}

.history-body .history-detail {
    margin-top: 20px;
    color: var(--teal-d);
    font-size: 16px
}

.history-detail b {
    display: inline-block;
    font-size: 28px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding-inline: 3px
}

.history-detail-separator {
    color: #94a3b8;
    padding-inline: 12px
}

.history-step.history-pending .history-body {
    opacity: 0;
    translate: 0 24px
}

/* เอฟเฟกต์ตอนนับ */
[data-count-to].is-counting {
    opacity: .6
}

[data-count-to].is-done {
    animation: history-pop .6s cubic-bezier(.3, 1.6, .5, 1)
}

/* ---------- ส่วนอื่น ๆ ---------- */
.history-location {
    display: flex;
    justify-content: space-between;
    gap: 28px;
    padding: 36px;
    border-radius: 16px;
    background: linear-gradient(120deg, #e6f8f2, #f5fafb);
    margin-top: 12px
}

.history-location address {
    font-style: normal;
    line-height: 1.9;
    align-self: center;
    font-size: 15px;
    color: var(--teal-d)
}

.history-landscape {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    padding-block: 48px
}

.history-landscape h3 {
    font-size: 22px;
    margin-bottom: 22px
}

.history-landscape li+li {
    margin-top: 20px
}

.history-landscape li span {
    display: block;
    font-size: 15px;
    color: var(--muted);
    margin-top: 4px
}

.history-landscape h4 {
    font-size: 16px;
    margin-bottom: 8px
}

.history-landscape p {
    line-height: 1.9;
    max-width: 45ch
}

.history-seasons {
    padding-block: 20px 24px;
    border-top: 1px solid var(--line)
}

.history-season-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
    margin-top: 32px
}

.history-season-list h3 {
    font-size: 20px;
    margin-bottom: 12px
}

.history-season-months {
    color: var(--teal-d);
    font-size: 14px;
    font-weight: 600
}

.history-season-list p {
    font-size: 15px;
    line-height: 1.9;
    margin-top: 12px
}

/* เลื่อนถึงแล้วค่อยเลื่อนขึ้นมา */
[data-reveal] {
    transition: opacity .8s ease, translate .8s cubic-bezier(.2, .7, .2, 1)
}

.reveal-pending {
    opacity: 0;
    translate: 0 20px
}

.history-stats>[data-reveal]:nth-child(2),
.history-landscape>[data-reveal]:nth-child(2),
.history-season-list>[data-reveal]:nth-child(2) {
    transition-delay: .12s
}

.history-stats>[data-reveal]:nth-child(3),
.history-season-list>[data-reveal]:nth-child(3) {
    transition-delay: .24s
}

@keyframes history-ping {
    0% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 50%, transparent)
    }

    100% {
        box-shadow: 0 0 0 18px transparent
    }
}

@keyframes history-pop {
    0% {
        transform: scale(1)
    }

    45% {
        transform: scale(1.12)
    }

    100% {
        transform: scale(1)
    }
}

@media(max-width:700px) {
    .history-story {
        padding-top: 8px
    }

    .history-story-head {
        margin-bottom: 28px
    }

    .history-stats {
        gap: 10px;
        margin-bottom: 44px
    }

    .history-stat {
        padding: 16px 8px
    }

    .history-stat-num {
        flex-direction: column;
        align-items: center;
        gap: 2px;
        font-size: clamp(28px, 9vw, 38px)
    }

    .history-stat-label {
        font-size: 12.5px
    }

    .history-step {
        --node-x: 11px;
        --node-y: 28px;
        grid-template-columns: 1fr;
        padding-left: 32px;
        padding-bottom: 52px;
        min-height: 0
    }

    .history-step::before,
    .history-step::after {
        left: calc(var(--node-x) - 1px);
        top: var(--node-y);
        bottom: calc(0px - var(--node-y))
    }

    .history-date::after {
        left: calc(var(--node-x) - var(--node-size) / 2);
        top: 17px
    }

    .history-date {
        text-align: left;
        display: flex;
        align-items: baseline;
        gap: 10px;
        flex-wrap: wrap;
        margin-bottom: 14px
    }

    .history-era {
        margin: 0
    }

    .history-year {
        font-size: 38px
    }

    .history-year-end {
        margin: 0;
        font-size: 15px
    }

    .history-present {
        font-size: 24px
    }

    .history-body {
        padding: 18px 18px 20px;
        margin-top: 0
    }

    .history-body h3 {
        font-size: 21px
    }

    .history-body>p {
        font-size: 15.5px;
        line-height: 1.9
    }

    .history-location {
        flex-direction: column;
        padding: 26px 22px
    }

    .history-location address {
        align-self: flex-start
    }

    .history-landscape {
        grid-template-columns: 1fr;
        gap: 32px;
        padding-block: 36px
    }

    .history-season-list {
        grid-template-columns: 1fr;
        gap: 28px
    }

    .history-season-list>div+div {
        padding-top: 24px;
        border-top: 1px solid var(--line)
    }
}

@media(prefers-reduced-motion:reduce) {

    .history-step.history-pending .history-body,
    .reveal-pending {
        opacity: 1;
        translate: none
    }

    .history-date::after,
    .history-body,
    [data-reveal] {
        transition: none
    }

    .history-step.is-reached .history-date::after,
    .history-step:last-child.is-reached .history-date::after,
    [data-count-to].is-done {
        animation: none
    }
}

@media print {

    .history-step.history-pending .history-body,
    .reveal-pending {
        opacity: 1;
        translate: none
    }

    .history-step {
        break-inside: avoid
    }

    .history-step::after {
        display: none
    }
}
