/*
Theme Name: dds_recommendedwebtools.com
Author: Дмитрий Кречетов
Description: Тема для информационного сайта-гида по веб-инструментам: подборки, обзоры и рейтинги онлайн-сервисов для профессионалов и обычных пользователей.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: wtools
*/

/* ============================================================
   Токены
   ============================================================ */
:root {
    --bg:          #f6f8fc;
    --surface:     #ffffff;
    --surface-alt: #eef2fa;
    --ink:         #15233b;
    --muted:       #56678a;
    --line:        #dce2ec;
    --primary:     #2d5bd7;
    --primary-dk:  #1e3f9e;
    --accent:      #f2a03d;
    --accent-dk:   #cf8021;
    --footer-bg:   #0f1a30;
    --footer-ink:  #c4d0e6;
    --footer-head: #ffffff;
    --footer-line: #27375a;
    --radius:      14px;
    --shadow:      0 1px 2px rgba(21,35,59,.06), 0 8px 24px rgba(21,35,59,.06);
    --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
    --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* ============================================================
   Сброс / основа
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.65;
    overflow-x: hidden;
}

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

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dk); text-decoration: underline; }

h1, h2, h3, h4 {
    color: var(--ink);
    line-height: 1.18;
    letter-spacing: -0.015em;
    margin: 0 0 .5em;
    font-weight: 800;
}

h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.55rem, 3.4vw, 2.3rem); }
h3 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); }

p { margin: 0 0 1.1em; }

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================================
   Контейнеры (единый источник ширины)
   ============================================================ */
.shell { width: min(92%, 1180px); margin-inline: auto; }

.main { padding: 38px 0 64px; }

/* раскладка с сайдбаром: контент ~67% / сайдбар ~27% */
.main.has-sidebar {
    width: min(92%, 1180px);
    margin-inline: auto;
    display: grid;
    grid-template-columns: minmax(0, 67%) minmax(0, 27%);
    justify-content: space-between;
    align-items: start;
    gap: 40px;
}

/* раскладка без сайдбара: контент 85% */
.main.no-sidebar {
    width: min(85%, 1180px);
    margin-inline: auto;
}

.content-area { min-width: 0; }

/* ============================================================
   Эйбрау-метка (подпись-сигнатура) + кнопки
   ============================================================ */
