:root {
    --bg-primary: #1a1a2e;
    --bg-card: #252542;
    --bg-code: #141428;
    --accent-cyan: #00d4ff;
    --accent-red: #ff2d55;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #606060;
    --content-width: 700px;
    --transition: 0.2s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ===== UTILITY ===== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

.header-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity var(--transition);
}

.logo:hover {
    opacity: 0.8;
}

.logo-icon {
    width: 36px;
    height: 36px;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-text {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.lang-toggle a {
    color: var(--text-muted);
    padding: 4px;
    transition: color var(--transition);
}

.lang-toggle a.active {
    color: var(--text-primary);
}

.lang-toggle a:hover {
    color: var(--accent-cyan);
}

.lang-toggle .separator {
    color: var(--text-muted);
    opacity: 0.5;
}

/* ===== MAIN CONTENT ===== */
.main {
    flex: 1;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 40px 20px;
    width: 100%;
}

/* Article page gets wider container (header + main) */
body:has(.article) .header-inner,
body:has(.article) .main {
    max-width: 900px;
}

/* ===== BACK LINK ===== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 40px;
    transition: color var(--transition);
}

.back-link:hover {
    color: var(--accent-cyan);
}

.back-link-bottom {
    margin-top: 60px;
    margin-bottom: 0;
}

/* ===== TAG PAGE HEADER ===== */
.tag-header {
    margin-bottom: 50px;
}

.tag-header h1 {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 32px;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 8px;
}

.tag-header .post-count {
    font-size: 14px;
    color: var(--text-muted);
}

/* ===== POST FEED ===== */
.post-feed {
    display: flex;
    flex-direction: column;
    gap: 50px;
}

.post-card {
    display: block;
}

.post-card-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 20px;
    opacity: 0.9;
    transition: opacity var(--transition);
}

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

.post-card-title {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 10px;
}

.post-card-title a {
    transition: color var(--transition);
}

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

.post-card-date {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: block;
}

.post-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
    border-radius: 20px;
    transition: all var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tag:hover,
.tag.active {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}

.tag.danger {
    color: var(--accent-red);
    border-color: var(--accent-red);
}

.tag.danger:hover {
    background: var(--accent-red);
    color: var(--text-primary);
}

.post-card-excerpt {
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.no-posts {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 0;
}

/* ===== LOAD MORE ===== */
.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 60px;
}

.load-more-btn {
    background: transparent;
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    padding: 14px 40px;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.load-more-btn:hover {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.load-more-btn.loading {
    pointer-events: none;
}

/* ===== ARTICLE PAGE ===== */
.article-header {
    margin-bottom: 40px;
}

.article-title {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 36px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: 0.01em;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.article-author {
    font-style: normal;
}

.article-author::after {
    content: '·';
    margin-left: 16px;
}

.article-date {
    display: inline;
}

.article-cover {
    margin: 0 0 40px 0;
}

.article-cover img {
    width: 100%;
    border-radius: 4px;
    display: block;
}

.article-featured-image {
    width: 100%;
    border-radius: 4px;
    margin-bottom: 40px;
}

.article-body {
    color: var(--text-secondary);
}

.article-body p {
    margin-bottom: 1.5em;
}

.article-body h2 {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 26px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2.5em;
    margin-bottom: 1em;
}

.article-body h3 {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin-top: 2em;
    margin-bottom: 0.8em;
}

.article-body h4 {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-top: 1.5em;
    margin-bottom: 0.6em;
}

.article-body a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: text-decoration var(--transition);
}

.article-body a:hover {
    text-decoration: underline;
}

.article-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

.article-body ul,
.article-body ol {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

.article-body li {
    margin-bottom: 0.5em;
}

.article-body blockquote {
    border-left: 3px solid var(--accent-cyan);
    padding-left: 20px;
    margin: 1.5em 0;
    font-style: italic;
    color: var(--text-muted);
}

.article-body code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    background: var(--bg-code);
    color: var(--accent-cyan);
    padding: 3px 8px;
    border-radius: 4px;
}

.article-body pre {
    background: var(--bg-code);
    border-left: 3px solid var(--accent-cyan);
    padding: 20px;
    margin: 1.5em 0;
    overflow-x: auto;
    border-radius: 0 4px 4px 0;
}

.article-body pre code {
    background: none;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.article-body img {
    max-width: 100%;
    border-radius: 4px;
    margin: 1.5em 0;
}

.article-body figure {
    margin: 1.5em 0;
    text-align: center;
}

.article-body figure img {
    margin: 0 auto;
    display: block;
}

.article-body figcaption {
    font-size: 14px;
    font-style: italic;
    color: var(--text-muted);
    margin-top: 8px;
}

.article-body hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 2em 0;
}

/* ===== RELATED POSTS ===== */
.related-posts {
    margin-top: 80px;
    padding-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.related-posts-title {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.related-post-card {
    display: block;
}

.related-post-card-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 12px;
    opacity: 0.8;
    transition: opacity var(--transition);
}

.related-post-card:hover .related-post-card-thumbnail {
    opacity: 1;
}

.related-post-card-title {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 6px;
    transition: color var(--transition);
}

.related-post-card:hover .related-post-card-title {
    color: var(--accent-cyan);
}

.related-post-card-date {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== ERROR PAGE ===== */
.error-page {
    text-align: center;
    padding: 80px 0;
}

.error-page h1 {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 72px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.error-page p {
    color: var(--text-muted);
    margin-bottom: 40px;
}

.error-page .back-link {
    display: inline-flex;
    margin-bottom: 0;
}

/* ===== FOOTER ===== */
.footer {
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    gap: 24px;
}

.social-icon {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    transition: color var(--transition);
}

.social-icon:hover {
    color: var(--accent-cyan);
}

.social-icon svg {
    width: 100%;
    height: 100%;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1199px) {
    .related-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .main {
        padding: 30px 20px;
    }

    .article-title {
        font-size: 28px;
    }

    .post-card-title {
        font-size: 20px;
    }

    .tag-header h1 {
        font-size: 26px;
    }

    .related-posts-grid {
        grid-template-columns: 1fr;
    }

    .load-more-btn {
        width: 100%;
    }

    .logo-text {
        font-size: 16px;
    }

    .post-feed {
        gap: 40px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card {
    animation: fadeIn 0.4s ease forwards;
}

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

.new-post {
    animation: fadeIn 0.4s ease forwards;
}
