/* 301 History Feature v0.4.0
   Scoped to body.h301-history-feature-enabled so normal posts are untouched. */

.h301-history-feature-enabled {
    --h301-red: #c90000;
    --h301-ink: #121212;
    --h301-muted: #6f6f6f;
    --h301-paper: #ffffff;
    --h301-soft: #f3f3f3;
    --h301-line: #dddddd;
}

html[data-theme="dark"] .h301-history-feature-enabled {
    --h301-ink: #f2f2f2;
    --h301-muted: #a8a8a8;
    --h301-paper: #111214;
    --h301-soft: #1b1c1f;
    --h301-line: #34363a;
}

/* Give the feature room without touching other posts. */
.h301-history-feature-enabled .sidebar-right #sidebar,
.h301-history-feature-enabled .sidebar-left #sidebar {
    display: none !important;
}

.h301-history-feature-enabled #page-wrapper #main {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.h301-history-feature-enabled .post-content {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
    font-size: 18px;
    line-height: 1.82;
}

.h301-history-feature-enabled .post-content > p {
    margin-bottom: 1.35em;
}

/*
 * IMPORTANT: Do not style generic Barcelona .post-title / .post-meta selectors here.
 * The theme reuses those classes for Related/Latest cards on the same single-post page.
 * Feature styling below is limited to h301-* components only.
 */

.h301-wide {
    clear: both;
    width: min(1120px, calc(100vw - 32px));
    max-width: none;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
}

.h301-feature-intro {
    clear: both;
    margin-top: 34px;
    margin-bottom: 58px;
    padding: 30px 0 0;
    border-top: 5px solid var(--h301-red);
    color: var(--h301-ink);
}

.h301-kicker {
    display: inline-block;
    background: var(--h301-red);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: .13em;
    padding: 9px 11px 8px;
    margin-bottom: 14px;
}

.h301-context {
    font-size: clamp(18px, 2.5vw, 30px);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: .02em;
}

.h301-context span {
    color: var(--h301-red);
    padding: 0 5px;
}

.h301-period {
    margin-top: 9px;
    color: var(--h301-muted);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .14em;
}

.h301-intro-line {
    height: 1px;
    background: var(--h301-line);
    margin: 28px 0 20px;
}

.h301-glance-title,
.h301-timeline-title,
.h301-continue-heading {
    font-size: 12px;
    line-height: 1.2;
    font-weight: 900;
    letter-spacing: .14em;
    margin-bottom: 14px;
}

.h301-glance {
    display: grid;
    grid-template-columns: repeat(var(--h301-glance-cols, 5), 1fr);
    border-top: 1px solid var(--h301-line);
    border-bottom: 1px solid var(--h301-line);
}

.h301-glance-item {
    min-height: 86px;
    padding: 17px 18px 16px;
    border-right: 1px solid var(--h301-line);
}

.h301-glance-item:last-child {
    border-right: 0;
}

.h301-glance-item strong,
.h301-glance-item span {
    display: block;
}

.h301-glance-item strong {
    color: var(--h301-red);
    font-size: 12px;
    letter-spacing: .08em;
    margin-bottom: 5px;
}

.h301-glance-item span {
    color: var(--h301-ink);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}


/* WordPress captions and aligned images may float beside body copy. Feature blocks are
 * structural breaks and must always begin below those floats. */
.h301-history-feature-enabled .h301-chapter::before,
.h301-history-feature-enabled .h301-feature-intro::before,
.h301-history-feature-enabled .h301-stats::before,
.h301-history-feature-enabled .h301-timeline::before {
    content: "";
    display: table;
}

.h301-chapter {
    clear: both;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
    gap: 18px;
    margin: 64px 0 28px;
    padding-bottom: 17px;
    border-bottom: 1px solid var(--h301-line);
}

.h301-chapter-number {
    color: var(--h301-red);
    font-size: clamp(46px, 5.2vw, 66px);
    font-weight: 900;
    line-height: .78;
    letter-spacing: -.06em;
}

.h301-chapter-copy {
    padding-bottom: 1px;
}

