/* ============================================================
   BLOG - Main Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,600;0,700;1,400&family=Source+Sans+3:wght@300;400;600;700&display=swap');

:root {
    --color-bg: #faf9f7;
    --color-surface: #ffffff;
    --color-text: #2c2c2c;
    --color-text-light: #6b6b6b;
    --color-text-muted: #999999;
    --color-primary: #b8540c;
    --color-primary-dark: #933f05;
    --color-primary-light: #f5e6d8;
    --color-accent: #1a6b4e;
    --color-border: #e5e2de;
    --color-border-light: #f0ede8;
    --color-error: #c53030;
    --color-error-bg: #fff5f5;
    --color-success: #276749;
    --color-success-bg: #f0fff4;
    --color-warning-bg: #fffff0;
    --color-code-bg: #f7f5f2;
    --font-heading: 'Crimson Pro', Georgia, serif;
    --font-body: 'Source Sans 3', -apple-system, sans-serif;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
    --radius: 6px;
    --max-width: 1100px;
    --content-width: 750px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--color-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-primary-dark); }
img { max-width: 100%; height: auto; display: block; }

/* ---- Layout ---- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1.25rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95);
}
.header-inner { display: flex; justify-content: space-between; align-items: center; }
.site-title { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 700; }
.site-title a { color: var(--color-text); }
.site-title a:hover { color: var(--color-primary); }
.site-description { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 0.15rem; }

.nav-menu { list-style: none; display: flex; gap: 1.5rem; }
.nav-menu a { font-weight: 600; font-size: 0.9rem; color: var(--color-text-light); letter-spacing: 0.02em; }
.nav-menu a:hover { color: var(--color-primary); }

.nav-toggle {
    display: none; background: none; border: none; cursor: pointer;
    width: 28px; height: 20px; position: relative;
}
.nav-toggle span {
    display: block; width: 100%; height: 2px; background: var(--color-text);
    position: absolute; left: 0; transition: 0.3s;
}
.nav-toggle span:nth-child(1) { top: 0; }
.nav-toggle span:nth-child(2) { top: 9px; }
.nav-toggle span:nth-child(3) { top: 18px; }

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-menu { display: none; flex-direction: column; position: absolute; top: 100%; right: 1.5rem;
        background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
        padding: 1rem; box-shadow: var(--shadow-md); gap: 0.75rem; }
    .main-nav.open .nav-menu { display: flex; }
    .header-inner { flex-wrap: wrap; }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.site-main { padding: 2.5rem 0; min-height: calc(100vh - 200px); }

/* ---- Search ---- */
.search-bar { margin-bottom: 2rem; }
.search-bar form { display: flex; gap: 0.5rem; max-width: 500px; }
.search-bar input {
    flex: 1; padding: 0.6rem 1rem; border: 1px solid var(--color-border);
    border-radius: var(--radius); font-size: 0.95rem; font-family: var(--font-body);
    background: var(--color-surface);
}
.search-bar input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
.search-bar button {
    padding: 0.6rem 1.25rem; background: var(--color-primary); color: white;
    border: none; border-radius: var(--radius); font-weight: 600; cursor: pointer;
    transition: background 0.2s;
}
.search-bar button:hover { background: var(--color-primary-dark); }

.search-results-header { margin-bottom: 1.5rem; }
.search-results-header h2 { font-family: var(--font-heading); font-size: 1.4rem; }
.search-results-header p { color: var(--color-text-muted); font-size: 0.9rem; }

/* ---- Post Cards ---- */
.posts-list { display: flex; flex-direction: column; gap: 1.75rem; }

.post-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.25s, transform 0.25s;
}
.post-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.post-image { aspect-ratio: 21/9; overflow: hidden; }
.post-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.post-card:hover .post-image img { transform: scale(1.03); }

.post-card-body { padding: 1.5rem; }
.post-title { font-family: var(--font-heading); font-size: 1.5rem; line-height: 1.3; margin-bottom: 0.5rem; }
.post-title a { color: var(--color-text); }
.post-title a:hover { color: var(--color-primary); }

