/* ============================================================
   blog-food — Rustic Farmhouse Stylesheet
   Warm. Earthy. Homely.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@400;500;600&display=swap');

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

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.7;
    color: #3a3226;
    background: #faf7f2 url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4c9b0' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    min-height: 100vh;
}

a {
    color: #7a5c3a;
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: #5a3f25;
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Navigation --- */
.navbar {
    background: #4a3728;
    background-image: linear-gradient(135deg, #3d2e1f 0%, #5a4330 100%);
    color: #f5ede2;
    padding: 0.85rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 12px rgba(58,50,38,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid #8a7a5a;
}

.navbar-brand {
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #f5ede2;
    letter-spacing: 0.5px;
}
.navbar-brand:hover {
    color: #d4c9b0;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}
.nav-links a {
    color: #e8ddd0;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.4rem 0.2rem;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s, color 0.2s;
}
.nav-links a:hover {
    color: #f5ede2;
    border-bottom-color: #c4a87c;
    text-decoration: none;
}

/* --- Flash Messages --- */
.flash-messages {
    max-width: 900px;
    margin: 1rem auto;
    padding: 0 1.5rem;
}
.flash {
    padding: 0.85rem 1.1rem;
    margin-bottom: 0.6rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    border-left: 4px solid transparent;
    background-color: #fff;
}
.flash-success {
    background-color: #e8f0e0;
    color: #4a6b3a;
    border-left-color: #7a9f5a;
}
.flash-error {
    background-color: #f5e0e0;
    color: #8a3a3a;
    border-left-color: #c45a5a;
}
.flash-warning {
    background-color: #f5ede0;
    color: #8a7040;
    border-left-color: #d4a85a;
}
.flash-info {
    background-color: #e0eaf0;
    color: #3a5a7a;
    border-left-color: #5a8ab4;
}

/* --- Layout --- */
.container {
    max-width: 960px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* --- Cards --- */
.card {
    background: #fffcf8;
    border-radius: 4px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(58,50,38,0.08), 0 0 0 1px rgba(200,185,160,0.3);
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
}
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #c4a87c, #8a7a5a, #c4a87c);
    border-radius: 4px 4px 0 0;
}
.card:hover {
    box-shadow: 0 4px 16px rgba(58,50,38,0.12), 0 0 0 1px rgba(200,185,160,0.4);
}
.card-flat {
    margin-bottom: 0;
}
.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    border: 1px solid #e8ddd0;
}

/* --- Grid --- */
.grid-2col {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* --- Hero --- */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
    position: relative;
}
.hero::after {
    content: '🌿';
    display: block;
    font-size: 1.5rem;
    margin-top: 0.5rem;
    opacity: 0.5;
}
.hero-title {
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
    font-size: 2.4rem;
    color: #4a3728;
    margin-bottom: 0.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}
.hero-subtitle {
    color: #7a6a55;
    font-size: 1.1rem;
    max-width: 550px;
    margin: 0 auto;
    font-style: italic;
}

/* --- Headings --- */
h1, h2, h3 {
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
    color: #4a3728;
}
h1 {
    font-weight: 700;
    letter-spacing: -0.3px;
}
h2 {
    font-weight: 600;
    letter-spacing: -0.2px;
}
h3 {
    font-weight: 600;
}

.page-title {
    color: #4a3728;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e8ddd0;
    padding-bottom: 0.5rem;
}
.section-title {
    color: #4a3728;
    font-size: 1.35rem;
    font-weight: 600;
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
}
.post-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
}
.post-title a {
    color: #4a3728;
}
.post-title a:hover {
    color: #7a5c3a;
}
.detail-title {
    color: #4a3728;
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
}

/* --- Typography helpers --- */
.text-center { text-align: center; }
.text-muted { color: #7a6a55; }
.text-muted-light { color: #a09080; }
.text-small { font-size: 0.9rem; }
.text-smaller { font-size: 0.85rem; }
.text-xsmall { font-size: 0.8rem; }
.text-green { color: #6a8a4a; }

/* --- Meta info row --- */
.meta-row {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #a09080;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.meta-row span {
    background: #f5ede2;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
}

/* --- Rating --- */
.rating-stars {
    color: #c4903a;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.color-warning {
    color: #c4903a;
}

/* --- Content --- */
.content-body {
    line-height: 1.9;
    color: #4a3a2e;
    font-size: 1.05rem;
}
.content-body p {
    margin-bottom: 1rem;
}

/* --- Comment --- */
.comment {
    padding: 1rem 0;
    border-bottom: 1px solid #e8ddd0;
}
.comment:last-child {
    border-bottom: none;
}
.comment-author {
    font-weight: 600;
    color: #4a3728;
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
}
.comment-date {
    font-size: 0.8rem;
    color: #a09080;
}
.comment-text {
    color: #5a4a3e;
    margin-top: 0.4rem;
    line-height: 1.6;
}
.comment-empty {
    color: #a09080;
    font-style: italic;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border-radius: 3px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}
.btn:hover {
    text-decoration: none;
}
.btn-primary {
    background-color: #6a8a4a;
    color: #fffcf8;
}
.btn-primary:hover {
    background-color: #5a7a3a;
    box-shadow: 0 2px 8px rgba(106,138,74,0.3);
}
.btn-secondary {
    background-color: #d4c9b0;
    color: #4a3728;
}
.btn-secondary:hover {
    background-color: #c4b89a;
    color: #3a3226;
}
.btn-sm {
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
}
.btn-link {
    color: #7a5c3a;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: "Inter", sans-serif;
}
.btn-link:hover {
    color: #5a3f25;
}
.btn-link::after {
    content: ' →';
}

/* --- Form elements --- */
.form-group {
    margin-bottom: 1rem;
}
.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #5a4a3e;
    margin-bottom: 0.3rem;
}
.form-input {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid #d4c9b0;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: #fffcf8;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
    outline: none;
    border-color: #8a7a5a;
    box-shadow: 0 0 0 3px rgba(138,122,90,0.15);
    background: #fff;
}
.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* --- Admin table --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table th {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid #c4a87c;
    color: #4a3728;
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f5ede2;
}
.admin-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #ece3d6;
    vertical-align: middle;
}
.admin-table tr:hover td {
    background-color: #faf5ec;
}
.admin-table code {
    background-color: #f5ede2;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
    color: #5a4a3e;
}
.admin-table-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 0;
    font-size: 0.95rem;
}
.pagination a {
    padding: 0.4rem 1rem;
    background: #6a8a4a;
    color: #fffcf8;
    border-radius: 3px;
    font-weight: 500;
    transition: background 0.2s;
    font-size: 0.9rem;
}
.pagination a:hover {
    background: #5a7a3a;
    text-decoration: none;
}
.pagination span {
    color: #7a6a55;
    font-style: italic;
}

/* --- Empty state --- */
.empty-state {
    color: #a09080;
    text-align: center;
    padding: 2.5rem;
    font-style: italic;
}

/* --- Footer --- */
.footer {
    background: #4a3728;
    color: #c4b89a;
    text-align: center;
    padding: 1.75rem;
    margin-top: 3rem;
    font-size: 0.9rem;
    border-top: 3px solid #8a7a5a;
}
.footer a {
    color: #d4c9b0;
}
.footer a:hover {
    color: #f5ede2;
}

/* --- Error pages --- */
.error-code {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
}
.error-code-500 { color: #c45a5a; }
.error-code-404 { color: #6a8a4a; }
.error-heading {
    color: #4a3728;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}
.error-text {
    color: #7a6a55;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
}
.error-link {
    display: inline-block;
    padding: 0.65rem 1.5rem;
    background-color: #6a8a4a;
    color: #fffcf8;
    border-radius: 3px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
}
.error-link:hover {
    background-color: #5a7a3a;
    text-decoration: none;
}

/* --- Image styling --- */
.img-grid {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    border: 1px solid #e8ddd0;
}
.img-detail {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid #e8ddd0;
}

/* --- Badge (published status) --- */
.badge-yes {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    background-color: #e0ebd0;
    color: #4a6b3a;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-no {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    background-color: #f0d8d8;
    color: #8a3a3a;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* --- Admin header & layout --- */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.admin-header h1 {
    font-size: 1.6rem;
    color: #4a3728;
}
.admin-actions {
    display: flex;
    gap: 0.75rem;
}
.admin-form {
    max-width: 600px;
}

/* --- Inline form helper --- */
.inline-form { display: inline; }

/* --- Spacing helpers --- */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mr-1 { margin-right: 0.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* --- Flex helpers --- */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { align-items: center; }
.flex-between { justify-content: space-between; }
.flex-col { flex-direction: column; }

/* --- Decorative elements --- */
.section-divider {
    text-align: center;
    margin: 2rem 0;
    color: #c4b89a;
    font-size: 1.2rem;
    letter-spacing: 0.5em;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.6rem 1rem;
    }
    .nav-links {
        gap: 1rem;
    }
    .container {
        padding: 0 1rem;
    }
    .grid-2col {
        grid-template-columns: 1fr;
    }
    .hero-title {
        font-size: 1.8rem;
    }
    .hero-subtitle {
        font-size: 1rem;
    }
    .detail-title {
        font-size: 1.4rem;
    }
    .pagination {
        flex-wrap: wrap;
    }
}
