﻿/* --- 1. VARIABEL & RESET (Pengaturan Dasar) --- */
/* Updated: Live Server Fix v1.0 M3-Mobile */
@import url('https://fonts.googleapis.com/css2?family=Hind:wght@300;400;500;600;700&display=swap');

:root {
    /* Palet Warna Sekolah Literasi Rinjani */
    --primary-color: #003f60;
    /* Biru Gelap Rinjani */
    --secondary-color: #76b917;
    /* Hijau Literasi (Accent) */
    --accent-color: #e6f4db;
    --text-light: #ffffff;

    /* Semantic Theme Variables (Default: LIGHT) */
    --bg-body: #ffffff;
    --text-main: #212121;
    --text-muted: #666666;

    /* Header Specific */
    --header-bg: #ffffff;
    --header-text: #003f60;
    /* Biru di atas Putih */
    --header-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);

    /* Components */
    --card-bg: #ffffff;
    --border-color: #eeeeee;
    --tag-bg: rgba(118, 185, 23, 0.1);

    /* Shadows & Glass */
    --shadow-soft: rgba(0, 0, 0, 0.05);
    /* Light Mode Soft */
    --shadow-deep: rgba(0, 63, 96, 0.15);
    /* Light Mode Deep Blue Tint */
    --glass-border: rgba(0, 0, 0, 0.04);

    --font-main: 'Hind', 'Segoe UI', sans-serif;
    --max-width: 1200px;
    --header-height: 80px;
}

[data-theme="dark"] {
    /* Semantic Theme Variables (DARK) */
    --bg-body: #121212;
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;

    /* Header Specific (Dark Mode = Blue BG) */
    --header-bg: #003f60;
    --header-text: #ffffff;
    --header-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);

    /* Components */
    --card-bg: transparent;
    --border-color: #333333;
    --tag-bg: rgba(118, 185, 23, 0.2);

    /* Shadows & Glass (Dark Mode) */
    --shadow-soft: rgba(255, 255, 255, 0.05);
    /* White Glow */
    --shadow-deep: rgba(0, 0, 0, 0.5);
    /* Deep Black Shadow */
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: var(--header-height);
    transition: background-color 0.3s, color 0.3s;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
li,
a {
    color: inherit;
    /* Ensure elements don't default to browser agent sheet */
}

a {
    transition: 0.3s;
    /* color: inherit is already set above */
}

ul {
    list-style: none;
}

/* --- 2. NAVIGASI / MENU --- */
/* --- 2. NAVIGASI / MENU --- */
nav {
    background-color: rgba(255, 255, 255, 0.75);
    /* More transparent for glass effect */
    color: var(--header-text);
    height: var(--header-height);
    position: fixed;
    top: 20px;
    /* Floating top gap */
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: var(--max-width);
    /* Align with content width */
    z-index: 1000;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    /* Glass shadow */
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s, top 0.3s;

    /* Liquid Glass Effect */
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: 20px;
    /* Full curved edges */
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* Optional glass border */
}

[data-theme="dark"] nav {
    background-color: rgba(30, 30, 30, 0.85);
    /* Neutral Dark Glass to match Bottom Navbar */
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

nav .wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    /* Wrapper takes full width of nav */
    margin: 0 auto;
    padding: 0 30px;
    /* Slightly more padding for pill shape */
    height: 100%;
}

nav .logo {
    display: flex;
    align-items: center;
}

nav .logo img {
    height: 55px;
    /* Increased size */
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

nav .nav-menu {
    display: flex;
    gap: 25px;
    align-items: center;
}

nav .nav-menu>li {
    position: relative;
}

nav .nav-menu>li>a {
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    padding: 22px 0;
    /* Menambah area klik vertikal */
}

nav .nav-menu>li>a:hover {
    opacity: 0.8;
}

/* Dropdown Menu */
nav .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-top: 3px solid var(--secondary-color);
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    border-radius: 0 0 4px 4px;
}

nav .nav-menu>li:hover .dropdown {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

nav .dropdown li a {
    display: block;
    padding: 12px 20px;
    color: var(--text-dark);
    font-size: 0.9rem;
    border-bottom: 1px solid #eee;
}

nav .dropdown li:last-child a {
    border-bottom: none;
}

nav .dropdown li a:hover {
    background-color: var(--bg-offwhite);
    color: var(--primary-color);
    padding-left: 25px;
    /* Efek geser sedikit */
}

/* --- 3. LAYOUT CONTAINER UTAMA --- */
.container {
    max-width: var(--max-width);
    margin: 40px auto;
    padding: 0 20px;
    flex: 1;
}

/* --- 4. HERO SECTION --- */
.hero-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    /* Tinggi hero */
    margin-bottom: 40px;
    overflow: hidden;
    border-radius: 20px;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 60px 20px 40px;
    color: #fff;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-tag {
    background-color: var(--primary-color);
    color: #fff;
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 15px;
    display: inline-block;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.2;
}

