/* History page — Reemoon VI · premium timeline narrative */

.hist-page {
    --hist-brand: #00856f;
    --hist-brand-dark: #004d41;
    --hist-brand-deep: #006b59;
    --hist-brand-light: #00a88a;
    --hist-brand-bright: #6ee7c7;
    --hist-brand-muted: #eef6f3;
    --hist-text: #1a1a1a;
    --hist-text-muted: #3d524c;
    --hist-text-soft: #5a756e;
    --hist-max: min(1480px, 100%);
    --hist-gutter: clamp(24px, 5vw, 96px);
    --hist-radius: 16px;
    --hist-radius-lg: 24px;
    width: 100%;
    overflow-x: clip;
    color: var(--hist-text);
    background: #fff;
}

.hist-container {
    width: 100%;
    max-width: var(--hist-max);
    margin: 0 auto;
    padding-left: var(--hist-gutter);
    padding-right: var(--hist-gutter);
    box-sizing: border-box;
}

/* ── Hero ─────────────────────────────────────────────────────────── */

.hist-hero {
    position: relative;
    min-height: clamp(560px, 78vh, 820px);
    display: flex;
    align-items: flex-end;
    padding-bottom: clamp(64px, 8vw, 112px);
    overflow: hidden;
}

.hist-hero__bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 65% 50% at 80% 30%, rgba(0, 168, 138, 0.22), transparent 55%),
        linear-gradient(155deg, #001512 0%, #003830 45%, #005a4a 100%);
}

.hist-hero__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
    opacity: 0.32;
}

.hist-hero__mesh {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 80%);
}

.hist-hero__overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 55% 65% at 12% 35%, rgba(0, 133, 111, 0.28), transparent 55%),
        linear-gradient(160deg, rgba(0, 18, 15, 0.92) 0%, rgba(0, 50, 42, 0.78) 55%, rgba(0, 90, 74, 0.55) 100%);
}

.hist-hero__inner {
    position: relative;
    z-index: 1;
    max-width: 920px;
}

.hist-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 28px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
}

.hist-breadcrumb a {
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    transition: color 0.15s ease;
}

.hist-breadcrumb a:hover {
    color: #fff;
}

.hist-hero__eyebrow {
    margin: 0 0 16px;
    font-size: clamp(0.75rem, 0.85vw, 0.8125rem);
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--hist-brand-bright);
}

.hist-hero__title {
    margin: 0 0 20px;
    font-size: clamp(2.25rem, 5vw, 3.75rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.03em;
    color: #fff;
}

.hist-hero__tagline {
    margin: 0;
    max-width: 720px;
    font-size: clamp(1.0625rem, 1.35vw, 1.3125rem);
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.82);
}

.hist-hero__scroll {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 36px;
    padding: 0;
    border: 0;
    background: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
}

.hist-hero__scroll:hover {
    color: #fff;
    transform: translateY(2px);
}

/* ── Milestones strip ─────────────────────────────────────────────── */

.hist-milestones {
    position: relative;
    z-index: 2;
    margin-top: -32px;
    padding-bottom: clamp(48px, 6vw, 72px);
}

.hist-milestones__list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    margin: 0;
    padding: 0;
    list-style: none;
    border-radius: var(--hist-radius-lg);
    overflow: hidden;
    background: rgba(0, 133, 111, 0.12);
    box-shadow:
        0 24px 60px rgba(0, 77, 65, 0.12),
        0 0 0 1px rgba(0, 133, 111, 0.08);
}

.hist-milestones__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;
    padding: 24px 16px;
    text-align: center;
    background: #fff;
}

.hist-milestones__value {
    font-size: clamp(1.75rem, 2.8vw, 2.375rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--hist-brand);
}

.hist-milestones__suffix {
    font-size: 0.72em;
    font-weight: 700;
}

.hist-milestones__label {
    font-size: clamp(0.8125rem, 0.9vw, 0.875rem);
    line-height: 1.45;
    color: var(--hist-text-soft);
}

