:root {
    --red: #b71c1c;
    --red-dark: #8e1414;
    --red-soft: #f6dede;
    --grey-900: #1f1f1f;
    --grey-800: #333333;
    --grey-700: #4f4f4f;
    --grey-500: #8a8a8a;
    --grey-300: #d9d9d9;
    --grey-200: #ececec;
    --grey-100: #f7f7f7;
    --white: #ffffff;
    --shadow: 0 14px 40px rgba(0, 0, 0, 0.08);
    --radius: 18px;
    --radius-sm: 12px;
    --container: 1200px;
    --container-narrow: 820px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--grey-900);
    background: linear-gradient(180deg, #ffffff 0%, #f4f4f4 100%);
    line-height: 1.6;
}

a {
    color: var(--red);
    text-decoration: none;
}

a:hover {
    color: var(--red-dark);
}

img {
    max-width: 100%;
    display: block;
}

main {
    min-height: calc(100vh - 170px);
}

.container {
    width: min(calc(100% - 2rem), var(--container));
    margin: 0 auto;
}

.narrow {
    width: min(calc(100% - 2rem), var(--container-narrow));
    margin: 0 auto;
}

.narrow-wide {
    width: min(calc(100% - 2rem), 980px);
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--grey-200);
}

.header-inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.logo-wrap {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: inherit;
}

.logo-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--red), var(--grey-700));
    color: var(--white);
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
}


.site-logo-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 16px;
    background: var(--grey-100);
    border: 1px solid var(--grey-200);
}

.site-name {
    font-weight: 700;
    font-size: 1.05rem;
}

.site-tagline {
    color: var(--grey-700);
    font-size: 0.92rem;
}

.main-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.main-nav a {
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    color: var(--grey-800);
    font-weight: 600;
}

.main-nav a.active,
.main-nav a:hover {
    background: var(--grey-100);
    color: var(--red);
}

.header-search,
.blog-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-search input,
.blog-search input,
input[type="text"],
input[type="password"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--grey-300);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font: inherit;
    background: var(--white);
    color: var(--grey-900);
}

textarea {
    resize: vertical;
}

button,
.btn {
    border: 0;
    border-radius: 999px;
    padding: 0.85rem 1.15rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary,
.header-search button,
.blog-search button {
    background: var(--red);
    color: var(--white);
}

.btn-primary:hover,
.header-search button:hover,
.blog-search button:hover {
    background: var(--red-dark);
    color: var(--white);
}

.btn-secondary {
    background: var(--grey-200);
    color: var(--grey-900);
}

.btn-secondary:hover {
    background: var(--grey-300);
}

.btn-danger {
    background: #7b1111;
    color: var(--white);
}

.hero-section,
.page-hero {
    padding: 4.5rem 0 3rem;
    background: linear-gradient(135deg, rgba(183, 28, 28, 0.08) 0%, rgba(51, 51, 51, 0.08) 100%);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: 2rem;
    align-items: center;
}

.hero-section h1,
.page-hero h1,
.auth-card h1,
.editor-header h1,
.admin-header h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.08;
    margin: 0.2rem 0 1rem;
}

