/* ===== RESET & BASE ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
    --bg-primary: #0c0c1d;
    --bg-secondary: #111128;
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-card-hover: rgba(255, 255, 255, 0.1);
    --text-primary: #f2f2ff;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-muted: rgba(255, 255, 255, 0.4);
    --accent: #60a5fa;
    --accent-2: #a78bfa;
    --accent-3: #f472b6;
    --gradient: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(96, 165, 250, 0.4);
    --radius: 4px;
    --radius-sm: 3px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-2); }
img { max-width: 100%; height: auto; }

/* ===== SPACE CANVAS ===== */
#space-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* ===== HEADER ===== */
.site-header {
    background: rgba(12, 12, 29, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 20px;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.site-logo {
    font-size: 22px;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.header-nav { display: flex; gap: 4px; }

.header-nav a {
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
}

.header-nav a:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
    border-color: var(--border);
}

/* ===== HERO ===== */
.hero {
    text-align: center;
    padding: 80px 20px 50px;
    position: relative;
    z-index: 1;
}

.hero::before {
    content: '';
    position: absolute;
    top: -100px; left: 50%;
    transform: translateX(-50%);
    width: 1000px; height: 600px;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(96,165,250,0.12), transparent 55%),
        radial-gradient(ellipse at 70% 60%, rgba(167,139,250,0.1), transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(244,114,182,0.06), transparent 50%);
    pointer-events: none;
    animation: nebulaPulse 10s ease-in-out infinite alternate;
}

@keyframes nebulaPulse {
    0% { transform: translateX(-50%) scale(1); opacity: 0.7; }
    100% { transform: translateX(-50%) scale(1.15); opacity: 1; }
}

.hero h1 {
    font-size: 54px;
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.65) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.hero p {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto;
    position: relative;
}

/* ===== PLANETS (orbiting in hero) ===== */
.planets-container {
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    z-index: 0;
    pointer-events: none;
}

.orbit {
    position: absolute;
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 50%;
    animation: orbit linear infinite;
}

.orbit-1 {
    width: 300px; height: 300px;
    top: -150px; left: -150px;
    animation-duration: 20s;
}
.orbit-2 {
    width: 500px; height: 500px;
    top: -250px; left: -250px;
    animation-duration: 35s;
    animation-direction: reverse;
}
.orbit-3 {
    width: 700px; height: 700px;
    top: -350px; left: -350px;
    animation-duration: 50s;
}

@keyframes orbit { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.planet {
    position: absolute;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255,255,255,0.1);
}

/* Earth */
.planet-earth {
    width: 36px; height: 36px;
    top: -18px; left: 50%;
    margin-left: -18px;
    background: radial-gradient(circle at 35% 35%, #4ade80, #1d6b3f 50%, #0e3d22);
    box-shadow: 0 0 15px rgba(74,222,128,0.4), inset -6px -4px 10px rgba(0,0,0,0.3);
    animation: planetGlow 3s ease-in-out infinite alternate;
}

.planet-earth::before {
    content: '';
    position: absolute;
    width: 100%; height: 100%;
    border-radius: 50%;
    background: 
        radial-gradient(circle at 55% 40%, rgba(96,165,250,0.5) 0%, transparent 40%),
        radial-gradient(circle at 30% 70%, rgba(96,165,250,0.3) 0%, transparent 30%),
        radial-gradient(circle at 70% 25%, rgba(34,197,94,0.4) 0%, transparent 25%);
    animation: earthRotate 8s linear infinite;
}

@keyframes earthRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mars */
.planet-mars {
    width: 22px; height: 22px;
    top: -11px; left: 50%;
    margin-left: -11px;
    background: radial-gradient(circle at 35% 35%, #fb923c, #c54b1a 55%, #7a2e10);
    box-shadow: 0 0 12px rgba(251,146,60,0.4), inset -4px -3px 8px rgba(0,0,0,0.3);
}

/* Saturn */
.planet-saturn {
    width: 28px; height: 28px;
    top: -14px; left: 50%;
    margin-left: -14px;
    background: radial-gradient(circle at 35% 35%, #fde68a, #d4a338 55%, #8a6711);
    box-shadow: 0 0 14px rgba(253,230,138,0.3), inset -5px -3px 8px rgba(0,0,0,0.2);
}

.planet-saturn::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotateX(65deg);
    width: 50px; height: 50px;
    border: 2px solid rgba(253,230,138,0.3);
    border-radius: 50%;
}

@keyframes planetGlow {
    0% { box-shadow: 0 0 15px rgba(74,222,128,0.3); }
    100% { box-shadow: 0 0 25px rgba(74,222,128,0.6); }
}

/* Moon (tiny, orbiting earth) */
.moon-orbit {
    position: absolute;
    width: 60px; height: 60px;
    top: -12px; left: 50%;
    margin-left: -30px;
    margin-top: -12px;
    animation: orbit 5s linear infinite;
}

.moon {
    width: 8px; height: 8px;
    position: absolute;
    top: -4px; left: 50%;
    margin-left: -4px;
    background: radial-gradient(circle at 35% 35%, #e2e8f0, #94a3b8);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(226,232,240,0.4);
}

/* ===== POST GRID ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    padding-bottom: 60px;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    position: relative;
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient);
    opacity: 0;
    transition: var(--transition);
}

.post-card:nth-child(1) { animation-delay: 0.05s; }
.post-card:nth-child(2) { animation-delay: 0.1s; }
.post-card:nth-child(3) { animation-delay: 0.15s; }
.post-card:nth-child(4) { animation-delay: 0.2s; }
.post-card:nth-child(5) { animation-delay: 0.25s; }
.post-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.post-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-6px);
    box-shadow:
        0 20px 60px rgba(0,0,0,0.3),
        0 0 40px rgba(96,165,250,0.06);
}

.post-card:hover::before { opacity: 1; }

.post-card-image {
    width: 100%;
    object-fit: cover;
    display: block;
}

.post-card-image-placeholder {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, rgba(96,165,250,0.08), rgba(167,139,250,0.1), rgba(244,114,182,0.06));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    position: relative;
    overflow: hidden;
}

.post-card-image-placeholder::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(60deg, transparent 40%, rgba(255,255,255,0.04) 50%, transparent 60%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.post-card-body {
    padding: 22px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    gap: 14px;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-card-meta span { display: flex; align-items: center; gap: 4px; }

.post-card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.3px;
    line-height: 1.35;
}

.post-card-title a { color: var(--text-primary); }
.post-card-title a:hover { color: var(--accent); }

.post-card-excerpt {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.read-more {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.read-more:hover { gap: 10px; color: var(--accent-2); }

.view-count {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== SINGLE POST ===== */
.single-post {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px 40px;
    position: relative;
    z-index: 1;
}

.single-post .post-header { margin-bottom: 40px; }

.single-post .post-title {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.2;
    margin-bottom: 16px;
}

.single-post .post-meta {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.single-post .post-content {
    font-size: 17px;
    line-height: 1.8;
    color: rgba(255,255,255,0.85);
}

.single-post .post-content p { margin-bottom: 20px; }
.single-post .post-content h2,
.single-post .post-content h3 { margin: 32px 0 16px; font-weight: 700; }
.single-post .post-content img { border-radius: var(--radius); margin: 20px 0; }

.single-post .post-content blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 20px;
    margin: 20px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.single-post .post-content code {
    background: rgba(255,255,255,0.08);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.single-post .post-content pre {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
}

.single-post .post-content pre code { background: none; padding: 0; }

/* ===== BACK LINK ===== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 30px;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.back-link:hover {
    color: var(--accent);
    border-color: var(--border-hover);
    background: rgba(96,165,250,0.05);
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 40px 0 80px;
    z-index: 1;
    position: relative;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.pagination a:hover {
    border-color: var(--border-hover);
    color: var(--accent);
    background: rgba(96,165,250,0.06);
}

.pagination .active {
    background: var(--gradient);
    color: #fff;
    border-color: transparent;
}

/* ===== FOOTER ===== */
.site-footer {
    text-align: center;
    padding: 30px 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    z-index: 1;
    position: relative;
    letter-spacing: 0.3px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-state .icon { font-size: 60px; margin-bottom: 20px; }
.empty-state h3 { font-size: 22px; margin-bottom: 10px; color: var(--text-primary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero h1 { font-size: 32px; }
    .hero p { font-size: 15px; }
    .posts-grid { grid-template-columns: 1fr; gap: 16px; }
    .single-post .post-title { font-size: 28px; }
    .header-nav { display: none; }
    .orbit { display: none; }
}

@media (max-width: 480px) {
    .hero { padding: 50px 16px 40px; }
    .hero h1 { font-size: 26px; }
}

/* ===== COMMENTS SECTION ===== */
.comments-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px 80px;
    position: relative;
    z-index: 1;
}

.comments-container {
    border-top: 1px solid var(--border);
    padding-top: 40px;
}

.comments-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 32px;
    letter-spacing: -0.5px;
}

.comment-form-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 36px;
}

.comment-form-wrapper h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.comment-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.comment-form-group { margin-bottom: 16px; }

.comment-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comment-form-group input,
.comment-form-group textarea {
    width: 100%;
    padding: 11px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.comment-form-group input:focus,
.comment-form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(96,165,250,0.12);
}

.comment-form-group textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.comment-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comment-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(96,165,250,0.3);
}

.comment-alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.comment-alert-success {
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.2);
    color: #22c55e;
}

.comment-alert-error {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    color: #ef4444;
}

.comments-list { display: flex; flex-direction: column; gap: 16px; }

.comment-item {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.comment-item:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 20px rgba(96,165,250,0.05);
}

.comment-avatar {
    width: 42px; height: 42px; min-width: 42px;
    border-radius: var(--radius);
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}

.comment-body { flex: 1; min-width: 0; }

.comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.comment-author { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.comment-date { font-size: 11px; color: var(--text-muted); }

.comment-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.no-comments {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 15px;
}

@media (max-width: 768px) {
    .comment-form-row { grid-template-columns: 1fr; }
}

/* ===== CATEGORY FILTER ===== */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 40px;
    padding: 0 16px;
    position: relative;
    z-index: 2;
}

.cat-box {
    --cat-color: #60a5fa;
    --cat-color2: #3b82f6;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-width: 120px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-left: 4px solid var(--cat-color);
}

.cat-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    border-color: var(--cat-color);
}

.cat-box.active {
    border-color: var(--cat-color);
    background: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2), 0 0 0 2px var(--cat-color);
}

.cat-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.cat-name {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.2px;
}

.cat-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    background: #f0f0f5;
    color: #555;
    margin-left: auto;
}

.cat-box.active .cat-count {
    background: linear-gradient(135deg, var(--cat-color), var(--cat-color2));
    color: #fff;
}

/* ===== CATEGORY BADGE ON POSTS ===== */
.post-category-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(96,165,250,0.12);
    color: #60a5fa;
    border: 1px solid rgba(96,165,250,0.15);
    text-decoration: none;
    transition: all 0.3s ease;
}

.post-category-badge:hover {
    background: rgba(96,165,250,0.25);
    color: #93c5fd;
}
