/* Línea de tiempo institucional — prefijo ptl- */

#proyectos.proyectos-timeline {
    background:
        radial-gradient(1200px 420px at 50% -10%, rgba(0, 92, 185, 0.08), transparent 60%),
        var(--aldea-sand, #f6f5f2);
    padding: 40px 0 96px;
    overflow: hidden;
}

#proyectos .title {
    text-align: center;
    padding-bottom: 56px;
}

#proyectos .title h2 {
    font-family: "Scada", sans-serif;
    color: var(--aldea-navy, #0f2a4a);
    margin-bottom: 8px;
}

#proyectos .title p {
    color: var(--aldea-muted, #5c6770);
    margin: 0;
}

.ptl {
    --ptl-green: #76bc21;
    --ptl-blue: #005cb9;
    --ptl-orange: #f0892d;
    --ptl-navy: #0f2a4a;
    position: relative;
    max-width: 1120px;
    margin: 0 auto;
    padding: 8px 0 24px;
}

.ptl-item[data-accent="green"] { --ptl-accent: var(--ptl-green); }
.ptl-item[data-accent="orange"] { --ptl-accent: var(--ptl-orange); }
.ptl-item[data-accent="blue"] { --ptl-accent: var(--ptl-blue); }
.ptl-item[data-accent="navy"] { --ptl-accent: var(--ptl-navy); }

.ptl-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    background: linear-gradient(180deg, var(--ptl-green) 0%, var(--ptl-blue) 52%, var(--ptl-orange) 100%);
    border-radius: 2px;
    transform: scaleY(0);
    transform-origin: top center;
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 0;
}

.ptl.is-drawn .ptl-line {
    transform: scaleY(1);
}

.ptl-track {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 44px;
}

.ptl-item {
    position: relative;
    width: calc(50% - 42px);
    opacity: 0;
    transform: translate3d(-40px, 22px, 0);
    transition:
        opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.ptl-item:nth-child(even) {
    margin-left: auto;
    transform: translate3d(40px, 22px, 0);
}

.ptl-item.is-visible,
.ptl-item:nth-child(even).is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.ptl-item:nth-child(1).is-visible { transition-delay: 0.04s; }
.ptl-item:nth-child(2).is-visible { transition-delay: 0.1s; }
.ptl-item:nth-child(3).is-visible { transition-delay: 0.16s; }
.ptl-item:nth-child(4).is-visible { transition-delay: 0.22s; }
.ptl-item:nth-child(5).is-visible { transition-delay: 0.28s; }

.ptl-marker {
    position: absolute;
    top: 92px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--ptl-accent, var(--ptl-blue));
    box-shadow: 0 0 0 7px rgba(0, 92, 185, 0.14);
    z-index: 2;
    transition: transform 0.35s ease, background 0.35s ease, box-shadow 0.35s ease;
}
.ptl-item[data-accent="green"] .ptl-marker { box-shadow: 0 0 0 7px rgba(118, 188, 33, 0.2); }
.ptl-item[data-accent="orange"] .ptl-marker { box-shadow: 0 0 0 7px rgba(240, 137, 45, 0.2); }
.ptl-item[data-accent="blue"] .ptl-marker { box-shadow: 0 0 0 7px rgba(0, 92, 185, 0.16); }
.ptl-item[data-accent="navy"] .ptl-marker { box-shadow: 0 0 0 7px rgba(15, 42, 74, 0.16); }

.ptl-item:nth-child(odd) .ptl-marker {
    right: -51px;
    left: auto;
}

.ptl-item:nth-child(even) .ptl-marker {
    left: -51px;
}

.ptl-item.is-open .ptl-marker {
    background: var(--ptl-accent, var(--ptl-blue));
    transform: scale(1.18);
    box-shadow: 0 0 0 10px rgba(0, 92, 185, 0.16);
}
.ptl-item[data-accent="green"].is-open .ptl-marker { box-shadow: 0 0 0 10px rgba(118, 188, 33, 0.2); }
.ptl-item[data-accent="orange"].is-open .ptl-marker { box-shadow: 0 0 0 10px rgba(240, 137, 45, 0.2); }
.ptl-item[data-accent="navy"].is-open .ptl-marker { box-shadow: 0 0 0 10px rgba(15, 42, 74, 0.16); }

.ptl-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(15, 42, 74, 0.08);
    box-shadow: 0 16px 40px rgba(15, 42, 74, 0.08);
    transition: box-shadow 0.4s ease, transform 0.4s ease, border-color 0.35s ease;
}

.ptl-item.is-visible .ptl-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 48px rgba(15, 42, 74, 0.12);
}

