:root {
    --primary: #3e3e3e;
    --accent: #ff4848;
    --accent-dark: #e63636;
    --accent-light: #ff6b6b;
    --accent-bg: #fff0f0;
    --text: #575757;
    --text-light: #888888;
    --bg: #ffffff;
    --bg-alt: #f8f8f8;
    --border: #bfbfbf;
    --border-light: #e5e5e5;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.08);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    max-width: 740px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    transition: box-shadow 0.3s;
}

.navbar.scrolled { box-shadow: var(--shadow); }

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.logo { text-decoration: none; }

.logo-img {
    height: 28px;
    width: auto;
    display: block;
}

.logo-text {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.03em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-links a:hover { color: var(--accent); }

.mobile-menu {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu span {
    width: 22px;
    height: 2px;
    background: var(--primary);
    transition: all 0.3s;
}

/* ===== HERO ===== */
.hero-blog {
    padding: 140px 0 60px;
    text-align: center;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border-light);
}

.hero-blog h1 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.hero-blog p {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

.hero-tag .section-tag,
.hero-author .section-tag {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 12px;
}

.author-hero-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
}

/* ===== TAGS BAR ===== */
.tags-bar {
    padding: 24px 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
}

.tags-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-pill {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-alt);
    border: 1px solid var(--border-light);
    text-decoration: none;
    transition: all 0.2s;
}

.tag-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tag-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ===== SECTIONS ===== */
.section {
    padding: 80px 0;
}

/* ===== POST GRID ===== */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-bottom: 48px;
}

.post-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.post-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all 0.3s;
}

.post-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.post-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.post-card-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-alt);
}

.post-card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border);
}

.post-card-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-tag {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 8px;
}

.post-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
    margin-bottom: 8px;
}

.post-card-excerpt {
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 16px;
    flex: 1;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-light);
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.post-card-author { font-weight: 600; color: var(--primary); }

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pagination .page-number {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ===== SINGLE POST ===== */
.post-header {
    padding: 140px 0 40px;
    text-align: center;
}

.post-tag-link {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 16px;
    transition: color 0.2s;
}

.post-tag-link:hover { color: var(--accent-dark); }

.post-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 16px;
}

.post-excerpt {
    font-size: 1.15rem;
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 24px;
}

.post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.post-author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.post-meta-info {
    text-align: left;
}

.post-author-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.post-meta-date {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ===== FEATURE IMAGE ===== */
.post-feature-image {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 24px;
}

.post-feature-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
}

.post-feature-image figcaption {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-light);
    margin-top: 12px;
}

/* ===== POST CONTENT ===== */
.post-content {
    padding: 40px 0 60px;
}

.post-content h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    margin: 48px 0 16px;
    letter-spacing: -0.02em;
}

.post-content h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin: 36px 0 12px;
}

.post-content h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 28px 0 8px;
}

.post-content p {
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 24px;
}

.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-content a:hover { color: var(--accent-dark); }

.post-content ul,
.post-content ol {
    margin: 0 0 24px 24px;
    font-size: 1.05rem;
    line-height: 1.8;
}

.post-content li { margin-bottom: 8px; }

.post-content blockquote {
    border-left: 4px solid var(--accent);
    padding: 16px 24px;
    margin: 32px 0;
    background: var(--bg-alt);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--text);
}

.post-content pre {
    background: var(--primary);
    color: #e0e0e0;
    padding: 24px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 32px 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.post-content code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.88em;
}

.post-content p code {
    background: var(--bg-alt);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent);
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 24px 0;
}

.post-content figure {
    margin: 32px 0;
}

.post-content figcaption {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-light);
    margin-top: 8px;
}

.post-content hr {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 48px 0;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    font-size: 0.95rem;
}

.post-content th,
.post-content td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.post-content th {
    font-weight: 700;
    color: var(--primary);
    background: var(--bg-alt);
}

