:root {
    --transition-speed: 0.5s;
    --accent: #e67e22;
    --bg-dark: #0f0f0f;
    --glass: rgba(0, 0, 0, 0.5);
}

/* Main Grid */
.magazine-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: 400px;
    gap: 20px;
    width: 100%;
    margin: auto;
}

/* Desktop layout fixed */
@media (min-width: 900px) {
    .magazine-grid {
        /* Changed from 2fr 1fr 1fr to ensure 3 distinct columns with gaps */
        grid-template-columns: repeat(4, 1fr); 
        grid-template-rows: 1fr 1fr;
        grid-template-areas:
            "hero hero small1 small2"
            "hero hero small3 small4";
        column-gap: 25px; /* Explicit horizontal spacing */
        row-gap: 25px;    /* Explicit vertical spacing */
        height: 80vh;
        min-height: 450px;
    }
    .hero_section_page { grid-area: hero; }
    #item-1 { grid-area: small1; }
    #item-2 { grid-area: small2; }
    #item-3 { grid-area: small3; }
    #item-4 { grid-area: small4; }
}

/* Grid items */
.grid-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    cursor: pointer;
    color: white;
    background: #1a1a1a;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.347);
}

/* Background image */
.bg-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 1.2s cubic-bezier(0.19, 1, 0.22, 1);
}
.grid-item:hover .bg-img {
    transform: scale(1.05);
}

/* Gradient overlay */
.grid-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.785) 0%, rgba(0, 0, 0, 0.232) 40%, transparent 100%);
    z-index: 1;
}

/* Content */
.content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 20px;
    z-index: 2;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.content-inner {
    background:rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: var(--border-radius);
    backdrop-filter: blur(4px);
}

h2:hover{
    color: #3498db;
}
.content-inner:hover .category{
    color: #3498db;
}
.fade-out {
    opacity: 0;
    transform: translateY(15px);
}
.category {
    display: inline-block;
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 6px;
    color: #fff;
}
h2, h3 {
    line-height: 1.2;
    font-weight: 700;
    transition: .3s all ease;
    /* color: #fff; */
}
.hero_section_page h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}
.small h3 {
    font-size: clamp(1rem, 2vw, 1.3rem);
}

h3:hover{
    color: var(--blue-color);
}
h2:hover{
    color: var(--blue-color);
}

/* Hero navigation buttons */
.hero_section_page .nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(11, 188, 214, 0.6);
    border: none;
    color: var(--white-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    z-index: 10;
    transition: 0.3s;
}
.hero_section_page .nav-btn:hover {
    background: rgba(255,255,255,0.8);
    color: black;
}
.hero_section_page .btn-prev { left: 15px; }
.hero_section_page .btn-next { right: 15px; }
/* Mobile layout */
@media (max-width: 900px) {
    .magazine-grid { 
        grid-template-columns: 1fr 1fr; 
        grid-auto-rows: 250px; 
        gap: 15px; 
    }
    .hero_section_page { grid-column: 1 / -1; grid-row: auto; height:auto; }
    .content { padding: 9px; }
    .hero_section_page .nav-btn { width: 35px; height: 35px; font-size: 18px; }
    .content-inner{padding: 10px;}

.hero_section_page h2 {
    font-size:20px;
}
.small h3 {
    font-size: 15px;
}
}