/*
Theme Name: dds_hpsmbcentral.com
Author: Илья Корнеев
Description: Тема для контентного проекта о строительных инструментах. Индустриальный сдержанный дизайн, тёплая палитра, акцент на читаемость.
Version: 1.1
Text Domain: dds_hpsmbcentral
*/

/* ---------- CSS-переменные ---------- */
:root {
    --color-bg: #F7F5F2;
    --color-text: #1E1B1A;
    --color-accent: #D94A1F;
    --color-accent-dark: #B83A12;
    --color-secondary: #3A6B4B;
    --color-card: #FFFFFF;
    --color-border: #E2DED9;
    --color-muted: #8C8279;
    --color-advice: #FCE8D9;
    --color-zebra: #F4F2EF;
    --color-footer-bg: #22201E;
    --color-footer-text: #B9B3AC;

    --font-heading: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;

    --radius: 6px;
    --radius-small: 4px;
}

/* ---------- Базовые сбросы и типографика ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.65;
    color: var(--color-text);
    background-color: var(--color-bg);
    background-image:
        repeating-linear-gradient(0deg, rgba(30,27,26,0.012) 0px, rgba(30,27,26,0.012) 1px, transparent 1px, transparent 2px),
        repeating-linear-gradient(90deg, rgba(30,27,26,0.012) 0px, rgba(30,27,26,0.012) 1px, transparent 1px, transparent 2px);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
    margin: 1.2em 0 0.6em;
}

h1 { font-size: 2.2rem; margin-top: 0.2em; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }

p {
    margin: 0 0 1em;
    background: none;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover { color: var(--color-accent-dark); text-decoration: underline; }

code, pre, kbd {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

code {
    background: var(--color-zebra);
    padding: 2px 6px;
    border-radius: var(--radius-small);
    border: 1px solid var(--color-border);
}

pre {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    overflow-x: auto;
}

pre code {
    background: none;
    border: none;
    padding: 0;
}

blockquote {
    border-left: 4px solid var(--color-accent);
    margin: 1.5em 0;
    padding: 0.8em 1.2em;
    background: var(--color-card);
    color: var(--color-text);
    font-style: normal;
}

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2em 0;
}

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

/* ---------- Таблицы ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    background: var(--color-card);
    border: 1px solid var(--color-border);
}

th, td {
    border: 1px solid var(--color-border);
    padding: 10px 14px;
    text-align: left;
    vertical-align: top;
}

thead th {
    background: var(--color-text);
    color: var(--color-bg);
    font-weight: 600;
    position: sticky;
    top: 0;
}

tbody tr:nth-child(even) { background: var(--color-zebra); }

/* ---------- Основной каркас ---------- */
.site-wrap {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 92%;
    max-width: 1200px;
    margin: 0 auto;
}

.main-content { flex: 1; padding: 36px 0 60px; }

/* ---------- Шапка ---------- */
.site-header {
    background: var(--color-card);
    border-bottom: 2px solid var(--color-border);
    padding: 18px 0;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--color-text);
    flex-shrink: 0;
}

.brand:hover { text-decoration: none; color: var(--color-text); }

.brand-logo {
    width: 48px;
    height: 48px;
    display: block;
    flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }

.brand-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-width: 520px;
}

.brand-desc {
    font-size: 0.82rem;
    color: var(--color-muted);
    line-height: 1.3;
    margin-top: 4px;
    max-width: 520px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.primary-nav { margin-left: auto; }

.primary-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.primary-nav a {
    display: inline-block;
    padding: 8px 14px;
    color: var(--color-text);
    font-weight: 500;
    border-radius: var(--radius-small);
    transition: background 0.15s ease, color 0.15s ease;
}

.primary-nav a:hover {
    background: var(--color-zebra);
    color: var(--color-accent);
    text-decoration: none;
}

.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a {
    background: var(--color-accent);
    color: #fff;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-small);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--color-text);
}

/* ---------- Хлебные крошки ---------- */
.breadcrumbs {
    font-size: 0.88rem;
    color: var(--color-muted);
    margin-bottom: 24px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.breadcrumbs a { color: var(--color-muted); }
.breadcrumbs a:hover { color: var(--color-accent); }
.breadcrumbs .sep { margin: 0 8px; opacity: 0.6; }
.breadcrumbs .current { color: var(--color-text); font-weight: 500; }

/* ---------- Layout content + sidebar ---------- */
.layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.layout.has-sidebar .content-area { flex: 0 0 67%; min-width: 0; }
.layout.has-sidebar .sidebar-area { flex: 0 0 27%; }
.layout.no-sidebar .content-area { flex: 0 0 85%; margin: 0 auto; min-width: 0; }

/* ---------- Карточки записей ---------- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 20px 0 32px;
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(30, 27, 26, 0.08);
}

.card-thumb-wrap {
    display: block;
    background: var(--color-zebra);
    overflow: hidden;
}

.card-thumb-wrap img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.card:hover .card-thumb-wrap img { transform: scale(1.03); }

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 18px 20px;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.3;
}

.card-title a {
    color: var(--color-text);
    text-decoration: none;
}

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

.card-meta {
    font-size: 0.82rem;
    color: var(--color-muted);
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.card-meta a { color: var(--color-muted); }
.card-meta a:hover { color: var(--color-accent); }

.card-excerpt {
    color: var(--color-text);
    margin-bottom: 14px;
    font-size: 0.95rem;
    flex: 1;
}

.card-excerpt p {
    margin: 0 0 0.5em;
    background: none;
}

.card-excerpt p:last-child { margin-bottom: 0; }

.card-footer { margin-top: auto; }

/* Бейджи рубрик */
.badge {
    display: inline-block;
    padding: 3px 12px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--color-secondary);
    color: #fff;
    clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
    margin-right: 6px;
}

.badge.badge-accent { background: var(--color-accent); }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    text-align: center;
    line-height: 1.2;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-accent-dark);
    color: #fff;
    text-decoration: none;
}

