:root {
    --primary: #FF6B6B;
    --secondary: #4ECDC4;
    --tertiary: #FFE66D;
    --quaternary: #9D4EDD;
    --bg-color: #F7FFF7;
    --text-color: #2F3542;
    --card-bg: rgba(255, 255, 255, 0.7);
    --header-bg: rgba(255, 255, 255, 0.85);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --radius: 20px;
    --font-main: 'Baloo 2', cursive;
}

[data-theme="dark"] {
    --primary: #FF8787;
    --secondary: #38B0A6;
    --tertiary: #FDE047;
    --quaternary: #C77DFF;
    --bg-color: #1A1B26;
    --text-color: #F8F8F2;
    --card-bg: rgba(40, 42, 54, 0.7);
    --header-bg: rgba(26, 27, 38, 0.85);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

main {
    flex: 1;
}

/* Glassmorphism */
.glass-header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

.main-nav {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 6px 4px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.action-btn {
    background: var(--card-bg);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.action-btn:hover {
    transform: scale(1.1);
}

.action-btn:focus-visible,
.hamburger:focus-visible,
.nav-link:focus-visible,
.btn-primary:focus-visible,
.cat-pill:focus-visible,
.post-card:focus-visible {
    outline: 3px solid var(--quaternary);
    outline-offset: 2px;
}

.logo-icon-img {
    height: 32px;
    width: auto;
    vertical-align: middle;
    border-radius: 6px;
}

.footer-social {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-top: 10px;
}

.footer-social a {
    font-size: 1.3rem;
    text-decoration: none;
    opacity: 0.85;
    transition: transform 0.2s, opacity 0.2s;
}

.footer-social a:hover,
.footer-social a:focus-visible {
    opacity: 1;
    transform: translateY(-2px);
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-color);
    cursor: pointer;
    width: 40px;
    height: 40px;
}

/* Hero Section */
.hero {
    position: relative;
    padding: 60px 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(255,107,107,0.1), rgba(78,205,196,0.1));
    border-radius: 0 0 40px 40px;
    overflow: hidden;
}

.hero-title {
    font-size: 3rem;
    color: var(--quaternary);
    text-shadow: 2px 2px 0px rgba(255,255,255,0.5);
    margin-bottom: 10px;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 30px;
}

.search-container {
    max-width: 500px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 15px 25px;
    border-radius: 30px;
    border: 2px solid var(--secondary);
    font-size: 1.1rem;
    background: var(--card-bg);
    color: var(--text-color);
    outline: none;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.search-input:focus {
    transform: scale(1.02);
}

/* Floating Elements */
.floating-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: -1;
}

.float-el {
    position: absolute;
    font-size: 2rem;
    animation: float 6s ease-in-out infinite;
}

.star1 { top: 10%; left: 10%; animation-delay: 0s; }
.rocket { top: 20%; right: 15%; font-size: 3rem; animation-delay: 1s; }
.cloud1 { top: 60%; left: 5%; animation-delay: 2s; }
.book { top: 70%; right: 10%; animation-delay: 1.5s; }
.star2 { top: 80%; left: 20%; animation-delay: 0.5s; }
.cloud2 { top: 30%; right: 30%; animation-delay: 2.5s; }

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

/* Categories */
.categories-section {
    padding: 40px 0;
    text-align: center;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.category-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.cat-pill {
    padding: 10px 20px;
    border-radius: 30px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
    background: var(--primary);
}

.cat-pill:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 30px;
    font-family: var(--font-main);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.2);
}

.load-more-container {
    text-align: center;
    padding: 20px 0 10px;
}

/* Empty / error states */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    font-size: 1.2rem;
    opacity: 0.85;
    grid-column: 1 / -1;
}

/* Category hero icon */
.cat-hero-icon {
    font-size: 3.5rem;
    margin-bottom: 5px;
}

/* Back to top */
.back-to-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 90;
}

.back-to-top.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-3px);
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

.post-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: var(--shadow);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: 1px solid rgba(255,255,255,0.2);
    animation: fadeInUp 0.5s ease backwards;
}

.post-card:hover {
    transform: translateY(-10px) rotate(2deg);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.card-emoji {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 10px;
}

.card-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    opacity: 0.8;
}

.cat-badge {
    background: var(--quaternary);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
}

/* Footer */
footer {
    background: var(--secondary);
    color: white;
    margin-top: auto;
    position: relative;
}

.footer-wave {
    display: block;
    width: 100%;
    height: auto;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    padding: 40px 20px;
}

.footer-col {
    flex: 1;
    min-width: 250px;
}

.footer-links {
    list-style: none;
}

.footer-links a {
    color: white;
    text-decoration: none;
    line-height: 1.8;
}

.footer-bottom {
    text-align: center;
    padding: 20px;
    background: rgba(0,0,0,0.1);
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Skeletons */
.skeleton-pill, .skeleton-card {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}
[data-theme="dark"] .skeleton-pill, [data-theme="dark"] .skeleton-card {
    background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    background-size: 200% 100%;
}
.skeleton-pill { width: 100px; height: 40px; border-radius: 30px; }
.skeleton-card { height: 250px; border-radius: var(--radius); }

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (max-width: 768px) {
    .hamburger { display: block; }
    .hero-title { font-size: 2.2rem; }
    .posts-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

    .main-nav {
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--header-bg);
        backdrop-filter: blur(10px);
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        gap: 0;
        border-bottom: 1px solid rgba(255,255,255,0.18);
    }

    .main-nav.open {
        max-height: 300px;
        padding: 10px 20px 20px;
    }

    .main-nav .nav-link {
        padding: 12px 0;
        border-bottom: 1px solid rgba(128,128,128,0.15);
    }

    .back-to-top {
        bottom: 15px;
        right: 15px;
        width: 42px;
        height: 42px;
    }
}
