.history-page-heading {
max-width: 920px;
}

.history-page-heading h1 {
margin-bottom: 0px;
font-size: 1.25rem;
line-height: 1.75;
letter-spacing: .01em;
}

.history-overview-panel {
margin-bottom: clamp(18px, 3vw, 28px);
}

.history-chart-panel {
margin-bottom: clamp(18px, 3vw, 28px);
}

.history-jump-navigation {
display: flex;
flex-wrap: wrap;
gap: 8px 10px;
align-items: center;
margin: -8px 0 clamp(18px, 3vw, 28px);
padding: 12px 14px;
border: 1px solid rgba(245, 196, 81, .16);
border-radius: 14px;
background: rgba(245, 196, 81, .045);
}

.gold-history-share-section {
padding: 0;
margin: -14px 0 0;
}

.gold-history-share-wrapper {
display: flex;
align-items: center;
justify-content: flex-start;
padding: 0;
background: transparent;
border: none;
}

.gold-history-share-wrapper .social-share-bar {
margin: 0;
width: 100%;
}

.site-footer {
margin-top: 20px;
}

.history-jump-navigation span {
color: var(--muted);
font-size: .85rem;
font-weight: 700;
}

.history-jump-navigation a,
.history-related-links a {
color: #ffe08a;
font-size: .86rem;
font-weight: 700;
text-decoration-thickness: 1px;
text-underline-offset: 3px;
}

.history-jump-navigation a:hover,
.history-related-links a:hover {
color: #fff1bd;
}

.history-jump-navigation a:focus-visible,
.history-related-links a:focus-visible {
outline: 3px solid rgba(98, 215, 255, .8);
outline-offset: 3px;
border-radius: 4px;
}

#gold-history-chart,
#gold-history-summary,
#gold-history-table,
#history-guide,
#faq {
scroll-margin-top: 96px;
}

.history-chart-heading {
max-width: 920px;
}

.history-chart-eyebrow {
margin: 0 0 7px;
color: var(--gold);
font-size: .78rem;
font-weight: 800;
letter-spacing: .12em;
text-transform: uppercase;
}

.history-chart-heading h2 {
margin: 0;
color: #f8f9fb;
font-size: clamp(1.25rem, 2.8vw, 1.85rem);
line-height: 1.35;
}

.history-chart-heading > p:last-child {
margin: 8px 0 0;
color: var(--muted);
}

.history-chart-figure {
margin: 20px 0 0;
}

.history-chart-canvas {
width: 100%;
height: clamp(430px, 48vw, 560px);
min-height: 430px;
overflow: hidden;
border: 1px solid rgba(245, 196, 81, .18);
border-radius: 18px;
background: rgba(6, 10, 17, .72);
}

.history-chart-status,
.history-chart-empty,
.history-chart-figure figcaption {
color: var(--muted);
font-size: .88rem;
}

.history-chart-status {
margin: 10px 0 0;
}

.history-chart-status.is-error,
.history-chart-empty {
color: #ffd0d0;
}

.history-chart-empty {
margin: 18px 0 0;
padding: 15px 17px;
border: 1px solid rgba(255, 125, 125, .28);
border-radius: 14px;
background: rgba(255, 125, 125, .07);
}

.history-chart-figure figcaption {
margin-top: 12px;
line-height: 1.7;
}

.history-chart-guide {
margin-top: 22px;
padding-top: 0;
overflow: hidden;
border: 1px solid rgba(173, 181, 196, .16);
}

.history-chart-guide > summary {
display: flex;
gap: 16px;
align-items: center;
justify-content: space-between;
padding: 18px 20px;
color: #f8f9fb;
font-size: clamp(1.1rem, 2.2vw, 1.4rem);
line-height: 1.45;
}

.history-chart-guide > summary::after {
float: none;
flex: 0 0 auto;
}

.history-chart-guide > summary:focus-visible {
outline: 3px solid rgba(98, 215, 255, .8);
outline-offset: -4px;
border-radius: 12px;
}

.history-chart-guide[open] > summary {
border-bottom: 1px solid var(--line);
}

.history-chart-guide-body {
padding: 0 20px 20px;
}

.history-chart-guide-body > p:first-child {
margin: 18px 0 0;
padding: 0;
color: var(--muted);
line-height: 1.75;
}

.history-chart-label-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
margin: 18px 0 0;
}

.history-chart-label-grid > div {
padding: 14px 16px;
border: 1px solid rgba(173, 181, 196, .16);
border-radius: 14px;
background: rgba(10, 16, 26, .62);
}

.history-chart-label-grid dt {
display: flex;
gap: 9px;
align-items: center;
color: #f8f9fb;
font-weight: 800;
}

