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

:root {
    --bg-primary: #0b0b12;
    --bg-secondary: #16161f;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --accent: #ff2d2d;
    --accent-hover: #ff5a5a;
    --accent-deep: #660000;
    --card-border: rgba(255, 255, 255, 0.1);
    --shadow-subtle: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}


.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 5%;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(22, 22, 31, 0.6);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    z-index: -1;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-img {
    height: 60px;
    width: auto;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
}


.auth-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

#writeBtn {
    align-items: center;
    gap: 6px;
}

#writeBtn svg {
    width: 16px;
    height: 16px;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-danger {
    background: transparent;
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.4);
}

.btn-danger:hover {
    background: rgba(231, 76, 60, 0.12);
}

.user-profile {
    display: none;
    align-items: center;
    gap: 12px;
    position: relative;
    cursor: pointer;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    padding: 8px 0;
    min-width: 200px;
    display: none;
    flex-direction: column;
    z-index: 200;
}

.profile-dropdown.show {
    display: flex;
}

.dropdown-item {
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--bg-primary);
}

.dropdown-item.danger {
    color: #e74c3c;
}


.hero {
    text-align: center;
    padding: 80px 20px 50px;
    max-width: 820px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 56px;
    font-weight: 700;
    letter-spacing: -1.5px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.hero p {
    font-size: 21px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    font-weight: 400;
    letter-spacing: -0.2px;
}


.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 20px 80px;
    width: 100%;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.section-head h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.6px;
}


/* ===== ARTICLES GRID ===== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.article-card {
    background: var(--bg-secondary);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-subtle);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--card-border);
    text-decoration: none;
    color: inherit;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(255, 45, 45, 0.4);
}

.article-card-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: linear-gradient(135deg, var(--accent-deep), #1a1a24);
    display: block;
}

.article-card-body {
    padding: 22px 24px 26px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-card-title {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.4px;
    margin-bottom: 8px;
    line-height: 1.25;
}

.article-card-excerpt {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 18px;
    flex-grow: 1;
}

.article-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.article-card-meta .dot {
    opacity: 0.5;
}

.badge-draft {
    background: rgba(255, 45, 45, 0.15);
    color: var(--accent-hover);
    border: 1px solid rgba(255, 45, 45, 0.3);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

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


/* ===== BLOG FILTER BAR ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 28px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-radius: 16px;
}

.search-box {
    flex: 1 1 240px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 10px 14px 10px 38px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-box svg {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    pointer-events: none;
}

.filter-bar select {
    background: var(--bg-primary);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-bar select:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-reset {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.filter-reset:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

.blog-count {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.article-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 26px;
}

.filter-chip {
    display: inline-block;
    background: rgba(255, 45, 45, 0.12);
    color: var(--accent-hover);
    border: 1px solid rgba(255, 45, 45, 0.28);
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.filter-chip:hover {
    background: rgba(255, 45, 45, 0.22);
}

/* ===== ARTICLE READER ===== */
.article-view {
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 20px 80px;
    width: 100%;
}

.article-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 28px;
    transition: color 0.2s;
}

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

.article-view h1.article-title {
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.1;
    margin-bottom: 16px;
}

.article-byline {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.article-cover {
    width: 100%;
    border-radius: 16px;
    margin-bottom: 32px;
    border: 1px solid var(--card-border);
}

.article-content {
    font-size: 18px;
    line-height: 1.75;
    color: #e7e7ec;
}

.article-content h1,
.article-content h2,
.article-content h3 {
    margin: 1.6em 0 0.5em;
    letter-spacing: -0.5px;
    line-height: 1.25;
}

.article-content h1 { font-size: 32px; }
.article-content h2 { font-size: 26px; }
.article-content h3 { font-size: 21px; }

.article-content p { margin: 0 0 1.1em; }

.article-content a {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-content ul,
.article-content ol {
    margin: 0 0 1.1em 1.4em;
}

.article-content li { margin-bottom: 0.4em; }

.article-content img {
    max-width: 100%;
    border-radius: 12px;
    margin: 1.2em 0;
    border: 1px solid var(--card-border);
}

.article-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 1.2em 0;
    padding: 4px 0 4px 18px;
    color: var(--text-secondary);
    font-style: italic;
}

.article-content pre {
    background: #0f0f17;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
    margin: 1.2em 0;
    font-size: 15px;
}

.article-content code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.9em;
}

.article-actions {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--card-border);
    display: flex;
    gap: 12px;
}


/* ===== EDITOR ===== */
.editor-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 36px 20px 90px;
    width: 100%;
}

.editor-wrap h1.editor-heading {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.8px;
    margin-bottom: 24px;
}

.field {
    margin-bottom: 20px;
}

.field-row {
    display: flex;
    gap: 16px;
}

.field-row .field {
    flex: 1;
}

.field .hint code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.95em;
    color: var(--text-primary);
}

@media (max-width: 600px) {
    .field-row { flex-direction: column; gap: 0; }
}

.field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.field input[type="text"],
.field textarea {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    transition: border-color 0.2s;
}

.field input[type="text"]:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.field textarea { resize: vertical; min-height: 70px; }

.field .hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 8px;
    position: sticky;
    top: 78px;
    z-index: 50;
}

