/* ========================================
   History Page Redesign
   ======================================== */

/* Hide the template post title (page content has its own) */
.wp-block-post-title {
    display: none;
}

/* Hero */
.history-hero {
    margin-bottom: 0 !important;
    align-items: flex-end !important;
}

.history-hero .wp-block-cover__inner-container {
    padding-bottom: 60px;
    width: 100%;
}

.history-hero-title {
    letter-spacing: 0.06em;
    text-align: center !important;
    /* Center the title within the left gap of the 800px card */
    max-width: calc((100% - 800px) / 2);
    margin-left: 0 !important;
    margin-right: auto !important;
    padding-left: 40px;
}

/* ========================================
   Intro Card (centered, overlaps hero)
   ======================================== */
.history-intro-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 36px 44px !important;
    margin-top: -50px;
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.history-intro-card p {
    color: #555;
    line-height: 1.8;
    margin: 0;
}

/* ========================================
   Timeline
   ======================================== */
.history-timeline {
    max-width: 1100px;
    margin: 0 auto;
    padding: 60px 20px 80px;
    position: relative;
}

/* Central vertical line */
.history-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 60px;
    bottom: 80px;
    width: 2px;
    background: #C8D6DC;
    transform: translateX(-50%);
}

/* ========================================
   Timeline Entry (CSS Grid - 3 columns)
   ======================================== */
.timeline-entry {
    display: grid;
    grid-template-columns: 1fr 160px 1fr;
    align-items: center;
    position: relative;
    margin-bottom: 36px;
}

.timeline-entry:last-child {
    margin-bottom: 0;
}

/* ========================================
   Center Column - Year Circle
   ======================================== */
.timeline-center {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
}

.timeline-year-circle {
    width: 140px;
    height: 140px;
    background: #3D5A62;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.timeline-year-circle span {
    color: #fff;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* ========================================
   Text Cards
   ======================================== */
.timeline-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
    padding: 28px 32px;
    position: relative;
}

.timeline-card p {
    color: #3D5A62;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.7;
    margin: 0;
}

.timeline-card p + p {
    margin-top: 14px;
}

/* ========================================
   Connector Dots
   ======================================== */

/* Cards on the RIGHT side (odd entries) - dot on left */
.timeline-entry:nth-child(odd) .timeline-right .timeline-card::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 50%;
    width: 14px;
    height: 14px;
    background: #C8D6DC;
    border-radius: 50%;
    transform: translateY(-50%);
}

/* Cards on the LEFT side (even entries) - dot on right */
.timeline-entry:nth-child(even) .timeline-left .timeline-card::after {
    content: '';
    position: absolute;
    right: -22px;
    top: 50%;
    width: 14px;
    height: 14px;
    background: #C8D6DC;
    border-radius: 50%;
    transform: translateY(-50%);
}

/* ========================================
   SVG Icons
   ======================================== */
.timeline-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.timeline-icon img {
    width: 120px;
    height: auto;
    max-height: 120px;
    object-fit: contain;
}

/* ========================================
   Left/Right column alignment
   ======================================== */
.timeline-left {
    display: flex;
    justify-content: flex-end;
    padding-right: 16px;
}

.timeline-right {
    display: flex;
    justify-content: flex-start;
    padding-left: 16px;
}

/* ========================================
   Responsive - Tablet
   ======================================== */
@media (max-width: 900px) {
    .history-intro-card {
        padding: 28px 32px !important;
    }

    .timeline-entry {
        grid-template-columns: 1fr 120px 1fr;
    }

    .timeline-year-circle {
        width: 110px;
        height: 110px;
    }

    .timeline-year-circle span {
        font-size: 1.3rem;
    }

    .timeline-card {
        padding: 22px 24px;
    }

    .timeline-icon img {
        width: 90px;
        max-height: 90px;
    }
}

/* ========================================
   Responsive - Mobile
   ======================================== */
@media (max-width: 768px) {
    .history-hero-title {
        font-size: 2.2rem !important;
    }

    .history-hero .wp-block-cover__inner-container {
        padding-bottom: 50px;
    }

    .history-intro-card {
        margin-top: -40px;
        padding: 24px 20px !important;
        margin-left: 16px;
        margin-right: 16px;
        border-radius: 10px;
    }

    .history-intro-card p {
        font-size: 1rem !important;
    }

    .history-timeline {
        padding: 40px 0 60px;
    }

    /* Vertical line - shifted left */
    .history-timeline::before {
        left: 40px;
        top: 40px;
        bottom: 60px;
    }

    /* Single column layout */
    .timeline-entry {
        grid-template-columns: 80px 1fr;
        grid-template-rows: auto;
        margin-bottom: 32px;
        align-items: start;
    }

    .timeline-center {
        grid-column: 1;
        grid-row: 1;
    }

    .timeline-year-circle {
        width: 80px;
        height: 80px;
    }

    .timeline-year-circle span {
        font-size: 1.1rem;
    }

    /* Text always goes to column 2 */
    .timeline-left,
    .timeline-right {
        padding-left: 16px;
        padding-right: 0;
        justify-content: flex-start;
    }

    /* For odd entries: left has icon (hide), right has card */
    .timeline-entry:nth-child(odd) .timeline-left {
        display: none;
    }

    .timeline-entry:nth-child(odd) .timeline-right {
        grid-column: 2;
        grid-row: 1;
    }

    /* For even entries: left has card, right has icon (hide) */
    .timeline-entry:nth-child(even) .timeline-left {
        grid-column: 2;
        grid-row: 1;
    }

    .timeline-entry:nth-child(even) .timeline-right {
        display: none;
    }

    /* Hide connector dots on mobile */
    .timeline-card::before,
    .timeline-card::after {
        display: none !important;
    }

    .timeline-card {
        padding: 20px;
    }

    .timeline-card p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .history-hero-title {
        font-size: 1.8rem !important;
    }

    .history-hero .wp-block-cover__inner-container {
        padding-bottom: 40px;
    }

    .history-intro-card {
        margin-top: -32px;
        padding: 20px 16px !important;
    }

    .history-timeline {
        padding: 30px 0 40px;
    }

    .history-timeline::before {
        left: 32px;
    }

    .timeline-entry {
        grid-template-columns: 64px 1fr;
        margin-bottom: 24px;
    }

    .timeline-year-circle {
        width: 64px;
        height: 64px;
    }

    .timeline-year-circle span {
        font-size: 0.95rem;
    }
}