.btn-secondary {
    background: transparent;
    color: var(--color-accent);
    border: 2px solid var(--color-accent);
    padding: 10px 22px;
}

.btn-secondary:hover {
    background: rgba(217, 74, 31, 0.1);
    color: var(--color-accent);
    text-decoration: none;
}

.btn-compact {
    padding: 6px 12px;
    font-size: 0.85rem;
    background: var(--color-secondary);
    color: #fff;
    border-radius: var(--radius-small);
}

.btn-compact:hover {
    background: #2e5a3d;
    color: #fff;
    text-decoration: none;
}

.btn-sm { padding: 8px 16px; font-size: 0.88rem; }

/* ---------- Тематические блоки на главной ---------- */
.feature-section {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 28px;
}

.feature-section h2 {
    margin-top: 0;
    position: relative;
    padding-bottom: 12px;
}

.feature-section h2::after {
    content: "";
    display: block;
    width: 44px;
    height: 3px;
    background: var(--color-accent);
    position: absolute;
    bottom: 0;
    left: 0;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 22px;
    margin-top: 20px;
}

.feature-item {
    padding: 18px;
    background: var(--color-zebra);
    border-radius: var(--radius);
    border-left: 3px solid var(--color-secondary);
}

.feature-item h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.feature-item p { margin: 0; font-size: 0.93rem; color: var(--color-text); }

.advice-box {
    background: var(--color-advice);
    border-left: 4px solid var(--color-accent);
    padding: 14px 18px;
    border-radius: var(--radius-small);
    margin: 16px 0;
}

.advice-box p:last-child { margin-bottom: 0; }

/* ---------- Сайдбар ---------- */
.sidebar-area {
    font-size: 0.94rem;
}

.widget {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 22px;
}

.widget-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-accent);
}

.widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget ul li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--color-border);
}

.widget ul li:last-child { border-bottom: none; }

.widget ul li a { color: var(--color-text); }
.widget ul li a:hover { color: var(--color-accent); }

/* ---------- Пагинация ---------- */
.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 32px 0 16px;
}

.pagination a,
.pagination span {
    display: inline-block;
    min-width: 40px;
    padding: 8px 14px;
    text-align: center;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    color: var(--color-text);
    font-weight: 500;
    text-decoration: none;
}

.pagination a:hover {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
    text-decoration: none;
}

.pagination .current {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.pagination .dots { background: transparent; border-color: transparent; }

/* ---------- Одиночная запись / страница ---------- */
.post-main {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 32px;
}

.post-title { margin-top: 0; }

.post-meta {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.post-meta a { color: var(--color-muted); }
.post-meta a:hover { color: var(--color-accent); }

.post-thumbnail {
    margin: 0 -32px 24px;
    overflow: hidden;
}

.post-thumbnail img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 440px;
    object-fit: cover;
}

.post-content > p:first-child::first-letter {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    float: left;
    line-height: 0.9;
    margin: 6px 10px 0 0;
    color: var(--color-accent);
}

.post-content h2 { margin-top: 1.8em; }
.post-content h3 { margin-top: 1.5em; }

.post-tags {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--color-border);
    font-size: 0.88rem;
    color: var(--color-muted);
}

.post-tags a {
    display: inline-block;
    padding: 3px 10px;
    background: var(--color-zebra);
    border-radius: var(--radius-small);
    margin: 0 4px 4px 0;
    color: var(--color-text);
    font-size: 0.85rem;
}

.post-tags a:hover {
    background: var(--color-accent);
    color: #fff;
    text-decoration: none;
}

/* ---------- Комментарии ---------- */
.comments-wrap {
    margin-top: 32px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 28px 32px;
}

