/* theme.css — CSS variables, shared semantic classes, prose */

:root {
    color-scheme: dark;
    --theme-bg: #1f1f1f;
    --theme-panel: #1f1f1f;
    --theme-admin-surface: #252525;
    --theme-admin-content: #1d1d1d;
    --theme-admin-header: #222222;
    --theme-panel-strong: #393939;
    --theme-panel-soft: #454545;
    --theme-line: #434343;
    --theme-line-strong: #515151;
    --theme-border: #323232;
    --theme-border-strong: #3c3c3c;
    --theme-ink: #e6e8f0;
    --theme-soft: #b7b7b7;
    --theme-muted: #999999;
    --theme-subtle: #a8a8a8;
    --theme-body: #e6e8f0;
    --theme-faint: #747369;
    --theme-base: #1a1a1a;
    --theme-brand: #6699cc;
    --theme-brand-light: #89b4e0;
    --theme-brand-strong: #7aa6d4;
    --theme-brand-soft: rgba(102, 153, 204, 0.22);
    --theme-purple: #cc99cc;
    --theme-purple-soft: rgba(204, 153, 204, 0.2);
    --theme-success-light: #6ee7b7;
    --theme-success: #99cc99;
    --theme-success-soft: rgba(153, 204, 153, 0.2);
    --theme-warm-light: #ffd98c;
    --theme-warm: #ffcc66;
    --theme-warm-strong: #f99157;
    --theme-warm-soft: rgba(255, 204, 102, 0.2);
    --theme-danger-light: #fca5a5;
    --theme-danger: #f2777a;
    --theme-danger-soft: rgba(242, 119, 122, 0.18);
}

html {
    background: var(--theme-bg);
    height: 100%;
}

body {
    color: var(--theme-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--theme-bg);
}

/* ── Layout ─────────────────────────────────────────── */

.page-wrapper {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.site-container {
    max-width: 48rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
    width: 100%;
}

@media (min-width: 640px) {
    .site-container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .site-container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

.page-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-ink);
}

/* ── Site bar / header ──────────────────────────────── */

.site-bar {
    backdrop-filter: blur(18px);
    box-shadow: none !important;
    background-color: var(--theme-panel);
    border-bottom: 1px solid var(--theme-border);
}

.site-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 3rem;
}

/* ── Navigation ─────────────────────────────────────── */

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--theme-muted);
    transition: color 150ms;
}

.nav-link:hover {
    color: var(--theme-ink);
}

.dropdown-menu {
    position: absolute;
    right: 0;
    margin-top: 0.5rem;
    width: 10rem;
    border-radius: 0.375rem;
    border: 1px solid var(--theme-line);
    background-color: var(--theme-panel);
    padding: 0.25rem 0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--theme-subtle);
    transition: background-color 150ms, color 150ms;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background-color: var(--theme-panel-strong);
    color: var(--theme-ink);
}

/* ── Buttons ────────────────────────────────────────── */

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background-color: #6485af;
    color: #1f1f1f;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 150ms;
}

.btn-primary:hover {
    background-color: #7494ba;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 2.5rem;
    border: 1px solid var(--theme-line);
    background-color: var(--theme-panel-strong);
    border-radius: 0.5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--theme-soft);
    transition: border-color 150ms, color 150ms;
}

.btn-secondary:hover {
    border-color: var(--theme-faint);
    color: var(--theme-ink);
}

.btn-small {
    border: 1px solid var(--theme-line);
    background-color: var(--theme-panel-strong);
    color: var(--theme-soft);
    border-radius: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    transition: background-color 150ms, color 150ms;
}

.btn-small:hover {
    background-color: var(--theme-line);
    color: var(--theme-ink);
}

.btn-ghost {
    font-size: 0.75rem;
    color: var(--theme-muted);
    transition: color 150ms;
}

.btn-ghost:hover {
    color: var(--theme-brand-strong);
}

.btn-ghost-view {
    font-size: 0.75rem;
    color: var(--theme-muted);
    transition: color 150ms;
}

.btn-ghost-view:hover {
    color: var(--theme-subtle);
}

.btn-danger-ghost {
    font-size: 0.75rem;
    color: var(--theme-muted);
    transition: color 150ms;
}

.btn-danger-ghost:hover {
    color: var(--theme-danger);
}

.btn-save-draft {
    background-color: var(--theme-panel-strong);
    color: var(--theme-soft);
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 150ms;
}

.btn-save-draft:hover {
    background-color: var(--theme-line);
}

.btn-publish {
    background-color: #6485af;
    color: #1f1f1f;
    border-radius: 0.25rem;
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 150ms;
}

.btn-publish:hover {
    background-color: #7494ba;
}

/* ── Alerts ─────────────────────────────────────────── */

