:root {
    --primary-color: #ff0000; /* Vibrant YouTube Red */
    --accent-color: #2d3436;
    --bg-color: #f0f2f5;
    --text-main: #1a1a1a;
    --text-muted: #636e72;
    --card-bg: #ffffff;
    --border-radius: 16px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 25px rgba(0,0,0,0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* Modern Header */
header {
    background-color: #000; /* Sophisticated dark header */
    color: white;
    padding: 4rem 1rem;
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

header h1 {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -1px;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

header p {
    color: #b2bec3;
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 300;
}

/* Main Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem 5rem 1.5rem;
}

/* Filter Section */
.filter-section {
    margin-bottom: 3rem;
    text-align: center;
}

.filter-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.filter-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-btn {
    padding: 0.6rem 1.5rem;
    background-color: white;
    border: 1px solid #dfe6e9;
    color: var(--accent-color);
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.filter-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
}

/* Article Card Styling */
.article-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 4rem;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* Thumbnail & Video Link Styling */
.video-link-container {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* Perfect YouTube ratio */
    overflow: hidden;
    background-color: #000;
}

.video-thumbnail {
    width: 100%;
    height: 100%; /* Keep your preferred height */
    object-fit: cover; /* Keep your preferred fit */
    display: block;
    
    /* ADD THESE FOR LAZY LOADING */
    opacity: 0;
    transition: opacity 0.8s ease-in-out; 
    background-color: #222; /* Optional: gives a dark placeholder box */
}

.video-thumbnail[src] {
    opacity: 1;
}

.video-thumbnail:not([src]) {
    background-color: #f0f0f0;
}

.video-link-container:hover .video-thumbnail {
    transform: scale(1.05);
}

/* Play Button Overlay */
.play-button-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
    transition: background 0.3s ease;
    z-index: 2;
}

.play-icon {
    width: 68px;
    height: 48px;
    background-color: rgba(255, 0, 0, 0.9);
    border-radius: 12px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.play-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent white;
}

/* Article Content */
.article-content {
    padding: 3rem;
}

.category-tag {
    display: inline-block;
    background-color: #f1f2f6;
    color: var(--text-muted);
    padding: 0.3rem 1rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.article-card:hover .category-tag {
    background-color: var(--primary-color);
    color: white;
}

.article-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.1;
    color: var(--accent-color);
}

.article-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.article-body {
    font-size: 1.15rem;
    color: #2d3436;
}

.article-body p {
    margin-bottom: 1.5rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 4rem 1rem;
    background: #fff;
    border-top: 1px solid #dfe6e9;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    color: var(--text-muted);
}

/* --- 1. THE CONTAINER (Handles the Grid) --- */
#content-container {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

#content-container.shorts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 3rem;
}

/* --- 2. THE CARD (Handles the Overlay) --- */
.short-overlay-card {
    position: relative;
    overflow: hidden;
    aspect-ratio: 9 / 16;
    border-radius: var(--border-radius);
    margin-bottom: 0 !important; /* Grid handles spacing */
}

.short-overlay-card .video-link-container {
    position: absolute;
    inset: 0;
    height: 100%;
}

.short-overlay-card .article-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 5;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 50%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
}

.short-overlay-card .article-title {
    color: white;
    font-size: 1rem; /* Adjusted for the 4-column width */
    margin-bottom: 0;
    font-weight: 700;
    line-height: 1.2;
}

/* Hide extra clutter in the overlay view */
.short-overlay-card .category-tag,
.short-overlay-card .article-meta,
.short-overlay-card .article-body {
    display: none;
}

.profile-container {
    display: flex;          
    justify-content: center; 
    align-items: center;
    width: 100%;
    padding: 20px 0;
}

.yt-profile-pic {
    width: 220px;            /* Set your desired size */
    height: 220px;
    border-radius: 50%; /* This creates the circle */
    object-fit: cover;  /* This prevents the "squished" look */
    border: 10px solid #dfe6e9; /* Optional: subtle border like YT */
    display: block;
}

.ad-container-wrapper {
    grid-column: 1 / -1; /* Spans all columns in your grid */
    width: 100%;
    border-radius: 8px;
}

.search-wrapper {
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 20px;
}

.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

#site-search {
    width: 100%;
    padding: 12px 45px 12px 20px; /* Extra padding on the right for the button */
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
}

#clear-search {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    display: none; /* Hidden by default */
}

#clear-search:hover {
    color: #ff0000; /* Turns red when hovering */
}

#site-search:focus {
    border-color: #ff00006e; /* YouTube Red focus color */
}

.article-link {
    color: #0984e3;
    text-decoration: underline;
    font-weight: bold;
    word-break: break-all; /* Prevents long URLs from breaking your layout */
    transition: color 0.2s ease;
}

.article-link:hover {
    text-decoration: none;
}

.hashtag-link {
    color: #065fd4;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s;
    padding: 2px 4px;
    border-radius: 4px;
}

.hashtag-link:hover {
    background-color: #eaf3ff;
    text-decoration: underline;
}

/* --- 3. RESPONSIVE GRID --- */
@media (max-width: 1000px) {
    #content-container.shorts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    #content-container.shorts-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    header h1 { font-size: 2.2rem; }
    .article-content { padding: 2rem; }
    .article-title { font-size: 1.75rem; }
    .article-body { font-size: 1.05rem; }
    .play-icon { transform: scale(0.8); } /* Slightly smaller play button on mobile */
}