.comments-wrap h3 { margin-top: 0; }

.comment-list {
    list-style: none;
    margin: 0 0 28px;
    padding: 0;
}

.comment-list li {
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border);
}

.comment-list li:last-child { border-bottom: none; }

.comment-list .children {
    list-style: none;
    padding-left: 26px;
    margin-top: 14px;
    border-left: 2px solid var(--color-border);
}

.comment-meta {
    font-size: 0.86rem;
    color: var(--color-muted);
    margin-bottom: 6px;
}

.comment-meta strong { color: var(--color-text); }

.comment-body p { margin: 0 0 0.6em; }

.comment-respond label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

.comment-respond input[type="text"],
.comment-respond input[type="email"],
.comment-respond input[type="url"],
.comment-respond textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-bg);
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--color-text);
}

.comment-respond textarea { min-height: 140px; resize: vertical; }

.comment-respond input:focus,
.comment-respond textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* ---------- Форма поиска ---------- */
.search-form {
    display: flex;
    gap: 8px;
    max-width: 520px;
    margin: 0 0 12px;
}

.search-form input[type="search"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-card);
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-text);
}

.search-form input[type="search"]:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* ---------- Подвал ---------- */
.site-footer {
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: 48px 0 24px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 32px;
}

.footer-col .widget {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--color-footer-text);
    font-size: 0.92rem;
}

.footer-col .widget-title {
    color: #fff;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.footer-col .widget a {
    color: var(--color-footer-text);
}

.footer-col .widget a:hover {
    color: var(--color-accent);
    text-decoration: none;
}

.footer-col .widget ul li {
    border-bottom: none;
    padding: 5px 0;
}

.footer-bottom {
    text-align: center;
    padding-top: 22px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.86rem;
    color: var(--color-muted);
}

/* ---------- Cookie-баннер ---------- */
.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    background: var(--color-footer-bg);
    color: #fff;
    padding: 16px 20px;
    border-radius: var(--radius);
    display: none;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    z-index: 9999;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
    max-width: 960px;
    margin: 0 auto;
}

.cookie-banner.is-visible { display: flex; }

.cookie-banner p {
    margin: 0;
    flex: 1 1 280px;
    font-size: 0.9rem;
    background: none;
}

.cookie-banner .btn { flex-shrink: 0; }

/* ---------- 404 ---------- */
.not-found {
    text-align: center;
    padding: 40px 20px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.not-found .big {
    font-family: var(--font-heading);
    font-size: 5rem;
    font-weight: 700;
    color: var(--color-accent);
    line-height: 1;
    margin-bottom: 10px;
}

.not-found .search-form { margin: 20px auto; justify-content: center; }

/* ---------- WordPress alignments ---------- */
.alignleft { float: left; margin: 0 20px 10px 0; }
.alignright { float: right; margin: 0 0 10px 20px; }
.aligncenter { display: block; margin: 10px auto; }
.alignwide { max-width: none; }
.alignfull { max-width: none; }

.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: 0.88rem; color: var(--color-muted); text-align: center; margin-top: 6px; }

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    height: 1px;
    width: 1px;
    overflow: hidden;
    position: absolute !important;
}

/* ---------- Адаптив ---------- */
@media (max-width: 960px) {
    .layout { flex-direction: column; gap: 28px; }
    .layout.has-sidebar .content-area,
    .layout.has-sidebar .sidebar-area,
    .layout.no-sidebar .content-area {
        flex: 1 1 100%;
        width: 100%;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    h1 { font-size: 1.9rem; }
    h2 { font-size: 1.5rem; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }

    .container { width: 94%; }

    .header-inner { gap: 16px; }

    .brand-desc { display: none; }

    .nav-toggle { display: inline-block; order: 3; margin-left: auto; }

    .primary-nav {
        order: 10;
        flex: 1 1 100%;
        margin-left: 0;
        display: none;
    }

    .primary-nav.is-open { display: block; }

    .primary-nav ul {
        flex-direction: column;
        gap: 0;
        border-top: 1px solid var(--color-border);
        padding-top: 10px;
        margin-top: 8px;
    }

    .primary-nav li { width: 100%; }
    .primary-nav a { display: block; padding: 10px 4px; }

    .cards-grid { grid-template-columns: 1fr; gap: 18px; }

    .feature-section { padding: 22px; }
    .feature-grid { grid-template-columns: 1fr; gap: 14px; }

    .post-main { padding: 22px; }
    .post-thumbnail { margin: 0 -22px 20px; }

    .comments-wrap { padding: 22px; }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 26px;
    }

    .cookie-banner {
        left: 8px;
        right: 8px;
        bottom: 8px;
        padding: 14px;
    }

    h1 { font-size: 1.7rem; }
    h2 { font-size: 1.35rem; }
}