/* ===== POST FOOTER ===== */
.post-footer {
    padding: 32px 0;
    border-top: 1px solid var(--border-light);
}

.post-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.post-share {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
}

.post-share span { color: var(--text-light); }

.post-share a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.post-share a:hover { color: var(--accent-dark); }

/* ===== COMMENTS ===== */
.post-comments {
    padding: 48px 0;
    background: var(--bg-alt);
}

.post-comments h3 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 24px;
}

/* ===== RELATED POSTS ===== */
.related-posts {
    background: var(--bg-alt);
    border-top: 1px solid var(--border-light);
}

.related-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 32px;
}

/* ===== ERROR PAGE ===== */
.error-page {
    padding: 200px 0 120px;
    text-align: center;
}

.error-code {
    font-size: 6rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 16px;
}

.error-message {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 32px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 72, 72, 0.3);
}

/* ===== FOOTER ===== */
.footer {
    background: var(--primary);
    color: rgba(255,255,255,0.6);
    padding: 64px 0 32px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand .logo-text {
    font-size: 1.4rem;
    color: white;
}

.footer-brand p {
    margin-top: 12px;
    font-size: 0.85rem;
    line-height: 1.6;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-col h4 {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.footer-col a,
.footer-col span {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-col a:hover { color: var(--accent); }

.footer-certs {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 24px;
}

.footer-certs span {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.04em;
}

.footer-bottom {
    text-align: center;
    font-size: 0.78rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .post-grid { grid-template-columns: 1fr 1fr; }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 24px;
        gap: 16px;
        border-bottom: 1px solid var(--border-light);
        box-shadow: var(--shadow-lg);
    }

    .nav-links.open { display: flex; }
    .mobile-menu { display: flex; }

    .hero-blog { padding: 120px 0 40px; }
    .post-header { padding: 120px 0 32px; }

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

    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .footer-certs { flex-wrap: wrap; }

    .post-content h2 { font-size: 1.3rem; }
    .post-content p { font-size: 1rem; }
}

/* ===== KOENIG EDITOR CARDS ===== */
.kg-width-wide {
    max-width: 1040px;
    margin-left: auto;
    margin-right: auto;
}

.kg-width-full {
    max-width: none;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
}

.kg-width-wide img,
.kg-width-full img {
    width: 100%;
}

.kg-image-card,
.kg-gallery-card {
    margin: 2em 0;
}

.kg-image-card img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.kg-image-card figcaption,
.kg-gallery-card figcaption {
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.75em;
}

.kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.75em;
}

.kg-gallery-row {
    display: flex;
    gap: 0.75em;
}

.kg-gallery-row img {
    display: block;
    flex: 1;
    height: auto;
    border-radius: var(--radius);
}

.kg-bookmark-card {
    margin: 2em 0;
}

.kg-bookmark-container {
    display: flex;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.kg-bookmark-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.kg-bookmark-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary);
}

.kg-bookmark-description {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.5em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-top: auto;
    padding-top: 1em;
    font-size: 0.8rem;
    color: var(--text-light);
}

.kg-bookmark-icon {
    width: 20px;
    height: 20px;
}

.kg-bookmark-thumbnail {
    flex-shrink: 0;
    width: 200px;
}

.kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kg-embed-card {
    margin: 2em 0;
    display: flex;
    justify-content: center;
}

.kg-embed-card iframe {
    max-width: 100%;
}

.kg-callout-card {
    margin: 2em 0;
    padding: 20px;
    border-radius: var(--radius);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.kg-callout-emoji {
    font-size: 1.2em;
}

.kg-callout-text {
    flex: 1;
}

.kg-toggle-card {
    margin: 2em 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
}

.kg-toggle-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
}

.kg-toggle-content {
    margin-top: 1em;
}

.kg-button-card {
    margin: 2em 0;
    text-align: center;
}

.kg-btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
}

.kg-btn:hover {
    background: var(--accent-dark);
}
