/* ============================================================
   Visual refresh for bazi-1.ru (JournalX theme)
   Modern readable magazine style
   ============================================================ */

:root {
    --accent: #d97706;
    --accent-dark: #b45309;
    --text: #1f2937;
    --text-soft: #4b5563;
    --muted: #6b7280;
    --bg: #f7f7f4;
    --card-bg: #ffffff;
    --border: #ececec;
    --shadow-sm: 0 2px 6px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);
    --shadow-md: 0 10px 28px rgba(15, 23, 42, .08), 0 2px 6px rgba(15, 23, 42, .04);
    --shadow-lg: 0 20px 45px rgba(15, 23, 42, .13), 0 4px 10px rgba(15, 23, 42, .05);
    --radius: 14px;
    --radius-sm: 10px;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-heading: 'Merriweather', Georgia, 'Times New Roman', serif;
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg) !important;
    color: var(--text) !important;
    font-family: var(--font-body) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.65;
}

/* Container — slightly narrower for better readability */
.site-content, .site-header-inner, .site-footer-inner {
    max-width: 1200px;
}

/* ---------- HEADER ---------- */
.site-header.fixed {
    background: rgba(255,255,255,.90) !important;
    backdrop-filter: saturate(180%) blur(14px) !important;
    -webkit-backdrop-filter: saturate(180%) blur(14px) !important;
    border-bottom: 1px solid rgba(0,0,0,.06) !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 10px 0 !important;
}
.site-branding__body { padding: 10px 0; }
.site-title a, .site-title {
    font-family: var(--font-heading) !important;
    font-weight: 900 !important;
    font-size: 1.7rem !important;
    color: var(--text) !important;
    letter-spacing: -.5px;
    background: linear-gradient(135deg, #111 0%, #444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.site-description {
    color: var(--muted) !important;
    font-style: italic;
    font-size: .9rem;
}
.main-navigation ul li a {
    font-weight: 600 !important;
    color: var(--text-soft) !important;
    letter-spacing: .2px;
    transition: color .15s ease;
    padding: 8px 14px !important;
    border-radius: 8px;
}
.main-navigation ul li a:hover {
    color: var(--accent) !important;
    background: rgba(217,119,6,.08);
}
.main-navigation ul li.current-menu-item > a,
.main-navigation ul li.current_page_item > a {
    color: var(--accent) !important;
}

/* ---------- HERO/HEADER SEARCH ---------- */
.header-search button,
.header-search input[type="search"],
.header-search input[type="text"] {
    border-radius: 999px !important;
    border: 1px solid var(--border) !important;
    transition: border .15s, box-shadow .15s;
}
.header-search input[type="search"]:focus,
.header-search input[type="text"]:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(217,119,6,.15);
    outline: none;
}

/* ---------- POST GRID (cards) ---------- */
.content-area { padding-top: 20px !important; }
.post-boxes {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)) !important;
    gap: 28px !important;
    margin-top: 32px !important;
}
.post-box {
    background: var(--card-bg) !important;
    border-radius: var(--radius) !important;
    overflow: hidden !important;
    box-shadow: var(--shadow-sm);
    transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s ease !important;
    display: flex !important;
    flex-direction: column !important;
    border: 1px solid var(--border);
}
.post-box:hover {
    transform: translateY(-6px) !important;
    box-shadow: var(--shadow-lg) !important;
    border-color: transparent;
}
.post-box a {
    text-decoration: none !important;
    color: inherit !important;
}
.post-box__thumbnail {
    overflow: hidden !important;
    position: relative !important;
    aspect-ratio: 16/10 !important;
}
.post-box__thumbnail img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform .7s cubic-bezier(.2,.8,.2,1), filter .4s ease !important;
}
.post-box:hover .post-box__thumbnail img {
    transform: scale(1.08) !important;
}
.post-box__thumbnail::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,.25) 100%);
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}
.post-box:hover .post-box__thumbnail::after { opacity: 1; }