.eyebrow {
    font-family: var(--mono);
    font-size: .74rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: .55em;
    margin: 0 0 .7em;
}
.eyebrow::before {
    content: "";
    width: 22px;
    height: 2px;
    background: var(--accent);
    display: inline-block;
}

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: .72em 1.5em;
    border-radius: 10px;
    font-weight: 700;
    border: 0;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.btn:hover { background: var(--primary-dk); color: #fff; text-decoration: none; transform: translateY(-1px); }
.btn.ghost {
    background: transparent;
    color: var(--primary);
    box-shadow: inset 0 0 0 2px var(--line);
}
.btn.ghost:hover { background: var(--surface-alt); color: var(--primary-dk); box-shadow: inset 0 0 0 2px var(--primary); }

/* ============================================================
   Шапка
   ============================================================ */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.header-top {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 18px 0;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo, .brand-mark { flex: 0 0 auto; display: block; }
.brand-mark { width: 46px; height: 46px; }
.brand-text { min-width: 0; }
.brand-name {
    font-weight: 800;
    font-size: 1.18rem;
    line-height: 1.25;
    color: var(--ink);
    display: block;
    /* длинное «Название сайта» из спецификации — ограничиваем визуально */
    max-height: 2.5em;
    overflow: hidden;
}
.brand-name a { color: inherit; }
.brand-name a:hover { color: var(--primary); text-decoration: none; }
.brand-desc {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.4;
    margin: 2px 0 0;
    max-height: 2.8em;
    overflow: hidden;
}

.nav-bar { border-top: 1px solid var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.main-nav a {
    display: block;
    padding: 14px 16px;
    color: var(--ink);
    font-weight: 600;
    border-bottom: 3px solid transparent;
}
.main-nav a:hover,
.main-nav .current-menu-item > a {
    color: var(--primary);
    border-bottom-color: var(--accent);
    text-decoration: none;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    cursor: pointer;
    color: var(--ink);
    font: inherit;
    margin: 8px 0;
}

/* ============================================================
   Хлебные крошки
   ============================================================ */
.breadcrumbs {
    font-size: .85rem;
    color: var(--muted);
    padding: 16px 0 0;
}
.breadcrumbs a { color: var(--primary); }
.breadcrumbs .sep { color: var(--line); margin: 0 .35em; }

/* ============================================================
   Карточки записей
   ============================================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 26px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(21,35,59,.12); }

.card-thumb { display: block; overflow: hidden; }
.card-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
.card-thumb-fallback {
    aspect-ratio: 16 / 9;
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(45,91,215,.16), transparent 55%),
        linear-gradient(135deg, var(--surface-alt), #dfe7f6);
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-thumb-fallback svg { width: 52px; height: 52px; opacity: .65; }

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 22px 22px;
    min-width: 0;
}
.card-cat {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent-dk);
    margin: 0 0 8px;
}
.card-title { font-size: 1.22rem; margin: 0 0 8px; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--primary); text-decoration: none; }
.card-meta { font-size: .8rem; color: var(--muted); margin: 0 0 10px; }
.card-excerpt { color: var(--muted); font-size: .95rem; }
.card-excerpt p { margin: 0 0 .5em; background: none; }
.card-more {
    margin-top: auto;
    padding-top: 12px;
    font-weight: 700;
    font-size: .92rem;
    color: var(--primary);
}
.card-more::after { content: " →"; }

/* горизонтальная карточка (последние записи на главной) */
.card.row { flex-direction: row; }
.card.row .card-thumb-wrap {
    flex: 0 0 38%;
    position: relative;
    overflow: hidden;
    min-height: 100%;
}
.card.row .card-thumb-wrap a,
.card.row .card-thumb-wrap .card-thumb {
    display: block;
    position: absolute;
    inset: 0;
}
.card.row .card-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card.row .card-thumb-fallback { position: absolute; inset: 0; }

/* ============================================================
   Главная
   ============================================================ */
.home { width: min(85%, 1180px); margin-inline: auto; padding: 0 0 64px; }

.home-section { padding: 56px 0; border-top: 1px solid var(--line); }
.home-section:first-child { border-top: 0; }
.section-head { max-width: 720px; margin: 0 0 34px; }
.section-head p { color: var(--muted); margin: 0; }

/* hero: текст + иллюстрация */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: 46px;
    align-items: center;
    padding: 64px 0 56px;
}
.hero-copy { min-width: 0; }
.hero-copy h1 { margin-bottom: .4em; }
.hero-lead { font-size: 1.12rem; color: var(--muted); margin-bottom: 1.6em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-art { min-width: 0; }
.hero-art img { display: block; width: 100%; height: auto; border-radius: var(--radius); }

/* сетка категорий (иконки) */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 22px;
}
.feature {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 26px 24px;
    min-width: 0;
}
.feature .ico {
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: var(--surface-alt);
    color: var(--primary);
    margin-bottom: 14px;
}
.feature .ico svg { width: 24px; height: 24px; display: block; }
.feature h3 { font-size: 1.12rem; margin: 0 0 6px; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }

/* пошаговый блок */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 22px;
    counter-reset: step;
}
.step {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px 24px 24px;
    min-width: 0;
    position: relative;
}
.step::before {
    counter-increment: step;
    content: counter(step, decimal-leading-zero);
    font-family: var(--mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-dk);
    display: block;
    margin-bottom: 12px;
}
.step h3 { font-size: 1.1rem; margin: 0 0 6px; }
.step p { color: var(--muted); font-size: .92rem; margin: 0; }

/* FAQ */
.faq { max-width: 820px; }
.faq details {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 4px 20px;
    margin-bottom: 12px;
}
.faq summary {
    cursor: pointer;
    font-weight: 700;
    padding: 16px 0;
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent-dk); font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--muted); margin: 0 0 16px; }