.alert {
    border-radius: 0.5rem;
    border-width: 1px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.alert-danger {
    border-color: rgba(242, 119, 122, 0.3);
    background-color: rgba(242, 119, 122, 0.1);
    color: var(--theme-danger-light);
}

.alert-warning {
    border-color: rgba(255, 204, 102, 0.3);
    background-color: rgba(255, 204, 102, 0.1);
    color: var(--theme-warm-light);
}

.alert-success {
    border-color: rgba(153, 204, 153, 0.3);
    background-color: rgba(153, 204, 153, 0.1);
    color: var(--theme-success-light);
}

.alert-info {
    border-color: rgba(100, 149, 237, 0.3);
    background-color: rgba(100, 149, 237, 0.1);
    color: #93bbfb;
}

.alert-draft {
    border-color: rgba(100, 149, 237, 0.3);
    background-color: rgba(100, 149, 237, 0.1);
    color: #93c5fd;
}

/* ── Badges ─────────────────────────────────────────── */

.badge-draft {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background-color: rgba(255, 204, 102, 0.15);
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--theme-warm-light);
}

.badge-private {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background-color: var(--theme-panel-strong);
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    color: var(--theme-subtle);
}

.badge-private-post {
    display: inline-flex;
    align-items: center;
    border-radius: 0.25rem;
    border: 1px solid rgba(255, 204, 102, 0.3);
    background-color: rgba(255, 204, 102, 0.1);
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--theme-warm-light);
}

/* ── Tags ───────────────────────────────────────────── */

.tag-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 0.25rem;
    background-color: var(--theme-panel-strong);
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--theme-muted);
    transition: background-color 150ms;
    text-decoration: none;
}

.tag-chip:hover {
    background-color: var(--theme-line);
}

/* ── Forms ──────────────────────────────────────────── */

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--theme-subtle);
    margin-bottom: 0.375rem;
}

.form-checkbox {
    border-radius: 0.25rem;
    border-color: var(--theme-faint);
    background-color: var(--theme-panel-strong);
    color: var(--theme-brand-strong);
}

.form-radio {
    height: 1rem;
    width: 1rem;
    color: var(--theme-brand-strong);
    border-color: var(--theme-faint);
    background-color: var(--theme-line);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.settings-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--theme-line);
    background-color: rgba(57, 57, 57, 0.5);
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: border-color 150ms;
}

.settings-option:hover {
    border-color: var(--theme-faint);
}

/* ── Tables ─────────────────────────────────────────── */

.table-divider > :not([hidden]) ~ :not([hidden]) {
    border-top: 1px solid var(--theme-border);
}

.table-divider-soft > :not([hidden]) ~ :not([hidden]) {
    border-top: 1px solid rgba(50, 50, 50, 0.5);
}

.table-row-hover:hover {
    background-color: rgba(57, 57, 57, 0.4);
}

/* ── Post card ──────────────────────────────────────── */

.post-card {
    display: block;
    padding: 1.5rem 1rem;
    margin-left: -1rem;
    margin-right: -1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 150ms;
}

.post-card:hover {
    background-color: #272727;
}

/* ── Login card ─────────────────────────────────────── */

.login-card {
    background-color: var(--theme-panel);
    border-radius: 0.75rem;
    border: 1px solid var(--theme-border);
    padding: 2rem;
}

/* ── Empty state ────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 4rem 0;
}

/* ── Link styles ────────────────────────────────────── */

.link-brand {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--theme-brand-strong);
    transition: color 150ms;
}

.link-brand:hover {
    color: var(--theme-brand-light);
}

.link-back {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--theme-muted);
    transition: color 150ms;
}

.link-back:hover {
    color: var(--theme-subtle);
}

.link-back svg {
    transition: transform 150ms;
}

.link-back:hover svg {
    transform: translateX(-2px);
}

/* ── Prose (self-contained typography) ──────────────── */

.prose {
    color: #d4d4d4;
    line-height: 1.75;
    max-width: none;
}

.prose.prose-lg {
    font-size: 1.25rem;
}

.prose h1 {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--theme-ink);
    letter-spacing: -0.025em;
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.prose h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--theme-ink);
    letter-spacing: -0.025em;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.prose h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--theme-ink);
    letter-spacing: -0.025em;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.prose p {
    color: var(--theme-body);
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.prose a {
    color: var(--theme-brand-strong);
    text-decoration: none;
}

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

.prose strong {
    color: var(--theme-soft);
    font-weight: 600;
}

.prose img {
    border-radius: 0.75rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.prose code {
    font-size: 0.875rem;
    background-color: var(--theme-purple-soft);
    color: var(--theme-subtle);
    padding: 0.125rem 0.375rem;
    border-radius: 0.45rem;
}

.prose pre {
    border: 1px solid var(--theme-border);
    border-radius: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    line-height: 1.85;
    background-color: #161616 !important;
    margin-top: 1rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}

.prose pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
}

.prose blockquote {
    border-left: 2px solid var(--theme-border-strong);
    padding-left: 1rem;
    color: var(--theme-muted);
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.prose hr {
    border: none;
    border-top: 1px solid var(--theme-border);
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.prose ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.prose ol {
    list-style: decimal;
    padding-left: 1.5rem;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.prose li {
    color: var(--theme-body);
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.prose li::marker {
    color: var(--theme-faint);
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.prose th {
    border-bottom: 1px solid var(--theme-border);
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--theme-ink);
}

.prose td {
    border-bottom: 1px solid var(--theme-border);
    padding: 0.5rem;
}
