/* ─────────────────────────────────────────
   C3Blog — site.css
   Aesthetic: editorial serif, ink-on-paper
───────────────────────────────────────── */

:root {
    --ink:       #1a1a18;
    --ink-light: #5a5a54;
    --rule:      #d8d4cc;
    --bg:        #f9f7f2;
    --bg-card:   #ffffff;
    --accent:    #b5451b;   /* burnt sienna — a little personality */
    --accent-hv: #8c3515;
    --mono:      'JetBrains Mono', 'Courier New', monospace;
    --serif:     'Lora', Georgia, serif;
    --max-w:     720px;
    --radius:    3px;
}

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

html { font-size: 18px; }

body {
    font-family: var(--serif);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.75;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ── Layout ── */
.container {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.5rem;
}

main.container { flex: 1; padding-top: 3rem; padding-bottom: 4rem; }

/* ── Header ── */
.site-header {
    border-bottom: 1px solid var(--rule);
    padding: 1.25rem 0;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header .container {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.site-title {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.site-title:hover { color: var(--accent); }

.site-nav { display: flex; gap: 1.5rem; align-items: center; }

.site-nav a {
    font-size: 0.85rem;
    color: var(--ink-light);
    text-decoration: none;
    font-family: var(--mono);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.site-nav a:hover { color: var(--accent); }

/* ── Footer ── */
.site-footer {
    border-top: 1px solid var(--rule);
    padding: 1.25rem 0;
    font-size: 0.8rem;
    color: var(--ink-light);
    font-family: var(--mono);
}

/* ── Post list ── */
.blog-header { margin-bottom: 2.5rem; }

.tagline {
    font-size: 0.95rem;
    color: var(--ink-light);
    font-style: italic;
}

.post-card {
    padding: 1.75rem 0;
    border-bottom: 1px solid var(--rule);
}

.post-card:first-of-type { border-top: 1px solid var(--rule); }

.post-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 0.35rem;
}

.post-card h2 a {
    color: var(--ink);
    text-decoration: none;
}

.post-card h2 a:hover { color: var(--accent); }

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

time {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--ink-light);
    letter-spacing: 0.02em;
}

.tag-list { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.tag {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--accent);
    background: #f5ece8;
    padding: 0.15em 0.55em;
    border-radius: var(--radius);
    letter-spacing: 0.02em;
}

.empty-state { color: var(--ink-light); font-style: italic; }

/* ── Single post ── */
.post-full { max-width: var(--max-w); }

.post-header { margin-bottom: 2.5rem; border-bottom: 1px solid var(--rule); padding-bottom: 1.5rem; }

.post-header h1 {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.post-content { font-size: 1rem; line-height: 1.8; }

.post-content p { margin-bottom: 1.25em; }

.post-content h2 { font-size: 1.35rem; margin: 2em 0 0.6em; font-weight: 600; }

.post-content h3 { font-size: 1.1rem; margin: 1.75em 0 0.5em; font-weight: 600; }

.post-content ul, .post-content ol {
    padding-left: 1.5em;
    margin-bottom: 1.25em;
}

.post-content li { margin-bottom: 0.3em; }

.post-content a { color: var(--accent); }
.post-content a:hover { color: var(--accent-hv); }

.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1.25rem;
    color: var(--ink-light);
    font-style: italic;
    margin: 1.5em 0;
}

.post-content pre, .post-content code {
    font-family: var(--mono);
    font-size: 0.875em;
    background: #f0ede8;
    border-radius: var(--radius);
}

.post-content pre {
    padding: 1em 1.25em;
    overflow-x: auto;
    margin-bottom: 1.25em;
}

.post-content code { padding: 0.15em 0.4em; }

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1.5em 0;
}

.post-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }

.back-link {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--ink-light);
    text-decoration: none;
    letter-spacing: 0.02em;
}

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

/* ── Buttons ── */
.btn {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.55em 1.2em;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1;
}

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

.btn-primary:hover { background: var(--accent-hv); border-color: var(--accent-hv); }

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--rule);
}

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

.btn-danger {
    background: transparent;
    color: #c0392b;
    border-color: #e8c4c0;
}

