/* ========== CSS VARIABLES ========== */
:root {
    --primary: #1e3a8a;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    
    --font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family);
    color: var(--gray-700);
    line-height: 1.6;
    background: var(--white);
}

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

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

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

ul, ol {
    list-style: none;
}

/* ========== LAYOUT ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.content-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.35);
    color: var(--white);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-900);
}

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

.btn-white:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.btn-outline-light {
    background: transparent;
    color: var(--white);
    border: 2px solid rgba(255,255,255,0.5);
}

.btn-outline-light:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--white);
    color: var(--white);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* ========== HEADER ========== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gray-200);
}

.site-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.site-logo img {
    height: 40px;
    width: auto;
}

.site-nav {
    display: flex;
    gap: 2rem;
}

.site-nav a {
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a.nav-current {
    color: var(--primary);
}

.nav-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--gray-700);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
}

.mobile-menu-toggle .icon-close {
    display: none;
}

.mobile-menu-toggle.active .icon-menu {
    display: none;
}

.mobile-menu-toggle.active .icon-close {
    display: block;
}

/* Mobile Menu */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    background: var(--white);
    z-index: 999;
    padding: 5rem 1.5rem 2rem;
    transform: translateX(100%);
    transition: transform 0.3s;
    overflow-y: auto;
}

.mobile-menu.open {
    transform: translateX(0);
}

.mobile-menu-links {
    margin-bottom: 2rem;
}

.mobile-menu-links li {
    border-bottom: 1px solid var(--gray-200);
}

.mobile-menu-links a {
    display: block;
    padding: 1rem 0;
    color: var(--gray-700);
    font-weight: 500;
    font-size: 1.0625rem;
}

.mobile-menu-links a:hover,
.mobile-menu-links a.nav-current {
    color: var(--primary);
}

.mobile-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-menu-buttons .btn {
    width: 100%;
}

@media (max-width: 768px) {
    .site-nav,
    .nav-buttons {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .mobile-menu {
        display: block;
    }
}

/* ========== PAGE HEADER ========== */
.page-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 4rem 0;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--white);
}

.page-header h1 span {
    color: rgba(255,255,255,0.8);
}

