.certifications-page {
    background: #f7f5f1;
}

.certs-a4-section {
    min-height: 100dvh;
    padding: clamp(94px, 12vh, 132px) 0 clamp(56px, 8vh, 92px);
    background: linear-gradient(180deg, #f7f5f1 0%, #eee9e1 100%);
}

.certs-a4-wrap {
    display: grid;
    gap: clamp(1.2rem, 2.2vw, 2rem);
}

.certs-a4-header {
    max-width: 920px;
}

.certs-eyebrow {
    margin: 0 0 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.78rem;
    font-weight: 700;
    color: #6e675f;
}

.certs-a4-header h1 {
    margin: 0;
    font-size: clamp(2rem, 4.3vw, 3.5rem);
    color: #171615;
    line-height: 1.08;
}

.certs-subtitle {
    margin: 0.75rem 0 0;
    color: #4f4a44;
    font-size: clamp(0.98rem, 1.3vw, 1.2rem);
    line-height: 1.55;
}

.certs-a4-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(14px, 1.8vw, 24px);
    align-items: stretch;
}

.cert-a4-card {
    position: relative;
    background: #fefdfb;
    border: 1px solid rgba(116, 107, 94, 0.28);
    border-radius: 16px;
    box-shadow: 0 14px 26px rgba(31, 26, 20, 0.12);
    overflow: hidden;
    display: block;
    aspect-ratio: 210 / 297;
    min-height: 0;
    isolation: isolate;
    opacity: 0;
    filter: blur(10px);
    transform: translateX(-34px);
    animation: certCardReveal 0.85s cubic-bezier(0.2, 0.75, 0.2, 1) forwards;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.certs-a4-grid .cert-a4-card:nth-child(1) {
    animation-delay: 0.16s;
}

.certs-a4-grid .cert-a4-card:nth-child(2) {
    animation-delay: 0.44s;
}

.certs-a4-grid .cert-a4-card:nth-child(3) {
    animation-delay: 0.72s;
}

.cert-a4-card:hover {
    transform: translateY(-6px) !important;
    box-shadow: 0 24px 40px rgba(31, 26, 20, 0.18);
}

.cert-a4-preview {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.cert-a4-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.62s cubic-bezier(0.22, 0.61, 0.36, 1), filter 0.32s ease;
}

.cert-a4-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cert-a4-card:hover .cert-a4-preview img,
.cert-a4-card:focus-within .cert-a4-preview img {
    transform: scale(1.03);
}

.cert-a4-preview-placeholder {
    background: linear-gradient(145deg, #efebe4 0%, #e3ddd3 100%);
}

.cert-a4-preview-placeholder span {
    color: #6f675f;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cert-a4-copy {
    position: absolute;
    left: 0.7rem;
    right: 0.7rem;
    bottom: 0.7rem;
    z-index: 2;
    padding: clamp(0.85rem, 1.3vw, 1.2rem);
    display: grid;
    align-content: start;
    gap: 0.45rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.5);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 0 26px rgba(255, 255, 255, 0.72);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    pointer-events: none;
}

.cert-a4-card:hover .cert-a4-copy,
.cert-a4-card:focus-within .cert-a4-copy {
    opacity: 1;
    transform: translateY(0);
}

html[data-reduce-motion="true"] .cert-a4-card {
    opacity: 1;
    filter: none;
    transform: none;
    animation: none;
}

html[data-reduce-motion="true"] .cert-a4-copy {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* High contrast overrides */
html[data-contrast="high"] .certifications-page,
html[data-contrast="high"] #main-content,
html[data-contrast="high"] .navbar,
html[data-contrast="high"] .nav-cluster,
html[data-contrast="high"] .nav-cluster.active,
html[data-contrast="high"] .certs-a4-section,
html[data-contrast="high"] .certs-a4-wrap,
html[data-contrast="high"] .footer {
    background: #000000 !important;
    background-image: none !important;
    color: #ffffff !important;
}

html[data-contrast="high"] .certs-a4-header,
html[data-contrast="high"] .cert-a4-card,
html[data-contrast="high"] .cert-a4-copy {
    background: #000000 !important;
    background-image: none !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    box-shadow: none !important;
}

html[data-contrast="high"] .certs-a4-header h1,
html[data-contrast="high"] .certs-subtitle,
html[data-contrast="high"] .certs-eyebrow,
html[data-contrast="high"] .cert-a4-copy h2,
html[data-contrast="high"] .cert-a4-copy p,
html[data-contrast="high"] .footer a {
    color: #ffffff !important;
}

html[data-contrast="high"] .cert-a4-preview-placeholder {
    background: #000000 !important;
    background-image: none !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
}

html[data-contrast="high"] .cert-a4-preview-placeholder span {
    color: #ffffff !important;
}

.cert-a4-copy h2 {
    margin: 0;
    font-size: clamp(1rem, 1.5vw, 1.22rem);
    color: #151413;
    line-height: 1.25;
}

.cert-a4-copy p {
    margin: 0;
    font-size: clamp(0.86rem, 1.08vw, 0.98rem);
    line-height: 1.5;
    color: #5a544d;
}

[data-theme="dark"] .certifications-page {
    background: #111111;
}

[data-theme="dark"] .certs-a4-section {
    background: linear-gradient(135deg, #050505 0%, #1d1b18 55%, #443f38 100%);
}

[data-theme="dark"] .certs-eyebrow {
    color: #c8c2b9;
}

[data-theme="dark"] .certs-a4-header h1 {
    color: #f1ece3;
}

[data-theme="dark"] .certs-subtitle {
    color: #d4cec4;
}

[data-theme="dark"] .cert-a4-card {
    background: linear-gradient(150deg, #1c1b19 0%, #2e2a26 100%);
    border-color: rgba(180, 170, 156, 0.25);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.36);
}

@keyframes certCardReveal {
    0% {
        opacity: 0;
        transform: translateX(-34px);
        filter: blur(10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

[data-theme="dark"] .cert-a4-preview-placeholder {
    background: linear-gradient(145deg, #1f1d1a 0%, #2e2b27 100%);
}

[data-theme="dark"] .cert-a4-preview-placeholder span {
    color: #ddd6cb;
}

[data-theme="dark"] .cert-a4-copy h2 {
    color: #f2ece2;
}

[data-theme="dark"] .cert-a4-copy p {
    color: #d1c9bf;
}

[data-theme="dark"] .cert-a4-copy {
    background: rgba(16, 15, 13, 0.62);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.58);
}

@media (max-width: 1100px) {
    .certs-a4-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .certs-a4-section {
        min-height: auto;
        padding: 88px 0 58px;
    }

    .certs-a4-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .cert-a4-card {
        aspect-ratio: 5 / 7;
    }
}

@media (hover: none) {
    .cert-a4-copy {
        opacity: 1;
        transform: translateY(0);
    }
}
