/* ============================================
   DESIGN SYSTEM — Editorial Minimalism
   Typography: Inter (UI) + Source Serif 4 (Body)
   ============================================ */

/* --- CSS Variables / Theme Tokens --- */
:root,
[data-theme="light"] {
    --bg-primary: #FAFAFA;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F3F4F6;
    --bg-elevated: #FFFFFF;
    --bg-code: #F8F9FA;

    --text-primary: #1A1A2E;
    --text-secondary: #4B5563;
    --text-tertiary: #9CA3AF;
    --text-inverse: #FFFFFF;

    --accent: #F75D34;
    --accent-hover: #D94A22;
    --accent-light: rgba(247, 93, 52, 0.08);
    --accent-border: rgba(247, 93, 52, 0.2);

    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --border-focus: #F75D34;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);

    --success: #059669;
    --error: #DC2626;
    --warning: #D97706;
    --info: #2563EB;

    --nav-bg: rgba(255,255,255,0.85);
    --nav-border: rgba(0,0,0,0.06);
    --overlay: rgba(0,0,0,0.5);

    --skeleton-base: #E5E7EB;
    --skeleton-shine: #F3F4F6;
}

[data-theme="dark"] {
    --bg-primary: #0F0F0F;
    --bg-secondary: #1A1A1A;
    --bg-tertiary: #242424;
    --bg-elevated: #1E1E1E;
    --bg-code: #1E1E1E;

    --text-primary: #E5E7EB;
    --text-secondary: #9CA3AF;
    --text-tertiary: #6B7280;
    --text-inverse: #0F0F0F;

    --accent: #F75D34;
    --accent-hover: #FF7A56;
    --accent-light: rgba(247, 93, 52, 0.12);
    --accent-border: rgba(247, 93, 52, 0.25);

    --border: #2D2D2D;
    --border-light: #242424;
    --border-focus: #F75D34;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);

    --success: #34D399;
    --error: #F87171;
    --warning: #FBBF24;
    --info: #60A5FA;

    --nav-bg: rgba(15,15,15,0.9);
    --nav-border: rgba(255,255,255,0.06);
    --overlay: rgba(0,0,0,0.7);

    --skeleton-base: #2D2D2D;
    --skeleton-shine: #3D3D3D;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s ease, color 0.3s ease;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; display: block; }

::selection {
    background: var(--accent-light);
    color: var(--text-primary);
}

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--nav-border);
    transition: background 0.3s, border-color 0.3s;
}

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

.nav-logo {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.nav-logo:hover { color: var(--text-primary); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.nav-link.active { color: var(--text-primary); background: var(--bg-tertiary); }

.nav-dropdown { position: relative; }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 10;
    margin-top: 8px;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-menu:hover,
.nav-dropdown.open .nav-dropdown-menu { display: block; }

/* User dropdown only opens via click, not hover */
.nav-user-dropdown:hover .nav-dropdown-menu { display: none; }
.nav-user-dropdown.open .nav-dropdown-menu { display: block; }

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-radius: 8px;
    transition: background 0.15s;
}
.nav-dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.cat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-search-toggle,
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.nav-search-toggle:hover,
.theme-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 10px;
}
.nav-hamburger span {
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.3s;
}

/* Mobile-only auth links */
.nav-mobile-auth {
    display: none;
}

@media (max-width: 768px) {
    .nav-mobile-auth {
        display: flex;
        flex-direction: column;
        border-top: 1px solid var(--border-light);
        margin-top: 8px;
        padding-top: 8px;
    }
    .nav-auth-btn {
        display: none;
    }
    .nav-user-dropdown {
        display: none;
    }
}

/* Nav Auth Button */
.nav-auth-btn {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 20px;
    background: var(--accent);
    color: var(--text-inverse);
    transition: all 0.2s;
    white-space: nowrap;
}
.nav-auth-btn:hover {
    background: var(--accent-hover);
    color: var(--text-inverse);
}

/* Nav User Avatar */
.nav-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.nav-user-avatar:hover {
    box-shadow: 0 0 0 3px var(--accent-light);
}

.nav-user-dropdown .nav-dropdown-menu {
    right: 0;
    left: auto;
    min-width: 180px;
}

