/*
Theme Name: Laboratory APCBC Theme
Description: Аналитическая лаборатория кредитов и займов.
Version: 1.0
*/

:root {
    --primary: #1E40AF;
    --secondary: #64748B;
    --accent: #0EA5E9;
    --bg: #F8FAFC;
    --text: #0F172A;
    --border: #E2E8F0;
    --section-pad: clamp(4rem, 8vw, 7rem);
    --shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.12), 0 4px 12px -4px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Source Sans 3', sans-serif; color: var(--text); line-height: 1.7; overflow-x: hidden; display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }
img { max-width: 100%; height: auto; display: block; border-radius: 8px; }
a { color: var(--accent); text-decoration: none; transition: 0.3s; }
h1, h2, h3, h4 { font-family: 'Source Serif 4', serif; }

.lab-container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* D-D Dot pattern */
.lab-pattern-bg { position: relative; z-index: 1; }
.lab-pattern-bg::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%230F172A' fill-opacity='0.04' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='2'/%3E%3Ccircle cx='13' cy='13' r='2'/%3E%3C/g%3E%3C/svg%3E"); z-index: -1; pointer-events: none; }

/* N-E Thin top-bar 48px */
.lab-site-header { background: var(--primary); color: #fff; position: relative; z-index: 1000; }
.lab-header-inner { display: flex; align-items: center; justify-content: space-between; height: 48px; gap: clamp(1rem, 5vw, 4rem); }
.lab-logo { display: inline-flex; align-items: center; gap: 10px; font-size: clamp(1rem, 3vw, 1.2rem); font-weight: 700; color: #fff; white-space: nowrap; flex-shrink: 0; min-height: 1em; min-width: 100px; }
.lab-logo span { color: var(--accent); }

.lab-main-nav { flex: 1; min-width: 0; overflow: hidden; display: flex; justify-content: flex-end; }
.lab-main-nav ul { display: flex; list-style: none; gap: 2rem; margin: 0; padding: 0; }
.lab-main-nav a { font-weight: 500; font-size: 0.9rem; color: #CBD5E1; }
.lab-main-nav a:hover { color: #fff; }

.lab-nav-toggle { display: none; flex-shrink: 0; z-index: 2100; background: none; border: none; width: 24px; height: 16px; position: relative; cursor: pointer; }
.lab-hamburger, .lab-hamburger::before, .lab-hamburger::after { content: ''; display: block; width: 100%; height: 2px; background: #fff; position: absolute; transition: 0.3s; }
.lab-hamburger { top: 50%; transform: translateY(-50%); }
.lab-hamburger::before { top: -6px; }
.lab-hamburger::after { bottom: -6px; }

@media (max-width: 1024px) { .lab-main-nav ul { gap: 1.5rem; } }
@media (max-width: 768px) {
    .lab-header-inner { gap: 1rem; }
    .lab-nav-toggle { display: block; }
    .lab-main-nav { display: block; position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: var(--primary); z-index: 2000; transform: translateY(-100%); transition: transform 0.4s ease; visibility: hidden; padding-top: 60px; }
    body.menu-open .lab-main-nav { transform: translateY(0); visibility: visible; }
    .lab-main-nav ul { flex-direction: column; padding: 20px; gap: 1.5rem; align-items: center; }
    .lab-main-nav a { font-size: 1.2rem; color: #fff; }
}

/* H-A Full bleed banner + overlay */
.lab-hero-section { position: relative; min-height: 70vh; display: flex; align-items: center; padding: var(--section-pad) 0; color: #fff; }
.lab-hero-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
.lab-hero-bg img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.lab-hero-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.75); }
.lab-hero-content { position: relative; z-index: 2; max-width: 760px; }
.lab-hero-content h1 { font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: 1.5rem; word-break: break-word; line-height: 1.15; font-weight: 700; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5); }
.lab-hero-content p { font-size: clamp(1.05rem, 2vw, 1.25rem); color: #fff; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45); }

/* F-D Manifest */
.lab-manifesto-section { padding: var(--section-pad) 0; background: #fff; text-align: center; }
.lab-manifesto-content { max-width: 820px; margin: 0 auto; font-size: clamp(1.15rem, 2.5vw, 1.6rem); line-height: 1.65; font-weight: 400; color: var(--text); font-family: 'Source Serif 4', serif; }
.lab-manifesto-content strong { font-weight: 700; color: var(--primary); }

/* U-E Stats */
.lab-stats-section { padding: var(--section-pad) 0; background: var(--bg); }
.lab-stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; text-align: center; }
.lab-stat-item { background: #fff; padding: 2.5rem 1.5rem; border-radius: 12px; box-shadow: var(--shadow); }
.lab-stat-item h4 { font-size: clamp(2.5rem, 5vw, 3.5rem); color: var(--primary); margin-bottom: 0.75rem; font-weight: 700; font-family: 'Source Serif 4', serif; }
.lab-stat-item p { font-size: 1rem; color: var(--secondary); }
@media (max-width: 768px) { .lab-stats-grid { grid-template-columns: 1fr; } }

/* C-E Numbered posts, V-A soft shadows */
.lab-posts-section { padding: var(--section-pad) 0; }
.lab-section-title { font-size: clamp(2rem, 4vw, 2.75rem); margin-bottom: 3rem; text-align: center; font-weight: 700; color: var(--primary); }
.lab-posts-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.lab-post-card { display: grid; grid-template-columns: 72px 1fr; gap: 1rem; align-items: start; background: #fff; padding: 1.75rem; border-radius: 12px; box-shadow: var(--shadow); transition: 0.3s; }
.lab-post-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px -8px rgba(15, 23, 42, 0.18); }
.lab-post-number { font-size: 1.5rem; font-weight: 700; color: var(--accent); font-family: 'Source Serif 4', serif; line-height: 1; }
.lab-post-card-content { display: flex; flex-direction: column; flex-grow: 1; }
.lab-post-category { font-size: 0.8rem; font-weight: 600; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.5rem; display: block; }
.lab-post-card-content h3 { font-size: 1.15rem; margin-bottom: 1.25rem; flex-grow: 1; word-break: break-word; line-height: 1.4; color: var(--text); font-weight: 600; }
.lab-btn-read { display: inline-block; font-weight: 600; color: var(--primary); font-size: 0.9rem; }
.lab-btn-read:hover { color: var(--accent); }

@media (max-width: 1024px) { .lab-posts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 768px) { .lab-posts-grid { grid-template-columns: minmax(0, 1fr); } }

.lab-all-posts-action { text-align: center; margin-top: 3.5rem; }
.lab-btn-primary { display: inline-block; padding: 1rem 2.5rem; background: var(--primary); color: #fff; font-weight: 600; border-radius: 8px; transition: 0.3s; }
.lab-btn-primary:hover { background: var(--accent); color: #fff; }

/* Pagination */
.pagination,
.lab-pagination { display: flex; justify-content: center; align-items: center; gap: 0.5rem; margin: 4rem 0; flex-wrap: wrap; }
.pagination .page-numbers,
.lab-pagination .page-numbers { display: flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 8px; text-decoration: none; font-weight: 600; background: #fff; color: var(--primary); border-radius: 8px; transition: 0.3s; box-shadow: var(--shadow); }
.lab-pagination .page-numbers.current,
.pagination .page-numbers.current { background: var(--primary); color: #fff; }
.lab-pagination .page-numbers.dots,
.pagination .page-numbers.dots { background: transparent; cursor: default; box-shadow: none; }
.lab-pagination .page-numbers:hover:not(.current):not(.dots),
.pagination .page-numbers:hover:not(.current):not(.dots) { background: var(--accent); color: #fff; }

/* Single / Page */
.lab-single-container { max-width: 800px; padding: var(--section-pad) 20px; margin: 0 auto; }
.lab-single-thumb { margin-bottom: 2.5rem; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.lab-single-header { margin-bottom: 2.5rem; }
.lab-single-header h1 { font-size: clamp(1.75rem, 5vw, 3rem); margin-bottom: 1rem; word-break: break-word; color: var(--primary); font-weight: 700; line-height: 1.2; }
.lab-post-meta { color: var(--secondary); font-size: 0.95rem; }
.lab-post-content { line-height: 1.8; font-size: 1.1rem; }
.lab-post-content h2, .lab-post-content h3, .lab-post-content h4 { margin-top: 3.5rem; margin-bottom: 1.25rem; word-break: break-word; color: var(--primary); font-weight: 700; }
.lab-post-content p { margin-bottom: 1.5rem; }
.lab-post-content ul, .lab-post-content ol { margin-bottom: 1.5rem; padding-left: 2rem; }
.lab-post-content li { margin-bottom: 0.5rem; }
.lab-post-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.lab-post-content th, .lab-post-content td { border: 1px solid var(--border); padding: 1rem; text-align: left; }
.lab-post-content th { background: var(--bg); font-weight: 600; color: var(--primary); }

/* Index cards */
.lab-index-card { display: flex; flex-direction: column; height: 100%; background: #fff; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; transition: 0.3s; }
.lab-index-card:hover { transform: translateY(-4px); }
.lab-index-card .lab-thumb { height: clamp(180px, 25vw, 250px); overflow: hidden; }
.lab-index-card .lab-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.lab-index-card-content { padding: 1.5rem; display: flex; flex-direction: column; flex-grow: 1; }
.lab-index-card-content h3 { font-size: 1.2rem; margin-bottom: 1.25rem; flex-grow: 1; word-break: break-word; color: var(--text); }

/* 404 */
.lab-error-page { text-align: center; min-height: 50vh; display: flex; flex-direction: column; justify-content: center; padding: var(--section-pad) 20px; }
.lab-error-code { font-size: clamp(3rem, 10vw, 6rem); color: var(--primary); margin-bottom: 1rem; font-weight: 700; font-family: 'Source Serif 4', serif; }
.lab-error-title { font-size: clamp(1.25rem, 3vw, 1.75rem); margin-bottom: 1.5rem; }
.lab-error-text { margin-bottom: 2rem; color: var(--secondary); max-width: 480px; margin-left: auto; margin-right: auto; }

/* FT-C Footer */
.lab-site-footer { background: #fff; color: var(--text); padding: var(--section-pad) 0; margin-top: auto; border-top: 1px solid var(--border); }
.lab-footer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(2rem, 5vw, 4rem); }
.lab-footer-logo { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; overflow-wrap: anywhere; margin-bottom: 1.25rem; color: var(--primary); font-family: 'Source Serif 4', serif; }
.lab-footer-desc { max-width: 100%; overflow-wrap: break-word; font-size: 0.95rem; color: var(--secondary); }
.lab-footer-col h4 { font-size: 1.05rem; margin-bottom: 1.25rem; color: var(--primary); font-weight: 600; }
.lab-footer-col ul { list-style: none; padding: 0; margin: 0; }
.lab-footer-col li { margin-bottom: 0.75rem; }
.lab-footer-col a { color: var(--secondary); font-weight: 500; }
.lab-footer-col a:hover { color: var(--accent); }
.lab-footer-contacts p { margin-bottom: 0.75rem; max-width: 100%; overflow-wrap: break-word; font-size: 0.95rem; color: var(--secondary); }

@media (max-width: 768px) {
    .lab-footer-grid { grid-template-columns: 1fr; text-align: center; }
}