/* ── Sticky era nav ─────────────────────────────────────────────── */

.hist-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(0, 133, 111, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.hist-nav__inner {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.hist-nav__inner::-webkit-scrollbar {
    display: none;
}

.hist-nav__list {
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 10px 0;
    list-style: none;
    min-width: max-content;
}

.hist-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--hist-text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.hist-nav__link:hover {
    color: var(--hist-brand);
    background: var(--hist-brand-muted);
}

.hist-nav__link.is-active {
    color: #fff;
    background: var(--hist-brand);
    box-shadow: 0 4px 14px rgba(0, 133, 111, 0.28);
}

.hist-nav__index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(0, 133, 111, 0.08);
    color: var(--hist-brand);
}

.hist-nav__link.is-active .hist-nav__index {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.hist-nav__text {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Era sections ───────────────────────────────────────────────── */

.hist-era {
    position: relative;
    padding: clamp(64px, 8vw, 96px) 0;
    overflow: hidden;
}

.hist-era__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hist-era--emerald .hist-era__bg {
    background: linear-gradient(180deg, #fff 0%, var(--hist-brand-muted) 100%);
}

.hist-era--forest .hist-era__bg {
    background: linear-gradient(180deg, var(--hist-brand-muted) 0%, #fff 100%);
}

.hist-era--teal .hist-era__bg {
    background: linear-gradient(180deg, #fff 0%, rgba(0, 133, 111, 0.06) 100%);
}

.hist-era--ocean .hist-era__bg {
    background:
        radial-gradient(ellipse 80% 60% at 100% 0%, rgba(0, 168, 138, 0.08), transparent 55%),
        linear-gradient(180deg, var(--hist-brand-muted) 0%, #fff 100%);
}

.hist-era--midnight .hist-era__bg {
    background:
        radial-gradient(ellipse 70% 55% at 0% 100%, rgba(0, 133, 111, 0.12), transparent 55%),
        linear-gradient(180deg, #fff 0%, #f4faf8 100%);
}

.hist-era__grid {
    position: relative;
    display: grid;
    grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
    gap: clamp(32px, 5vw, 64px);
    align-items: start;
    max-width: min(1080px, 100%);
    margin-left: auto;
    margin-right: auto;
}

.hist-era__head {
    position: sticky;
    top: 88px;
    padding-top: 8px;
}

.hist-era__head::after {
    content: "";
    display: block;
    width: 48px;
    height: 3px;
    margin-top: 20px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--hist-brand), rgba(0, 133, 111, 0.15));
}

.hist-era__index {
    display: block;
    margin-bottom: 12px;
    font-size: clamp(2.75rem, 4.5vw, 3.75rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    color: rgba(0, 133, 111, 0.14);
}

.hist-era__title {
    margin: 0;
    font-size: clamp(1.375rem, 2.2vw, 1.875rem);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.02em;
    color: var(--hist-text);
}

/* ── Timeline events ────────────────────────────────────────────── */

.hist-era__events {
    margin: 0;
    padding: 0 0 0 4px;
    list-style: none;
    position: relative;
}

.hist-era__events::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: linear-gradient(180deg, rgba(0, 133, 111, 0.4), rgba(0, 133, 111, 0.08));
    pointer-events: none;
}

.hist-event {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 20px;
    padding-bottom: 24px;
    position: relative;
}

.hist-event:last-child {
    padding-bottom: 0;
}

.hist-event__marker {
    display: flex;
    justify-content: center;
    padding-top: 28px;
}

.hist-event__dot {
    position: relative;
    z-index: 1;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--hist-brand);
    box-shadow: 0 0 0 4px rgba(0, 133, 111, 0.15);
}

.hist-event__card {
    padding: 0;
    border-radius: var(--hist-radius-lg);
    background: #fff;
    border: 1px solid rgba(0, 133, 111, 0.1);
    box-shadow:
        0 12px 32px rgba(0, 77, 65, 0.07),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.hist-event__card:hover {
    border-color: rgba(0, 133, 111, 0.22);
    box-shadow:
        0 20px 48px rgba(0, 77, 65, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    transform: translateY(-2px);
}

.hist-event__card-inner {
    display: block;
}

.hist-event__card--media .hist-event__card-inner {
    display: flex;
    flex-direction: column;
}

.hist-event__photo {
    margin: 0;
    padding: clamp(16px, 2vw, 20px) clamp(16px, 2vw, 20px) 0;
    background: linear-gradient(180deg, rgba(238, 246, 243, 0.65) 0%, #fff 100%);
}

.hist-event__photo-btn {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    cursor: zoom-in;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 77, 65, 0.08);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.hist-event__photo-btn:hover {
    box-shadow: 0 8px 28px rgba(0, 77, 65, 0.14);
    transform: translateY(-1px);
}

.hist-event__photo-btn:focus-visible {
    outline: 2px solid var(--hist-brand);
    outline-offset: 3px;
}

.hist-event__photo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    min-height: 0;
    object-fit: contain;
    vertical-align: middle;
}

.hist-event__photo-hint {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 77, 65, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.hist-event__photo-btn:hover .hist-event__photo-hint,
.hist-event__photo-btn:focus-visible .hist-event__photo-hint {
    opacity: 1;
    transform: translateY(0);
}

.hist-event__content {
    padding: clamp(22px, 2.5vw, 28px) clamp(22px, 2.5vw, 32px);
}

.hist-event__year {
    display: inline-block;
    margin-bottom: 12px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: clamp(1rem, 1.4vw, 1.125rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    color: var(--hist-brand);
    background: var(--hist-brand-muted);
}

.hist-event__body {
    margin: 0;
    font-size: clamp(0.9375rem, 1.05vw, 1.0625rem);
    line-height: 1.85;
    color: var(--hist-text-muted);
}

/* ── Photo lightbox ───────────────────────────────────────────────── */

.hist-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 32px);
    background: rgba(0, 18, 15, 0.88);
    cursor: zoom-out;
}

.hist-lightbox[hidden] {
    display: none;
}

.hist-lightbox__img {
    display: block;
    max-width: min(94vw, 1100px);
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.hist-lightbox__close {
    position: absolute;
    top: clamp(12px, 3vw, 24px);
    right: clamp(12px, 3vw, 24px);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.hist-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.26);
}

/* ── Scroll reveal ──────────────────────────────────────────────── */

[data-history-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

[data-history-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── CTA flush ────────────────────────────────────────────────────── */

body:has(.hist-page) .site-footer,
body:has(.hist-page) .cases-cta {
    margin-top: 0;
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .hist-era__grid {
        grid-template-columns: 1fr;
        gap: 28px;
        max-width: 100%;
    }

    .hist-era__head {
        position: static;
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 16px 20px;
        align-items: center;
    }

    .hist-era__head::after {
        grid-column: 1 / -1;
        margin-top: 0;
    }

    .hist-era__index {
        margin-bottom: 0;
        font-size: 2.5rem;
    }

    .hist-event__card--media .hist-event__card-inner {
        display: flex;
        flex-direction: column;
    }

    .hist-event__photo {
        padding: 14px 14px 0;
    }
}

@media (max-width: 768px) {
    .hist-milestones__list {
        grid-template-columns: repeat(2, 1fr);
    }

    .hist-event__content {
        padding: 18px 20px;
    }

    .hist-nav__text {
        max-width: 160px;
    }

    .hist-event__card {
        padding: 18px 18px;
    }
}

@media (max-width: 480px) {
    .hist-milestones__list {
        grid-template-columns: 1fr;
    }

    .hist-nav__index {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    [data-history-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hist-event__card:hover {
        transform: none;
    }
}