.nav-user-info {
    display: block;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

.nav-logout-item {
    color: var(--error) !important;
    border-top: 1px solid var(--border-light);
}

/* Search Overlay */
.search-overlay {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    box-shadow: var(--shadow-md);
}
.search-overlay.active { display: block; }

.search-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 12px 16px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}
.search-form:focus-within { border-color: var(--border-focus); }

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}
.search-input::placeholder { color: var(--text-tertiary); }

.search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
}

/* --- Flash Messages --- */
.flash-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease;
}

.flash-success { border-left: 4px solid var(--success); }
.flash-error { border-left: 4px solid var(--error); }
.flash-warning { border-left: 4px solid var(--warning); }
.flash-info { border-left: 4px solid var(--info); }

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-tertiary);
    padding: 0 2px;
    line-height: 1;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- Main Content --- */
.main-content {
    margin-top: 64px;
    min-height: calc(100vh - 64px);
}

/* --- Page Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Section --- */
.section {
    padding: 64px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.section-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --- Hero / Featured Post --- */
.hero {
    padding: 80px 0 48px;
}

.hero-featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

.hero-image {
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: var(--bg-tertiary);
}
.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-content { max-width: 560px; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 16px;
}

.hero-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    color: var(--text-primary);
}
.hero-title a { color: inherit; }
.hero-title a:hover { color: var(--accent); }

.hero-excerpt {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.hero-meta-dot::before {
    content: '·';
    margin: 0 2px;
}

/* --- Post Cards Grid --- */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.post-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    transition: transform 0.2s, box-shadow 0.2s;
}
.post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.post-card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-tertiary);
}
.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.post-card:hover .post-card-image img {
    transform: scale(1.03);
}

.post-card-body {
    padding: 20px;
}

.post-card-category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 8px;
    display: inline-block;
}

.post-card-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}
.post-card-title a { color: var(--text-primary); }
.post-card-title a:hover { color: var(--accent); }

.post-card-excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

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

/* --- Trending List --- */
.trending-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.trending-item {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 28px 0;
    border-bottom: 1px solid var(--border-light);
}
.trending-item:last-child { border-bottom: none; }

.trending-number {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--bg-tertiary);
    line-height: 1;
    min-width: 40px;
}

[data-theme="dark"] .trending-number { color: var(--border); }

.trending-content { flex: 1; }

.trending-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
}
.trending-title a { color: var(--text-primary); }
.trending-title a:hover { color: var(--accent); }

.trending-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* --- Article / Post Detail --- */
.article {
    padding: 48px 0 80px;
}

.article-header {
    max-width: 680px;
    margin: 0 auto 40px;
    padding: 0 24px;
    text-align: center;
}

.article-category {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 16px;
    display: inline-block;
}

.article-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.article-excerpt {
    font-size: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--text-tertiary);
    flex-wrap: wrap;
}

.article-featured-image {
    max-width: 960px;
    margin: 0 auto 48px;
    padding: 0 24px;
    border-radius: 16px;
    overflow: hidden;
}
.article-featured-image img {
    width: 100%;
    aspect-ratio: 2 / 1;
    object-fit: cover;
    border-radius: 16px;
}

/* Reading Progress */
.reading-progress {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 99;
    background: transparent;
}
.reading-progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.1s linear;
}

/* Article Body — the reading experience */
.article-body {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--text-primary);
    overflow-wrap: break-word;
    word-break: break-word;
}

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

.article-body h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 2em 0 0.75em;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.article-body h3 {
    font-size: 1.375rem;
    font-weight: 600;
    margin: 1.5em 0 0.5em;
}

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

.article-body pre {
    background: var(--bg-code);
    border-radius: 8px;
    padding: 20px 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.5em 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    border: 1px solid var(--border);
    max-width: 100%;
}

.article-body code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85em;
}
.article-body pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.article-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-body img {
    border-radius: 8px;
    margin: 1.5em auto;
    max-width: 100%;
    height: auto;
}

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

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

.article-body hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 2em 0;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.95rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.article-body th, .article-body td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.article-body th {
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}

