/*
Theme Name: BlogFlix
Author: Gemini
Description: A WordPress theme inspired by the Netflix browsing experience for blogs.
Version: 1.0
*/

/* --- 1. VARIABLES & RESET --- */
:root {
    --bg-body: #141414;
    --bg-card: #1f1f1f;
    --brand-red: #E50914;
    --text-white: #ffffff;
    --text-gray: #a3a3a3;
    
    --font-display: 'Bebas Neue', sans-serif;
    --font-ui: 'Inter', sans-serif;
    --font-body: 'Merriweather', serif; /* Better for long reading */

    --max-width: 1100px;
    --content-width: 740px;
}

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

body {
    background-color: var(--bg-body);
    color: var(--text-white);
    font-family: var(--font-ui);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
button { border: none; outline: none; cursor: pointer; }

/* --- 2. PROGRESS BAR (Like Video Timeline) --- */
.reading-progress-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 4px;
    background: transparent; z-index: 1002;
}
.reading-progress-bar {
    height: 100%; background: var(--brand-red); width: 0%;
    box-shadow: 0 0 10px var(--brand-red);
    transition: width 0.1s linear;
}

/* --- 3. NAVIGATION --- */
.navbar {
    position: fixed; top: 0; width: 100%; height: 68px;
    padding: 0 4%;
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3));
    z-index: 1000; transition: background-color 0.4s, box-shadow 0.4s;
}
.navbar.scrolled { background-color: #0f0f0f; box-shadow: 0 4px 20px rgba(0,0,0,0.5); }

.logo {
    font-family: var(--font-display);
    color: var(--brand-red);
    font-size: 2.2rem;
    letter-spacing: 1px;
    padding-top: 5px;
}

.nav-links { display: flex; gap: 20px; font-size: 0.95rem; font-weight: 600; letter-spacing: 0.2px; }
.nav-links a:hover { color: #b3b3b3; }
.nav-links li { list-style: none; }
.nav-links a { color: inherit; }

.back-btn {
    display: flex; align-items: center; gap: 8px;
    font-weight: 600; cursor: pointer;
}
.back-btn:hover { color: #ccc; }

/* --- 4. CINEMATIC HERO (The "Movie" Header) --- */
.article-hero {
    position: relative;
    height: 85vh; /* Full screen feel */
    width: 100%;
    background-size: cover;
    background-position: center;
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.hero-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(90deg, #141414 0%, rgba(20,20,20,0.6) 50%, transparent 100%);
}

.hero-content {
    position: absolute;
    bottom: 20%; 
    left: 4%;
    max-width: 650px;
    z-index: 2;
}

.series-badge {
    font-family: var(--font-display);
    font-size: 1.2rem; letter-spacing: 2px; margin-bottom: 10px;
    color: #fff; display: flex; align-items: center; gap: 5px;
    text-transform: uppercase;
}
.series-badge::before { content: 'N'; color: var(--brand-red); font-size: 2rem; font-weight: bold; margin-right: 5px;}

.article-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw, 5.5rem); line-height: 0.95; margin-bottom: 1rem;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.8);
    word-break: break-word;
}

.meta-line {
    display: flex; align-items: center; gap: 15px;
    font-size: 1rem; color: #d2d2d2; font-weight: 600;
    margin-bottom: 1.5rem;
}
.match { color: #46d369; font-weight: bold; }
.year { color: #a3a3a3; }
.rating { border: 1px solid #a3a3a3; padding: 0 5px; font-size: 0.8rem; }

.hero-synopsis {
    font-size: 1.2rem; line-height: 1.5; margin-bottom: 2rem;
    color: #fff; text-shadow: 1px 1px 3px black;
}

.action-buttons { display: flex; gap: 15px; }

.btn {
    padding: 0.8rem 2.2rem; border-radius: 4px; font-weight: 700; font-size: 1.2rem;
    display: flex; align-items: center; gap: 10px; transition: 0.2s;
}
.btn:hover { transform: scale(1.05); }

.btn-white { background: white; color: black; }
.btn-gray { background: rgba(109, 109, 110, 0.7); color: white; }

/* --- 5. ARTICLE BODY (The "Content") --- */
.content-wrapper {
    position: relative;
    z-index: 10;
    max-width: var(--content-width);
    margin: -50px auto 0; /* Pull up over hero fade */
    padding: 0 20px 100px;
}

.article-meta-bar {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid #333; border-bottom: 1px solid #333;
    padding: 15px 0; margin-bottom: 40px;
    color: var(--text-gray); font-size: 0.9rem;
}

.author-info { display: flex; align-items: center; gap: 10px; }
.author-img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; }
.author-name span { color: white; display: block; font-weight: bold; }

.article-text {
    font-family: var(--font-body);
    font-size: 1.15rem;
    line-height: 1.8;
    color: #e0e0e0;
}

.article-text p { margin-bottom: 2rem; }
.article-text h2 {
    font-family: var(--font-ui); font-weight: 700; font-size: 1.8rem;
    color: white; margin: 3rem 0 1rem;
}
.article-text blockquote {
    border-left: 4px solid var(--brand-red);
    padding-left: 20px; margin: 2rem 0;
    font-style: italic; color: #fff; font-size: 1.3rem;
}
.article-text img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 2rem 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

/* --- 6. "MORE LIKE THIS" GRID --- */
.more-section {
    max-width: 1200px; margin: 0 auto; padding: 40px 4%;
    border-top: 1px solid #333;
}
.section-title {
    font-family: var(--font-display); font-size: 2rem; margin-bottom: 20px;
    color: white;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.card {
    aspect-ratio: 16/9;
    background-color: var(--bg-card);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.3s;
}
.card:hover { transform: scale(1.05); z-index: 5; box-shadow: 0 0 20px rgba(0,0,0,0.7); }
.card img { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; transition: 0.3s; }
.card:hover img { opacity: 1; }

.card-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    padding: 10px; display: flex; flex-direction: column; justify-content: flex-end;
    opacity: 0; transition: opacity 0.3s;
}
.card:hover .card-overlay { opacity: 1; }
.card-title { font-weight: bold; font-size: 0.9rem; margin-bottom: 5px; }
.card-match { color: #46d369; font-size: 0.7rem; font-weight: bold; }

.categories-section { margin-top: 40px; }
.category-card img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.85); }
.category-card:hover img { filter: brightness(1); }
.explore-filter { display: grid; gap: 12px; margin: 20px 0 30px; }
.explore-filter form { display: grid; gap: 10px; grid-template-columns: 1fr; }
.explore-filter input[type="text"], .explore-filter select { padding: 10px; border-radius: 6px; border: 1px solid #333; background: #1f1f1f; color: white; }
.explore-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }
.explore-results .card-overlay { opacity: 1; background: linear-gradient(to top, rgba(0,0,0,0.9), transparent); }
.explore-results .card-hover-info { display: none; }

.tts-word.active { background: rgba(229, 9, 20, 0.4); box-shadow: 0 0 0 1px rgba(229,9,20,0.7); }

.nav-actions { display: flex; align-items: center; gap: 10px; }
.search-form { display: flex; align-items: center; background: rgba(255,255,255,0.12); padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.08); }
.search-form:focus-within { border-color: rgba(229,9,20,0.6); box-shadow: 0 0 0 2px rgba(229,9,20,0.25); }
.search-field { background: transparent; border: none; color: white; outline: none; width: 170px; font-size: 0.95rem; }
.search-form button { background: transparent; color: white; padding: 0; display: flex; align-items: center; }

/* --- HOMEPAGE (INDEX) --- */
body.home main { margin-top: -100px; padding-bottom: 60px; }
.hero { position: relative; height: 85vh; width: 100%; overflow: hidden; }
.hero-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1s ease-in-out; z-index: 0; }
.hero-slide.active { opacity: 1; z-index: 1; }
.hero-bg { width: 100%; height: 100%; object-fit: cover; mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 80%, rgba(0,0,0,0) 100%); transform: scale(1); transition: transform 10s linear; }
.hero-slide.active .hero-bg { transform: scale(1.15); }
.hero-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(90deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 40%, transparent 100%); }
.hero-content { position: absolute; bottom: 30%; left: 4%; max-width: 600px; z-index: 2; }
.hero-badge { font-family: var(--font-display); font-size: 1.2rem; letter-spacing: 3px; margin-bottom: 10px; color: #fff; display: flex; align-items: center; gap: 10px; text-transform: uppercase; }
.hero-badge::before { content: 'N'; color: var(--brand-red); font-size: 2.5rem; font-weight: bold; }
.hero-title { font-family: var(--font-display); font-size: clamp(2.5rem, 5vw, 5rem); line-height: 0.95; margin-bottom: 1.5rem; text-shadow: 2px 2px 4px rgba(0,0,0,0.6); word-break: break-word; }
.hero-desc { font-size: 1.1rem; line-height: 1.5; margin-bottom: 2rem; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); max-width: 500px; }
.hero-btns { display: flex; gap: 1rem; }
.btn-white { background: white; color: black; }
.btn-gray { background: rgba(109, 109, 110, 0.7); color: white; }