.history-chart-label-grid dd {
margin: 6px 0 0 21px;
color: var(--muted);
font-size: .88rem;
line-height: 1.65;
}

.history-chart-swatch {
display: inline-block;
flex: 0 0 12px;
width: 12px;
height: 12px;
border-radius: 50%;
box-shadow: 0 0 0 3px rgba(255, 255, 255, .05);
}

.history-chart-swatch.is-open {
background: #f5a623;
}

.history-chart-swatch.is-low {
background: #ff625b;
}

.history-chart-swatch.is-high {
background: #2fcf79;
}

.history-chart-swatch.is-close {
background: #4c8dff;
}

.history-chart-usage {
margin-top: 18px;
padding: 16px 18px;
border-left: 3px solid rgba(245, 196, 81, .72);
border-radius: 0 14px 14px 0;
background: rgba(245, 196, 81, .055);
}

.history-chart-usage h4 {
margin: 0;
color: #f8f9fb;
font-size: 1rem;
}

.history-chart-usage ol {
margin: 10px 0 0;
padding-left: 22px;
color: var(--muted);
}

.history-chart-usage li {
line-height: 1.7;
}

.history-chart-usage li + li {
margin-top: 7px;
}

.history-chart-usage strong,
.history-chart-source strong,
.history-chart-caution strong {
color: var(--text);
}

.history-chart-guide .history-chart-source,
.history-chart-guide .history-chart-caution {
margin-top: 16px;
padding: 14px 16px;
border-radius: 14px;
}

.history-chart-guide .history-chart-source {
border: 1px solid rgba(245, 196, 81, .22);
background: rgba(245, 196, 81, .06);
}

.history-chart-source a {
color: #ffe08a;
font-weight: 700;
}

.history-chart-guide .history-chart-caution {
border: 1px solid rgba(98, 215, 255, .18);
background: rgba(98, 215, 255, .055);
}

.history-related-links {
display: flex;
flex-wrap: wrap;
gap: 9px 14px;
align-items: center;
margin-top: 18px;
padding-top: 17px;
border-top: 1px dashed rgba(173, 181, 196, .2);
}

.history-related-links strong {
color: var(--text);
font-size: .88rem;
}

.history-article a,
.history-aside a {
color: #ffe08a;
font-weight: 700;
text-decoration-thickness: 1px;
text-underline-offset: 3px;
}

.history-status-message {
margin: 0 0 22px;
padding: 16px 18px;
border: 1px solid rgba(255, 125, 125, .34);
border-radius: 16px;
background: rgba(255, 125, 125, .08);
color: #ffd0d0;
}

.history-data-summary {
display: flex;
flex-wrap: wrap;
gap: 8px 18px;
align-items: center;
color: var(--muted);
}

.history-data-summary strong {
color: var(--text);
}

.history-period-navigation {
margin-top: 24px;
padding-top: 22px;
border-top: 1px solid var(--line);
}

.history-nav-row + .history-nav-row {
margin-top: 20px;
}

.history-nav-row h3 {
margin: 0 0 10px;
font-size: 1rem;
color: var(--text);
}

.history-filter-list {
display: flex;
flex-wrap: wrap;
gap: 9px;
}

