/**
 * History Section Block Styles
 *
 * Full-width white section with a centered vertical timeline. Entries
 * alternate left/right on desktop and stack to a single column on mobile.
 * Entries with description or image expand as accordions.
 *
 * @package ACF Child Theme
 */

:root {
    --color-primary: #3a9bf7;
    --color-grey: #f3f3f3;
    --color-text: #252525;
    --color-white: #ffffff;
    --color-history-line: #1e2a5e;
    --font-primary: 'Montserrat', sans-serif;
}

/* Section wrapper - full-width white background
   ========================================================================== */
.history-section {
    width: 100%;
    margin: 0;
    padding: 80px 0;
    background-color: var(--color-white, #ffffff);
}

.history-section__container {
    max-width: var(--theme-normal-container-max-width, 1290px);
    width: var(--theme-container-width, 100%);
    margin: 0 auto;
    padding: 0;
}

/* Timeline wrapper - holds the central vertical line and decorative end dots
   ========================================================================== */
.history-section__timeline {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0;
}

.history-section__timeline::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 0;
    left: 50%;
    width: 8px;
    margin-left: -3px;
    background-color: var(--color-history-line, #1e2a5e);
    border-radius: 4px;
}

/* Small decorative end dots at the very top and bottom of the line */
.history-section__decor {
    position: absolute;
    left: 50%;
    width: 26px;
    height: 26px;
    margin-left: -12px;
    border-radius: 50%;
    background-color: var(--color-primary, #3a9bf7);
    z-index: 1;
}

.history-section__decor--top {
    top: 0;
}

.history-section__decor--bottom {
    bottom: 0;
}

/* Items list
   ========================================================================== */
.history-section__items {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 70px;
    z-index: 2;
}

.history-section__item {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    column-gap: 80px;
}

/* Circle dot on the line for each item.
   Absolutely positioned so its vertical center always lines up with the
   year text, independent of how tall the content column is. */
.history-section__dot {
    position: absolute;
    top: 20px; /* year line-height (36px * 1.1) / 2 ≈ 20px */
    left: 50%;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: var(--color-primary, #3a9bf7);
    transform: translate(-50%, -50%);
    z-index: 3;
    transition: width 0.3s ease, height 0.3s ease;
}

/* Open state: emphasise the dot for the currently expanded item */
.history-section__item.is-open .history-section__dot {
    width: 36px;
    height: 36px;
}

/* Content column - left or right of the line
   ========================================================================== */
.history-section__content {
    min-width: 0;
}

.history-section__item--left .history-section__content {
    grid-column: 1 / 2;
    text-align: left;
}

.history-section__item--right .history-section__content {
    grid-column: 2 / 3;
    text-align: left;
}

/* Header (toggle button or plain block)
   ========================================================================== */
.history-section__header {
    display: block;
    width: 100%;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    text-align: left;
    color: inherit;
    font: inherit;
}

.history-section__header--button {
    cursor: pointer;
    transition: color 0.3s ease;
}

.history-section__header--button:hover .history-section__title,
.history-section__header--button:focus-visible .history-section__title {
    color: var(--color-primary, #3a9bf7);
}

.history-section__header--button:focus-visible {
    outline: 2px solid var(--color-primary, #3a9bf7);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Row containing the title and the chevron toggle */
.history-section__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

/* Year and title
   ========================================================================== */
.history-section__year {
    display: block;
    font-family: var(--font-primary), 'Montserrat', sans-serif;
    font-size: 36px;
    font-weight: 600;
    line-height: 1.1;
    color: var(--color-primary, #3a9bf7);
    margin: 0 0 10px 0;
    letter-spacing: 0;
}

.history-section__title {
    font-family: var(--font-primary), 'Montserrat', sans-serif;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--color-text, #252525);
    margin: 0;
    transition: color 0.3s ease;
}

/* Chevron icon
   ========================================================================== */
.history-section__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    color: var(--color-primary, #3a9bf7);
    transition: transform 0.3s ease;
}

.history-section__icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Open state: rotate chevron to point down */
.history-section__item.is-open .history-section__icon {
    transform: rotate(90deg);
}

/* Panel (description + image)
   ========================================================================== */
.history-section__panel {
    margin-top: 18px;
}

.history-section__panel[hidden] {
    display: none;
}

.history-section__panel-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.history-section__description {
    font-family: var(--font-primary), 'Montserrat', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text, #252525);
}

.history-section__description p {
    margin: 0 0 10px 0;
}

.history-section__description p:last-child {
    margin-bottom: 0;
}

.history-section__image-wrap {
    margin: 0;
    max-width: 180px;
}

.history-section__item--left .history-section__image-wrap {
    margin-left: auto;
}

.history-section__image {
    display: block;
    width: 100%;
    height: auto;
}

/* Responsive - Tablet
   ========================================================================== */
@media (min-width: 769px) and (max-width: 1023px) {
    .history-section {
        padding: 60px 0;
    }

    .history-section__timeline {
        max-width: 720px;
    }

    .history-section__items {
        gap: 56px;
    }

    .history-section__item {
        column-gap: 60px;
    }

    .history-section__dot {
        top: 17px; /* tablet year line-height (30px * 1.1) / 2 ≈ 16.5px */
    }

    .history-section__year {
        font-size: 30px;
    }

    .history-section__title {
        font-size: 17px;
    }

    .history-section__image-wrap {
        max-width: 160px;
    }
}

/* Responsive - Mobile
   ========================================================================== */
@media (max-width: 768px) {
    .history-section {
        padding: 50px 0;
    }

    .history-section__timeline {
        max-width: none;
        padding: 0;
    }

    /* Move the central line to the left so all items sit on the right */
    .history-section__timeline::before {
        left: 18px;
        margin-left: 0;
        width: 4px;

    }

    .history-section__decor {
        left: 16px;
        margin-left: -8px;
        width: 22px;
        height: 22px;
    }

    .history-section__items {
        gap: 40px;
    }

    /* Single-column layout: dot on the left, content on the right */
    .history-section__item,
    .history-section__item--left,
    .history-section__item--right {
        display: block;
        padding-left: 48px;
        column-gap: 0;
    }

    /* Anchor the dot at the left line and at the year's vertical center */
    .history-section__dot {
        top: 14px; /* mobile year line-height (26px * 1.1) / 2 ≈ 14.3px */
        left: 19px;
        transform: translate(-50%, -50%);
        width: 22px;
        height: 22px;
    }

    .history-section__item.is-open .history-section__dot {
        width: 28px;
        height: 28px;
    }

    .history-section__item--left .history-section__content,
    .history-section__item--right .history-section__content {
        text-align: left;
    }

    .history-section__item--left .history-section__image-wrap {
        margin-left: 0;
    }

    .history-section__year {
        font-size: 26px;
        margin-bottom: 6px;
    }

    .history-section__title {
        font-size: 16px;
    }

    .history-section__icon {
        width: 20px;
        height: 20px;
    }

    .history-section__image-wrap {
        max-width: 150px;
    }
}
