:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2235;
    --bg-card-hover: #1f2a3f;
    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #3b82f6;
    --accent-pink: #ec4899;
    --gradient-main: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --border-color: rgba(148, 163, 184, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.navbar {
    display: flex;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .brand {
    font-weight: 700;
    font-size: 1.2rem;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    margin-right: 2rem;
    letter-spacing: -0.5px;
}

.navbar .nav-links {
    display: flex;
    gap: 0.25rem;
}

.navbar .nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.navbar .nav-links a:hover,
.navbar .nav-links a.active {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.1);
}

.auth-links {
    margin-left: auto;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-links a:hover {
    color: var(--accent-blue);
}

.logout-form {
    margin: 0;
}

.logout-form button {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-secondary);
    font: inherit;
    cursor: pointer;
}

.logout-form button:hover {
    color: var(--accent-blue);
}

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.content-narrow {
    max-width: 900px;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
    letter-spacing: -1px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 0;
}

.articles-actions {
    text-align: center;
    margin: 0 0 2rem;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    max-width: 860px;
    margin: 0 auto;
}

.articles-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
}

.article-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem 1.6rem 1.35rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.article-card:hover {
    border-color: rgba(148, 163, 184, 0.2);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-sm);
}

.article-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    letter-spacing: -0.4px;
    line-height: 1.35;
}

.draft-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.35rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(209, 100, 135, 0.14);
    color: #b54b6e;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.article-card-summary {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.65;
    margin: 0 0 1rem;
    flex: 1;
}

.article-card .meta,
.meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.article-detail-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0 0 0.5rem;
    letter-spacing: -1px;
}

.article-detail-body {
    margin: 2rem 0;
}

.article-detail-body,
.article-form .ql-container.ql-snow,
.article-form .ql-editor {
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 1.05rem;
    line-height: 1.8;
    max-width: 100%;
    overflow-wrap: break-word;
}

.article-form .ql-editor p,
.article-form .ql-editor h2,
.article-form .ql-editor h3,
.article-form .ql-editor pre,
.article-form .ql-editor blockquote {
    margin: 1em 0;
}

.article-detail-body h2,
.article-detail-body h3,
.article-form .ql-snow .ql-editor h2,
.article-form .ql-snow .ql-editor h3 {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.3;
}

.article-form .ql-snow .ql-editor h2 {
    font-size: 1.5em;
}

.article-form .ql-snow .ql-editor h3 {
    font-size: 1.17em;
}

.article-detail-body blockquote,
.article-form .ql-snow .ql-editor blockquote {
    margin: 1.5rem 0;
    padding: 0.5rem 1.25rem;
    border-left: 3px solid var(--accent-blue);
    background: var(--bg-card);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article-detail-body pre,
.article-form .ql-snow .ql-editor pre,
.article-form .ql-snow .ql-editor .ql-code-block-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    overflow-x: auto;
    color: var(--text-primary);
}

.article-detail-body img,
.article-form .ql-snow .ql-editor img {
    max-width: 100%;
    border-radius: var(--radius-md);
}

.article-detail-body a,
.article-form .ql-snow .ql-editor a,
.article-form .ql-snow a {
    color: var(--accent-blue);
}

.article-detail-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.article-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.article-form .form-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.article-form .errorlist,
.login-form .errorlist {
    color: var(--accent-pink);
    font-size: 0.85rem;
    list-style: none;
    padding: 0;
    margin: 0.4rem 0 0;
}

.article-compose-settings {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 0.35rem 0;
}

.article-compose-settings[open] {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    padding: 0.7rem 1rem;
}

.article-compose-settings > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.article-compose-settings-fields {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.article-form .article-compose-title {
    flex: 1;
    min-width: 12rem;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    letter-spacing: inherit;
    color: inherit;
    line-height: inherit;
}

.article-form .article-compose-title:focus {
    outline: none;
    border: none;
    box-shadow: none;
}

.article-form .article-compose-title::placeholder {
    color: var(--text-muted);
    opacity: 0.4;
    font-weight: 700;
}

.article-form .article-compose-summary {
    width: 100%;
    background: transparent;
    border: none;
    resize: none;
    padding: 0.25rem 0 0;
    margin: 0.35rem 0 0;
    color: var(--text-secondary);
    font-size: 1.15rem;
    line-height: 1.5;
    min-height: 2.6rem;
}

.article-form .article-compose-summary:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

.article-form .article-compose-summary::placeholder {
    color: var(--text-muted);
    opacity: 0.55;
}

.article-editor {
    min-height: 0;
    background: transparent;
}

.article-form .ql-toolbar.ql-snow {
    position: sticky;
    top: 4.5rem;
    z-index: 20;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    margin: 0 0 1.25rem;
    font-size: 13px;
    color: var(--text-secondary);
}

.article-form .ql-container.ql-snow {
    border: none;
    height: auto;
}

.article-form .ql-editor {
    min-height: 22rem;
    height: auto;
    overflow-y: visible;
    padding: 0;
}

.article-form .ql-snow .ql-stroke { stroke: var(--text-secondary); }
.article-form .ql-snow .ql-fill { fill: var(--text-secondary); }
.article-form .ql-snow .ql-picker { color: var(--text-secondary); }
.article-form .ql-snow .ql-picker-options {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

.article-form .ql-snow.ql-toolbar button:hover,
.article-form .ql-snow.ql-toolbar button:focus,
.article-form .ql-snow.ql-toolbar button.ql-active,
.article-form .ql-snow.ql-toolbar .ql-picker-label:hover,
.article-form .ql-snow.ql-toolbar .ql-picker-label.ql-active,
.article-form .ql-snow.ql-toolbar .ql-picker-item:hover,
.article-form .ql-snow.ql-toolbar .ql-picker-item.ql-selected {
    color: var(--accent-blue);
}

.article-form .ql-snow.ql-toolbar button:hover .ql-stroke,
.article-form .ql-snow.ql-toolbar button:focus .ql-stroke,
.article-form .ql-snow.ql-toolbar button.ql-active .ql-stroke,
.article-form .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke,
.article-form .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke,
.article-form .ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke,
.article-form .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke {
    stroke: var(--accent-blue);
}

.article-form .ql-snow.ql-toolbar button:hover .ql-fill,
.article-form .ql-snow.ql-toolbar button:focus .ql-fill,
.article-form .ql-snow.ql-toolbar button.ql-active .ql-fill,
.article-form .ql-snow.ql-toolbar .ql-picker-label:hover .ql-fill,
.article-form .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill,
.article-form .ql-snow.ql-toolbar .ql-picker-item:hover .ql-fill,
.article-form .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-fill {
    fill: var(--accent-blue);
}

.article-form .ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: normal;
    left: 0;
    right: 0;
}

.button,
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.button,
.btn-primary {
    background: var(--gradient-main);
    color: #fff;
}

.button:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-blue);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    transition: color 0.2s ease;
}

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