.eyebrow {
    display: inline-block;
    background: var(--red-soft);
    color: var(--red-dark);
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.hero-card,
.card,
.post-card,
.post-list-item,
.search-result,
.auth-card,
.admin-header,
.subtle-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-card,
.card,
.auth-card,
.editor-form,
.admin-header,
.search-result,
.message-item,
.current-image {
    padding: 1.4rem;
}

.hero-actions,
.editor-actions,
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.section {
    padding: 2.5rem 0 4rem;
}

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

.section-heading h2,
.prose-block h2,
.prose-rendered h2 {
    font-size: 1.8rem;
    margin: 0;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.4rem;
}

.post-card,
.post-list-item {
    overflow: hidden;
}

.post-card-body,
.post-list-content {
    padding: 1.2rem;
}

.post-card-image,
.post-list-image {
    width: 100%;
    height: 230px;
    object-fit: cover;
}

.post-date,
.result-type,
.message-meta,
.mini-count {
    font-size: 0.9rem;
    color: var(--grey-700);
}

.post-list {
    display: grid;
    gap: 1.2rem;
}

.post-list-item {
    display: grid;
    grid-template-columns: 280px 1fr;
}

.single-post-hero {
    min-height: 380px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.single-post-overlay {
    min-height: 380px;
    display: flex;
    align-items: end;
    background: linear-gradient(180deg, rgba(0,0,0,0.15), rgba(0,0,0,0.72));
    color: var(--white);
    padding: 2rem 0;
}

.prose-block,
.prose-rendered {
    font-size: 1.05rem;
}

.prose-block p,
.prose-rendered p,
.prose-rendered ul,
.prose-rendered ol,
.prose-rendered blockquote {
    margin: 0 0 1rem;
}

.prose-rendered h3 {
    font-size: 1.45rem;
    margin: 1.5rem 0 0.8rem;
}

.prose-rendered h4 {
    font-size: 1.2rem;
    margin: 1.2rem 0 0.7rem;
}

.prose-rendered blockquote {
    border-left: 4px solid var(--red);
    padding-left: 1rem;
    color: var(--grey-700);
}

.site-footer {
    border-top: 1px solid var(--grey-200);
    background: var(--white);
    padding: 1.2rem 0;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.alert {
    padding: 0.95rem 1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
    font-weight: 600;
}

.alert-success {
    background: #e6f6ea;
    color: #14532d;
}

.alert-error {
    background: #fde8e8;
    color: #8a1212;
}

.empty-state {
    padding: 1.2rem;
    background: var(--grey-100);
    border: 1px dashed var(--grey-300);
    border-radius: 16px;
}

.text-link {
    font-weight: 700;
}

.auth-section {
    padding-top: 4rem;
}

.auth-card {
    max-width: 560px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.45rem;
    font-weight: 700;
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.editor-toolbar button {
    background: var(--grey-100);
    color: var(--grey-900);
    border: 1px solid var(--grey-300);
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
}

.editor-toolbar button:hover {
    background: var(--grey-200);
}

.rich-editor {
    min-height: 320px;
    border: 1px solid var(--grey-300);
    border-radius: 16px;
    padding: 1rem;
    background: var(--white);
}

.rich-editor:focus {
    outline: 3px solid rgba(183, 28, 28, 0.15);
    border-color: var(--red);
}

.hidden-textarea {
    display: none;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.2rem;
    margin-top: 1rem;
}

.table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid var(--grey-200);
    text-align: left;
}

.status-badge {
    display: inline-flex;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.status-badge.published {
    background: #e6f6ea;
    color: #166534;
}

.status-badge.draft {
    background: var(--grey-100);
    color: var(--grey-700);
}

.message-list {
    display: grid;
    gap: 1rem;
}

.message-item {
    border: 1px solid var(--grey-200);
    border-radius: 16px;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.7rem;
}

.current-hero-preview {
    border-radius: 14px;
    margin: 0.75rem 0;
    max-height: 240px;
    object-fit: cover;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.search-result-list {
    display: grid;
    gap: 1rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1024px) {
    .header-inner {
        grid-template-columns: 1fr;
    }

    .main-nav {
        justify-content: start;
    }

    .hero-grid,
    .admin-grid,
    .post-grid,
    .post-list-item {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .site-header {
        position: static;
        top: auto;
    }

    .hero-section,
    .page-hero {
        padding-top: 3rem;
    }

    .post-grid {
        grid-template-columns: 1fr;
    }

    .header-search,
    .blog-search,
    .editor-header,
    .section-heading,
    .footer-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .single-post-hero,
    .single-post-overlay {
        min-height: 280px;
    }
}
