:root {
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --accent-color: #0ea5e9;
    --card-bg: rgba(255, 255, 255, 0.9);
    --modal-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.5);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: #f8fafc;
    /* A very subtle and modern dot pattern background */
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 24px 24px;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    overflow-x: hidden;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 1s ease-out;
}

h1 {
    font-size: 3.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0px 4px 15px rgba(14, 165, 233, 0.15);
}

header p {
    font-size: 1.3rem;
    font-weight: 400;
    color: #475569;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2.5rem;
    width: 100%;
    max-width: 1200px;
}

@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
}

.card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    background-color: var(--card-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    aspect-ratio: 3/4;
    transition: box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
    
    animation-name: fadeInUp, gentleFloat;
    animation-duration: 0.8s, 6s;
    animation-timing-function: ease-out, ease-in-out;
    animation-fill-mode: both, both;
    animation-iteration-count: 1, infinite;
}

.card:hover {
    animation-play-state: paused, paused;
    transform: translateY(-12px) scale(1.03) !important;
    box-shadow: 0 20px 40px rgba(14, 165, 233, 0.12);
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.5s ease, transform 0.5s ease;
}

.card:hover img {
    filter: brightness(0.9) contrast(1.05);
    transform: scale(1.05);
}

.card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(5px);
    transition: opacity 0.4s ease;
}

.card:hover .card-overlay {
    opacity: 1;
}

.overlay-text {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    color: var(--accent-color);
    padding: 1.5rem;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card:hover .overlay-text {
    transform: translateY(0);
}

/* Modal styling */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    padding: 2rem;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--modal-bg);
    border: 1px solid rgba(255, 255, 255, 1);
    border-radius: 20px;
    width: 100%;
    max-width: 950px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #f1f5f9;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: #475569;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s, color 0.3s, transform 0.3s;
    line-height: 1;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.close-btn:hover {
    color: #fff;
    background: #ef4444;
    transform: rotate(90deg);
}

.modal-body {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .modal-body {
        flex-direction: row;
        align-items: stretch;
    }
}

.modal-image-container {
    flex: 1;
    min-height: 350px;
}

@media (min-width: 768px) {
    .modal-image-container {
        flex: 0 0 45%;
    }
}

.modal-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

@media (min-width: 768px) {
    .modal-image-container img {
        border-top-right-radius: 0;
        border-bottom-left-radius: 20px;
    }
}

.modal-text-container {
    flex: 1;
    padding: 3rem;
    font-size: 1.15rem;
    line-height: 1.8;
    color: #334155;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-text-container p {
    margin-bottom: 1.2rem;
}

.modal-text-container h2 {
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    font-size: 2.5rem;
    font-weight: 800;
}

/* Footer */
footer {
    width: 100%;
    text-align: center;
    margin-top: 5rem;
    padding-top: 2.5rem;
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1.6;
    animation: fadeInUp 1s both;
    animation-delay: 0.5s;
    border-top: 1px solid rgba(0,0,0,0.05);
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s, text-decoration 0.3s;
}

footer a:hover {
    color: #3b82f6;
    text-decoration: underline;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gentleFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-4px) rotate(1deg); }
    66% { transform: translateY(3px) rotate(-1deg); }
}