.home-main .row { margin-bottom: -20px; position: relative; }
.home-main .row:hover { z-index: 20; }
.home-main .row-header { padding-left: 4%; margin-bottom: -10px; font-family: var(--font-display); font-size: 1.8rem; color: #e5e5e5; letter-spacing: 1px; position: relative; z-index: 5; display: flex; align-items: center; gap: 10px; }
.home-main .explore { font-family: var(--font-ui); font-size: 0.8rem; color: #54b9c5; font-weight: 600; letter-spacing: 0; }
.slider-container { position: relative; width: 100%; }
.slider-track { display: flex; gap: 8px; padding: 50px 4%; overflow-x: auto; overflow-y: visible; scroll-behavior: smooth; scrollbar-width: none; }
.slider-track::-webkit-scrollbar { display: none; }
.home-main .card { flex: 0 0 auto; width: 280px; aspect-ratio: 16/9; background-color: var(--bg-card); border-radius: 4px; position: relative; cursor: pointer; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.home-main .card img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.home-main .card-static-overlay { position: absolute; bottom: 0; left: 0; width: 100%; height: 50%; background: linear-gradient(to top, rgba(0,0,0,0.9) 10%, transparent); border-radius: 0 0 4px 4px; display: flex; align-items: flex-end; padding: 10px; transition: opacity 0.3s; }
.home-main .card-hover-info { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, #141414 20%, rgba(20,20,20,0.4)); border-radius: 4px; opacity: 0; padding: 15px; display: flex; flex-direction: column; justify-content: flex-end; transition: opacity 0.3s; pointer-events: none; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); }
.home-main .card:hover { transform: scale(1.2); z-index: 100; box-shadow: 0 10px 20px rgba(0,0,0,0.8); transition-delay: 0.3s; }
.home-main .card:hover .card-static-overlay { opacity: 0; transition-delay: 0.3s; }
.home-main .card:hover .card-hover-info { opacity: 1; transition-delay: 0.3s; }
.home-main .card-meta { font-size: 0.75rem; color: #aaa; margin-top: 8px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.handle { position: absolute; top: 0; bottom: 0; width: 4%; background: rgba(0,0,0,0.5); color: white; border: none; font-size: 3rem; z-index: 50; display: flex; align-items: center; justify-content: center; opacity: 0; transition: 0.2s; }
.handle:hover { background: rgba(0,0,0,0.8); }
.slider-container:hover .handle { opacity: 1; }
.handle.left { left: 0; }
.handle.right { right: 0; }

@media (max-width: 1024px) {
    .hero-title { font-size: 3.2rem; }
    .home-main .card { width: 220px; }
}
@media (max-width: 768px) {
    .hero { height: 65vh; }
    .hero-title { font-size: 2.2rem; }
    .hero-desc { display: none; }
    .handle { display: none; }
    .slider-track { padding-right: 20px; padding-top: 20px; }
    .home-main .card { width: 70vw; max-width: 260px; transform: none !important; }
    .card-hover-info { display: none; }
    .card-static-overlay { opacity: 1 !important; height: 70%; }
    .nav-actions { display: none; }
}

/* --- FOOTER (Netflix Style) --- */
.netflix-footer {
    background-color: var(--bg-body);
    padding: 40px 0;
    border-top: 1px solid #333;
}

.footer-content {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 4%;
    color: #808080;
}

.footer-social {
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
}

.footer-social a {
    color: #808080;
    font-size: 24px;
    transition: color 0.3s ease;
}

.footer-social a:hover {
    color: #fff;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.footer-links-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links-col a {
    color: #808080;
    text-decoration: none;
    font-size: 13px;
    transition: text-decoration 0.3s ease;
}

.footer-links-col a:hover {
    text-decoration: underline;
}

.footer-service-code {
    margin-bottom: 20px;
}

.footer-service-code a {
    color: #808080;
    border: 1px solid #808080;
    padding: 8px 15px;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.footer-service-code a:hover {
    color: #fff;
    border-color: #fff;
}

.footer-copyright {
    font-size: 11px;
    color: #808080;
}


/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .article-hero { height: 65vh; }
    .article-title { font-size: 3rem; }
    .hero-content { bottom: 10%; left: 20px; right: 20px; }
    .meta-line { flex-wrap: wrap; gap: 10px; font-size: 0.9rem; }
    .content-wrapper { padding: 0 15px 60px; }
    .footer-links { grid-template-columns: 1fr 1fr; }
    .action-buttons { flex-direction: column; width: 100%; }
    .btn { width: 100%; justify-content: center; }
}

/* BLOG PAGE HERO FIX */
.page-template-page-blog .article-hero {
    mask-image: none;
    -webkit-mask-image: none;
    height: 70vh;
}

.tts-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.tts-controls.hidden {
    display: none;
}

.tts-controls button {
    padding: 0.6rem; 
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center; 
    transition: 0.2s;
    background: rgba(109, 109, 110, 0.7);
    color: white;
}

.tts-controls button:hover {
    transform: scale(1.05);
}

#voiceSelect {
    padding: 0.8rem;
    border-radius: 4px;
    background: #333;
    color: white;
    border: none;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .tts-controls {
        flex-wrap: wrap; 
        justify-content: flex-start;
    }

    #voiceSelect {
        width: 100%; 
        margin-top: 10px;
    }
}

#tts-caret {
    position: absolute;
    width: 2px;
    background: var(--brand-red);
    box-shadow: 0 0 6px rgba(229,9,20,0.7);
    z-index: 2000;
    display: none;
}

/* Similar Posts Section */
.similar-posts {
    margin-top: 40px;
}

.similar-posts h3 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: #e5e5e5;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.card-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.card {
    background-color: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.3s;
}

.card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0,0,0,0.7);
}

.card a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.card-content {
    padding: 15px;
}

.card-content h4 {
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