.post-meta {
    display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.82rem;
    color: var(--color-text-muted); margin-bottom: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.post-excerpt { color: var(--color-text-light); margin-bottom: 1rem; font-size: 0.95rem; }
.read-more {
    font-weight: 600; font-size: 0.9rem; color: var(--color-primary);
    letter-spacing: 0.02em;
}
.read-more:hover { color: var(--color-primary-dark); }

/* ---- Single Post ---- */
.single-post { max-width: var(--content-width); margin: 0 auto; }
.post-hero { margin: -2.5rem -1.5rem 2rem; border-radius: 0; overflow: hidden; aspect-ratio: 21/9; }
.post-hero img { width: 100%; height: 100%; object-fit: cover; }

.post-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--color-border-light); }
.post-header h1 { font-family: var(--font-heading); font-size: 2.4rem; line-height: 1.2; margin-bottom: 0.75rem; }
.post-categories { margin-top: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.category-badge {
    font-size: 0.78rem; background: var(--color-primary-light); color: var(--color-primary-dark);
    padding: 0.2rem 0.7rem; border-radius: 50px; font-weight: 600;
}
.category-badge:hover { background: var(--color-primary); color: white; }

.post-content {
    font-size: 1.08rem; line-height: 1.85;
}
.post-content p { margin-bottom: 1.4rem; }
.post-content h2 { font-family: var(--font-heading); font-size: 1.7rem; margin: 2.5rem 0 1rem; }
.post-content h3 { font-family: var(--font-heading); font-size: 1.35rem; margin: 2rem 0 0.75rem; }
.post-content blockquote {
    border-left: 3px solid var(--color-primary); padding: 1rem 1.5rem;
    margin: 1.5rem 0; background: var(--color-primary-light); border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic; color: var(--color-text-light);
}
.post-content pre {
    background: var(--color-code-bg); padding: 1.25rem; border-radius: var(--radius);
    overflow-x: auto; font-size: 0.9rem; margin: 1.5rem 0; border: 1px solid var(--color-border-light);
}
.post-content code { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.88em; }
.post-content img { border-radius: var(--radius); margin: 1.5rem 0; }
.post-content ul, .post-content ol { padding-left: 1.5rem; margin-bottom: 1.4rem; }
.post-content li { margin-bottom: 0.4rem; }
.post-content a { text-decoration: underline; text-underline-offset: 2px; }

.post-footer {
    margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--color-border-light);
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
}
.post-share { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.post-share a { font-weight: 600; }
.back-link { font-weight: 600; font-size: 0.9rem; }

/* ---- Comments ---- */
.comments-section { max-width: var(--content-width); margin: 3rem auto 0; }
.comments-section h3 { font-family: var(--font-heading); font-size: 1.5rem; margin-bottom: 1.5rem; }

.comments-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.comment {
    background: var(--color-surface); border: 1px solid var(--color-border-light);
    padding: 1.25rem; border-radius: var(--radius);
}
.comment-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; flex-wrap: wrap; }
.comment-author { font-size: 0.95rem; }
.comment-date { font-size: 0.8rem; color: var(--color-text-muted); }
.comment-body { font-size: 0.95rem; color: var(--color-text-light); }

.comment-form-wrapper { margin-top: 2rem; }
.comment-form-wrapper h4 { font-family: var(--font-heading); font-size: 1.25rem; margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.no-comments { color: var(--color-text-muted); font-style: italic; }

/* ---- CAPTCHA ---- */
.captcha-group {
    background: var(--color-code-bg);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
}
.captcha-group label {
    font-size: 0.95rem;
}
.captcha-input {
    max-width: 140px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* ---- Category Page ---- */
.category-header { margin-bottom: 2rem; }
.category-header h2 { font-family: var(--font-heading); font-size: 1.8rem; }
.category-header .post-count { color: var(--color-text-muted); font-size: 0.9rem; }

/* ---- Pagination ---- */
.pagination { display: flex; justify-content: center; gap: 0.4rem; margin-top: 2.5rem; flex-wrap: wrap; }
.page-link {
    padding: 0.5rem 0.85rem; border: 1px solid var(--color-border);
    border-radius: var(--radius); font-size: 0.9rem; font-weight: 600;
    color: var(--color-text-light); background: var(--color-surface);
    transition: all 0.2s;
}
.page-link:hover { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary); }
.page-link.current { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--color-text-muted); }

/* ============================================================
   FORMS & BUTTONS
   ============================================================ */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; color: var(--color-text); }
.form-group small { color: var(--color-text-muted); font-weight: 400; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="search"],
.form-group textarea,
.form-group select {
    width: 100%; padding: 0.65rem 0.9rem; border: 1px solid var(--color-border);
    border-radius: var(--radius); font-size: 0.95rem; font-family: var(--font-body);
    background: var(--color-surface); transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; margin-bottom: 0.4rem; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.55rem 1.25rem; border: none; border-radius: var(--radius);
    font-size: 0.9rem; font-weight: 600; font-family: var(--font-body);
    cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-dark); color: white; }
.btn-secondary { background: var(--color-border); color: var(--color-text); }
.btn-secondary:hover { background: var(--color-text-muted); color: white; }
.btn-large { padding: 0.75rem 2rem; font-size: 1rem; }
.btn-small { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-success { background: var(--color-success); color: white; }
.btn-warning { background: #c69026; color: white; }
.btn-danger { background: var(--color-error); color: white; }

/* ---- Alerts ---- */
.alert {
    padding: 0.9rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.5rem;
    font-size: 0.95rem; border-left: 4px solid;
}
.alert-error { background: var(--color-error-bg); border-color: var(--color-error); color: var(--color-error); }
.alert-success { background: var(--color-success-bg); border-color: var(--color-success); color: var(--color-success); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    padding: 2rem 0; text-align: center; font-size: 0.85rem;
    color: var(--color-text-muted); border-top: 1px solid var(--color-border-light);
    margin-top: 2rem;
}

/* ============================================================
   INSTALL PAGE
   ============================================================ */
.install-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; }
.install-container { width: 100%; max-width: 550px; }
.install-header { text-align: center; margin-bottom: 2rem; }
.install-header h1 { font-family: var(--font-heading); font-size: 2rem; }
.install-header p { color: var(--color-text-muted); }
.install-form fieldset { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.install-form legend { font-weight: 700; padding: 0 0.5rem; font-size: 0.95rem; }
.install-links { display: flex; gap: 1rem; margin-top: 1rem; justify-content: center; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.admin-login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; }
.login-container {
    width: 100%; max-width: 400px; background: var(--color-surface);
    padding: 2.5rem; border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header h1 { font-family: var(--font-heading); font-size: 1.8rem; }
.login-footer { text-align: center; margin-top: 1.5rem; font-size: 0.85rem; }
