:root {
    --bg-color: #0d0f12;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --surface: #1e2229;
    --gap: 24px;
    --radius: 16px;
    --transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Cutive', serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header */
.header {
    text-align: center;
    padding: 100px 20px 80px;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.title {
    font-size: clamp(3rem, 7vw, 5.5rem);
    font-weight: 700;
    letter-spacing: -2px;
    margin-bottom: 24px;
    line-height: normal;
    padding-top: 10px;
    padding-bottom: 10px;
    background: linear-gradient(to right, #ffffff, #a8b2d1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.title span {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    display: inline-block;
}

.title span::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 100%;
    height: 6px;
    background-color: var(--accent);
    box-shadow: 0 0 24px var(--accent-glow);
    border-radius: 4px;
    opacity: 0.5;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Gallery Container */
.gallery-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 40px 120px;
    position: relative;
    min-height: 50vh;
}

@media screen and (max-width: 768px) {
    .gallery-container {
        padding: 0 20px 80px;
    }
}

/* Loader */
.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    z-index: 100;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Masonry Grid */
.grid {
    width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.grid.ready {
    opacity: 1;
}

/* Responsive Column Widths */
.grid-sizer,
.grid-item {
    width: calc(25% - var(--gap) * 0.75);
    margin-bottom: var(--gap);
}

@media screen and (max-width: 1200px) {

    .grid-sizer,
    .grid-item {
        width: calc(33.333% - var(--gap) * 0.666);
    }
}

@media screen and (max-width: 900px) {

    .grid-sizer,
    .grid-item {
        width: calc(50% - var(--gap) * 0.5);
    }
}

@media screen and (max-width: 600px) {

    .grid-sizer,
    .grid-item {
        width: 100%;
    }
}

/* Grid Item Details */
.grid-item {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.grid-item.loaded {
    opacity: 1;
    transform: translateY(0);
}

.item-inner {
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    background-color: var(--surface);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transform: translateZ(0);
    /* Hardware acceleration */
    will-change: transform;
}

/* Subtle Gradient Border */
.item-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.02) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: 2;
    pointer-events: none;
}

.image-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    aspect-ratio: auto;
}

.image-wrapper img,
.image-wrapper video {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Footer */
.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 80px;
    /* Space between the cert and email */
    padding: 60px 40px 80px;
    margin-top: 10px;
    position: relative;
    z-index: 10;
}

.footer-item {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Offsets giving slight left/right nudge */
.cert-container {
    transform: translateX(+6px) translateY(+7px);
}

.email-container {}

.contact-email {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all var(--transition);
    padding: 12px 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.contact-email:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Ensure the cert script iframe or component sits cleanly */
#ofgcert {
    display: inline-flex;
}

/* Responsive Footer adjustments */
@media screen and (max-width: 768px) {
    .footer {
        flex-direction: column;
        gap: 40px;
    }

    .cert-container,
    .email-container {
        transform: none;
    }
}