
/* --- Headline Grid Layout --- */
#headline-grid-container {
    max-width: 1200px;
    margin: 140px auto 10px auto; 
    /* 
       4. 타이틀과 메인 이미지 사이 space를 1/2로. (Previously 155px for desktop)
       Header 100px. Space was ~55px. 1/2 of 55 = 27px. 
       So margin-top = 100 + 27 = 127px. (approx 130px)
    */
    margin-top: 130px;
    padding: 0 40px;
    box-sizing: border-box;
    width: 100%;
    display: block; 
}

@media screen and (min-width: 1024px) {
    #headline-grid-container {
        padding: 0 60px;
        /* Desktop */
        margin-top: 90px; 
    }
}

.headline-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* Fixed to 6 columns for balanced layout */
    grid-template-rows: 400px 250px;
    gap: 10px;
}

/* Grid Slots Definition */
/* Top Row: 2 Big items - Reduced width to 75% (3/4) */
.headline-slot-1 { /* Hot */
    grid-column: 1 / 4; 
    grid-row: 1;
    width: 75%;
    justify-self: end; /* Push to center */
}
.headline-slot-2 { /* Focus */
    grid-column: 4 / 7; 
    grid-row: 1;
    width: 75%;
    justify-self: start; /* Push to center */
}

/* Bottom Row: 3 items - Full Width */
.headline-slot-3 { /* Wow */
    grid-column: 1 / 3; 
    grid-row: 2;
    /* Default width auto, justify stretch */
}
.headline-slot-4 { /* New */
    grid-column: 3 / 5; 
    grid-row: 2;
}
.headline-slot-5 { /* Mixed */
    grid-column: 5 / 7; 
    grid-row: 2;
}

/* Adjust Grid Template for 6 columns */
.headline-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* Card Styling */
.headline-card {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background-color: #f0f0f0;
}

/* Image */
.headline-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 5s ease;
}
.headline-card:hover .headline-img {
    transform: scale(1.05); /* Slow zoom effect */
}

/* Overlay for text readability */
.headline-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
}

/* Theme Label (Top Right) */
.headline-theme {
    position: absolute;
    top: 15px; 
    right: 15px; /* Changed back to right */
    left: auto;
    background-color: rgba(0,0,0,0.6);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 2;
}

/* Specific styling for Top Row (Hot/Focus) */
.headline-slot-1 .headline-theme,
.headline-slot-2 .headline-theme {
    font-size: 20px; /* Larger */
    padding: 8px 20px;
}

/* Title (Bottom Center) */
.headline-title {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    color: white;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    z-index: 2;
    text-decoration: none;
    line-height: 1.3;
}

.headline-slot-1 .headline-title,
.headline-slot-2 .headline-title {
    font-size: 32px; /* Larger title for top row */
}

.headline-card:hover .headline-title {
    text-decoration: underline;
}

/* Fading Transition Classes */
.headline-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    z-index: 1;
}
.headline-content.active {
    opacity: 1;
    z-index: 2;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    #headline-grid-container {
        margin-top: 78px; /* Task 3: Reduced spacing by 1/2 (Header 70px + ~8px gap) */
        padding: 0 15px; /* Matches header padding */
    }

    .headline-grid {
        display: flex;
        flex-direction: column;
        grid-template: none;
        height: auto;
    }
    .headline-card {
        height: 250px;
    }

    /* Task 3: Normalize sizes for Top 2 headlines (Hot/Focus) */
    .headline-slot-1 .headline-theme,
    .headline-slot-2 .headline-theme {
        font-size: 14px; /* Same as others */
        padding: 5px 15px;
    }

    .headline-slot-1 .headline-title,
    .headline-slot-2 .headline-title {
        font-size: 20px; /* Same as others */
    }
    
    /* Ensure slots take full width if needed, though flex-direction column handles it */
    .headline-slot-1, .headline-slot-2 {
        width: 100%;
    }
}
