:root {
    --bg: #f5f6f8;
    --card-bg: #ffffff;
    --border: #e2e5ea;
    --text: #1a1d21;
    --text-muted: #6b7280;
    --accent: #d5222b;
    --accent-dark: #a91920;
    --radius: 10px;
    --max-width: 680px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    padding-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}
.brand {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.nav {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.95rem;
}
.nav-user {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger {
    background: #fff;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-danger:hover { background: #fdecec; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 16px 0;
    font-size: 0.95rem;
}
.alert-error { background: #fdecec; color: #8a1c1c; border: 1px solid #f3c1c1; }
.alert-success { background: #e9f8ee; color: #1e6a3a; border: 1px solid #bfe8cc; }

/* Feed */
.feed {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 20px 0;
}
.feed-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    gap: 14px;
    padding: 14px;
}
.feed-item-thumb {
    flex: 0 0 96px;
    width: 96px;
    height: 96px;
    border-radius: 8px;
    overflow: hidden;
    display: block;
    background: var(--bg);
}
.feed-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.feed-item-body { flex: 1; min-width: 0; }
.feed-item-title { margin: 0 0 6px; font-size: 1.1rem; }
.feed-item-title a { color: var(--text); }
.feed-item-excerpt {
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.feed-item-meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 0 40px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Single post */
.post-full h1 { margin-bottom: 6px; font-size: 1.6rem; }
.post-images {
    display: grid;
    gap: 6px;
    margin: 16px 0;
    border-radius: var(--radius);
    overflow: hidden;
}
.post-images img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-images-1 { grid-template-columns: 1fr; }
.post-images-1 img { max-height: 480px; }
.post-images-2 { grid-template-columns: 1fr 1fr; }
.post-images-2 img { height: 300px; }
.post-images-3 { grid-template-columns: 1fr 1fr; }
.post-images-3 img:first-child { grid-row: span 2; height: 100%; }
.post-images-3 img:not(:first-child) { height: 147px; }

.post-body {
    font-size: 1.05rem;
    white-space: pre-wrap;
    margin: 20px 0;
}
.post-owner-actions { margin: 20px 0; }

/* Forms */
.post-form, .auth-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
    max-width: 520px;
}
.post-form label, .auth-form label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 10px;
}
.post-form input[type="text"],
.post-form textarea,
.post-form input[type="file"],
.auth-form input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    width: 100%;
}
.post-form button, .auth-form button {
    margin-top: 16px;
    align-self: flex-start;
}
.field-hint {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* Footer */
.site-footer {
    margin-top: 40px;
    padding: 20px 0 40px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

@media (max-width: 480px) {
    .feed-item { flex-direction: column; }
    .feed-item-thumb { width: 100%; height: 180px; }
}
