@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;1,400;1,500;1,600&family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================
   HISTORY SECTION — Diseño de Museo Editorial
   ============================================ */

.history-section {
    width: 100%;
    background-color: #f5f0e8;
    color: #2c2c2c;
    padding: 140px 0 0;
    position: relative;
    z-index: 10;
    overflow: clip;
}

.history-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(166, 127, 105, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 90%, rgba(194, 187, 157, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.history-container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 60px;
    position: relative;
}

/* =============================
   CHAPTERS — Alternancia imagen/texto
   ============================= */

/* ---- First chapter: header + chapter 1 merged ---- */

.history-chapter:first-of-type .history-text {
    padding: 40px 48px;
}

.history-chapter:first-of-type .history-eyebrow {
    font-family: "Inter", sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #a67f69;
    margin-bottom: 16px;
    position: relative;
    padding-left: 48px;
    display: inline-block;
}

.history-chapter:first-of-type .history-eyebrow::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 32px;
    height: 1px;
    background: #a67f69;
}

.history-chapter:first-of-type h1 {
    font-family: "Lora", serif;
    font-weight: 600;
    font-size: clamp(2.8rem, 5vw, 4.2rem);
    line-height: 1.05;
    letter-spacing: -0.5px;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.history-chapter:first-of-type h2 {
    font-family: "Lora", serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    color: #6b6757;
    line-height: 1.5;
    max-width: 380px;
    margin-bottom: 28px;
}

.history-chapter:first-of-type .history-chapter-label {
    margin-bottom: 16px;
}

/* =============================
   CHAPTERS — Alternancia imagen/texto
   ============================= */

.history-chapter {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: stretch;
    gap: 0;
    margin-bottom: 60px;
    position: relative;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.history-chapter.reveal {
    opacity: 1;
    transform: translateY(0);
}

.history-chapter--alt {
    grid-template-columns: 0.9fr 1.1fr;
}

.history-chapter--alt .history-chapter-media {
    order: 2;
}

.history-chapter--alt .history-text {
    order: 1;
}

/* ---- Media side ---- */

.history-chapter-media {
    position: relative;
    min-height: 400px;
    padding: 20px;
    background-color: #e7e3d6;
    border-radius: 3px;
    overflow: hidden;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-chapter-media > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: saturate(0.92) contrast(1.03);
    transition: opacity 0.6s ease;
}

.history-chapter-media:hover > img {
    opacity: 0.92;
}

/* Chapter number badge */
.history-chapter-num {
    position: absolute;
    top: 28px;
    z-index: 3;
    font-family: "Lora", serif;
    font-style: italic;
    font-size: 0.95rem;
    color: rgba(0, 0, 0, 0.35);
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-chapter-num::after {
    content: "";
    display: block;
    width: 24px;
    height: 1px;
    background: rgba(0, 0, 0, 0.15);
}

.history-chapter:not(.history-chapter--alt) .history-chapter-num {
    right: 28px;
}

.history-chapter--alt .history-chapter-num {
    left: 28px;
}

/* ---- Text side ---- */

.history-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 64px;
    position: relative;
}

.history-chapter:not(.history-chapter--alt) .history-text {
    padding-left: 72px;
}

.history-chapter--alt .history-text {
    padding-right: 72px;
    align-items: flex-end;
    text-align: right;
}

.history-chapter-label {
    font-family: "Lora", serif;
    font-style: italic;
    font-size: 1.05rem;
    color: #a67f69;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.history-chapter:not(.history-chapter--alt) .history-chapter-label {
    padding-left: 0;
}

.history-chapter--alt .history-chapter-label {
    padding-right: 0;
}

.history-text p {
    font-family: "Inter", sans-serif;
    font-weight: 400;
    font-size: clamp(0.92rem, 1vw, 1.02rem);
    line-height: 1.85;
    color: #3b3634;
    max-width: 460px;
    margin-bottom: 18px;
}

.history-text p:last-of-type {
    margin-bottom: 0;
}

.history-chapter--alt .history-text p {
    max-width: 460px;
}

/* =============================
   BANNER — Full-bleed highlight
   ============================= */

.history-banner {
    position: relative;
    width: 100%;
    margin: 20px 0 60px;
    border-radius: 4px;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.history-banner.reveal {
    opacity: 1;
    transform: translateY(0);
}

.history-banner-bg {
    position: absolute;
    inset: 0;
}

.history-banner-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(0.88) contrast(1.06) brightness(0.5);
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.history-banner:hover .history-banner-bg img {
    transform: scale(1.04);
}

.history-banner-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 40%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
}

.history-highlight {
    position: relative;
    z-index: 2;
    max-width: 720px;
    text-align: center;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.history-banner-label {
    font-family: "Inter", sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #c2bb9d;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.history-banner-label::before,
.history-banner-label::after {
    content: "";
    display: block;
    width: 28px;
    height: 1px;
    background: rgba(194, 187, 157, 0.4);
}

.history-highlight p {
    font-family: "Lora", serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    line-height: 1.55;
    color: #f6f1e7;
}

/* =============================
   DIVIDER
   ============================= */

.history-divider {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto 60px;
    padding: 0 60px;
}

.history-divider span {
    display: block;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.08), transparent);
}

/* =============================
   FOOTER
   ============================= */

.history-footer {
    margin-top: 80px;
    padding: 80px 24px;
    text-align: center;
    position: relative;
    isolation: isolate;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 0.2s, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s;
    /* Full-width breakout */
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    /* Background image + gradient overlay */
    background-image:
        linear-gradient(to right, rgba(31, 28, 26, 0.82) 0%, rgba(31, 28, 26, 0.65) 50%, rgba(31, 28, 26, 0.82) 100%),
        url('../img/bios3.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.history-footer.reveal {
    opacity: 1;
    transform: translateY(0);
}

.history-footer-line {
    display: block;
    width: 40px;
    height: 2px;
    background: #a67f69;
    margin: 0 auto 24px;
}

.history-footer-text {
    position: relative;
    z-index: 2;
    font-family: "Lora", serif;
    font-style: italic;
    font-size: 1.15rem;
    color: #f6f1e7;
    letter-spacing: 0.5px;
    max-width: 600px;
    margin: 0 auto;
}

/* =============================
   ANIMATIONS — Scroll Reveal
   ============================= */

.history-chapter:nth-child(2) { transition-delay: 0.05s; }
.history-chapter:nth-child(3) { transition-delay: 0.1s; }
.history-chapter:nth-child(4) { transition-delay: 0.15s; }

/* =============================
   RESPONSIVE — 1024px
   ============================= */

@media (max-width: 1024px) {
    .history-container {
        padding: 0 36px;
    }

    .history-chapter:first-of-type {
        margin-bottom: 60px;
    }

    .history-chapter:first-of-type .history-text {
        padding: 0 20px;
    }

    .history-chapter:first-of-type h2 {
        max-width: 100%;
    }

    .history-chapter,
    .history-chapter--alt {
        grid-template-columns: 1fr 1fr;
    }

    .history-text {
        padding: 40px 36px;
    }

    .history-chapter:not(.history-chapter--alt) .history-text {
        padding-left: 40px;
    }

    .history-chapter--alt .history-text {
        padding-right: 40px;
    }

    .history-chapter-media {
        min-height: 300px;
        padding: 14px;
    }

    .history-divider {
        padding: 0 36px;
    }

    .history-banner {
        min-height: 320px;
    }
}

/* =============================
   RESPONSIVE — 768px
   ============================= */

@media (max-width: 768px) {
    .history-section {
        padding: 60px 0 0;
    }

    .history-container {
        padding: 0 20px;
    }

    .history-chapter,
    .history-chapter--alt {
        margin-bottom: 36px;
    }

    .history-chapter:first-of-type {
        margin-bottom: 36px;
    }

    .history-chapter:first-of-type .history-text {
        padding: 24px 16px 28px;
        text-align: left;
        align-items: flex-start;
    }

    .history-chapter:first-of-type h1 {
        font-size: clamp(2.4rem, 10vw, 3.2rem);
    }

    .history-chapter:first-of-type h2 {
        max-width: 100%;
    }

    .history-chapter:first-of-type .history-chapter-label {
        font-size: 0.95rem;
    }

    .history-chapter:first-of-type .history-text p {
        text-align: left;
    }

    .history-chapter,
    .history-chapter--alt {
        grid-template-columns: 1fr;
    }

    .history-chapter .history-chapter-media,
    .history-chapter--alt .history-chapter-media {
        order: 1;
        min-height: 240px;
        padding: 8px;
    }

    .history-chapter .history-text,
    .history-chapter--alt .history-text {
        order: 2;
        padding: 20px 16px 28px;
        align-items: flex-start;
        text-align: left;
    }

    .history-chapter:not(.history-chapter--alt) .history-text {
        padding-left: 20px;
    }

    .history-chapter--alt .history-text {
        padding-right: 20px;
    }

    .history-chapter--alt .history-text p {
        max-width: 100%;
    }

    .history-text p {
        max-width: 100%;
        font-size: 0.95rem;
    }

    .history-chapter-num {
        top: 20px;
    }

    .history-chapter:not(.history-chapter--alt) .history-chapter-num {
        right: 18px;
    }

    .history-chapter--alt .history-chapter-num {
        left: 18px;
    }

    .history-divider {
        padding: 0 20px;
        margin-bottom: 36px;
    }

    .history-banner {
        min-height: 280px;
        margin: 0 0 32px;
        border-radius: 3px;
    }

    .history-banner-bg img {
        filter: saturate(0.88) contrast(1.06) brightness(0.4);
    }

    .history-highlight {
        padding: 40px 24px;
    }

    .history-highlight p {
        font-size: 1.1rem;
    }

    .history-chapter:first-of-type .history-eyebrow {
        padding-left: 36px;
        font-size: 0.65rem;
    }

    .history-chapter:first-of-type .history-eyebrow::before {
        width: 22px;
    }

    .history-footer {
        margin-top: 40px;
        padding: 60px 20px;
    }

    .history-footer-text {
        font-size: 1rem;
    }
}