.h301-chapter-date {
    color: var(--h301-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .13em;
    margin-bottom: 5px;
}

.h301-chapter h2 {
    margin: 0 !important;
    color: var(--h301-ink) !important;
    font-size: clamp(30px, 3.6vw, 46px) !important;
    line-height: 1 !important;
    letter-spacing: -.035em;
}

.h301-stats {
    clear: both;
    display: grid;
    grid-template-columns: repeat(var(--h301-stat-cols, 2), minmax(0, 1fr));
    gap: 1px;
    background: var(--h301-line);
    margin-top: 42px;
    margin-bottom: 54px;
    border: 1px solid var(--h301-line);
}

.h301-stat {
    background: var(--h301-paper);
    padding: clamp(24px, 4vw, 46px);
}

.h301-stat strong,
.h301-stat span {
    display: block;
}

.h301-stat strong {
    color: var(--h301-ink);
    font-size: clamp(38px, 6vw, 72px);
    line-height: .95;
    letter-spacing: -.045em;
    margin-bottom: 12px;
}

.h301-stat span {
    color: var(--h301-muted);
    max-width: 360px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.h301-transition {
    margin-top: 62px;
    margin-bottom: 58px;
    background: var(--h301-ink);
    padding: clamp(38px, 7vw, 82px) clamp(24px, 5vw, 64px);
    text-align: center;
}

.h301-transition span {
    color: var(--h301-paper);
    font-size: clamp(28px, 5.5vw, 66px);
    line-height: .98;
    letter-spacing: -.035em;
    font-weight: 900;
}

html[data-theme="dark"] .h301-transition {
    background: #050505;
}

html[data-theme="dark"] .h301-transition span {
    color: #fff;
}

.h301-section-title {
    margin: 72px 0 30px;
}

.h301-section-rule {
    width: 56px;
    height: 5px;
    background: var(--h301-red);
    margin-bottom: 16px;
}

.h301-section-title h2 {
    margin: 0 !important;
    color: var(--h301-ink) !important;
    font-size: clamp(32px, 4.7vw, 54px) !important;
    line-height: 1 !important;
    letter-spacing: -.03em;
}

.h301-section-title p {
    margin: 11px 0 0 !important;
    color: var(--h301-muted);
    font-size: 15px;
    line-height: 1.45;
}

.h301-note {
    margin-top: 42px;
    margin-bottom: 54px;
    padding: clamp(26px, 4vw, 44px);
    background: var(--h301-soft);
    border-left: 5px solid var(--h301-red);
}

.h301-note-title {
    color: var(--h301-ink);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .12em;
    margin-bottom: 20px;
}

.h301-note-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.h301-note-grid span {
    color: var(--h301-ink);
    background: var(--h301-paper);
    border: 1px solid var(--h301-line);
    padding: 16px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
}

.h301-timeline {
    clear: both;
    margin-top: 64px;
    margin-bottom: 66px;
    padding: clamp(28px, 4vw, 46px);
    background: var(--h301-soft);
}

.h301-timeline-track {
    display: grid;
    grid-template-columns: repeat(var(--h301-timeline-cols, 6), 1fr);
    position: relative;
    padding-top: 24px;
}

.h301-timeline-track::before {
    content: "";
    position: absolute;
    left: 7%;
    right: 7%;
    top: 31px;
    height: 2px;
    background: var(--h301-line);
}

.h301-timeline-item {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0 8px;
}

.h301-dot {
    width: 16px;
    height: 16px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--h301-red);
    box-shadow: 0 0 0 5px var(--h301-soft);
}

.h301-timeline-item strong,
.h301-timeline-item span {
    display: block;
}

.h301-timeline-item strong {
    color: var(--h301-red);
    font-size: 11px;
    letter-spacing: .08em;
    margin-bottom: 4px;
}

.h301-timeline-item span {
    color: var(--h301-ink);
    font-size: 13px;
    line-height: 1.25;
    font-weight: 700;
}

.h301-impact {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--h301-line);
    border: 1px solid var(--h301-line);
    margin-top: 40px;
    margin-bottom: 70px;
}

.h301-impact-item {
    background: var(--h301-paper);
    padding: 26px 24px;
}

.h301-impact-item strong,
.h301-impact-item span {
    display: block;
}

.h301-impact-item strong {
    color: var(--h301-red);
    font-size: 12px;
    letter-spacing: .1em;
    margin-bottom: 8px;
}

.h301-impact-item span {
    color: var(--h301-ink);
    font-size: 15px;
    line-height: 1.35;
    font-weight: 700;
}

