/* ============================================
   History Page — Structured Corporate Layout
   ============================================ */

/* ---- Sections ---- */
.history-section {
    padding: var(--space-4xl) 0;
    position: relative;
}

.history-section--alt {
    background: var(--color-bg-soft);
}

/* ---- Block (section content wrapper) ---- */
.history-block {
    max-width: 860px;
    margin: 0 auto;
}

.history-block__heading {
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-neutral);
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--color-primary);
    display: inline-block;
}

.history-block__content p {
    font-size: var(--text-base);
    color: var(--color-neutral);
    line-height: 1.8;
    margin-bottom: var(--space-lg);
}

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

.history-block__content strong {
    color: var(--color-neutral);
    font-weight: var(--font-weight-semibold);
}

.history-block__empty {
    font-size: var(--text-base);
    color: var(--color-gray);
    font-style: italic;
}

/* ---- Departments Grid ---- */
.history-departments {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
    margin: var(--space-xl) 0;
}

.history-dept {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xl) var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-light-gray);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: border-color var(--duration-hover) var(--ease-smooth),
                transform var(--duration-hover) var(--ease-smooth);
}

.history-dept:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.history-dept svg {
    color: var(--color-secondary);
    flex-shrink: 0;
}

.history-dept span {
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-neutral);
    letter-spacing: 0.01em;
}

/* ---- Associated Company Card ---- */
.history-associate {
    background: var(--color-surface);
    border: 1px solid var(--color-light-gray);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
}

.history-associate__header {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-light-gray);
}

.history-associate__name {
    font-size: var(--text-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-neutral);
    margin-bottom: var(--space-xs);
}

.history-associate__type {
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-secondary);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.history-associate p {
    font-size: var(--text-base);
    color: var(--color-neutral);
    line-height: 1.8;
    margin-bottom: var(--space-lg);
}

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

/* ---- Activities Grid ---- */
.history-activities {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
}

.history-activity {
    background: var(--color-surface);
    border: 1px solid var(--color-light-gray);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: border-color var(--duration-hover) var(--ease-smooth),
                transform var(--duration-hover) var(--ease-smooth);
}

.history-activity:hover {
    border-color: var(--color-primary);
    transform: translateY(-3px);
}

.history-activity__icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 26, 43, 0.1);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    color: var(--color-primary-light);
}

.history-activity h4 {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-neutral);
    margin-bottom: var(--space-sm);
    line-height: 1.35;
}

.history-activity p {
    font-size: var(--text-sm);
    color: var(--color-neutral-lighter);
    line-height: 1.7;
    margin-bottom: 0;
}

/* ============================================
   Project Timeline (vertical, left-aligned)
   ============================================ */
.project-timeline {
    position: relative;
    padding-left: 2.5rem;
}

.project-timeline__line {
    position: absolute;
    left: 0.5rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background: linear-gradient(180deg,
        var(--color-primary) 0%,
        var(--color-primary-dark) 50%,
        var(--color-primary) 100%);
    opacity: 0.3;
}

.project-timeline__item {
    position: relative;
    display: flex;
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

.project-timeline__item:last-child {
    margin-bottom: 0;
}

.project-timeline__marker {
    position: absolute;
    left: -2.5rem;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.project-timeline__year {
    font-size: var(--text-xs);
    font-weight: var(--font-weight-extrabold);
    color: var(--color-secondary);
    letter-spacing: 0.04em;
    white-space: nowrap;
    width: 2rem;
    text-align: center;
}

.project-timeline__dot {
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    border: 2px solid var(--color-bg-soft);
    border-radius: 50%;
    margin-top: var(--space-xs);
    box-shadow: 0 0 0 3px rgba(139, 26, 43, 0.15);
    transition: transform var(--duration-hover) var(--ease-smooth),
                box-shadow var(--duration-hover) var(--ease-smooth);
}

.project-timeline__item:hover .project-timeline__dot {
    transform: scale(1.4);
    box-shadow: 0 0 0 5px rgba(139, 26, 43, 0.25);
}

.project-timeline__card {
    flex: 1;
    background: var(--color-surface);
    border: 1px solid var(--color-light-gray);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform var(--duration-hover) var(--ease-smooth),
                box-shadow var(--duration-hover) var(--ease-smooth),
                border-color var(--duration-hover) var(--ease-smooth);
}

.project-timeline__card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--color-primary);
}

.project-timeline__image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.project-timeline__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-hover) var(--ease-smooth);
}

.project-timeline__card:hover .project-timeline__image img {
    transform: scale(1.03);
}

.project-timeline__body {
    padding: var(--space-lg) var(--space-xl);
}

.project-timeline__title {
    font-size: var(--text-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-neutral);
    margin-bottom: var(--space-xs);
    line-height: 1.35;
}

.project-timeline__location {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: var(--text-sm);
    color: var(--color-secondary);
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--space-sm);
}

.project-timeline__location svg {
    flex-shrink: 0;
}

.project-timeline__desc {
    font-size: var(--text-sm);
    color: var(--color-neutral-lighter);
    line-height: 1.7;
}

