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

body {
    font-family: sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    color: #111;
    background: #fff;
}

/* ── Header ─────────────────────────────────────────── */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-title {
    font-weight: bold;
    text-decoration: none;
    color: inherit;
}

.social-links {
    display: flex;
    gap: 0.75rem;
}

.social-links a {
    font-size: 0.85rem;
    color: #555;
    text-decoration: none;
}

.social-links a:hover { text-decoration: underline; }

.header-right {
    display: flex;
    gap: 0.75rem;
    white-space: nowrap;
}

.header-right a {
    font-size: 0.9rem;
    color: #555;
    text-decoration: none;
}

.header-right a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────── */
.layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

main {
    flex: 1 1 0;
    min-width: 0;
}

aside {
    flex: 0 0 180px;
    width: 180px;
    font-size: 0.9rem;
}

aside section {
    margin-bottom: 1.5rem;
}

aside h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.2rem;
}

aside ul {
    list-style: none;
    padding: 0;
}

aside ul li {
    padding: 0.15rem 0;
}

aside ul li a {
    color: #333;
    text-decoration: none;
}

aside ul li a:hover {
    text-decoration: underline;
}

/* ── Posts ───────────────────────────────────────────── */
article {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    padding-left: 0.85rem;
    border-bottom: 1px solid #eee;
    border-left: 4px solid transparent; /* overridden inline per post */
}

article:last-child { border-bottom: none; }

h1, h2 { margin-bottom: 0.25rem; }
h2 a { text-decoration: none; color: inherit; }
h2 a:hover { text-decoration: underline; }

time {
    font-size: 0.85rem;
    color: #666;
    display: block;
    margin-bottom: 0.5rem;
}

p { margin-top: 0.5rem; }

.preview {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
}

.post-actions { margin-top: 1rem; font-size: 0.9rem; }
.post-actions a { color: #555; }

.post-links {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
    border-top: 1px solid #eee;
    padding-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.post-links li a {
    font-size: 0.9rem;
    color: #333;
    text-decoration: none;
    border: 1px solid #ccc;
    padding: 0.15rem 0.5rem;
}

.post-links li a:hover { background: #f5f5f5; }

/* ── Link editor (new/edit forms) ─────────────────────── */
.links-fieldset {
    border: 1px solid #ddd;
    padding: 0.75rem;
    margin-top: 1.25rem;
}

.links-fieldset legend {
    font-size: 0.9rem;
    padding: 0 0.25rem;
    color: #555;
}

.link-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.link-row input[type="text"] { flex: 0 0 140px; width: 140px; margin-top: 0; }
.link-row input[type="url"]  { flex: 1 1 0;    min-width: 0;  margin-top: 0; }

.remove-link {
    margin-top: 0;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid #ccc;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
}

.remove-link:hover { background: #fee; border-color: #c00; }

#add-link {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    padding: 0.2rem 0.6rem;
    border: 1px dashed #aaa;
    background: none;
    cursor: pointer;
}

#add-link:hover { background: #f5f5f5; }

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #555;
}

.pagination a { color: #333; text-decoration: none; }
.pagination a:hover { text-decoration: underline; }

/* ── Forms ───────────────────────────────────────────── */
label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    margin-top: 1rem;
}

input[type="text"],
input[type="password"],
input[type="url"],
textarea {
    width: 100%;
    padding: 0.4rem 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid #bbb;
    background: #fafafa;
}

select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid #bbb;
    background: #fafafa;
}

textarea { resize: vertical; }

button {
    margin-top: 1rem;
    padding: 0.4rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    border: 1px solid #888;
    background: #f0f0f0;
}

button:hover { background: #e0e0e0; }

.error { color: #c00; margin-top: 0.5rem; }

form a {
    margin-left: 1rem;
    font-size: 0.9rem;
    color: #555;
}

/* ── Footer ──────────────────────────────────────────── */
footer {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid #ccc;
    font-size: 0.8rem;
    color: #888;
    text-align: center;
}
