:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --bg-body: #ffffff;
    --bg-surface: #f8fafc;
    --border: #e2e8f0;
    --radius: 8px;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-sans); color: var(--text-main); background: var(--bg-body); line-height: 1.6; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }

/* Header & Nav */
.site-header { background: #ffffff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.site-brand { font-size: 20px; font-weight: 800; color: var(--text-main); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.site-brand span { color: var(--primary); }

.nav-menu { display: flex; list-style: none; gap: 24px; align-items: center; }
.nav-link { color: var(--text-muted); text-decoration: none; font-size: 15px; font-weight: 500; transition: color 0.15s; }
.nav-link:hover, .nav-link.active { color: var(--primary); }

.lang-switcher { display: flex; gap: 4px; background: var(--bg-surface); padding: 3px; border-radius: 6px; border: 1px solid var(--border); }
.lang-btn { text-decoration: none; padding: 4px 8px; font-size: 12px; font-weight: 700; color: var(--text-muted); border-radius: 4px; transition: all 0.15s; }
.lang-btn:hover { color: var(--text-main); }
.lang-btn.active { background: #ffffff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Hero Section */
.hero-section { padding: 70px 0; background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%); border-bottom: 1px solid var(--border); text-align: center; }
.hero-inner { max-width: 800px; margin: 0 auto; }
.hero-title { font-size: 42px; font-weight: 800; line-height: 1.2; margin-bottom: 16px; color: #0f172a; }
.hero-subtitle { font-size: 18px; color: var(--text-muted); margin-bottom: 28px; }
.btn-cta { display: inline-block; background: var(--primary); color: #ffffff; padding: 12px 28px; border-radius: var(--radius); font-weight: 600; text-decoration: none; transition: background 0.15s; }
.btn-cta:hover { background: var(--primary-hover); }

/* Page Header */
.page-header { padding: 40px 0; background: var(--bg-surface); border-bottom: 1px solid var(--border); margin-bottom: 30px; }
.page-title { font-size: 32px; font-weight: 800; color: #0f172a; }
.page-description { font-size: 16px; color: var(--text-muted); margin-top: 8px; }

/* Page Content & Blocks */
.page-content { padding: 30px 0 60px 0; }
.prose { font-size: 16px; color: #334155; line-height: 1.7; }
.block-header { margin: 32px 0 16px 0; font-weight: 700; color: #0f172a; }
.block-h1 { font-size: 32px; }
.block-h2 { font-size: 26px; border-bottom: 2px solid var(--primary-light); padding-bottom: 8px; }
.block-h3 { font-size: 20px; }
.block-paragraph { margin-bottom: 18px; }
.block-list { margin: 16px 0 20px 24px; }
.block-list li { margin-bottom: 6px; }
.block-quote { border-left: 4px solid var(--primary); padding: 14px 20px; background: var(--bg-surface); margin: 24px 0; border-radius: 0 var(--radius) var(--radius) 0; font-style: italic; }
.block-quote cite { display: block; margin-top: 8px; font-size: 13px; font-style: normal; color: var(--text-muted); font-weight: 600; }
.block-image { margin: 30px 0; text-align: center; }
.block-image img { max-width: 100%; border-radius: var(--radius); height: auto; }

/* Cards Grid & Collections */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; margin: 24px 0 40px 0; }
.card { background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,0.06); }
.card-body { padding: 22px; display: flex; flex-direction: column; flex-grow: 1; }
.card-top-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; font-size: 12px; }
.card-date { color: var(--text-muted); font-weight: 500; }
.card-title { font-size: 19px; font-weight: 700; margin-bottom: 8px; line-height: 1.35; }
.card-title a { color: #0f172a; text-decoration: none; transition: color 0.15s; }
.card-title a:hover { color: var(--primary); }
.card-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5; flex-grow: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; margin-top: auto; }
.card-author { color: var(--text-muted); font-weight: 500; }
.read-more { font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; }
.read-more:hover { text-decoration: underline; }

/* Interactive Collection Controls */
.collection-interactive-section { margin-top: 24px; }
.collection-controls { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.collection-controls-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.search-box { position: relative; flex-grow: 1; max-width: 420px; min-width: 240px; }
.search-box input { width: 100%; height: 42px; padding: 8px 36px 8px 38px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; font-family: inherit; background: #ffffff; color: var(--text-main); outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.search-icon { position: absolute; left: 12px; top: 12px; color: var(--text-muted); pointer-events: none; }
#clear-search-btn { position: absolute; right: 10px; top: 10px; background: none; border: none; font-size: 18px; color: var(--text-muted); cursor: pointer; padding: 2px 6px; line-height: 1; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-surface); border: 1px solid var(--border); padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.15s; font-family: inherit; }
.filter-btn:hover { color: var(--text-main); border-color: #cbd5e1; }
.filter-btn.active { background: var(--primary); color: #ffffff; border-color: var(--primary); }
.filter-count { display: inline-block; font-size: 11px; opacity: 0.8; font-weight: 500; }
.tags-filter-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 4px; border-top: 1px dashed var(--border); }
.tags-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-right: 4px; }
.tag-filter-btn { background: #ffffff; border: 1px solid var(--border); padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 500; color: #475569; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.tag-filter-btn:hover { background: var(--bg-surface); border-color: #cbd5e1; color: var(--text-main); }
.tag-filter-btn.active { background: #0f172a; color: #ffffff; border-color: #0f172a; }

.collection-status-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; font-weight: 500; }
.per-page-selector { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.per-page-select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; background: #fff; color: var(--text-main); cursor: pointer; font-family: inherit; }
.no-results { padding: 48px 20px; text-align: center; color: var(--text-muted); background: var(--bg-surface); border-radius: var(--radius); border: 1px dashed var(--border); font-size: 15px; }

/* Pagination Controls */
.pagination-wrapper { display: flex; justify-content: center; align-items: center; margin: 40px 0 20px 0; padding-top: 24px; border-top: 1px solid var(--border); }
.pagination { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--border); background: #ffffff; color: var(--text-main); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; transition: all 0.15s; font-family: inherit; user-select: none; }
.page-btn:hover:not(.disabled):not(.active) { background: var(--bg-surface); border-color: #cbd5e1; color: var(--primary); }
.page-btn.active { background: var(--primary); color: #ffffff; border-color: var(--primary); cursor: default; }
.page-btn.disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.page-btn-nav { font-weight: 700; }
.pagination-ellipsis { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 38px; color: var(--text-muted); font-weight: 700; }

/* Breadcrumbs & Badges */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 16px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-separator { color: #cbd5e1; }
.breadcrumb-current { color: var(--text-main); font-weight: 600; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.category-badge { background: var(--primary-light); color: var(--primary); }
.tag-pill { display: inline-block; padding: 3px 8px; border-radius: 4px; background: #f1f5f9; color: #475569; font-size: 11px; font-weight: 500; }
.item-meta-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 18px; font-size: 13px; color: var(--text-muted); }
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.meta-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-left: 8px; }
.page-subtitle { font-size: 18px; color: var(--text-muted); margin-top: 10px; line-height: 1.5; }
.btn-back { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: #ffffff; color: var(--text-main); text-decoration: none; font-size: 14px; font-weight: 600; transition: all 0.15s; }
.btn-back:hover { background: var(--bg-surface); border-color: #cbd5e1; }
.back-link-wrapper { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }

/* Editor.js Block Enhancements */
.block-code-wrapper { background: #0f172a; color: #f8fafc; border-radius: var(--radius); padding: 18px; margin: 24px 0; overflow-x: auto; }
.block-code { font-family: monospace; font-size: 13px; line-height: 1.6; }
.block-embed { margin: 30px 0; }
.embed-responsive { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius); }
.embed-responsive iframe { position: absolute; top:0; left: 0; width: 100%; height: 100%; border-radius: var(--radius); }
.block-warning { background: #fffbeb; border-left: 4px solid #f59e0b; padding: 16px 20px; border-radius: 0 var(--radius) var(--radius) 0; margin: 24px 0; }
.block-warning-title { display: block; font-size: 15px; color: #b45309; margin-bottom: 4px; font-weight: 700; }
.block-warning-message { font-size: 14px; color: #92400e; margin: 0; }
.block-checklist { list-style: none; margin: 20px 0; padding: 0; }
.checklist-item { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; font-size: 15px; }
.checklist-item.checked .checklist-text { text-decoration: line-through; color: var(--text-muted); }
.checklist-icon { font-weight: bold; color: var(--primary); }
.block-attachment { margin: 20px 0; }
.attachment-link { display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface); text-decoration: none; color: var(--text-main); font-weight: 500; font-size: 14px; transition: all 0.15s; }
.attachment-link:hover { border-color: var(--primary); background: #ffffff; }
.attachment-badge { background: var(--primary); color: #ffffff; padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.attachment-size { color: var(--text-muted); font-size: 12px; }
.block-table-wrapper { overflow-x: auto; margin: 24px 0; border: 1px solid var(--border); border-radius: var(--radius); }
.block-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.block-table th, .block-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.block-table th { background: var(--bg-surface); font-weight: 700; color: #0f172a; }

/* Footer */
.site-footer { background: #0f172a; color: #94a3b8; padding: 50px 0 30px 0; margin-top: 60px; font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-title { color: #ffffff; font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.footer-menu { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-menu a { color: #94a3b8; text-decoration: none; }
.footer-menu a:hover { color: #ffffff; }
.footer-bottom { border-top: 1px solid #1e293b; padding-top: 24px; text-align: center; font-size: 13px; }

@media (max-width: 768px) {
    .header-inner { height: auto; padding: 14px 0; flex-direction: column; gap: 12px; }
    .hero-title { font-size: 28px; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}