.h301-then-now {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 78px;
    margin-bottom: 52px;
    background: #070707;
    color: #fff;
}

.h301-then,
.h301-now {
    min-height: 330px;
    padding: clamp(34px, 5vw, 62px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.h301-then {
    border-right: 1px solid #333;
}

.h301-now {
    background: #111;
}

.h301-tn-year {
    color: var(--h301-red);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .14em;
}

.h301-tn-copy {
    font-size: clamp(28px, 4.5vw, 56px);
    line-height: 1.03;
    letter-spacing: -.035em;
    font-weight: 900;
}

.h301-tn-footer {
    grid-column: 1 / -1;
    border-top: 1px solid #333;
    padding: 20px clamp(34px, 5vw, 62px);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .13em;
}

.h301-continue {
    margin-top: 76px;
    margin-bottom: 28px;
    padding-top: 26px;
    border-top: 5px solid var(--h301-ink);
}

.h301-continue-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.h301-continue-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--h301-ink) !important;
    text-decoration: none !important;
}

.h301-continue-image {
    display: block;
    aspect-ratio: 16 / 9;
    margin-bottom: 14px;
    background-size: cover;
    background-position: center;
    background-color: var(--h301-soft);
    overflow: hidden;
}

.h301-continue-date {
    color: var(--h301-red);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 7px;
}

.h301-continue-card strong {
    color: var(--h301-ink);
    font-size: 18px;
    line-height: 1.25;
}

.h301-continue-link {
    margin-top: 10px;
    color: var(--h301-muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .1em;
}

.h301-continue-card:hover .h301-continue-link {
    color: var(--h301-red);
}

@media (max-width: 900px) {
    .h301-glance {
        grid-template-columns: repeat(2, 1fr);
    }

    .h301-glance-item:nth-child(2n) {
        border-right: 0;
    }

    .h301-glance-item:last-child {
        grid-column: 1 / -1;
        border-top: 1px solid var(--h301-line);
    }

    .h301-note-grid,
    .h301-impact {
        grid-template-columns: repeat(2, 1fr);
    }

    .h301-timeline-track {
        grid-template-columns: repeat(3, 1fr);
        row-gap: 28px;
    }

    .h301-timeline-track::before {
        display: none;
    }
}

@media (max-width: 767px) {
    .h301-history-feature-enabled .post-content {
        font-size: 17px;
        line-height: 1.72;
    }

    .h301-wide {
        width: calc(100vw - 24px);
    }

    .h301-feature-intro {
        margin-top: 24px;
        margin-bottom: 42px;
    }

    .h301-glance {
        grid-template-columns: 1fr;
    }

    .h301-glance-item,
    .h301-glance-item:nth-child(2n),
    .h301-glance-item:last-child {
        min-height: 0;
        grid-column: auto;
        border-right: 0;
        border-top: 1px solid var(--h301-line);
        padding: 13px 4px;
        display: grid;
        grid-template-columns: 78px 1fr;
        gap: 8px;
        align-items: baseline;
    }

    .h301-glance-item:first-child {
        border-top: 0;
    }

    .h301-chapter {
        margin-top: 48px;
        gap: 10px;
    }

    .h301-chapter-number {
        font-size: 56px;
    }

    .h301-stats,
    .h301-note-grid,
    .h301-impact,
    .h301-then-now,
    .h301-continue-grid {
        grid-template-columns: 1fr;
    }

    .h301-transition {
        margin-top: 48px;
        margin-bottom: 42px;
    }

    .h301-timeline-track {
        display: block;
        padding-top: 4px;
    }

    .h301-timeline-item {
        display: grid;
        grid-template-columns: 20px 70px 1fr;
        gap: 10px;
        align-items: center;
        text-align: left;
        padding: 9px 0;
    }

    .h301-dot {
        margin: 0;
        width: 12px;
        height: 12px;
        box-shadow: none;
    }

    .h301-timeline-item strong,
    .h301-timeline-item span {
        margin: 0;
    }

    .h301-then,
    .h301-now {
        min-height: 245px;
    }

    .h301-then {
        border-right: 0;
        border-bottom: 1px solid #333;
    }

    .h301-tn-footer {
        grid-column: auto;
    }
}