input,
textarea,
select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    width: 100%;
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.login-form {
    max-width: 420px;
}

.login-form button[type="submit"] {
    margin-top: 0.5rem;
    background: #000;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
}

.compose-chrome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.compose-chrome-left,
.compose-chrome-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.compose-back {
    margin-bottom: 0;
}

.compose-save-state {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.compose-save-state[data-kind="busy"] {
    color: var(--text-secondary);
}

.compose-save-state[data-kind="err"] {
    color: #b3405f;
}

.compose-wordcount {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.is-hidden {
    display: none;
}

.status-pills {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
}

.status-pill input {
    width: auto;
    margin: 0;
    accent-color: #d16487;
}

.field-help {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

body.theme-light {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f7;
    --bg-card: #ffffff;
    --bg-card-hover: #fff7fa;
    --text-primary: #000000;
    --text-secondary: #3d3d3d;
    --text-muted: #707070;
    --accent-blue: #d16487;
    --accent-pink: #d16487;
    --gradient-main: #000000;
    --border-color: #e6e6e6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-glow-blue: 0 4px 14px rgba(209, 100, 135, 0.15);
}

body.theme-light .navbar {
    background: rgba(255, 255, 255, 0.92);
}

body.theme-light .navbar .brand {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: #000000;
}

body.theme-light .navbar .nav-links a:hover,
body.theme-light .navbar .nav-links a.active {
    color: #000000;
    background: #fbe9f0;
}

body.theme-light .article-card:hover {
    border-color: #f0c2d2;
}

body.theme-light .button,
body.theme-light .btn-primary,
body.theme-light .login-form button[type="submit"] {
    background: #000000;
    color: #ffffff;
}

body.theme-light .button:hover,
body.theme-light .btn-primary:hover {
    box-shadow: 0 4px 14px rgba(209, 100, 135, 0.25);
}

.content.home-simple {
    max-width: 660px;
    padding: 4rem 1.5rem 5rem;
}

.home-intro h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0 0 0.75rem;
}

.home-intro p {
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin: 0;
}

.home-who {
    margin-top: 4rem;
}

.home-who h2 {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px solid #f7cede;
    padding-bottom: 0.3rem;
    margin: 0 0 1.25rem;
}

.home-who p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.75;
    margin: 0 0 1.25rem;
}

.home-platforms {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

.home-platforms a {
    color: #000000;
    text-decoration: underline;
    text-decoration-color: #f0aec6;
    text-underline-offset: 3px;
}

.home-platforms a:hover {
    color: #d16487;
}

.home-newsletter {
    margin-top: 4rem;
    padding: 2rem;
    background: #fdf3f7;
    border: 1px solid #f7d9e4;
    border-radius: 12px;
}

.articles-grid ~ .home-newsletter {
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

.home-newsletter-topic {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #d16487;
    margin: 0 0 0.75rem;
}

.home-newsletter h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin: 0 0 0.75rem;
}

.home-newsletter p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0 0 1.5rem;
}

.home-newsletter-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.home-newsletter-form input[type="email"] {
    flex: 1;
    min-width: 220px;
    width: auto;
    background: #ffffff;
    border: 1px solid #e6c3d1;
    padding: 0.75rem 1rem;
}

.home-newsletter-form input[type="email"]:focus {
    border-color: #d16487;
    box-shadow: 0 0 0 3px rgba(209, 100, 135, 0.12);
}

.home-newsletter-form button {
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    background: #000000;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
}

.home-newsletter-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(209, 100, 135, 0.25);
}

.home-newsletter-note {
    font-size: 0.9rem;
    margin: 1rem 0 0;
}

.home-newsletter-note.ok {
    color: #1a7a4a;
}

.home-newsletter-note.err {
    color: #b3405f;
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .navbar .brand {
        margin-right: auto;
        font-size: 1rem;
    }

    .content {
        padding: 2rem 1rem;
    }

    .article-detail-header h1 {
        font-size: 1.7rem;
    }
}

@media (max-width: 600px) {
    .home-newsletter-form input[type="email"],
    .home-newsletter-form button {
        min-width: 100%;
        width: 100%;
    }

    .compose-chrome {
        align-items: flex-start;
    }
}
