/*
Theme Name: dds_roulette-rules.ru
Author: Дмитрий Кравцов
Description: Информационная тема для техноблога о алгоритмах, вероятностях и искусственном интеллекте.
Version: 1.1
Text Domain: tehnova
*/

/* ============================================================
   Токены
   ============================================================ */
:root {
    --bg: #f5f6f9;
    --surface: #ffffff;
    --ink: #14181f;
    --muted: #5a6472;
    --line: #e3e6eb;
    --primary: #4338ca;
    --primary-d: #352bb0;
    --accent: #06b6d4;
    --chance: #d98a1f;
    --dark: #0e1320;
    --dark-2: #161d30;
    --dark-ink: #e8ebf3;
    --dark-muted: #9aa4ba;
    --radius: 14px;
    --shell: min(92%, 1180px);
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
}

/* ============================================================
   База
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

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

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1.1em; }

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

.shell { width: var(--shell); margin-inline: auto; }

.eyebrow {
    font-family: var(--font-mono);
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--primary);
    display: inline-block;
    margin-bottom: .7rem;
}

.btn {
    display: inline-block;
    padding: .7em 1.4em;
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
    font-size: .95rem;
    transition: background .2s ease;
}
.btn:hover { background: var(--primary-d); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn--ghost:hover { background: var(--primary); color: #fff; }

/* ============================================================
   Шапка
   ============================================================ */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1rem 0;
}
.brand { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.brand-logo { display: block; width: 48px; height: 48px; }
.brand-text { min-width: 0; }
.brand-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ink);
    display: block;
    line-height: 1.25;
    max-width: 46ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.brand-name:hover { text-decoration: none; }
.brand-desc {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.3;
    max-width: 58ch;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .5rem .7rem;
    cursor: pointer;
    color: var(--ink);
    font-size: 1.1rem;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 1.4rem;
    margin: 0;
    padding: 0;
}
.main-nav a {
    color: var(--ink);
    font-weight: 500;
    font-size: .98rem;
}
.main-nav a:hover { color: var(--primary); text-decoration: none; }
.main-nav .current-menu-item > a { color: var(--primary); }

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

/* ============================================================
   Раскладки
   ============================================================ */
.site-main { padding: 2.5rem 0 3.5rem; }

.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 2.5rem;
    align-items: start;
}
.layout-single { display: block; }
.layout-single .content-area { max-width: 820px; margin-inline: auto; }

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

/* ============================================================
   Сайдбар (светлый фон → тёмный текст)
   ============================================================ */
.sidebar { min-width: 0; }
.sidebar .widget {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem;
    margin-bottom: 1.5rem;
    color: var(--ink);
}
.sidebar .widget-title {
    font-size: 1rem;
    color: var(--ink);
    margin-bottom: 1rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid var(--primary);
}
.sidebar .widget a { color: var(--ink); }
.sidebar .widget a:hover { color: var(--primary); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.sidebar li:last-child { border-bottom: none; }
.sidebar .post-date { display: block; color: var(--muted); font-size: .8rem; font-family: var(--font-mono); }

/* ============================================================
   Карточки записей
   ============================================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.6rem;
}
.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(20, 24, 31, .08); }
.card-thumb {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, #1d2540, #2c3a66);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-body { flex: 1; display: flex; flex-direction: column; padding: 1.3rem; }
.card-meta {
    font-family: var(--font-mono);
    font-size: .76rem;
    color: var(--muted);
    margin-bottom: .5rem;
    letter-spacing: .03em;
}
.card-title { font-size: 1.15rem; margin-bottom: .6rem; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--primary); text-decoration: none; }
.card-excerpt { color: var(--muted); font-size: .94rem; }
.card-excerpt p { margin: 0 0 .5em; background: none; }
.card-more {
    margin-top: auto;
    padding-top: .9rem;
    font-weight: 600;
    font-size: .9rem;
    color: var(--primary);
}

/* ============================================================
   Одиночная запись / страница
   ============================================================ */
.entry {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2rem;
}
.entry-header { margin-bottom: 1.5rem; }
.entry-meta { font-family: var(--font-mono); font-size: .82rem; color: var(--muted); }
.entry-thumb { border-radius: var(--radius); overflow: hidden; margin: 1.5rem 0; }
.entry-thumb img { width: 100%; display: block; }
.entry-content { font-size: 1.05rem; }
.entry-content img { border-radius: 10px; display: block; }
.entry-content h2 { margin-top: 1.6em; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }

.tax-links { margin-top: 2rem; font-size: .9rem; color: var(--muted); }
.tax-links a {
    display: inline-block;
    background: #eef0fb;
    color: var(--primary);
    padding: .25em .7em;
    border-radius: 999px;
    margin: .2em .2em 0 0;
    font-size: .82rem;
}
.tax-links a:hover { text-decoration: none; background: var(--primary); color: #fff; }

/* Таблицы */
.entry-content table { border-collapse: collapse; width: 100%; margin: 1.5rem 0; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: .6em .8em; text-align: left; }
.entry-content th { background: #f0f2f7; }

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

/* ============================================================
   Главная
   ============================================================ */
.section { padding: 3.5rem 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: 720px; margin-bottom: 2rem; }
.section-head p { color: var(--muted); }

/* Блок 1: текст + иллюстрация */
.split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3rem;
    align-items: center;
}
.split-media img { width: 100%; display: block; border-radius: var(--radius); }
.split-text p { color: var(--muted); font-size: 1.02rem; }

/* Блок 2: сетка направлений */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.4rem;
}
.tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem;
}
.tile-ico {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #eef0fb;
    margin-bottom: 1rem;
    color: var(--primary);
}
.tile h3 { font-size: 1.08rem; }
.tile p { color: var(--muted); font-size: .92rem; margin: 0; }

