/* =====================================================================
   Public site styles - modern, minimal, mobile-first, dark-mode ready
   ===================================================================== */

:root {
    --primary: #6366f1;
    --primary-2: #8b5cf6;
    --primary-soft: rgba(99, 102, 241, 0.12);
    --accent: #f59e0b;

    --bg: #ffffff;
    --bg-alt: #f6f7fb;
    --card: #ffffff;
    --border: #e8eaf2;
    --text: #1c2030;
    --muted: #6b7280;
    --header-bg: rgba(255, 255, 255, 0.92);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.07);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
    --radius: 14px;
    --container: 1180px;
}

html[data-theme="dark"] {
    --bg: #0e1120;
    --bg-alt: #131730;
    --card: #171b36;
    --border: #272c4d;
    --text: #e8eaf6;
    --muted: #9aa2c4;
    --header-bg: rgba(14, 17, 32, 0.92);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    font-size: 16px;
    transition: background 0.25s, color 0.25s;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: 10px; border: 1px solid transparent;
    font-size: 14.5px; font-weight: 600; cursor: pointer; background: var(--bg-alt);
    color: var(--text); text-decoration: none; transition: background 0.15s, transform 0.06s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-outline { border-color: var(--border); background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.icon-btn {
    background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px;
    width: 38px; height: 38px; font-size: 16px; cursor: pointer; color: var(--text);
    display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--primary); }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--header-bg); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex; align-items: center; gap: 24px; height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand-logo { border-radius: 8px; }
.brand-dot {
    width: 26px; height: 26px; border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 4px 14px var(--primary-soft);
}
.main-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.main-nav a, .nav-link {
    padding: 8px 12px; border-radius: 8px; color: var(--text);
    text-decoration: none; font-size: 14.5px; font-weight: 500; background: none; border: 0; cursor: pointer;
}
.main-nav a:hover, .nav-link:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.main-nav a.active { color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.nav-dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: 100%; left: 0; min-width: 220px; display: none;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow-lg); padding: 8px; z-index: 60;
}
.nav-dropdown:hover .dropdown-menu, .nav-dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-menu a {
    display: flex; justify-content: space-between; align-items: center; padding: 9px 12px;
    border-radius: 8px; font-size: 14px;
}
.dropdown-menu a:hover { background: var(--primary-soft); }
.dropdown-menu .count, .count { background: var(--primary-soft); color: var(--primary); border-radius: 10px; font-size: 11.5px; padding: 1px 8px; font-weight: 700; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.hamburger { display: none; }

/* ---------- Search overlay ---------- */
.search-overlay {
    position: fixed; inset: 0; background: rgba(10, 12, 24, 0.96); z-index: 90;
    display: flex; align-items: flex-start; padding-top: 12vh;
}
.search-form { display: flex; gap: 10px; }
.search-form input[type="search"] {
    flex: 1; padding: 14px 18px; font-size: 17px; border-radius: 12px;
    border: 1px solid var(--border); background: var(--card); color: var(--text); outline: none;
}
.autosuggest {
    margin-top: 12px; background: var(--card); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-lg);
}
.autosuggest a { display: flex; gap: 12px; padding: 10px 14px; align-items: center; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.autosuggest a:last-child { border-bottom: 0; }
.autosuggest a:hover { background: var(--primary-soft); }
.autosuggest img { width: 56px; height: 38px; object-fit: cover; border-radius: 7px; }
.autosuggest .title { font-weight: 600; font-size: 14px; }
.autosuggest .date { font-size: 12px; color: var(--muted); }

/* ---------- Reading progress ---------- */
#readingProgress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
    z-index: 100; border-radius: 0 3px 3px 0;
}