.btn-danger:hover { background: #c0392b; color: #fff; border-color: #c0392b; }

.btn-sm { padding: 0.35em 0.9em; font-size: 0.75rem; }

/* ── Auth page ── */
.auth-page { max-width: 380px; margin: 3rem auto; }

.auth-page h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }

.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }

.error-msg {
    background: #fdecea;
    color: #c0392b;
    border: 1px solid #f5c6c2;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ── Forms (shared) ── */
.form-field { display: flex; flex-direction: column; gap: 0.35rem; }

.form-field label {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-light);
}

.hint { font-size: 0.75rem; text-transform: none; letter-spacing: 0; color: var(--ink-light); opacity: 0.7; }

.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="date"] {
    font-family: var(--serif);
    font-size: 1rem;
    padding: 0.55em 0.75em;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s;
}

.form-field input:focus { border-color: var(--accent); }

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

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rule);
}

.admin-header h1 { font-size: 1.5rem; }

.flash-msg {
    background: #eaf7ee;
    color: #2d7a48;
    border: 1px solid #b8e4c8;
    border-radius: var(--radius);
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-family: var(--mono);
}

/* ── Post table ── */
.post-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.post-table th {
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-light);
    border-bottom: 2px solid var(--rule);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.post-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: middle;
}

.post-table td a { color: var(--ink); text-decoration: none; }
.post-table td a:hover { color: var(--accent); }

.row-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

.status-badge {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    padding: 0.2em 0.6em;
    border-radius: var(--radius);
    text-transform: uppercase;
}

.status-badge.published { background: #eaf7ee; color: #2d7a48; }
.status-badge.draft     { background: #f5f0e8; color: #7a6a3a; }

/* ── Edit form ── */
.edit-form { display: flex; flex-direction: column; gap: 1.25rem; }

.form-row { display: flex; gap: 1.25rem; align-items: flex-start; }
.flex-1 { flex: 1; }

.form-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--rule);
}


/* ── Not found ── */
.not-found { padding: 3rem 0; }
.not-found h1 { font-size: 1.5rem; margin-bottom: 1rem; }

/* ── Custom editor ── */
.editor-wrap {
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.15rem;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--rule);
    background: #f5f2ed;
    border-radius: var(--radius) var(--radius) 0 0;
}

.editor-toolbar button {
    font-family: var(--mono);
    font-size: 0.78rem;
    padding: 0.25em 0.55em;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--ink);
    line-height: 1.4;
    transition: background 0.1s, border-color 0.1s;
}

.editor-toolbar button:hover {
    background: var(--bg-card);
    border-color: var(--rule);
}

.editor-toolbar button.active {
    background: var(--bg-card);
    border-color: var(--accent);
    color: var(--accent);
}

.tb-sep {
    width: 1px;
    height: 1.2rem;
    background: var(--rule);
    margin: 0 0.2rem;
    flex-shrink: 0;
}

.editor-body {
    font-family: var(--serif);
    font-size: 1rem;
    line-height: 1.8;
    color: var(--ink);
    min-height: 420px;
    padding: 1.25rem 1.5rem;
    outline: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

.editor-body:empty::before {
    content: 'Start writing\2026';
    color: var(--ink-light);
    pointer-events: none;
}

.editor-body p          { margin-bottom: 1.25em; }
.editor-body h2         { font-size: 1.35rem; margin: 2em 0 0.6em; font-weight: 600; }
.editor-body h3         { font-size: 1.1rem;  margin: 1.75em 0 0.5em; font-weight: 600; }
.editor-body ul,
.editor-body ol         { padding-left: 1.5em; margin-bottom: 1.25em; }
.editor-body li         { margin-bottom: 0.3em; }
.editor-body a          { color: var(--accent); }
.editor-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1.25rem;
    color: var(--ink-light);
    font-style: italic;
    margin: 1.5em 0;
}
.editor-body pre,
.editor-body code       { font-family: var(--mono); font-size: 0.875em; background: #f0ede8; border-radius: var(--radius); }
.editor-body pre        { padding: 1em 1.25em; overflow-x: auto; margin-bottom: 1.25em; }
.editor-body code       { padding: 0.15em 0.4em; }
.editor-body img        { max-width: 100%; height: auto; border-radius: var(--radius); margin: 1.5em 0; display: block; }
.editor-body hr         { border: none; border-top: 1px solid var(--rule); margin: 2em 0; }