/* секция последних записей на главной */
.latest-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 30px; }
.latest-list { display: grid; gap: 22px; }

/* ============================================================
   Контент записи / страницы
   ============================================================ */
.entry {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 34px clamp(20px, 4vw, 44px);
    box-shadow: var(--shadow);
}
.entry-title { margin-bottom: .3em; }
.entry-meta { color: var(--muted); font-size: .88rem; margin-bottom: 22px; }
.entry-thumb { border-radius: 12px; overflow: hidden; margin: 0 0 24px; }
.entry-thumb img { display: block; width: 100%; height: auto; }
.entry-content { min-width: 0; }
.entry-content img { border-radius: 10px; }
.entry-content h2 { margin-top: 1.4em; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content blockquote {
    margin: 1.4em 0;
    padding: 4px 0 4px 20px;
    border-left: 4px solid var(--accent);
    color: var(--ink);
    font-style: italic;
}

/* акцентная цитата-секция (главная) */
.quote-block {
    background: linear-gradient(135deg, var(--primary), var(--primary-dk));
    color: #fff;
    border-radius: var(--radius);
    padding: clamp(30px, 5vw, 56px);
}
.quote-block .eyebrow { color: #fff; }
.quote-block .eyebrow::before { background: var(--accent); }
.quote-block blockquote { margin: 0; font-size: clamp(1.3rem, 2.6vw, 1.9rem); font-weight: 700; line-height: 1.4; letter-spacing: -.01em; }
.quote-block cite { display: block; margin-top: 18px; font-style: normal; font-weight: 600; opacity: .82; font-size: .95rem; }

/* таблицы в контенте */
.entry-content table { border-collapse: collapse; width: 100%; margin: 1.4em 0; }
.entry-content table, .entry-content th, .entry-content td { border: 1px solid var(--line); }
.entry-content th, .entry-content td { padding: 10px 12px; text-align: left; }
.entry-content th { background: var(--surface-alt); }

/* ============================================================
   Сайдбар + виджеты
   ============================================================ */
.sidebar { min-width: 0; }
.widget {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 22px;
    margin-bottom: 22px;
    color: var(--ink);
}
.widget-title {
    font-size: 1.02rem;
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent);
    color: var(--ink);
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.widget li:last-child { border-bottom: 0; }
.widget a { color: var(--primary); }
.widget a:hover { color: var(--primary-dk); }
.widget .post-date { display: block; font-size: .78rem; color: var(--muted); }

/* ============================================================
   Форма поиска
   ============================================================ */
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font: inherit;
    background: #fff;
    color: var(--ink);
}
.search-form button {
    border: 0;
    background: var(--primary);
    color: #fff;
    padding: 0 18px;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 700;
}
.search-form button:hover { background: var(--primary-dk); }

/* ============================================================
   Пагинация (type => plain : .page-numbers)
   ============================================================ */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
    justify-content: center;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}
.pagination a.page-numbers:hover { border-color: var(--primary); color: var(--primary); }
.pagination .page-numbers.current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.pagination .page-numbers.dots {
    border: 0;
    background: transparent;
    color: var(--muted);
}

/* ============================================================
   Комментарии
   ============================================================ */
