.tri-kicker,
.tri-title,
.tri-copy {
    opacity: 0;
    transform: translateY(14px);
    will-change: transform, opacity;
}

.tri-kicker {
    transition: opacity 0.55s cubic-bezier(0.2, 0.85, 0.25, 1), transform 0.55s cubic-bezier(0.2, 0.85, 0.25, 1), box-shadow 0.28s ease;
}

.tri-title {
    transition: opacity 0.62s cubic-bezier(0.2, 0.85, 0.25, 1), transform 0.62s cubic-bezier(0.2, 0.85, 0.25, 1), text-shadow 0.3s ease;
}

.tri-copy {
    transition: opacity 0.68s cubic-bezier(0.2, 0.85, 0.25, 1), transform 0.68s cubic-bezier(0.2, 0.85, 0.25, 1), color 0.28s ease;
}

.tri-intro.is-visible .tri-kicker,
.tri-intro.is-visible .tri-title,
.tri-intro.is-visible .tri-copy {
    opacity: 1;
    transform: translateY(0);
}

.tri-intro.is-visible .tri-kicker {
    transition-delay: 0.05s;
}

.tri-intro.is-visible .tri-title {
    transition-delay: 0.2s;
}

.tri-intro.is-visible .tri-copy {
    transition-delay: 0.35s;
}

.tri-intro:hover .tri-kicker {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -12px rgba(14, 54, 89, 0.65);
}

.tri-intro:hover .tri-title {
    transform: translateX(4px);
    text-shadow: 0 8px 24px rgba(14, 54, 89, 0.16);
}

.tri-intro:hover .tri-copy {
    transform: translateX(4px);
    color: #334155;
}

.tri-kicker:hover {
    transform: translateY(-4px) scale(1.01) !important;
    box-shadow: 0 14px 26px -16px rgba(14, 54, 89, 0.65) !important;
}

.tri-title:hover {
    transform: translateY(-4px) scale(1.01) !important;
    text-shadow: 0 14px 30px rgba(14, 54, 89, 0.24) !important;
}

.cert-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.cert-card::before {
    content: '';
    position: absolute;
    inset: -140% 45% auto auto;
    width: 220%;
    height: 220%;
    background: linear-gradient(120deg, transparent 40%, rgba(217, 122, 26, 0.18), transparent 60%);
    transform: rotate(18deg) translateX(-40%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.cert-card:hover {
    transform: translateY(-8px);
    border-color: rgba(217, 122, 26, 0.55);
    box-shadow: 0 18px 42px -20px rgba(14, 54, 89, 0.45);
}

.cert-card:hover::before {
    opacity: 1;
    animation: certSweep 1.1s ease forwards;
}

.cert-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    border-radius: 0.85rem;
    border: 1px solid rgba(235, 239, 242, 0.1);
    background: rgba(19, 43, 64, 0.82);
    color: #EBEFF2;
    padding: 0.7rem 0.85rem;
    font-size: 0.67rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 900;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.cert-download:hover {
    transform: translateY(-2px);
    border-color: rgba(217, 122, 26, 0.65);
    background: #132B40;
    box-shadow: 0 10px 24px -16px rgba(0, 0, 0, 0.65);
}

.cert-download--dark {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(217, 122, 26, 0.35);
    color: #D97A1A;
}

.cert-download--dark:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cert-download--disabled {
    background: rgba(26, 29, 38, 0.55);
    border-color: rgba(235, 239, 242, 0.08);
    color: rgba(156, 160, 166, 0.72);
    cursor: not-allowed;
}

.cert-download--disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(235, 239, 242, 0.08);
    background: rgba(26, 29, 38, 0.55);
}

.cert-card.is-downloading {
    animation: certImpact 0.58s cubic-bezier(0.2, 0.85, 0.25, 1);
}

.cert-card.is-downloading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 2px solid rgba(217, 122, 26, 0.7);
    transform: translate(-50%, -50%);
    animation: certPulseRing 0.65s ease-out;
    pointer-events: none;
}

.cert-download.is-downloading {
    background: #D97A1A;
    color: #1A1D26;
    border-color: #D97A1A;
}

.cert-card.is-unavailable {
    animation: certUnavailable 0.62s cubic-bezier(0.2, 0.85, 0.25, 1);
}

.cert-download.is-unavailable {
    background: rgba(217, 122, 26, 0.16);
    border-color: rgba(217, 122, 26, 0.65);
    color: #EBEFF2;
}

@keyframes certSweep {
    0% { transform: rotate(18deg) translateX(-55%); }
    100% { transform: rotate(18deg) translateX(35%); }
}

@keyframes certImpact {
    0% { transform: translateY(0) scale(1); }
    35% { transform: translateY(-10px) scale(1.015); }
    100% { transform: translateY(0) scale(1); }
}

@keyframes certPulseRing {
    0% { opacity: 0.75; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(8.2); }
}

@keyframes certUnavailable {
    0% { transform: translateY(0) scale(1); }
    25% { transform: translateY(-6px) scale(1.01); }
    60% { transform: translateY(0) scale(1); }
    78% { transform: translateX(-4px); }
    88% { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

@keyframes triAppear {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ---- Cert Viewer Button ---- */
.cert-download--viewer {
    background: rgba(217, 122, 26, 0.1);
    border-color: rgba(217, 122, 26, 0.45);
    color: #D97A1A;
    cursor: pointer;
}

.cert-download--viewer:hover {
    background: rgba(217, 122, 26, 0.2);
    border-color: rgba(217, 122, 26, 0.75);
    color: #EBEFF2;
}

/* ---- PDF Viewer Modal ---- */
.cert-viewer-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(14, 28, 44, 0.88);
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.cert-viewer-modal.is-open {
    display: flex;
    opacity: 1;
    animation: modalFadeIn 0.25s ease forwards;
}

.cert-viewer-modal__container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 56rem;
    max-height: 88vh;
    background: #1A1D26;
    border: 1px solid rgba(217, 122, 26, 0.25);
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 32px 72px -20px rgba(0, 0, 0, 0.75);
}

.cert-viewer-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.cert-viewer-modal__title {
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #D97A1A;
}

.cert-viewer-modal__close {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #EBEFF2;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.cert-viewer-modal__close:hover {
    background: rgba(217, 122, 26, 0.18);
    border-color: rgba(217, 122, 26, 0.5);
    color: #D97A1A;
}

.cert-viewer-modal__body {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.cert-viewer-modal__iframe {
    width: 100%;
    height: 100%;
    min-height: 60vh;
    border: none;
    display: block;
}

@keyframes modalFadeIn {
    0% { opacity: 0; transform: scale(0.97); }
    100% { opacity: 1; transform: scale(1); }
}


/* ---- Mobile Optimizations ---- */
@media (max-width: 639px) {
    .tri-title {
        font-size: 1.65rem !important; /* Ajuste para evitar cortes en Tri-norma */
        line-height: 1.1;
    }
    
    .tri-copy {
        font-size: 0.9rem;
    }

    .cert-card {
        padding: 1.5rem !important; /* Equivalente a p-6 */
    }

    .cert-card h4 {
        font-size: 1rem !important;
    }

    .cert-download {
        min-height: 48px; /* Touch target standard */
        font-size: 0.72rem;
        padding: 0.8rem 1rem;
    }

    .cert-viewer-modal__container {
        max-height: 92vh;
        border-radius: 1rem;
    }
}

@media (max-width: 479px) {
    .tri-intro {
        text-align: center;
    }
    
    .tri-intro .flex {
        justify-content: center;
    }

    .tri-title {
        font-size: 1.5rem !important;
    }
}