/* Блок: последние записи (обёртка) */
.latest { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* Блок 3: цитата */
.quote-band { background: var(--dark); color: var(--dark-ink); }
.quote-band .eyebrow { color: var(--accent); }
.quote-band blockquote {
    margin: 0;
    font-size: 1.7rem;
    line-height: 1.4;
    font-weight: 600;
    max-width: 22ch;
    letter-spacing: -.01em;
}
.quote-band .quote-wrap { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 2.5rem; align-items: center; }
.quote-band cite { display: block; margin-top: 1.5rem; font-style: normal; color: var(--dark-muted); font-family: var(--font-mono); font-size: .85rem; }
.quote-band .quote-figure img { width: 100%; display: block; border-radius: var(--radius); }

/* Блок 4: CTA */
.cta-band {
    background: linear-gradient(120deg, var(--primary), #5b50e0);
    color: #fff;
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .85); max-width: 50ch; margin-inline: auto; }
.cta-band .btn { background: #fff; color: var(--primary); margin-top: .8rem; }
.cta-band .btn:hover { background: #eef0fb; }

/* ============================================================
   Поиск / 404
   ============================================================ */
.search-form { display: flex; gap: .5rem; max-width: 480px; }
.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: .65em .9em;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
    background: var(--surface);
    color: var(--ink);
}
.search-form button {
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    padding: 0 1.2em;
    cursor: pointer;
    font-weight: 600;
}
.search-form button:hover { background: var(--primary-d); }

.notfound { text-align: center; padding: 3rem 0; }
.notfound-code { font-family: var(--font-mono); font-size: 4rem; color: var(--primary); font-weight: 700; }
.notfound .search-form { margin: 1.5rem auto; }

/* ============================================================
   Комментарии
   ============================================================ */
.comments-area { margin-top: 2.5rem; }
.comment-list { list-style: none; margin: 1.5rem 0; padding: 0; }
.comment-list ul { list-style: none; margin-left: 1.5rem; padding: 0; }
.comment-inner {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 1rem;
}
.comment-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.comment-author { font-weight: 700; }
.comment-date { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }
.comment-tools { margin-top: .5rem; font-size: .85rem; }
.comment-respond {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: .6em .8em;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
    margin-bottom: 1rem;
    background: var(--bg);
}
.comment-form textarea { min-height: 120px; }
.comment-form .submit {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: .7em 1.6em;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================================
   Cookie-баннер — правило [hidden] идёт ДО основного блока (A11)
   ============================================================ */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 999;
    background: var(--dark);
    color: var(--dark-ink);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
    max-width: 760px;
    margin-inline: auto;
}
.cookie-banner p { margin: 0; font-size: .9rem; color: var(--dark-muted); flex: 1; min-width: 200px; }
.cookie-banner a { color: var(--accent); }
.cookie-banner button {
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    padding: .6em 1.4em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.cookie-banner button:hover { background: var(--primary-d); }

/* ============================================================
   Подвал (тёмный фон → светлый текст), явный цвет на виджеты
   ============================================================ */
.site-footer { background: var(--dark); color: var(--dark-ink); margin-top: 3rem; }
.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
    padding: 3rem 0 2rem;
}
.footer-cols .widget { color: var(--dark-ink); }
.footer-cols .widget-title {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 1rem;
}
.footer-cols .widget,
.footer-cols .widget p,
.footer-cols .widget li,
.footer-cols .widget .post-date { color: var(--dark-muted); }
.footer-cols .widget a { color: var(--dark-ink); }
.footer-cols .widget a:hover { color: var(--accent); }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { padding: .35rem 0; font-size: .92rem; }
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding: 1.3rem 0;
    font-size: .85rem;
    color: var(--dark-muted);
    text-align: center;
}

/* ============================================================
   Адаптив
   ============================================================ */
@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; }
    .split { grid-template-columns: 1fr; gap: 1.8rem; }
    .split--reverse .split-media { order: -1; }
    .quote-band .quote-wrap { grid-template-columns: 1fr; }
    .footer-cols { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    h1 { font-size: 1.7rem; }
    h2 { font-size: 1.4rem; }
    .nav-toggle { display: inline-flex; }
    .main-nav {
        display: none;
        width: 100%;
        margin-top: 1rem;
    }
    .main-nav.is-open { display: block; }
    .main-nav ul { flex-direction: column; gap: .2rem; }
    .main-nav li { border-bottom: 1px solid var(--line); }
    .main-nav a { display: block; padding: .7rem 0; }
    .header-inner { flex-wrap: wrap; }
    .brand-name { white-space: normal; }
    .section { padding: 2.5rem 0; }
    .cta-band { padding: 2rem; }
    .footer-cols { grid-template-columns: 1fr; }
    .quote-band blockquote { font-size: 1.35rem; }
}

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