/* Article Tags */
.article-tags {
    max-width: 680px;
    margin: 40px auto 0;
    padding: 0 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.tag-pill:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* Article Share */
.article-share {
    max-width: 680px;
    margin: 40px auto 0;
    padding: 32px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.share-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.share-buttons {
    display: flex;
    gap: 8px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.share-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent-border);
    color: var(--accent);
}

/* Bookmark button */
.bookmark-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.bookmark-btn:hover,
.bookmark-btn.bookmarked {
    background: var(--accent-light);
    border-color: var(--accent-border);
    color: var(--accent);
}

/* --- Comments Section --- */
.comments-section {
    max-width: 680px;
    margin: 0 auto;
    padding: 48px 24px 0;
    border-top: 1px solid var(--border);
}

.comments-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 32px;
}

.comment {
    padding: 24px 0;
    border-bottom: 1px solid var(--border-light);
}
.comment:last-child { border-bottom: none; }

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

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
}

.comment-author {
    font-weight: 600;
    font-size: 0.9rem;
}

.comment-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.comment-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Comment Form */
.comment-form-section {
    padding: 32px 0;
}

.comment-form-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Comment Auth Prompt */
.comment-auth-prompt {
    text-align: center;
    padding: 48px 24px;
}

.auth-prompt-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.auth-prompt-content p {
    color: var(--text-secondary);
    font-size: 1rem;
}
.auth-prompt-buttons {
    display: flex;
    gap: 12px;
}

/* --- Similar Posts / Recommendations --- */
.similar-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 64px 24px;
    border-top: 1px solid var(--border);
}

.similar-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 32px;
    text-align: center;
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-tertiary);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: var(--text-inverse);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.btn-secondary:hover { background: var(--border); }

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    background: var(--bg-tertiary);
}

.btn-danger {
    background: var(--error);
    color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
}

/* --- About Page --- */
.about-page {
    max-width: 680px;
    margin: 0 auto;
    padding: 80px 24px;
}

.about-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.about-content {
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

/* --- Search Results --- */
.search-page {
    padding: 48px 0 80px;
}

.search-page-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 2rem;
    margin-bottom: 8px;
}

.search-page-subtitle {
    color: var(--text-tertiary);
    margin-bottom: 40px;
}

/* Search Results — horizontal cards */
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.search-result-card {
    display: flex;
    gap: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.search-result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.search-result-image {
    flex-shrink: 0;
    width: 240px;
    min-height: 160px;
    overflow: hidden;
    background: var(--bg-tertiary);
}
.search-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.search-result-card:hover .search-result-image img {
    transform: scale(1.03);
}

.search-result-body {
    flex: 1;
    padding: 20px 20px 20px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.search-result-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
}
.search-result-title a { color: var(--text-primary); }
.search-result-title a:hover { color: var(--accent); }

.search-result-excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 600px) {
    .search-result-card {
        flex-direction: column;
        gap: 0;
    }
    .search-result-image {
        width: 100%;
        height: 180px;
        min-height: auto;
    }
    .search-result-body {
        padding: 16px;
    }
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 48px;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.pagination a:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.pagination .active {
    background: var(--accent);
    color: var(--text-inverse);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 80px 24px;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state-text {
    color: var(--text-tertiary);
    font-size: 0.95rem;
}

/* --- Footer --- */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 64px 0 0;
}

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

.footer-top {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1.5fr;
    gap: 48px;
    padding-bottom: 48px;
}

.footer-logo {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    margin-bottom: 12px;
}

.footer-tagline {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.footer-links {
    display: flex;
    gap: 48px;
}

.footer-col h4 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.footer-col a {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    transition: color 0.2s;
}
.footer-col a:hover { color: var(--text-primary); }

.footer-newsletter h4 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.footer-newsletter p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.newsletter-form {
    display: flex;
    gap: 8px;
}

.newsletter-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
}
.newsletter-input:focus {
    border-color: var(--border-focus);
}

.newsletter-btn {
    padding: 10px 20px;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    white-space: nowrap;
}
.newsletter-btn:hover { background: var(--accent-hover); }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 300;
    pointer-events: none;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Skeleton Loading --- */
.skeleton {
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

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

/* ============================================
   ADMIN STYLES
   ============================================ */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

.admin-sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
}

.admin-sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.admin-sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
}
.admin-nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.admin-nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
}

.admin-content {
    flex: 1;
    padding: 32px;
    max-width: calc(100% - 260px);
}

.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.admin-page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-change {
    font-size: 0.8rem;
    margin-top: 8px;
    color: var(--success);
}

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.admin-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 14px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}
.admin-table tr:last-child td { border-bottom: none; }

