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

html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: #333;
    background: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #c0392b;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

/* === Container === */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === Header === */
.site-header {
    background: #fff;
    border-bottom: 3px solid #c0392b;
    padding: 15px 0;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: #c0392b;
    letter-spacing: -1px;
}

.logo:hover {
    text-decoration: none;
    color: #a93226;
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.main-nav a {
    display: block;
    padding: 6px 14px;
    color: #555;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.main-nav a:hover {
    background: #f0f0f0;
    text-decoration: none;
    color: #c0392b;
}

.main-nav .count {
    font-size: 0.75rem;
    color: #999;
}

/* === Main === */
.site-main {
    flex: 1;
    padding: 30px 0;
}

/* === Hero === */
.hero {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.hero h1 {
    font-size: 2rem;
    color: #222;
    margin-bottom: 8px;
}

.hero-sub {
    font-size: 1.1rem;
    color: #777;
}

/* === Post Cards === */
.posts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.post-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
}

.post-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.post-card__image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.post-card__body {
    padding: 20px;
}

.post-card__category a {
    display: inline-block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #c0392b;
    font-weight: 600;
    margin-bottom: 8px;
}

.post-card__title {
    font-size: 1.15rem;
    margin-bottom: 8px;
    line-height: 1.3;
}

.post-card__title a {
    color: #222;
}

.post-card__title a:hover {
    color: #c0392b;
    text-decoration: none;
}

.post-card__lead {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card__meta {
    font-size: 0.8rem;
    color: #999;
}

/* === See All Link === */
.see-all {
    text-align: right;
    margin-bottom: 30px;
}

/* === List Toolbar === */
.list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    background: #fff;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 15px;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-form label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
}

.filter-form select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.85rem;
    font-family: inherit;
}

.list-toolbar__sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-label {
    font-size: 0.85rem;
    color: #555;
    font-weight: 600;
}

.sort-link {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #555;
    background: #f0f0f0;
    transition: all 0.2s;
}

.sort-link:hover {
    background: #e0e0e0;
    text-decoration: none;
}

.sort-link--active {
    background: #c0392b;
    color: #fff;
}

.sort-link--active:hover {
    background: #a93226;
    color: #fff;
}

.list-info {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 15px;
}

.page-title__filter {
    font-size: 1rem;
    font-weight: 400;
    color: #777;
}

/* === Post Rows (List View) === */
.posts-list-rows {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.post-row {
    display: flex;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
}

.post-row:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.post-row__image {
    flex-shrink: 0;
    width: 200px;
}

.post-row__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.post-row__body {
    flex: 1;
    padding: 18px 22px;
}

.post-row__title {
    font-size: 1.1rem;
    margin-bottom: 6px;
    line-height: 1.3;
}

.post-row__title a {
    color: #222;
}

.post-row__title a:hover {
    color: #c0392b;
    text-decoration: none;
}

.post-row__lead {
    font-size: 0.88rem;
    color: #666;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 30px 0;
}

.pagination__link {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #555;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.2s;
}

.pagination__link:hover {
    background: #f0f0f0;
    text-decoration: none;
}

.pagination__link--active {
    background: #c0392b;
    color: #fff;
}

/* === Post Detail === */
.post-detail {
    background: #fff;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.post-detail__category a {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #c0392b;
    font-weight: 600;
}

.post-detail__title {
    font-size: 2rem;
    margin: 12px 0;
    line-height: 1.2;
}

.post-detail__meta {
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.post-detail__lead {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 25px;
    border-left: 3px solid #c0392b;
    padding-left: 15px;
}

.post-detail__image {
    margin-bottom: 25px;
    text-align: center;
}

.post-detail__image img {
    max-width: 728px;
    border-radius: 6px;
}

.post-detail__image[data-source]::after {
    content: attr(data-source);
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #999;
}

.post-detail__content {
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 30px;
}

.post-detail__content h2 {
    font-size: 1.4rem;
    margin: 25px 0 12px;
    color: #333;
}

.post-detail__content p {
    margin-bottom: 15px;
}

.post-detail__link {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.back-link {
    margin-top: 10px;
}

.back-link a {
    color: #777;
    font-size: 0.9rem;
}

/* === Page Title === */
.page-title {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #222;
}

.page-subtitle {
    color: #777;
    margin-bottom: 25px;
}

/* === CTA Section === */
.cta-section {
    margin-top: 20px;
}

.cta-box {
    background: #fff;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cta-box h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.cta-box p {
    color: #777;
    margin-bottom: 20px;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: #c0392b;
    color: #fff;
}

.btn-primary:hover {
    background: #a93226;
    color: #fff;
}

.btn-secondary {
    background: #ecf0f1;
    color: #333;
}

.btn-secondary:hover {
    background: #dce0e1;
}

/* === Forms === */
.form {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    max-width: 700px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #444;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #c0392b;
}

.form-group.has-error input,
.form-group.has-error textarea {
    border-color: #e74c3c;
}

.form-error {
    display: block;
    color: #e74c3c;
    font-size: 0.8rem;
    margin-top: 4px;
}

.form-actions {
    margin-top: 25px;
}

/* === Thanks Page === */
.thanks-page {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.thanks-page p {
    color: #666;
    margin-bottom: 8px;
}

.thanks-actions {
    margin-top: 25px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* === Error Page === */
.error-page {
    text-align: center;
    padding: 80px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.error-page__code {
    font-size: 6rem;
    font-weight: 800;
    color: #c0392b;
    line-height: 1;
    margin-bottom: 10px;
}

.error-page__title {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 12px;
}

.error-page__text {
    color: #777;
    max-width: 480px;
    margin: 0 auto 30px;
    line-height: 1.6;
}

/* === See Also === */
.see-also {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.see-also__title {
    font-size: 1.3rem;
    color: #555;
    margin-bottom: 20px;
}

.see-also__posts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    color: #999;
    padding: 40px;
    grid-column: 1 / -1;
}

/* === Footer === */
.site-footer {
    background: #2c3e50;
    color: #95a5a6;
    padding: 20px 0;
    text-align: center;
    font-size: 0.85rem;
}

.footer-links {
    margin-bottom: 10px;
}

.footer-links a {
    color: #bdc3c7;
    margin: 0 10px;
}

.footer-links a:hover {
    color: #fff;
}

/* === Responsive === */
@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        text-align: center;
    }

    .main-nav ul {
        justify-content: center;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .posts-list {
        grid-template-columns: 1fr;
    }

    .post-detail {
        padding: 20px;
    }

    .post-detail__title {
        font-size: 1.5rem;
    }

    .form {
        padding: 20px;
    }

    .list-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .post-row {
        flex-direction: column;
    }

    .post-row__image {
        width: 100%;
        height: 180px;
    }
}