.history-filter-button {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 42px;
padding: 9px 14px;
border: 1px solid rgba(245, 196, 81, .28);
border-radius: 999px;
background: rgba(245, 196, 81, .06);
color: #f7e7bd;
font-weight: 700;
line-height: 1.2;
text-decoration: none;
transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.history-filter-button:hover {
transform: translateY(-1px);
border-color: rgba(245, 196, 81, .72);
background: rgba(245, 196, 81, .13);
}

.history-filter-button:focus-visible {
outline: 3px solid rgba(98, 215, 255, .8);
outline-offset: 3px;
}

.history-filter-button.is-active {
border-color: #ffe08a;
background: linear-gradient(135deg, #ffe08a, var(--gold));
box-shadow: 0 10px 30px rgba(245, 196, 81, .22);
color: #2e2100;
}

.history-filter-button.is-active::before {
content: "✓";
margin-right: 6px;
font-weight: 900;
}

.history-nav-empty {
margin: 0;
color: var(--muted);
}

.history-content-grid {
display: grid;
grid-template-columns: minmax(0, 1.45fr) minmax(260px, .75fr);
gap: 22px;
align-items: start;
}

.history-article,
.history-aside {
padding: clamp(22px, 4vw, 38px);
border-radius: var(--radius);
}

.history-article h2,
.history-aside h2 {
margin-top: 0;
}

.history-article h3 {
margin-top: 28px;
}

.history-article p,
.history-article li,
.history-aside p,
.history-aside li {
color: var(--muted);
}

.history-article strong,
.history-aside strong {
color: var(--text);
}

.history-fact-list {
margin: 0;
padding-left: 20px;
}

.history-fact-list li + li {
margin-top: 10px;
}

.top-nav a[aria-current="page"] {
color: var(--gold);
}

@media (max-width: 820px) {
.history-content-grid {
    grid-template-columns: 1fr;
}

.history-filter-button {
    min-height: 44px;
}
}

/* จัดหัวข้อหน้าราคาทองย้อนหลังบนมือถือให้ชิดขอบบนเท่าหน้าราคาทองวันนี้ */
@media (max-width: 640px) {
    #gold-history {
        padding-top: 0;
    }

    #gold-history .history-page-heading {
        margin-bottom: 8px;
    }

    #gold-history .history-page-heading > .eyebrow {
        margin-top: 0;
    }

    .history-chart-canvas {
        height: 430px;
        min-height: 430px;
        border-radius: 14px;
    }

    .history-chart-figure {
        margin-top: 16px;
    }

    .history-jump-navigation {
        margin-top: 0;
        padding: 11px 12px;
    }

    .history-jump-navigation span {
        flex-basis: 100%;
    }

    .history-chart-label-grid {
        grid-template-columns: 1fr;
    }

    .history-chart-guide > summary {
        padding: 15px 14px;
        font-size: 1rem;
    }

    .history-chart-guide-body {
        padding: 0 14px 14px;
    }

    .history-chart-label-grid dd {
        margin-left: 21px;
    }

    .history-chart-usage,
    .history-chart-guide .history-chart-source,
    .history-chart-guide .history-chart-caution {
        padding: 14px;
    }
}


/*** ล่าสุด ***/
.history-summary-change-value.is-positive { color: #8ff0b4; }
.history-summary-change-value.is-negative { color: #ffaaaa; }
.gold-history-table .history-average-label-row th {
    padding: 14px 16px;
    color: #f4f7fb;
    background: rgba(255, 255, 255, .09);
    border-top: 2px solid rgba(245, 196, 81, .7);
    text-align: left;
    white-space: normal;
}
.history-average-label-row strong,
.history-average-label-row small { display: block; }
.history-average-label-row small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 500;
}
.gold-history-table .history-average-value-row th,
.gold-history-table .history-average-value-row td {
    color: #ffe7a1;
    background: linear-gradient(180deg, rgba(255, 217, 111, .2), rgba(233, 165, 18, .13));
    font-weight: 900;
}
.gold-history-table .history-average-value-row th {
    color: #f7e3a7;
    text-align: left;
}
.history-average-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.history-average-value-row .history-change { min-width: 88px; }
.history-price-type-summary + .history-price-type-summary {
    margin-top: 26px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}
.history-period-summary + .history-period-summary {
    margin-top: 24px;
}
.history-monthly-summary-heading {
    margin: 34px 0 18px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}
.history-monthly-summary-heading h2 {
    margin: 0 0 8px;
    color: #f8f9fb;
    font-size: clamp(1.25rem, 2.6vw, 1.75rem);
}
.history-monthly-summary-heading p {
    margin: 0;
    color: var(--muted);
}
.history-year-summary {
    border-color: rgba(245, 196, 81, .42);
}
.history-nav-row.history-annual-nav-row {
    margin-top: 26px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}
.history-price-type-heading { margin: 0 0 16px; }
.history-price-type-heading h4 {
    margin: 0;
    color: #f8f9fb;
    font-size: clamp(1rem, 2.1vw, 1.3rem);
}
.history-price-type-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: .88rem;
}
.history-price-type-summary .gold-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 960px) {
    .history-price-type-summary .gold-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 390px) {
    .history-price-type-summary .gold-summary-grid {
        grid-template-columns: 1fr;
    }
}
/* Versioned 30-day social summary generated by the GTA cron publisher. */
.history-social-image {
    width: min(100%, 1200px);
    margin: 1.25rem auto 1.5rem;
    overflow: hidden;
    border: 1px solid rgba(245, 196, 81, .24);
    border-radius: 22px;
    background: #080b10;
    box-shadow: 0 20px 54px rgba(0, 0, 0, .34);
}

.history-social-image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1200 / 630;
    object-fit: cover;
}

.history-social-image figcaption {
    margin: 0;
    padding: .9rem 1rem;
    color: #aeb8c7;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: clamp(.8rem, 1.2vw, .9rem);
    line-height: 1.72;
}

.history-social-image figcaption strong {
    color: #f5c451;
}

@media (max-width: 640px) {
    .history-social-image {
        margin: 1rem auto 1.25rem;
        border-radius: 15px;
    }

    .history-social-image figcaption {
        padding: .8rem .85rem;
    }
}