/* ---- Meta row (location + type + status) ---- */
.project-timeline__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.project-timeline__type {
    font-size: 0.6875rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-neutral-lighter);
    background: var(--color-off-white);
    padding: 0.15rem 0.55rem;
    border-radius: 100px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.project-timeline__status {
    font-size: 0.6875rem;
    font-weight: var(--font-weight-bold);
    padding: 0.15rem 0.55rem;
    border-radius: 100px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.project-timeline__status--completed {
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
}

.project-timeline__status--ongoing {
    color: var(--color-secondary);
    background: rgba(196, 155, 12, 0.1);
}

/* ---- View Details Button ---- */
.project-timeline__details-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: var(--space-md);
    padding: 0.4rem 0.85rem;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary-light);
    background: rgba(139, 26, 43, 0.08);
    border: 1px solid rgba(139, 26, 43, 0.2);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-hover) var(--ease-smooth),
                color var(--duration-hover) var(--ease-smooth),
                border-color var(--duration-hover) var(--ease-smooth);
}

.project-timeline__details-btn:hover {
    background: rgba(139, 26, 43, 0.15);
    border-color: rgba(139, 26, 43, 0.35);
    color: var(--color-primary);
}

.project-timeline__details-btn-icon {
    transition: transform var(--duration-hover) var(--ease-smooth);
}

.project-timeline__details-btn[aria-expanded="true"] .project-timeline__details-btn-icon {
    transform: rotate(180deg);
}

.project-timeline__details-btn[aria-expanded="true"] .project-timeline__details-btn-text::after {
    content: none;
}

/* ---- Accordion Expand ---- */
.project-timeline__expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.45s var(--ease-smooth);
}

.project-timeline__expand[aria-hidden="false"] {
    max-height: 600px;
}

.project-timeline__expand-inner {
    padding: 0 var(--space-xl) var(--space-xl);
    border-top: 1px solid var(--color-light-gray);
    margin-top: 0;
    padding-top: var(--space-lg);
}

.project-timeline__expand-desc {
    font-size: var(--text-sm);
    color: var(--color-neutral);
    line-height: 1.8;
    margin-bottom: var(--space-lg);
}

/* ---- Thumbnail Grid ---- */
.project-timeline__thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.project-timeline__thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-light-gray);
    cursor: pointer;
    background: none;
    padding: 0;
    transition: border-color var(--duration-hover) var(--ease-smooth),
                transform var(--duration-hover) var(--ease-smooth);
}

.project-timeline__thumb:hover {
    border-color: var(--color-primary);
    transform: scale(1.03);
}

.project-timeline__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-timeline__thumb-more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: var(--color-white);
    font-size: var(--text-lg);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.02em;
}

/* ============================================
   Gallery Modal
   ============================================ */
.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s var(--ease-smooth),
                visibility 0.35s var(--ease-smooth);
}

.gallery-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.gallery-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.gallery-modal__container {
    position: relative;
    z-index: 1;
    width: 90vw;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-light-gray);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.35s var(--ease-smooth);
}

.gallery-modal[aria-hidden="false"] .gallery-modal__container {
    transform: scale(1) translateY(0);
}

.gallery-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-xl);
    border-bottom: 1px solid var(--color-light-gray);
    flex-shrink: 0;
}

.gallery-modal__title {
    font-size: var(--text-base);
    font-weight: var(--font-weight-bold);
    color: var(--color-neutral);
    margin: 0;
}

.gallery-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--color-light-gray);
    border-radius: var(--radius-md);
    color: var(--color-gray);
    cursor: pointer;
    transition: color var(--duration-hover) var(--ease-smooth),
                border-color var(--duration-hover) var(--ease-smooth);
}

.gallery-modal__close:hover {
    color: var(--color-white);
    border-color: var(--color-primary);
}

.gallery-modal__body {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
    padding: var(--space-md);
}

.gallery-modal__image-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    max-height: 65vh;
    overflow: hidden;
}

.gallery-modal__image {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    transition: opacity 0.25s ease;
}

.gallery-modal__image.is-loading {
    opacity: 0.3;
}

.gallery-modal__nav {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--color-light-gray);
    border-radius: 50%;
    color: var(--color-gray);
    cursor: pointer;
    transition: color var(--duration-hover) var(--ease-smooth),
                background var(--duration-hover) var(--ease-smooth),
                border-color var(--duration-hover) var(--ease-smooth);
}

.gallery-modal__nav:hover {
    color: var(--color-primary);
    background: rgba(139, 26, 43, 0.15);
    border-color: var(--color-primary);
}

.gallery-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-xl);
    border-top: 1px solid var(--color-light-gray);
    flex-shrink: 0;
}

.gallery-modal__caption {
    font-size: var(--text-sm);
    color: var(--color-neutral-lighter);
}

.gallery-modal__counter {
    font-size: var(--text-sm);
    color: var(--color-gray);
    font-weight: var(--font-weight-medium);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 992px) {
    .history-activities {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .history-section {
        padding: var(--space-3xl) 0;
    }

    .history-block__heading {
        font-size: var(--text-xl);
    }

    .history-departments {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .history-associate {
        padding: var(--space-xl);
    }

    .project-timeline__thumbs {
        grid-template-columns: repeat(3, 1fr);
    }

    .gallery-modal__container {
        width: 96vw;
        max-height: 95vh;
    }

    .gallery-modal__nav {
        width: 36px;
        height: 36px;
    }

    .gallery-modal__image {
        max-height: 55vh;
    }

    .gallery-modal__image-wrap {
        max-height: 55vh;
    }

    .gallery-modal__header {
        padding: var(--space-sm) var(--space-md);
    }

    .gallery-modal__footer {
        padding: var(--space-xs) var(--space-md);
    }
}

@media (max-width: 480px) {
    .history-departments {
        grid-template-columns: 1fr;
    }

    .project-timeline__thumbs {
        grid-template-columns: repeat(2, 1fr);
    }

    .project-timeline__meta {
        gap: var(--space-xs);
    }
}