/* ---------- Layout ---------- */
.main-layout { padding-top: 28px; padding-bottom: 60px; }
.with-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; align-items: start; }
.sidebar-col { display: flex; flex-direction: column; gap: 22px; position: sticky; top: 88px; }
.main-col { min-width: 0; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 46px; }
.hero-main {
    position: relative; border-radius: 18px; overflow: hidden; min-height: 420px;
    display: flex; align-items: flex-end; box-shadow: var(--shadow-lg);
}
.hero-main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-main .hero-overlay {
    position: relative; width: 100%; padding: 40px 28px 26px;
    background: linear-gradient(180deg, transparent, rgba(5, 8, 20, 0.92));
    color: #fff;
}
.hero-main h1 { font-size: clamp(22px, 3vw, 32px); margin: 8px 0 10px; }
.hero-main h1 a { color: #fff; text-decoration: none; }
.hero-main p { color: rgba(255, 255, 255, 0.8); font-size: 14.5px; }
.hero-main .chip { background: rgba(255, 255, 255, 0.18); color: #fff; }
.hero-side { display: flex; flex-direction: column; gap: 20px; }
.hero-side-item {
    position: relative; border-radius: 16px; overflow: hidden; min-height: 200px; flex: 1;
    display: flex; align-items: flex-end; box-shadow: var(--shadow);
}
.hero-side-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-side-item .hero-overlay {
    position: relative; width: 100%; padding: 22px 18px 14px;
    background: linear-gradient(180deg, transparent, rgba(5, 8, 20, 0.9)); color: #fff;
}
.hero-side-item h3 { font-size: 16px; margin: 4px 0 0; }
.hero-side-item h3 a { color: #fff; text-decoration: none; }
.chip {
    display: inline-block; background: var(--primary-soft); color: var(--primary);
    font-size: 12px; font-weight: 700; border-radius: 20px; padding: 3px 11px;
}

/* ---------- Section headings ---------- */
.section-head { display: flex; align-items: center; gap: 14px; margin: 0 0 20px; }
.section-head h2 { font-size: 22px; margin: 0; }
.section-head::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Post cards grid ---------- */
.posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.posts-grid-2 { grid-template-columns: repeat(2, 1fr); }
.post-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
    transition: transform 0.18s, box-shadow 0.18s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.post-card-img { display: block; aspect-ratio: 16/9; overflow: hidden; background: var(--bg-alt); }
.post-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.post-card:hover .post-card-img img { transform: scale(1.05); }
.img-placeholder {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-soft), transparent); color: var(--primary); font-weight: 800;
}
.post-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post-card-title { font-size: 17px; margin: 0; }
.post-card-title a { color: var(--text); text-decoration: none; }
.post-card-title a:hover { color: var(--primary); }
.post-card-excerpt { color: var(--muted); font-size: 14px; margin: 0; flex: 1; }
.post-card-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 12px; }
.author-link { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; }
.mini-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }

/* ---------- Widgets / sidebar ---------- */
.widget {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow);
}
.widget-title { font-size: 15px; margin: 0 0 12px; }
.trend-item { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.trend-item:last-child { border-bottom: 0; }
.trend-item:hover .trend-title { color: var(--primary); }
.trend-rank {
    min-width: 26px; height: 26px; border-radius: 8px; background: var(--primary-soft);
    color: var(--primary); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.trend-title { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.cat-link { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: 14px; }
.cat-link:last-child { border-bottom: 0; }
.cat-link:hover { color: var(--primary); }

/* ---------- Single post ---------- */
.post-head { max-width: 760px; margin: 0 auto 26px; }
.post-head h1 { font-size: clamp(26px, 4vw, 40px); margin-bottom: 16px; }
.post-meta-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13.5px; }
.post-meta-line .avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.post-cover { border-radius: 18px; overflow: hidden; margin-bottom: 28px; box-shadow: var(--shadow-lg); }
.post-cover img { width: 100%; object-fit: cover; }
.post-cover figcaption { font-size: 12.5px; color: var(--muted); padding: 8px 14px; background: var(--bg-alt); }

.post-body { max-width: 760px; margin: 0 auto; font-size: 17px; }
.post-body h2 { font-size: 26px; margin: 32px 0 14px; }
.post-body h3 { font-size: 21px; margin: 26px 0 12px; }
.post-body p { margin: 0 0 18px; }
.post-body a:hover { text-decoration: underline; }
.post-body ul, .post-body ol { margin: 0 0 18px; padding-left: 26px; }
.post-body li { margin-bottom: 6px; }
.post-body blockquote {
    border-left: 4px solid var(--primary); background: var(--bg-alt);
    padding: 14px 20px; border-radius: 0 10px 10px 0; margin: 22px 0; font-style: italic;
}
.post-body img { border-radius: 12px; margin: 10px 0; }
.post-body iframe { max-width: 100%; border-radius: 12px; }
.post-body table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.post-body th, .post-body td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.post-body pre, .post-body code { background: var(--bg-alt); border-radius: 8px; }
.post-body code { padding: 2px 6px; font-size: 0.9em; }
.post-body pre { padding: 16px; overflow-x: auto; }
.post-body pre code { padding: 0; background: none; }

.tag-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 26px 0; }
.tag-list a {
    background: var(--bg-alt); border: 1px solid var(--border); color: var(--text);
    font-size: 13px; border-radius: 20px; padding: 5px 13px; text-decoration: none;
}
.tag-list a:hover { border-color: var(--primary); color: var(--primary); }

/* Share bar */
.share-bar { display: flex; gap: 10px; align-items: center; margin: 20px 0 30px; }
.share-bar .btn { padding: 7px 14px; font-size: 13px; }
.share-label { font-weight: 700; font-size: 13.5px; }

/* Author box */
.author-box {
    display: flex; gap: 16px; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin: 10px 0 34px;
}
.author-box .avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

/* Related posts */
.related-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }

/* ---------- Comments ---------- */
.comments { max-width: 760px; margin: 40px auto 0; }
.comment {
    display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border);
}
.comment .avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.comment-name { font-weight: 700; font-size: 14px; }
.comment-time { font-size: 12px; color: var(--muted); }
.comment-body { font-size: 14.5px; margin-top: 4px; word-break: break-word; }
.comments.replies { margin-left: 54px; border-left: 2px solid var(--border); padding-left: 18px; }