.editor-toolbar button {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    border-radius: 8px;
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.editor-toolbar button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.editor-toolbar button.active {
    background: rgba(255, 45, 45, 0.18);
    color: var(--accent-hover);
}

.editor-toolbar .sep {
    width: 1px;
    background: var(--card-border);
    margin: 4px 2px;
}

.editor-area {
    min-height: 360px;
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-radius: 0 0 12px 12px;
    padding: 20px 22px;
    font-size: 18px;
    line-height: 1.75;
    outline: none;
}

.editor-area:empty::before {
    content: attr(data-placeholder);
    color: var(--text-secondary);
    opacity: 0.7;
}

.editor-area:focus {
    border-color: var(--accent);
}

/* reuse reader typography inside the editor */
.editor-area h1, .editor-area h2, .editor-area h3 { margin: 1.2em 0 0.4em; letter-spacing: -0.5px; }
.editor-area h1 { font-size: 30px; }
.editor-area h2 { font-size: 24px; }
.editor-area h3 { font-size: 20px; }
.editor-area p { margin: 0 0 0.9em; }
.editor-area a { color: var(--accent-hover); text-decoration: underline; }
.editor-area ul, .editor-area ol { margin: 0 0 0.9em 1.4em; }
.editor-area img { max-width: 100%; border-radius: 10px; margin: 0.8em 0; }
.editor-area blockquote { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--text-secondary); font-style: italic; margin: 0.9em 0; }

.editor-footer {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 24px;
}

.editor-footer .spacer { flex: 1; }

.switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.alert {
    display: none;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.alert.show { display: block; }
.alert.error { background: rgba(231, 76, 60, 0.12); border: 1px solid rgba(231, 76, 60, 0.4); color: #ff8a7a; }
.alert.success { background: rgba(46, 204, 113, 0.12); border: 1px solid rgba(46, 204, 113, 0.4); color: #7ee2a8; }


.footer {
    padding: 24px 5%;
    text-align: center;
    font-size: 13px;
    background: rgba(22, 22, 31, 0.6);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: auto;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

app-footer {
    margin-top: auto;
    width: 100%;
}


.main-content {
    flex: 1;
    width: 100%;
}


.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* Vanta Background */
#vanta-bg {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    background-color: var(--bg-primary);
}

.content-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.glass-panel {
    background: rgba(22, 22, 31, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}


/* Main Navigation */
.main-nav {
    display: flex;
    gap: 20px;
    align-items: center;
    margin: 0 20px;
    position: relative;
}

.nav-indicator {
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(255, 45, 45, 0.15);
    border-radius: 20px;
    z-index: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1.2), width 0.4s cubic-bezier(0.4, 0, 0.2, 1.2), height 0.4s cubic-bezier(0.4, 0, 0.2, 1.2);
    pointer-events: none;
}

.main-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: color 0.2s;
    padding: 8px 16px;
    border-radius: 8px;
    position: relative;
    z-index: 1;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--accent);
    background: transparent !important;
}


/* Error Page */
.error-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
}

.error-content h1 {
    font-size: 120px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
    letter-spacing: -3px;
}

.error-content h2 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.error-content p {
    color: var(--text-secondary);
    font-size: 18px;
    margin-bottom: 32px;
}


/* Cookie Consent Banner */
.cookie-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(180%);
    width: calc(100% - 48px);
    max-width: 720px;
    z-index: 2000;
    border-radius: 18px;
    padding: 20px 24px;
    background: rgba(22, 22, 31, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.cookie-banner.show {
    transform: translateX(-50%) translateY(0);
}

.cookie-banner-content {
    display: flex;
    align-items: center;
    gap: 24px;
}

.cookie-banner-text strong {
    font-size: 15px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.cookie-banner-text p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.cookie-banner-text a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}

.cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}


/* Mobile Responsiveness */
@media (max-width: 768px) {
    .cookie-banner {
        bottom: 100px;
        padding: 18px 20px;
    }
    .cookie-banner-content {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .cookie-banner-actions .btn { flex: 1; }

    .header {
        flex-direction: row;
        justify-content: space-between;
        gap: 10px;
        padding: 16px 20px;
        text-align: left;
    }
    .main-nav {
        position: fixed !important;
        bottom: 24px;
        left: 50%;
        transform: translateX(-50%);
        width: max-content;
        min-width: 250px;
        background: rgba(22, 22, 31, 0.65);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
        border-radius: 40px;
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 10px 20px;
        z-index: 1000;
        margin: 0 !important;
    }
    .main-nav a {
        font-size: 14px;
        padding: 8px 16px;
        background: transparent !important;
    }
    .footer { padding-bottom: 90px; }
    .auth-section { gap: 10px; }
    .hero { padding: 40px 20px 24px; }
    .hero h1 { font-size: 34px; }
    .hero p { font-size: 16px; }
    .articles-grid { grid-template-columns: 1fr; }
    .article-view h1.article-title { font-size: 32px; }
    .article-content { font-size: 17px; }
    .editor-toolbar { top: 70px; }
    .error-content h1 { font-size: 80px; }
    .error-content h2 { font-size: 24px; }
}