.page-header p {
    font-size: 1.125rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.section-label {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    color: var(--white);
    padding: 0.375rem 1rem;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.author-header .author-profile-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    border: 4px solid rgba(255,255,255,0.3);
}

/* ========== POST GRID ========== */
.post-feed {
    padding: 4rem 0;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.post-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

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

.post-card.featured {
    grid-column: span 2;
}

.post-card-image {
    display: block;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.post-card-content {
    padding: 1.5rem;
}

.post-card-tag {
    display: inline-block;
    background: var(--primary-100);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.post-card-tag:hover {
    background: var(--primary);
    color: var(--white);
}

.post-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.post-card-title a {
    color: var(--gray-900);
}

.post-card-title a:hover {
    color: var(--primary);
}

.post-card-excerpt {
    color: var(--gray-600);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.post-card-author-image {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.pagination a {
    color: var(--primary);
    font-weight: 500;
}

.page-number {
    color: var(--gray-500);
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .post-card.featured {
        grid-column: span 1;
    }
}

/* ========== SINGLE POST ========== */
.post-full {
    padding: 3rem 0;
}

.post-full-header {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
}

.post-full-tag {
    display: inline-block;
    background: var(--primary-100);
    color: var(--primary);
    padding: 0.375rem 1rem;
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.post-full-tag:hover {
    background: var(--primary);
    color: var(--white);
}

.post-full-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
}

.post-full-excerpt {
    font-size: 1.25rem;
    color: var(--gray-600);
    margin-bottom: 1.5rem;
}

.post-full-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--gray-500);
    font-size: 0.9375rem;
}

.post-full-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-full-author-image {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.post-full-author-name {
    color: var(--gray-700);
    font-weight: 500;
}

.post-full-author-name:hover {
    color: var(--primary);
}

.post-full-image {
    max-width: 1000px;
    margin: 0 auto 3rem;
}

.post-full-image img {
    width: 100%;
    border-radius: var(--radius);
}

.post-full-image figcaption {
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-top: 0.75rem;
}

/* Post Content */
.post-content {
    font-size: 1.0625rem;
    line-height: 1.8;
}

.post-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    color: var(--gray-900);
}

.post-content h3 {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
    color: var(--gray-900);
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.post-content ul {
    list-style: disc;
}

.post-content ol {
    list-style: decimal;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--gray-600);
}

.post-content pre {
    background: var(--gray-900);
    color: var(--gray-100);
    padding: 1.5rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.post-content code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.9em;
}

.post-content a {
    color: var(--primary);
    text-decoration: underline;
}

.post-content img {
    border-radius: var(--radius);
    margin: 2rem 0;
}

.post-content hr {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 3rem 0;
}

/* Tags */
.post-tags {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.tag-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Author Box */
.author-box {
    display: flex;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-top: 3rem;
}

.author-box-image img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.author-box-content h4 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.author-box-content p {
    color: var(--gray-600);
    font-size: 0.9375rem;
}

@media (max-width: 768px) {
    .post-full-title {
        font-size: 1.875rem;
    }
    
    .author-box {
        flex-direction: column;
        text-align: center;
    }
    
    .author-box-image img {
        margin: 0 auto;
    }
}

/* ========== CTA SECTION ========== */
.cta-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 4rem 0;
    text-align: center;
}

.cta-section h2 {
    color: var(--white);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-section p {
    opacity: 0.9;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ========== FOOTER ========== */
.site-footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: 3rem 0 1.5rem;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

.footer-brand {
    flex: 0 1 300px;
}

.footer-logo {
    display: block;
    margin-bottom: 1rem;
}

.footer-logo img {
    height: 32px;
    width: auto;
}

.footer-desc {
    font-size: 0.9375rem;
    line-height: 1.6;
}

.footer-nav {
    flex: 0 1 auto;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: var(--gray-400);
    font-size: 0.9375rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-subscribe {
    flex: 0 1 250px;
    text-align: right;
}

.footer-subscribe p {
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.footer-bottom {
    border-top: 1px solid var(--gray-800);
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-copyright {
    font-size: 0.875rem;
}

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

.footer-social a {
    color: var(--gray-400);
    transition: color 0.2s;
}

.footer-social a:hover {
    color: var(--white);
}

.footer-social svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    .footer-inner {
        flex-direction: column;
        gap: 2rem;
    }
    
    .footer-brand,
    .footer-subscribe {
        text-align: left;
    }
    
    .footer-links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* ========== ERROR PAGE ========== */
.error-page {
    padding: 6rem 0;
    text-align: center;
}

.error-page h1 {
    font-size: 6rem;
    font-weight: 800;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.error-page p {
    font-size: 1.25rem;
    color: var(--gray-600);
    margin-bottom: 2rem;
}

/* ========== GHOST CONTENT CARDS ========== */
.kg-card {
    margin: 2rem 0;
}

.kg-image-card img {
    width: 100%;
}

.kg-width-wide {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

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

.kg-bookmark-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.kg-bookmark-container {
    display: flex;
    text-decoration: none;
    color: inherit;
}

.kg-bookmark-content {
    flex: 1;
    padding: 1.25rem;
}

.kg-bookmark-title {
    font-weight: 600;
    color: var(--gray-900);
}

.kg-bookmark-description {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

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

.kg-bookmark-thumbnail {
    flex: 0 0 160px;
}

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

.kg-callout-card {
    padding: 1.25rem;
    border-radius: var(--radius);
    display: flex;
    gap: 1rem;
}

.kg-callout-card-grey {
    background: var(--gray-100);
}

.kg-callout-card-blue {
    background: var(--primary-50);
}

.kg-callout-emoji {
    font-size: 1.25rem;
}

.kg-toggle-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

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

.kg-toggle-content {
    margin-top: 1rem;
    color: var(--gray-600);
}

/* Mobile footer fix */
@media (max-width: 768px) {
    .footer-inner { gap: 1rem !important; }
    .footer-brand, .footer-nav, .footer-subscribe { 
        flex: 1 1 100% !important; 
        margin: 0 !important;
        padding: 0 !important;
    }
    .footer-subscribe { margin-top: 0.5rem !important; }
}

/* Responsive video embeds */
.post-content iframe,
.post-content video,
.post-content embed {
    width: 100%;
    max-width: 100%;
    min-height: 400px;
    aspect-ratio: 16/9;
    border-radius: 8px;
}


/* Author box image fix */
.author-box-image img {
    width: 80px;
    height: 80px;
    min-height: 80px;
    object-fit: cover;
    border-radius: 50%;
}


/* Navigation helper styling */
.site-nav ul, .mobile-menu-links ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}
.site-nav li, .mobile-menu-links li {
    margin: 0;
}
.site-nav a, .mobile-menu-links a {
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
}
.site-nav a:hover, .site-nav .nav-current a,
.mobile-menu-links a:hover, .mobile-menu-links .nav-current a {
    color: var(--primary);
}
.mobile-menu-links ul {
    flex-direction: column;
    gap: 0;
}
.mobile-menu-links li {
    border-bottom: 1px solid var(--gray-200);
}
.mobile-menu-links a {
    display: block;
    padding: 1rem 0;
    color: var(--gray-700);
}


/* Navigation helper styling */
.site-nav ul, .footer-nav ul, .mobile-menu-links ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}
.site-nav li, .footer-nav li { margin: 0; }
.site-nav a {
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
}
.site-nav a:hover, .site-nav .nav-current a { color: var(--primary); }
.footer-nav ul { flex-direction: column; gap: 0.5rem; }
.footer-nav a {
    color: var(--gray-400);
    font-size: 0.9375rem;
    text-decoration: none;
}
.footer-nav a:hover { color: var(--white); }
.mobile-menu-links ul { flex-direction: column; gap: 0; }
.mobile-menu-links li { border-bottom: 1px solid var(--gray-200); }
.mobile-menu-links a {
    display: block;
    padding: 1rem 0;
    color: var(--gray-700);
    font-weight: 500;
    text-decoration: none;
}
.mobile-menu-links a:hover { color: var(--primary); }


/* Author box image fix - prevent cutoff */
.author-box {
    overflow: visible !important;
    padding: 2rem !important;
}
.author-box-image {
    flex-shrink: 0 !important;
    overflow: visible !important;
}
.author-box-image img {
    width: 80px !important;
    height: 80px !important;
    min-width: 80px !important;
    min-height: 80px !important;
    max-height: none !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}