.ptl-item.is-open .ptl-card {
    border-color: rgba(0, 92, 185, 0.22);
    box-shadow: 0 24px 52px rgba(15, 42, 74, 0.14);
}
.ptl-item[data-accent="green"].is-open .ptl-card { border-color: rgba(118, 188, 33, 0.4); }
.ptl-item[data-accent="orange"].is-open .ptl-card { border-color: rgba(240, 137, 45, 0.4); }
.ptl-item[data-accent="navy"].is-open .ptl-card { border-color: rgba(15, 42, 74, 0.28); }

.ptl-header {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
    appearance: none;
}

.ptl-header:focus { outline: none; }
.ptl-header:focus-visible {
    box-shadow: inset 0 0 0 3px var(--ptl-blue);
}

.ptl-visual {
    position: relative;
    display: block;
    height: 210px;
    overflow: hidden;
}

.ptl-item.is-open .ptl-visual {
    height: 250px;
}

.ptl-visual img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.ptl-header:hover .ptl-visual img,
.ptl-item.is-open .ptl-visual img {
    transform: scale(1.06);
}

.ptl-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 42, 74, 0.05) 20%, rgba(15, 42, 74, 0.58) 100%);
}

.ptl-year {
    position: absolute;
    left: 18px;
    bottom: 16px;
    z-index: 1;
    font-family: "Scada", sans-serif;
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
    text-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.ptl-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px 18px;
    border-top: 3px solid var(--ptl-accent, var(--ptl-blue));
}

.ptl-meta {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ptl-tag {
    width: fit-content;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ptl-accent, var(--ptl-blue));
    font-weight: 700;
}

.ptl-title {
    display: block;
    margin: 0;
    font-family: "Scada", sans-serif;
    font-size: 1.2rem;
    line-height: 1.3;
    color: var(--ptl-navy);
    font-weight: 700;
}

.ptl-hint {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    color: #7a7a7a;
    white-space: nowrap;
}

.ptl-item.is-open .ptl-hint {
    color: var(--ptl-accent, var(--ptl-blue));
}

.ptl-chevron {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    position: relative;
    color: var(--ptl-accent, var(--ptl-blue));
}

.ptl-chevron::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.ptl-item.is-open .ptl-chevron::before {
    top: 8px;
    transform: rotate(225deg);
}

.ptl-panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.ptl-item.is-open .ptl-panel {
    grid-template-rows: 1fr;
}

.ptl-panel-inner {
    overflow: hidden;
    min-height: 0;
}

.ptl-body {
    padding: 4px 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ptl-copy {
    margin: 0;
    color: #3d4650;
    font-size: 15px;
    line-height: 1.7;
}

.ptl-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ptl-gallery img {
    display: block;
    width: 100%;
    height: 168px;
    object-fit: cover;
    border-radius: 14px;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
}

.ptl-gallery img:first-child {
    grid-column: 1 / -1;
    height: 260px;
}

.ptl-item.is-open .ptl-gallery img {
    animation: ptlImageIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.ptl-item.is-open .ptl-gallery img:nth-child(1) { animation-delay: 0.08s; }
.ptl-item.is-open .ptl-gallery img:nth-child(2) { animation-delay: 0.16s; }
.ptl-item.is-open .ptl-gallery img:nth-child(3) { animation-delay: 0.24s; }

@keyframes ptlImageIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 767px) {
    #proyectos.proyectos-timeline {
        padding: 24px 0 64px;
    }

    .ptl {
        padding-left: 8px;
    }

    .ptl-line {
        left: 16px;
        margin-left: 0;
    }

    .ptl-item,
    .ptl-item:nth-child(even) {
        width: calc(100% - 42px);
        margin-left: 42px;
        transform: translate3d(0, 22px, 0);
    }

    .ptl-item.is-visible,
    .ptl-item:nth-child(even).is-visible {
        transform: translate3d(0, 0, 0);
    }

    .ptl-item:nth-child(odd) .ptl-marker,
    .ptl-item:nth-child(even) .ptl-marker {
        left: -35px;
        right: auto;
        top: 88px;
    }

    .ptl-visual,
    .ptl-item.is-open .ptl-visual {
        height: 190px;
    }

    .ptl-bar {
        flex-wrap: wrap;
    }

    .ptl-hint {
        display: none;
    }

    .ptl-gallery {
        grid-template-columns: 1fr;
    }

    .ptl-gallery img,
    .ptl-gallery img:first-child {
        height: 210px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ptl-line,
    .ptl-item,
    .ptl-card,
    .ptl-marker,
    .ptl-visual img,
    .ptl-chevron::before,
    .ptl-panel {
        transition: none;
    }

    .ptl-item,
    .ptl-item:nth-child(even) {
        opacity: 1;
        transform: none;
    }

    .ptl-gallery img,
    .ptl-item.is-open .ptl-gallery img {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