.comments-area { margin-top: 36px; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list li { margin: 0 0 18px; }
.comment-body {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 20px;
}
.comment-list .children { list-style: none; margin: 16px 0 0 28px; padding: 0; }
.comment-author { font-weight: 700; }
.comment-meta { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.comment-respond {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 22px 24px;
    margin-top: 24px;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font: inherit;
    margin-top: 4px;
    background: #fff;
    color: var(--ink);
}
.comment-form p { margin-bottom: 14px; }
.comment-form label { font-weight: 600; font-size: .9rem; }

/* ============================================================
   404
   ============================================================ */
.notfound { text-align: center; padding: 24px 0 8px; }
.notfound .code { font-family: var(--mono); font-size: clamp(4rem, 14vw, 8rem); font-weight: 800; color: var(--surface-alt); line-height: 1; }
.notfound h1 { margin-top: -.2em; }
.notfound .search-form { max-width: 440px; margin: 22px auto 0; }
.notfound .home-link { display: inline-block; margin-top: 18px; }

/* ============================================================
   Контакты (статичные, без форм/телефона)
   ============================================================ */
.contact-list { list-style: none; padding: 0; margin: 1.2em 0 0; }
.contact-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.contact-list .label { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: block; }

/* ============================================================
   Подвал
   ============================================================ */
.site-footer { background: var(--footer-bg); color: var(--footer-ink); margin-top: 40px; }
.footer-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 36px;
    padding: 54px 0 40px;
}
.footer-widgets .widget {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
    color: var(--footer-ink);
}
.footer-widgets .widget-title {
    color: var(--footer-head);
    border-bottom-color: var(--accent);
    font-size: .96rem;
}
.footer-widgets .widget,
.footer-widgets .widget p,
.footer-widgets .widget li,
.footer-widgets .widget .post-date { color: var(--footer-ink); }
.footer-widgets .widget a { color: #fff; }
.footer-widgets .widget a:hover { color: var(--accent); }
.footer-widgets .widget li { border-bottom: 1px solid var(--footer-line); }
.footer-widgets .widget .post-date { color: #9fb0cf; }

.footer-bottom {
    border-top: 1px solid var(--footer-line);
    padding: 20px 0;
    font-size: .85rem;
    color: #9fb0cf;
}

/* ============================================================
   Cookie-баннер
   ============================================================ */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    background: rgba(15,26,48,.97);
    color: #e6ecf7;
    padding: 16px 0;
    box-shadow: 0 -6px 24px rgba(0,0,0,.18);
}
.cookie-inner { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: space-between; }
.cookie-banner p { margin: 0; font-size: .9rem; max-width: 760px; }
.cookie-banner a { color: var(--accent); }
.cookie-banner .btn { white-space: nowrap; }

/* ============================================================
   Адаптив
   ============================================================ */
@media (max-width: 960px) {
    .main.has-sidebar { grid-template-columns: 1fr; gap: 36px; }
    .hero { grid-template-columns: 1fr; gap: 30px; padding: 40px 0; }
    .hero-art { order: -1; }
}

@media (max-width: 600px) {
    .home { width: 90%; }
    .main.no-sidebar { width: 90%; }
    .main.has-sidebar { width: 90%; }

    .header-top { flex-wrap: wrap; gap: 14px; }

    .nav-toggle { display: block; }
    .nav-inner { flex-wrap: wrap; }
    .main-nav { width: 100%; }
    .main-nav ul { display: none; flex-direction: column; width: 100%; padding-bottom: 8px; }
    .main-nav.is-open ul { display: flex; }
    .main-nav a { padding: 12px 6px; border-bottom: 1px solid var(--line); }
    .main-nav a:hover, .main-nav .current-menu-item > a { border-bottom-color: var(--line); }

    /* горизонтальная карточка → вертикальная */
    .card.row { flex-direction: column; }
    .card.row .card-thumb-wrap {
        flex: none;
        width: 100%;
        position: static;
        min-height: 0;
    }
    .card.row .card-thumb-wrap a,
    .card.row .card-thumb-wrap .card-thumb {
        position: static;
    }
    .card.row .card-thumb-wrap img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
    .card.row .card-thumb-fallback { position: static; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}