.admin-table tr:hover td {
    background: var(--bg-tertiary);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-published { background: rgba(5, 150, 105, 0.1); color: var(--success); }
.badge-draft { background: var(--bg-tertiary); color: var(--text-tertiary); }
.badge-archived { background: rgba(220, 38, 38, 0.1); color: var(--error); }
.badge-scheduled { background: rgba(37, 99, 235, 0.1); color: var(--info); }

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.filter-tab {
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}
.filter-tab:hover { color: var(--text-primary); }
.filter-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Editor */
.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    min-height: 500px;
}

.editor-pane {
    display: flex;
    flex-direction: column;
}

.editor-pane-header {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border);
}

.editor-textarea {
    flex: 1;
    width: 100%;
    padding: 20px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

.editor-preview {
    flex: 1;
    padding: 20px;
    border-left: 1px solid var(--border);
    overflow-y: auto;
    background: var(--bg-secondary);
}

/* Editor sidebar settings */
.editor-sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}

/* Chart placeholder */
.chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.chart-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 180px;
}

.chart-bar {
    flex: 1;
    background: var(--accent);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
    position: relative;
}
.chart-bar:hover { opacity: 1; }

.chart-bar-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .hero-featured { grid-template-columns: 1fr; gap: 32px; }
    .posts-grid { grid-template-columns: repeat(2, 1fr); }
    .similar-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-top { grid-template-columns: 1fr 1fr; gap: 32px; }
    .editor-sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-links.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--border);
        padding: 16px;
        box-shadow: var(--shadow-md);
    }
    .nav-hamburger { display: flex; }
    .nav-dropdown-menu {
        position: static;
        transform: none;
        box-shadow: none;
        border: none;
        margin-top: 4px;
        padding-left: 16px;
    }
    .nav-dropdown:hover .nav-dropdown-menu { display: none; }
    .nav-dropdown.open .nav-dropdown-menu { display: block; }

    .hero { padding: 40px 0 32px; }
    .hero-title { font-size: 1.75rem; }
    .hero-excerpt { font-size: 1rem; }

    .posts-grid { grid-template-columns: 1fr; gap: 24px; }
    .similar-grid { grid-template-columns: 1fr; }

    .article-title { font-size: 2rem; }
    .article-body { font-size: 1.1rem; }

    .footer-top { grid-template-columns: 1fr; gap: 32px; }
    .footer-links { flex-direction: column; gap: 24px; }

    .section { padding: 40px 0; }

    .admin-sidebar { display: none; }
    .admin-content { max-width: 100%; padding: 20px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }

    .editor-container { grid-template-columns: 1fr; }
    .editor-preview { border-left: none; border-top: 1px solid var(--border); }
}

@media (max-width: 480px) {
    .hero-title { font-size: 1.5rem; }
    .article-title { font-size: 1.5rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .article-share { flex-direction: column; gap: 16px; }
    .newsletter-form { flex-direction: column; }
}

/* --- Login Page --- */
.login-page {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
}

.login-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-tertiary);
}
.auth-switch a {
    color: var(--accent);
    font-weight: 500;
}

/* --- Category Page Header --- */
.category-header {
    padding: 48px 0 32px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 48px;
}

.category-color-bar {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    margin-bottom: 16px;
}

.category-page-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.category-description {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* --- Utilities --- */
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Verification modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-elevated);
    border-radius: 16px;
    padding: 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.otp-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
.otp-input:focus { border-color: var(--accent); }

/* --- Skip Link (Accessibility) --- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 10000;
    padding: 8px 16px;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: 0 0 8px 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

/* --- Error Pages --- */
.error-page {
    text-align: center;
    padding: 80px 24px 120px;
    max-width: 520px;
    margin: 0 auto;
}
.error-code {
    font-size: 7rem;
    font-weight: 800;
    line-height: 1;
    color: var(--border);
    margin-bottom: 16px;
    font-family: 'Inter', sans-serif;
}
.error-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.error-message {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}
.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Print */
@media print {
    .navbar, .footer, .reading-progress, .article-share,
    .comments-section, .similar-section { display: none; }
    .main-content { margin-top: 0; }
    .article-body { max-width: 100%; font-size: 12pt; }
}