/* ---------- Newsletter ---------- */
.newsletter { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; padding: 46px 0; }
.newsletter-inner { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 24px; }
.newsletter h2 { color: #fff; margin: 0 0 6px; }
.newsletter .muted { color: rgba(255, 255, 255, 0.85); }
.newsletter-form { display: flex; gap: 10px; }
.newsletter-form input {
    flex: 1; padding: 13px 16px; border-radius: 11px; border: 0; font-size: 15px; outline: none;
}
.newsletter-msg { margin-top: 10px; }
.newsletter .btn-primary { background: #10121f; }
.newsletter .btn-primary:hover { background: #1d2033; }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 44px 0 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; padding-bottom: 30px; }
.footer-col h4 { font-size: 14px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.footer-col a { display: block; padding: 4px 0; color: var(--muted); font-size: 14px; text-decoration: none; }
.footer-col a:hover { color: var(--primary); }
.social-links { display: flex; gap: 8px; margin-top: 10px; }
.social-links a {
    width: 34px; height: 34px; border-radius: 9px; background: var(--card); border: 1px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800;
}
.footer-bottom { border-top: 1px solid var(--border); padding: 16px 0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13.5px; }
.footer-bottom p { margin: 0; color: var(--muted); }
.footer-bottom .muted a { color: var(--muted); }

/* ---------- Cookie consent ---------- */
.cookie-consent {
    position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 120;
    background: var(--card); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow-lg); padding: 14px 18px; max-width: 640px; width: calc(100% - 40px);
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13.5px;
}
.cookie-consent p { margin: 0; flex: 1; min-width: 260px; }
.cookie-actions { display: flex; gap: 8px; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { opacity: 0.5; }

/* ---------- Archive header ---------- */
.archive-head { margin-bottom: 30px; }
.archive-head h1 { font-size: 30px; margin-bottom: 8px; }
.archive-head p { color: var(--muted); max-width: 640px; }

/* ---------- Search results ---------- */
.result-item { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.result-item:hover .result-title { color: var(--primary); }
.result-item img { width: 168px; height: 100px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.result-title { font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.result-meta { font-size: 13px; color: var(--muted); }

/* ---------- Page (static) ---------- */
.page-body { max-width: 760px; margin: 0 auto; }
.page-body .post-body { max-width: none; }
.page-body h2 { margin-top: 28px; }

/* ---------- Contact form ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; max-width: 900px; margin: 0 auto; }
.contact-info { display: flex; flex-direction: column; gap: 14px; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.form-field input, .form-field textarea {
    width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-alt); color: var(--text); font-size: 14.5px; font-family: inherit; outline: none;
}
.form-field input:focus, .form-field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.35); color: #10b981; }
.alert-error { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.35); color: #ef4444; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 34px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 8px 14px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px;
    color: var(--text); text-decoration: none;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .muted { color: var(--muted); }

/* ---------- Ads ---------- */
.ad-zone {
    background: var(--bg-alt); border: 1px dashed var(--border); border-radius: 12px;
    margin: 18px 0; min-height: 90px; display: flex; align-items: center; justify-content: center;
    color: var(--muted); font-size: 12.5px;
}
.ad-zone-in_article { max-width: 760px; margin-left: auto; margin-right: auto; }

/* ---------- 404 ---------- */
.error-page { text-align: center; padding: 90px 20px; }
.error-page h1 { font-size: 110px; line-height: 1; margin: 0; background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page h2 { margin: 14px 0 8px; }
.error-page p { color: var(--muted); max-width: 420px; margin: 0 auto 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .hero { grid-template-columns: 1fr; }
    .hero-side { flex-direction: row; }
    .hero-side-item { min-height: 160px; }
    .posts-grid { grid-template-columns: repeat(2, 1fr); }
    .with-sidebar { grid-template-columns: 1fr; }
    .sidebar-col { position: static; }
    .newsletter-inner { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
    .hamburger { display: inline-flex; }
    .main-nav {
        position: fixed; top: 64px; left: 0; right: 0; bottom: 0; z-index: 80;
        background: var(--bg); flex-direction: column; align-items: stretch; gap: 2px;
        padding: 16px; display: none; overflow-y: auto;
    }
    .main-nav.open { display: flex; }
    .main-nav a, .main-nav .nav-link { padding: 13px 14px; font-size: 16px; }
    .dropdown-menu { position: static; display: block; box-shadow: none; min-width: 0; border: 0; padding: 0 0 0 12px; }
    .posts-grid, .posts-grid-2, .related-grid, .contact-grid { grid-template-columns: 1fr; }
    .post-body { font-size: 16px; }
    .comment-avatar-col { display: none; }
    .search-overlay { padding-top: 8vh; }
    .footer-bottom { flex-direction: column; text-align: center; }
    .hero-main { min-height: 320px; }
}