.hero-meta {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* --- 5. GRID LAYOUT SYSTEM --- */
.grid-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* Layout 2 kolom: Konten Utama & Sidebar */
    gap: 40px;
}

/* Featured Section (Kiri Atas) */
.featured-section {
    grid-column: 1 / -1;
    /* Full width awalnya */
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    display: block;
    width: 50%;
    height: 3px;
    background-color: var(--primary-color);
    margin-top: 5px;
}

/* Filter Chips */
.filter-chips {
    display: inline-flex;
    gap: 10px;
    margin-left: 20px;
    flex-wrap: wrap;
    vertical-align: middle;
}

.chip {
    background-color: transparent;
    border: 1px solid var(--border-color);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-muted);
}

.chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.chip.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Card Styling */
.post-card {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    /* Add background capability */
    transition: background-color 0.3s;
}

.post-thumb {
    width: 100%;
    height: 250px;
    object-fit: cover;
    margin-bottom: 15px;
    border-radius: 4px;
    display: block;
    /* Ensure it's block for container */
}

.thumb-wrapper {
    position: relative;
    display: block;
}

.views-badge {
    position: absolute;
    bottom: 25px;
    /* Adjust based on margin-bottom of img */
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.post-category {
    color: var(--secondary-color);
    /* Better visibility */
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.post-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.3;
}

.post-title a:hover {
    color: var(--secondary-color);
    opacity: 0.8;
}

.post-excerpt {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.post-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Sidebar Styles */
.sidebar-widget {
    margin-bottom: 40px;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.sidebar-list li {
    margin-bottom: 15px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 15px;
}

/* CTA Widget */
.cta-widget {
    background: linear-gradient(135deg, var(--primary-color), #005a8d);
    color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta-widget h3 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.cta-widget p {
    font-size: 0.9rem;
    margin-bottom: 20px;
    opacity: 0.9;
    position: relative;
    z-index: 2;
}

.btn-cta-sidebar {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-cta-sidebar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    color: white;
}

/* Masonry Grid untuk artikel lain */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

/* --- 6. FOOTER --- */
footer {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 40px 0 20px;
    margin-top: auto;
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.footer-socials {
    display: flex;
    align-items: center;
}

.footer-socials a {
    margin-left: 15px;
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.footer-socials a:hover {
    color: var(--secondary-color);
    transform: translateY(-3px);
}

.copyright {
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* --- RESPONSIVE MOBILE OPTIMIZATION --- */

nav .nav-menu>li>a {
    color: var(--header-text);
    /* Ensure contrast */
    font-weight: 500;
}

/* ... existing code ... */

/* Menu Toggle Button (Default Hidden) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    margin-right: 0;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--header-text);
    /* Dynamic color */
    border-radius: 3px;
    transition: 0.3s;
}

@media (max-width: 768px) {

    /* 1. Navigation Mobile */
    .menu-toggle {
        display: flex;
        margin-left: auto;
        /* Push to right */
    }

    /* ... toggle animation ... */

    nav .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        /* Limit width */
        height: 100vh;
        background-color: var(--primary-color);
        /* Solid Blue always for mobile drawer */
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 30px 30px;
        transition: 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.2);
    }

    /* Reset link color for mobile drawer to always be white */
    nav .nav-menu>li>a {
        color: #fff !important;
    }

    nav .nav-menu.active {
        right: 0;
    }

    nav .nav-menu>li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    nav .nav-menu>li>a {
        display: block;
        padding: 15px 0;
        font-size: 1.1rem;
    }

    /* Mobile Dropdown */
    nav .dropdown {
        position: static;
        visibility: visible;
        opacity: 1;
        transform: none;
        background-color: rgba(0, 0, 0, 0.1);
        /* Sedikit lebih gelap */
        box-shadow: none;
        min-width: 100%;
        display: none;
        /* Default hidden styling for mobile JS toggle */
        border-top: none;
    }

    nav .nav-menu>li.active .dropdown {
        display: block;
    }

    nav .dropdown li a {
        color: var(--text-light);
        padding-left: 30px;
    }

    /* 2. Hero Section */
    .hero-wrapper {
        height: 80vh;
        /* More vertical real estate on mobile */
        max-height: 550px;
        /* Don't let it get TOO long */
    }

    .hero-content {
        width: 100%;
    }

    .hero h1 {
        font-size: 1.5rem;
        /* Reduced from 1.8rem */
        line-height: 1.3;
    }

    /* 3. Grid & Layout */
    .grid-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .container {
        padding: 0 15px;
        /* Margin kiri-kanan lebih tipis di HP */
    }

    /* 4. Footer */
    .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .footer-socials a {
        margin: 0 10px;
    }
}

/* FIX: Curved Header Sides */
nav {
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

/* --- LOGO & THEME TOGGLE (Utility) --- */
/* Default (Light Mode) */
.logo-dark {
    display: none;
}

.logo-light {
    display: block;
}

.logo img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

/* Dark Mode overrides */
[data-theme="dark"] .logo-light {
    display: none !important;
}

[data-theme="dark"] .logo-dark {
    display: block !important;
}

/* Theme Toggle Button */
#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    margin-left: 20px;
    padding: 5px;
    transition: transform 0.3s;
    color: var(--header-text);
    /* Auto-adapts to header color */
    display: flex;
    align-items: center;
    justify-content: center;
}

#theme-toggle:hover {
    transform: rotate(20deg) scale(1.1);
}

@media (max-width: 768px) {
    #theme-toggle {
        order: 2;
        /* Adjust flex order if needed */
        margin-left: auto;
        margin-right: 15px;
    }

    .post-title-main {
        font-size: 2rem !important;
        /* Force smaller size on mobile */
        line-height: 1.2;
    }
}

/* --- ANIMATIONS & INTERACTIONS --- */

/* Remove Underlines Globally */
a {
    text-decoration: none !important;
}

h1 a,
h2 a,
h3 a,
h4 a,
.post-title a {
    text-decoration: none;
    color: inherit;
    background-image: linear-gradient(var(--text-main), var(--text-main));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size .3s;
}

h1 a:hover,
h2 a:hover,
h3 a:hover,
h4 a:hover,
.post-title a:hover {
    background-size: 100% 2px;
    /* Subtle underline animation on hover instead */
}

/* Scroll Reveal Base */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hero Animations */
.slide-in-bottom {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s forwards;
}

.delay-100 {
    animation-delay: 0.1s;
    transition-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
    transition-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
    transition-delay: 0.3s;
}

.delay-400 {
    animation-delay: 0.4s;
    transition-delay: 0.4s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero Parallax Setup */
.hero-wrapper {
    overflow: hidden;
    /* Ensure image doesn't spill out when scaling */
}

.hero-image.parallax-bg {
    transition: transform 0.1s linear;
    /* Smooth movement */
    will-change: transform;
}

/* Button Pulse Standard */
.btn-cta,
.btn-hero {
    position: relative;
    overflow: hidden;
}

.btn-cta::after,
.btn-hero::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-cta:hover::after,
.btn-hero:hover::after {
    width: 300px;
    height: 300px;
}

/* --- SEARCH BAR (M3 Expressive) --- */
.search-bar-container {
    flex: 1;
    max-width: 400px;
    /* Lebar maksimal search bar */
    margin: 0 20px;
    display: flex;
    justify-content: center;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--card-bg);
    /* Adaptif Light/Dark */
    border-radius: 50px;
    /* Pill shape */
    padding: 5px 15px;
    width: 100%;
    height: 48px;
    /* Standard accessible touch target */
    box-shadow: var(--shadow-soft);
    /* Elevasi ringan */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid var(--border-color);
}

.search-bar:hover,
.search-bar:focus-within {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    /* Elevasi saat aktif */
    background-color: var(--bg-body);
    transform: translateY(-1px);
}

.search-icon {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: var(--text-muted);
    border-radius: 50%;
    transition: background-color 0.2s;
}

.search-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

.search-bar input {
    border: none;
    background: transparent;
    flex: 1;
    padding: 0 10px;
    font-size: 1rem;
    color: var(--text-main);
    outline: none;
    font-family: var(--font-main);
}

/* Dark Mode Adjustments */
[data-theme="dark"] .search-bar {
    background-color: rgba(255, 255, 255, 0.1);
    /* Glassy look */
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .search-bar:hover,
[data-theme="dark"] .search-bar:focus-within {
    background-color: rgba(0, 0, 0, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .search-icon {
    color: #ccc;
    fill: #ccc;
    /* SVG fill */
}

[data-theme="dark"] .search-icon svg {
    fill: currentColor;
}

[data-theme="dark"] .search-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Responsiveness */
@media (max-width: 768px) {
    .search-bar-container {
        margin: 0 10px;
        max-width: 60%;
        /* Limit width to allow space for logo and toggle */
    }

    .search-bar {
        height: 40px;
        padding: 5px 10px;
    }

    .search-bar input {
        font-size: 0.9rem;
        /* Smaller font on mobile */
    }

    nav .logo img {
        height: 40px;
        /* Resize logo slightly if needed */
    }
}