* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

::selection {
    background: rgba(194, 42, 61, 0.3);
    color: white;
}

body {
    font-family: Poppins, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #121212;
    background-image: radial-gradient(rgba(194, 42, 61, 0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    flex-direction: column;
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

header {
    border-bottom: 1px solid rgba(194, 42, 61, 0.2);
    padding: 18px 0;
    width: 100%;
    max-width: 1400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

header a {
    text-decoration: none;
    color: #c22a3d;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 900;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

header a:hover {
    color: #e3172f;
    text-shadow: 0 0 20px rgba(194, 42, 61, 0.4);
}

.back-arrow {
    font-size: 28px;
    font-style: normal;
    transition: transform 0.3s ease;
}

header a:hover .back-arrow {
    transform: translateX(-4px);
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 20px;
    max-width: 1400px;
    width: 100%;
}

.certificate {
    background-color: #fff;
    border-radius: 10px;
    position: relative;
    border: 1px solid rgba(194, 42, 61, 0.15);
    box-shadow: 0 4px 12px rgba(194, 42, 61, 0.1), 0 6px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    animation: fadeUp 0.8s ease forwards;
}

/* Stagger each certificate */
.certificate:nth-child(1)  { animation-delay: 0.1s; }
.certificate:nth-child(2)  { animation-delay: 0.15s; }
.certificate:nth-child(3)  { animation-delay: 0.2s; }
.certificate:nth-child(4)  { animation-delay: 0.25s; }
.certificate:nth-child(5)  { animation-delay: 0.3s; }
.certificate:nth-child(6)  { animation-delay: 0.35s; }
.certificate:nth-child(7)  { animation-delay: 0.4s; }
.certificate:nth-child(8)  { animation-delay: 0.45s; }
.certificate:nth-child(9)  { animation-delay: 0.5s; }
.certificate:nth-child(10) { animation-delay: 0.55s; }
.certificate:nth-child(11) { animation-delay: 0.6s; }
.certificate:nth-child(12) { animation-delay: 0.65s; }
.certificate:nth-child(13) { animation-delay: 0.7s; }
.certificate:nth-child(14) { animation-delay: 0.75s; }
.certificate:nth-child(15) { animation-delay: 0.8s; }
.certificate:nth-child(16) { animation-delay: 0.85s; }
.certificate:nth-child(17) { animation-delay: 0.9s; }

@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.certificate img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.certificate:hover {
    border-color: rgba(194, 42, 61, 0.4);
    box-shadow: 0 8px 25px rgba(194, 42, 61, 0.2), 0 6px 20px rgba(0, 0, 0, 0.3);
}

.certificate:hover img {
    transform: scale(1.03);
}

.certificate.horizontal {
    grid-column: span 2;
}