.post-box__body {
    padding: 18px 22px 22px !important;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.post-box__title {
    font-family: var(--font-heading) !important;
    font-size: 1.2rem !important;
    line-height: 1.4 !important;
    font-weight: 700 !important;
    color: var(--text) !important;
    margin: 0 !important;
    transition: color .2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-box:hover .post-box__title {
    color: var(--accent) !important;
}

/* Category badge on cards */
.post-box::before {
    content: attr(data-category);
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 3;
    background: var(--accent);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 5px 10px;
    border-radius: 999px;
    box-shadow: 0 4px 10px rgba(217,119,6,.35);
}

/* ---------- READ MORE indicator ---------- */
.post-box__body::after {
    content: "Читать статью  →";
    display: inline-block;
    margin-top: auto;
    padding-top: 14px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--accent);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity .3s ease, transform .3s ease;
}
.post-box:hover .post-box__body::after {
    opacity: 1;
    transform: translateX(0);
}

/* ---------- Make post-box relative for badge placement ---------- */
.post-box { position: relative !important; }

/* ---------- SINGLE POST ---------- */
.single-post .site-content, .page .site-content, .error404 .site-content {
    background: var(--bg);
    padding: 0 20px;
}
.single-post .content-area, .page .content-area {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 48px 64px 56px;
    margin: 32px auto 48px;
    max-width: 760px;
    border: 1px solid var(--border);
    overflow: visible !important;
    position: relative;
}
/* JournalX shifts .post-thumbnail, .entry-header, .entry-content, .entry-footer...
   left:-230px on desktop for a "wide magazine" layout. When our card is narrower,
   that offset pushes content off the card. Neutralize it for everything inside
   the single-post card. */
.single-post .content-area .post-thumbnail,
.single-post .content-area .entry-header,
.single-post .content-area .entry-content,
.single-post .content-area .entry-footer,
.single-post .content-area .entry-tags,
.single-post .content-area .entry-comments,
.single-post .content-area .entry-rating,
.single-post .content-area .social-buttons,
.single-post .content-area .related-posts,
.single-post .content-area .nav-links,
.single-post .content-area .breadcrumb,
.single-post .content-area .author-box,
.page .content-area .entry-header,
.page .content-area .entry-content,
.page .content-area .entry-footer,
.page .content-area .post-thumbnail {
    left: auto !important;
    right: auto !important;
    transform: none !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    position: relative !important;
}
/* Related posts grid inside our card — give it proper spacing */
.single-post .related-posts,
.single-post .social-buttons {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}
.single-post .related-posts__list {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 20px !important;
}
/* JournalX JournalX shifts .post-thumbnail left:-230px for a "wide magazine" hero.
   When our card is narrower, that offset is too large. Reset to a contained hero. */
.single-post .post-thumbnail {
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
    max-width: 100% !important;
    margin: 0 0 36px !important;
    padding: 0 !important;
    text-align: center;
}
.single-post .post-thumbnail img {
    display: block;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}
.single-post .article-wrap {
    overflow: visible;
}
.single .entry-header { margin-bottom: 32px; }
.single .entry-header .entry-title { margin-top: 0; }
.entry-title {
    font-family: var(--font-heading) !important;
    font-weight: 900 !important;
    font-size: 2.25rem !important;
    line-height: 1.25 !important;
    letter-spacing: -.5px;
    color: var(--text) !important;
    margin-bottom: 16px !important;
}
.entry-content, .entry-content p, .home-text {
    font-size: 18px !important;
    line-height: 1.8 !important;
    color: var(--text) !important;
}
.entry-content p { margin-bottom: 1.25em; }
.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4 {
    font-family: var(--font-heading) !important;
    font-weight: 700 !important;
    margin-top: 1.8em !important;
    margin-bottom: .6em !important;
    color: var(--text) !important;
    letter-spacing: -.2px;
}
.entry-content h2 { font-size: 1.7rem !important; }
.entry-content h3 { font-size: 1.35rem !important; }
/* ---------- LISTS (numbered circles + bullet squares) ---------- */
.entry-content ul:not([class]),
.home-text ul:not([class]),
.entry-content ol:not([class]),
.home-text ol:not([class]) {
    list-style: none !important;
    padding: 0 !important;
    margin: 1.5em 0 1.8em !important;
    counter-reset: section;
}
.entry-content ul:not([class]) li,
.home-text ul:not([class]) li,
.entry-content ol:not([class]) li,
.home-text ol:not([class]) li {
    position: relative !important;
    padding-left: 3.2em !important;
    margin-bottom: 1em !important;
    line-height: 1.7 !important;
}

/* Numbered list: amber circle marker */
.entry-content ol:not([class]) > li:before,
.home-text ol:not([class]) > li:before {
    counter-increment: section;
    content: counter(section);
    position: absolute !important;
    top: .1em !important;
    left: 0 !important;
    width: 2em !important;
    height: 2em !important;
    padding: 0 !important;
    font-size: .95rem !important;
    font-weight: 700 !important;
    color: #fff !important;
    text-align: center;
    line-height: 2em;
    background: linear-gradient(135deg, var(--accent) 0%, #ea580c 100%);
    border: none !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 10px rgba(217,119,6,.3);
    transition: transform .2s ease;
}
.entry-content ol:not([class]) > li:hover::before,
.home-text ol:not([class]) > li:hover::before {
    transform: scale(1.08);
}

/* Bullet list: small amber square marker */
.entry-content ul:not([class]) li:before,
.home-text ul:not([class]) li:before {
    content: "";
    position: absolute !important;
    top: .75em !important;
    left: .5em !important;
    width: .55em !important;
    height: .55em !important;
    background: var(--accent) !important;
    border-radius: 3px !important;
    transform: rotate(45deg);
    box-shadow: 0 2px 5px rgba(217,119,6,.25);
}

/* Nested ol (sublists): small dashed-line numbering, no circle */
.entry-content ol:not([class]) li ol,
.home-text ol:not([class]) li ol {
    margin: .6em 0 .6em 0 !important;
    padding: 0 !important;
    counter-reset: subsection;
}
.entry-content ol:not([class]) li ol li,
.home-text ol:not([class]) li ol li {
    padding-left: 2em !important;
    margin-bottom: .5em !important;
}
.entry-content ol:not([class]) li ol li:before,
.home-text ol:not([class]) li ol li:before {
    counter-increment: subsection;
    content: counter(subsection, lower-alpha) ".";
    position: absolute !important;
    left: 0 !important;
    top: .2em !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    color: var(--accent) !important;
    font-weight: 700;
    line-height: 1.5;
    border-radius: 0 !important;
    font-size: .95rem;
}

/* Paragraphs inside list items should NOT look like new list items */
.entry-content ol:not([class]) li > p,
.entry-content ol:not([class]) li > ul,
.entry-content ol:not([class]) li > ol,
.home-text ol:not([class]) li > p,
.entry-content ul:not([class]) li > p,
.home-text ul:not([class]) li > p {
    margin: .5em 0 .6em 0 !important;
    padding-left: 0 !important;
}
.entry-content ol:not([class]) li > p:first-child,
.home-text ol:not([class]) li > p:first-child {
    margin-top: 0 !important;
}
/* Bold sub-headings inside list items (like "Что делать:") — slightly warmer */
.entry-content ol:not([class]) li strong:first-child,
.home-text ol:not([class]) li strong:first-child,
.entry-content ul:not([class]) li strong:first-child {
    color: var(--text);
}
/* If a <p> inside an li also starts with <strong>, that's a sub-heading */
.entry-content ol:not([class]) li p > strong:only-child,
.entry-content ol:not([class]) li p:first-child > strong:first-child {
    color: var(--accent-dark);
}

.entry-content img {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-width: 100%;
    height: auto;
}
.entry-content blockquote {
    border-left: 4px solid var(--accent);
    background: linear-gradient(90deg, #fff7ed 0%, transparent 100%);
    padding: 18px 24px;
    margin: 28px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--text-soft);
    font-family: var(--font-heading);
    font-size: 1.1em;
}
.entry-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(217,119,6,.3);
    transition: color .15s, border-color .15s;
}
.entry-content a:hover { color: var(--accent-dark); border-bottom-color: var(--accent-dark); }
.entry-content code, .entry-content pre {
    background: #f3f4f6;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: .9em;
}
.entry-content pre { padding: 16px; overflow-x: auto; }

.single-post .post-thumbnail img {
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 32px;
}

/* ---------- PAGINATION / NAVIGATION ---------- */
.nav-links, .pagination, .page-numbers {
    margin-top: 40px !important;
}
.page-numbers a, .page-numbers span {
    border-radius: 8px !important;
    padding: 8px 14px !important;
    font-weight: 600;
}
.page-numbers.current {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
}

/* ---------- FOOTER ---------- */
.site-footer {
    background: #fff !important;
    border-top: 1px solid var(--border) !important;
    color: var(--muted) !important;
    margin-top: 60px !important;
    padding-top: 28px !important;
    box-shadow: 0 -1px 0 rgba(0,0,0,.02);
}
.footer-info, .footer-info a { color: var(--muted) !important; }
.site-footer a:hover { color: var(--accent) !important; }

/* ---------- BUTTONS ---------- */
button, .button, input[type="submit"], .wp-block-button__link, .comment-form input[type="submit"] {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    padding: 10px 22px !important;
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 4px 10px rgba(217,119,6,.25);
}
button:hover, .button:hover, input[type="submit"]:hover {
    background: var(--accent-dark) !important;
    border-color: var(--accent-dark) !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(217,119,6,.35);
}

/* ---------- FORMS (search, comments) ---------- */
input[type="text"], input[type="email"], input[type="search"], input[type="url"], textarea {
    border-radius: 8px !important;
    border: 1px solid var(--border) !important;
    padding: 10px 14px !important;
    transition: border .15s, box-shadow .15s;
    background: #fff;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="search"]:focus, textarea:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(217,119,6,.15);
    outline: none;
}

/* ---------- SCROLL TO TOP BUTTON ---------- */
.wpfront-scroll-top-container img,
.wpfront-scroll-top-container div {
    filter: hue-rotate(-10deg);
}

/* ---------- SIDEBAR ---------- */
.widget-area .widget {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.widget-title, .widget-title:first-child {
    font-family: var(--font-heading) !important;
    font-weight: 700 !important;
    color: var(--text) !important;
    font-size: 1.1rem !important;
    margin-bottom: 14px !important;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
}

/* ---------- CATEGORY ARCHIVE HEADINGS ---------- */
.archive-header, .page-header {
    margin: 28px 0 10px;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}
.archive-title, .page-title {
    font-family: var(--font-heading) !important;
    font-weight: 900 !important;
    font-size: 2rem !important;
    letter-spacing: -.5px;
    color: var(--text);
}

/* ---------- SELECTION ---------- */
::selection {
    background: var(--accent);
    color: #fff;
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- PAGE LOAD SUBTLE ANIMATION ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.post-box { animation: fadeInUp .5s ease-out backwards; }
.post-box:nth-child(1) { animation-delay: .02s; }
.post-box:nth-child(2) { animation-delay: .06s; }
.post-box:nth-child(3) { animation-delay: .10s; }
.post-box:nth-child(4) { animation-delay: .14s; }
.post-box:nth-child(5) { animation-delay: .18s; }
.post-box:nth-child(6) { animation-delay: .22s; }
.post-box:nth-child(7) { animation-delay: .26s; }
.post-box:nth-child(8) { animation-delay: .30s; }
.post-box:nth-child(9) { animation-delay: .34s; }
.post-box:nth-child(10) { animation-delay: .38s; }
.post-box:nth-child(11) { animation-delay: .42s; }
.post-box:nth-child(12) { animation-delay: .46s; }

/* ---------- MOBILE ---------- */
@media (max-width: 768px) {
    .post-boxes {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 0 10px;
    }
    .single-post .content-area, .page .content-area {
        padding: 28px 20px !important;
        border-radius: 0;
        margin: 10px;
    }
    .entry-title { font-size: 1.7rem !important; }
    .entry-content, .entry-content p { font-size: 16.5px !important; }
    .site-title { font-size: 1.3rem !important; }
    .site-branding__body { padding: 6px 0; }
}

/* Dark mode support (auto via system) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111317;
        --card-bg: #1a1d23;
        --text: #e5e7eb;
        --text-soft: #cbd5e1;
        --muted: #94a3b8;
        --border: #2a2e37;
    }
    body { background: var(--bg) !important; }
    .site-content, .single-post .site-content, .page .site-content { background: var(--bg) !important; }
    .site-header.fixed { background: rgba(20,22,28,.9) !important; border-bottom-color: rgba(255,255,255,.08) !important; }
    .site-title a { background: linear-gradient(135deg, #f3f4f6 0%, #9ca3af 100%) !important; -webkit-background-clip: text !important; -webkit-text-fill-color: transparent !important; background-clip: text !important; }
    .site-footer { background: #16181d !important; border-top-color: rgba(255,255,255,.06) !important; }
    .widget-area .widget { background: #1a1d23; border-color: #2a2e37; }
    .single-post .content-area, .page .content-area { background: #1a1d23 !important; border-color: #2a2e37 !important; }
    input[type="text"], input[type="email"], input[type="search"], input[type="url"], textarea { background: #111317 !important; color: var(--text) !important; border-color: #2a2e37 !important; }
    .entry-content code, .entry-content pre { background: #0d0f13; color: #e5e7eb; }
    .entry-content blockquote { background: linear-gradient(90deg, rgba(217,119,6,.15) 0%, transparent 100%); color: var(--text-soft); }
    ::-webkit-scrollbar-thumb { background: #3a3e49; }
    .main-navigation ul li a:hover { background: rgba(217,119,6,.12); }
}
