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

body {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 16px;
    line-height: 1.7;
    color: #c8d4e8;
    background: #0f1623;
}

a { color: #7eb8f7; text-decoration: none; }
a:hover { color: #a8d0ff; text-decoration: underline; }

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

/* ── Header ───────────────────────────────────────────────── */
header {
    background: #0a0f1a;
    border-bottom: 1px solid #1e2d4a;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1060px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
}
.site-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #7eb8f7;
    letter-spacing: 0.04em;
}
.site-title:hover { color: #a8d0ff; text-decoration: none; }
header nav a {
    color: #4a6888;
    margin-left: 1.2rem;
    font-family: sans-serif;
    font-size: 0.85rem;
}
header nav a:hover { color: #7eb8f7; text-decoration: none; }

/* ── Layout ───────────────────────────────────────────────── */
.layout {
    max-width: 1060px;
    margin: 1.8rem auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr 230px;
    gap: 1.8rem;
}

main { min-width: 0; }

/* ── Search ───────────────────────────────────────────────── */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}
.search-form input {
    flex: 1;
    background: #0d1829;
    border: 1px solid #1e2d4a;
    color: #a8c8f0;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    font-size: 0.88rem;
    font-family: sans-serif;
}
.search-form input::placeholder { color: #3a5070; }
.search-form input:focus {
    outline: none;
    border-color: #2a4880;
}
.clear-search {
    font-family: sans-serif;
    font-size: 0.82rem;
    color: #4a6070;
    align-self: center;
    white-space: nowrap;
}

.feed-heading {
    font-family: sans-serif;
    font-size: 0.9rem;
    color: #4a6888;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Post cards ───────────────────────────────────────────── */
.post-card {
    background: #131c2e;
    border: 1px solid #1a2840;
    border-radius: 5px;
    padding: 1.1rem 1.4rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.15s;
}
.post-card:hover { border-color: #2a4070; }

.post-title {
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
}
.post-title a { color: #a8c8f0; }
.post-title a:hover { color: #7eb8f7; text-decoration: none; }

.post-meta {
    font-family: sans-serif;
    font-size: 0.75rem;
    color: #3a5878;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.35rem;
}
.post-description {
    font-size: 0.88rem;
    color: #5a7898;
    margin-top: 0.3rem;
    line-height: 1.5;
}

/* ── Tags ─────────────────────────────────────────────────── */
.tag {
    display: inline-block;
    background: #0d1829;
    border: 1px solid #1e3055;
    color: #4a7ab0;
    font-size: 0.72rem;
    font-family: sans-serif;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    white-space: nowrap;
}
.tag:hover { background: #1a3060; color: #7eb8f7; text-decoration: none; border-color: #2a4880; }
.tag.active { background: #1a3060; color: #7eb8f7; border-color: #2a4880; }

/* ── Sidebar ──────────────────────────────────────────────── */
.widget {
    background: #0d1829;
    border: 1px solid #1a2840;
    border-radius: 5px;
    padding: 0.9rem 1rem;
    margin-bottom: 1.1rem;
}
.widget h3 {
    font-family: sans-serif;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #2a4060;
    margin-bottom: 0.7rem;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.archive-list { list-style: none; }
.archive-list li { margin-bottom: 0.2rem; }
.archive-list a {
    font-family: sans-serif;
    font-size: 0.82rem;
    color: #3a5878;
}
.archive-list a:hover { color: #7eb8f7; text-decoration: none; }
.archive-list .count { color: #2a3a50; font-size: 0.75rem; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.2rem;
    font-family: sans-serif;
    font-size: 0.85rem;
}
.page-info { color: #2a4060; }
.post-nav { margin-top: 1.5rem; }
.no-posts { color: #2a4060; font-style: italic; font-family: sans-serif; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: #0d1829;
    color: #5a85b8;
    border: 1px solid #1e2d4a;
    border-radius: 4px;
    font-family: sans-serif;
    font-size: 0.82rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #1a2d4a; color: #7eb8f7; border-color: #2a4070; text-decoration: none; }
.btn-primary { background: #1a3a70; color: #7eb8f7; border-color: #2a4880; }
.btn-primary:hover { background: #1e4480; color: #a8d0ff; }
.btn-success { background: #0d2a1a; color: #4ab87a; border-color: #1a4a2a; }
.btn-success:hover { background: #1a3a28; color: #6ad898; }
.btn-danger { background: transparent; color: #c05858; border-color: #6a2828; }
.btn-danger:hover { background: #2a1010; color: #e07878; }
.btn-sm { padding: 0.18rem 0.5rem; font-size: 0.75rem; }

/* ── Single post ──────────────────────────────────────────── */
.post-full {
    background: #131c2e;
    border: 1px solid #1a2840;
    border-radius: 5px;
    padding: 1.8rem 2rem;
}
.post-header { margin-bottom: 1.4rem; }
.post-header h1 {
    font-size: 1.5rem;
    color: #a8c8f0;
    margin-bottom: 0.5rem;
    line-height: 1.35;
}
.post-content { line-height: 1.85; color: #b0c4de; }
.post-content p { margin-bottom: 1rem; }
.post-content img { border-radius: 4px; border: 1px solid #1a2840; }
.post-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }

/* ── Comments ─────────────────────────────────────────────── */
.comments {
    margin-top: 2rem;
    border-top: 1px solid #1a2840;
    padding-top: 1.4rem;
}
.comments h3 {
    font-family: sans-serif;
    font-size: 0.85rem;
    color: #3a5878;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
}
.comment {
    border-left: 2px solid #1e3055;
    padding: 0.65rem 1rem;
    margin-bottom: 0.85rem;
    background: #0d1829;
    border-radius: 0 4px 4px 0;
}
.comment-reply { margin-left: 1.8rem; border-left-color: #2a4070; }
.comment-meta {
    font-family: sans-serif;
    font-size: 0.75rem;
    color: #3a5070;
    margin-bottom: 0.35rem;
    display: flex;
    gap: 0.75rem;
}
.comment-meta strong { color: #5a85b8; }
.comment-content { font-size: 0.9rem; color: #8aaac8; line-height: 1.6; }

/* ── Login page ───────────────────────────────────────────── */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #080e18;
}
.login-box {
    background: #0f1a2e;
    border: 1px solid #1e2d4a;
    padding: 2.5rem;
    border-radius: 6px;
    width: 100%;
    max-width: 360px;
}
.login-box h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: #7eb8f7;
    letter-spacing: 0.04em;
}

/* ── Forms ────────────────────────────────────────────────── */
.field { margin-bottom: 1rem; }
.field label {
    display: block;
    font-family: sans-serif;
    font-size: 0.8rem;
    color: #3a5878;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.field small {
    font-size: 0.75rem;
    color: #2a4060;
    text-transform: none;
    letter-spacing: 0;
}
.field input[type="text"],
.field input[type="password"],
.field textarea,
.field select {
    width: 100%;
    padding: 0.45rem 0.75rem;
    background: #0a1422;
    border: 1px solid #1e2d4a;
    border-radius: 4px;
    color: #a8c8f0;
    font-size: 0.92rem;
    font-family: inherit;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: #2a4880;
}
.field input.disabled { background: #0a0f1a; color: #2a4060; }
.field textarea { resize: vertical; font-family: monospace; font-size: 0.85rem; background: #0a1422; color: #a8c8f0; }
.field select { background: #0a1422; color: #a8c8f0; }
.field-row { display: flex; gap: 2rem; }
.field-row label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.85rem;
    color: #5a85b8;
}
.field input[type="checkbox"] { width: auto; accent-color: #3a6ab0; }

.error {
    background: #1a0a0a;
    border: 1px solid #4a1a1a;
    color: #c07070;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-family: sans-serif;
    font-size: 0.85rem;
}

/* ── Admin ────────────────────────────────────────────────── */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.4rem;
}
.admin-header h1 {
    font-size: 1.2rem;
    color: #7eb8f7;
    font-family: sans-serif;
    font-weight: normal;
}
.admin-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.admin-filters input,
.admin-filters select {
    padding: 0.32rem 0.6rem;
    background: #0a1422;
    border: 1px solid #1e2d4a;
    border-radius: 4px;
    color: #a8c8f0;
    font-size: 0.85rem;
    font-family: sans-serif;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-family: sans-serif;
    font-size: 0.83rem;
    background: #0d1829;
    border: 1px solid #1a2840;
    border-radius: 5px;
    overflow: hidden;
}
.admin-table th {
    background: #0a1020;
    padding: 0.55rem 0.8rem;
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #2a4060;
    border-bottom: 1px solid #1a2840;
    font-weight: normal;
}
.admin-table td {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid #111e30;
    vertical-align: middle;
    color: #8aaac8;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr.row-deleted td { color: #2a4060; }
.admin-table tr.row-unpublished td { color: #4a6888; }
.admin-table tr:hover td { background: #111e32; }
.nowrap { white-space: nowrap; }
.actions { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }

.post-tags-small { margin-top: 0.2rem; display: flex; gap: 0.25rem; flex-wrap: wrap; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: 0.68rem;
    padding: 0.12rem 0.4rem;
    border-radius: 3px;
    font-family: sans-serif;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-published { background: #0a2018; color: #3a8a5a; border: 1px solid #1a4a2a; }
.badge-draft     { background: #1a1a08; color: #8a7030; border: 1px solid #3a3010; }
.badge-deleted   { background: #1a0808; color: #8a3030; border: 1px solid #3a1010; }

/* ── Editor toolbar ───────────────────────────────────────── */
.editor-toolbar { margin-bottom: 0.4rem; display: flex; gap: 0.5rem; }

/* ── Admin edit page ──────────────────────────────────────── */
.admin-edit { max-width: 860px; }

/* ── 404 ──────────────────────────────────────────────────── */
.error-page { text-align: center; padding: 4rem 2rem; color: #3a5878; }
.error-page h1 { font-size: 1.8rem; margin-bottom: 1rem; color: #4a6888; }

/* ── Footer ───────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 2rem;
    font-family: sans-serif;
    font-size: 0.75rem;
    color: #1e2d40;
    border-top: 1px solid #0f1e30;
    margin-top: 2rem;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .layout { grid-template-columns: 1fr; }
    aside { order: -1; }
    .post-full { padding: 1.2rem; }
    .admin-table { font-size: 0.75rem; }
    .actions { flex-direction: column; align-items: flex-start; }
    .header-inner { height: 48px; }
}

/* ── Feed post content ────────────────────────────────────── */
.post-card .post-content {
    margin-top: 0.75rem;
    line-height: 1.8;
    color: #b0c4de;
}
.post-card .post-content img {
    border-radius: 4px;
    border: 1px solid #1a2840;
    max-width: 100%;
}
.post-footer {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid #111e30;
    display: flex;
    justify-content: flex-end;
}
.post-permalink {
    font-family: sans-serif;
    font-size: 0.75rem;
    color: #2a4060;
}
.post-permalink:hover { color: #7eb8f7; text-decoration: none; }
.permalink-icon { margin-left: 0.3rem; }
