/*
Theme Name: dds_red-ray.ru
Theme URI: https://red-ray.ru
Author: Алексей Комаров
Description: Информационная тема для образовательного онлайн-проекта Red Ray. Техно-индустриальный редакционный стиль «Атомный минимализм»: холодная палитра, чертёжная сетка, красный акцент.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: redray
*/

/* ============================================================
   Переменные
   ============================================================ */
:root {
    --ink: #0E1726;
    --ink-soft: #1B2A3D;
    --paper: #F2F5F8;
    --paper-alt: #E7ECF1;
    --red: #E23A2E;
    --red-dk: #C22C21;
    --line: #C9D2DA;
    --line-dk: #A9B6C2;
    --muted: #5E6E7C;
    --white: #FFFFFF;
    --shell: min(92%, 1180px);
    --mono: "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        repeating-linear-gradient(0deg, rgba(14,23,38,0.035) 0, rgba(14,23,38,0.035) 1px, transparent 1px, transparent 40px),
        repeating-linear-gradient(90deg, rgba(14,23,38,0.035) 0, rgba(14,23,38,0.035) 1px, transparent 1px, transparent 40px);
    overflow-x: hidden;
}

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

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

h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; color: var(--ink); }

p { margin: 0 0 1em; }

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

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--ink); color: #fff; padding: 10px 16px; z-index: 1000;
}
.skip-link:focus { left: 8px; top: 8px; }

.kicker {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--red);
    margin-bottom: 0.6rem;
}

/* Кнопки */
.btn {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.75em 1.5em;
    border: 2px solid var(--ink);
    border-radius: 0;
    cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
    line-height: 1.1;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dk); border-color: var(--red-dk); color: #fff; }
.btn-ghost { background: transparent; border-color: #fff; color: #fff; }
.btn-ghost:hover { background: #fff; color: var(--ink); }

/* ============================================================
   Шапка
   ============================================================ */
.site-head { background: var(--white); border-bottom: 1px solid var(--line); }
.head-rule { height: 4px; background: var(--red); }

.head-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.1rem 0;
    flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.brand-mark { flex: 0 0 auto; display: block; }
.brand-svg, .brand-logo { display: block; width: 52px; height: 52px; }
.brand-text { min-width: 0; }
.site-name {
    display: block;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: var(--ink);
    line-height: 1.25;
    max-width: 46ch;
}
.site-name:hover { text-decoration: none; color: var(--red-dk); }
.site-desc {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.4;
    max-width: 60ch;
    display: none;
}

.site-nav { flex: 0 0 auto; }
.nav-list {
    list-style: none;
    display: flex;
    gap: 0.4rem;
    margin: 0; padding: 0;
    flex-wrap: wrap;
}
.nav-list a {
    display: block;
    font-family: var(--mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ink);
    padding: 0.5em 0.85em;
    border: 1px solid transparent;
}
.nav-list a:hover { text-decoration: none; border-color: var(--line); background: var(--paper-alt); }
.nav-list .current-menu-item > a { border-color: var(--red); color: var(--red); }

.nav-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid var(--line);
    padding: 0.55rem 0.8rem;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--ink);
}
.nav-toggle span:not(.nav-toggle-label) {
    display: block; width: 20px; height: 2px; background: var(--ink); margin: 3px 0;
}
.nav-toggle-label { margin-left: 0.2rem; }

/* ============================================================
   Оболочка контента
   ============================================================ */
.site-main { display: block; padding-bottom: 3rem; }

.page-wrap { padding-top: 1.6rem; }

.crumbs {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 1.4rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--line);
}
.crumbs a { color: var(--ink); }
.crumbs .sep { color: var(--line-dk); margin: 0 0.15rem; }

.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 67fr) minmax(0, 27fr);
    gap: 3rem;
    align-items: start;
}
.layout-single {
    display: block;
    width: 85%;
    margin-inline: auto;
}
.content-area { min-width: 0; }

/* ============================================================
   Сайдбар
   ============================================================ */
.sidebar { min-width: 0; }
.sidebar .widget {
    background: var(--white);
    border: 1px solid var(--line);
    border-top: 3px solid var(--red);
    padding: 1.2rem 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--ink);
}
.sidebar .widget-title {
    font-family: var(--mono);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 0.9rem;
    color: var(--ink);
}
.sidebar .widget a { color: var(--ink); }
.sidebar .widget a:hover { color: var(--red-dk); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: 0.5rem 0; border-bottom: 1px dashed var(--line); }
.sidebar li:last-child { border-bottom: 0; }

.recent-list li { display: flex; flex-direction: column; }
.recent-list time { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; }

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

.card {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--line);
    overflow: hidden;
    min-width: 0;
    transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--red); transform: translateY(-2px); }

.card-thumb { display: block; }
.card-thumb a { display: block; }
.card-thumb img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 5 / 3;
    object-fit: cover;
}
.card-thumb--ph svg { display: block; width: 100%; height: auto; aspect-ratio: 5 / 3; }

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1.2rem 1.2rem;
    min-width: 0;
}
.card-meta {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.6rem;
}
.card-cat a { color: var(--red); }
.card-title { font-size: 1.15rem; margin: 0 0 0.5rem; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--red-dk); text-decoration: none; }
.card-excerpt { color: var(--ink); font-size: 0.95rem; }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more {
    margin-top: auto;
    font-family: var(--mono);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--red-dk);
    padding-top: 0.7rem;
}

/* ============================================================
   Главная — секции
   ============================================================ */
.fs { padding: 3.2rem 0; position: relative; }
.fs:nth-of-type(even) { background: var(--paper-alt); }
.fs-title { font-size: 1.9rem; margin: 0 0 1.6rem; position: relative; }
.fs-title::after { content: ""; display: block; width: 46px; height: 3px; background: var(--red); margin-top: 0.6rem; }

/* Hero */
.fs-hero { padding: 0; overflow: hidden; background: var(--ink); }
.fs-hero-bg {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0.5;
}
.fs-hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(120deg, rgba(14,23,38,0.92) 0%, rgba(14,23,38,0.6) 60%, rgba(226,58,46,0.35) 100%);
}
.fs-hero-inner { position: relative; padding: 5rem 0; color: #fff; }
.fs-hero .kicker { color: #ff9d94; }
.fs-hero-title { font-size: 2.6rem; color: #fff; margin: 0 0 1rem; max-width: 20ch; }
.fs-hero-sub { font-size: 1.1rem; color: #DDE6EE; max-width: 55ch; margin-bottom: 1.8rem; }

/* Шаги */
.steps {
    list-style: none; margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1.4rem;
}
.step {
    background: var(--white);
    border: 1px solid var(--line);
    border-left: 4px solid var(--red);
    padding: 1.4rem 1.4rem 1.5rem;
    min-width: 0;
}
.step-num {
    display: block;
    font-family: var(--mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--red);
    line-height: 1;
    margin-bottom: 0.6rem;
}
.step-title { font-size: 1.1rem; margin: 0 0 0.4rem; }
.step-text { font-size: 0.92rem; color: var(--ink-soft); margin: 0; }

/* Текст + иллюстрация */
.fs-split-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2.6rem;
    align-items: center;
}
.fs-split-text { min-width: 0; }
.fs-split-media { min-width: 0; }
.fs-split-media img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    background: var(--white);
}

/* CTA */
.fs-cta {
    background: var(--ink);
    color: #fff;
    padding: 2.6rem 2.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.8rem;
    flex-wrap: wrap;
    border-left: 4px solid var(--red);
}
.fs-cta-title { color: #fff; font-size: 1.5rem; margin: 0 0 0.5rem; }
.fs-cta-text { min-width: 0; }
.fs-cta-text p { color: #DDE6EE; margin: 0; max-width: 52ch; }

.empty { color: var(--muted); font-family: var(--mono); font-size: 0.9rem; }

/* ============================================================
   Записи и страницы
   ============================================================ */
.arch-head { margin-bottom: 1.8rem; }
.arch-title { font-size: 2rem; margin: 0 0 0.4rem; }
.arch-title::after { content: ""; display: block; width: 46px; height: 3px; background: var(--red); margin-top: 0.6rem; }
.arch-desc { color: var(--muted); }

.post-single { background: var(--white); border: 1px solid var(--line); padding: 1.8rem 2rem 2rem; }
.post-title { font-size: 2.1rem; margin: 0 0 0.6rem; }
.post-meta {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.4rem;
}
.post-cats a { color: var(--red); }
.post-cover { margin: 0 0 1.6rem; }
.post-cover img { display: block; width: 100%; height: auto; border: 1px solid var(--line); }

.post-content { font-size: 1.05rem; line-height: 1.75; }
.post-content h2 { font-size: 1.55rem; margin: 1.8rem 0 0.8rem; }
.post-content h3 { font-size: 1.25rem; margin: 1.5rem 0 0.6rem; }
.post-content img { height: auto; }
.post-content a { text-decoration: underline; }
.post-content blockquote {
    margin: 1.5rem 0;
    padding: 1.2rem 1.4rem;
    background: var(--paper-alt);
    border-left: 4px solid var(--red);
    color: var(--ink-soft);
}
.post-content ul, .post-content ol { padding-left: 1.4rem; }
.post-content code {
    font-family: var(--mono);
    background: var(--paper-alt);
    padding: 0.1em 0.4em;
    font-size: 0.9em;
}
.post-content pre {
    background: var(--ink);
    color: #E7ECF1;
    padding: 1.2rem;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.88rem;
}

.post-tags { margin-top: 1.6rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.post-tags a {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 0.25em 0.7em;
}
.post-tags a:hover { border-color: var(--red); color: var(--red); text-decoration: none; }

.page-links { margin-top: 1.4rem; font-family: var(--mono); font-size: 0.85rem; }

/* Таблицы */
.post-content table { border-collapse: collapse; width: 100%; margin: 1.4rem 0; }
.post-content table, .post-content th, .post-content td { border: 1px solid var(--line-dk); }
.post-content th, .post-content td { padding: 0.6rem 0.8rem; text-align: left; }
.post-content th { background: var(--paper-alt); }

/* ============================================================
   Пагинация
   ============================================================ */
.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 2.4rem;
    justify-content: center;
}
.pager .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 0.5em 0.8em;
    border: 1px solid var(--line-dk);
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--ink);
    background: var(--white);
}
.pager a.page-numbers:hover { border-color: var(--red); color: var(--red); text-decoration: none; }
.pager .page-numbers.current { background: var(--red); border-color: var(--red); color: #fff; }
.pager .page-numbers.dots { border-color: transparent; background: transparent; }

/* ============================================================
   Поиск / уведомления / 404
   ============================================================ */
.search-form { margin: 1.2rem 0; }
.search-label { display: block; font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.search-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.search-field {
    flex: 1 1 220px;
    min-width: 0;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--line-dk);
    background: var(--white);
    font-family: var(--sans);
    font-size: 1rem;
    color: var(--ink);
}
.search-field:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.search-submit { flex: 0 0 auto; }

.notice { background: var(--white); border: 1px solid var(--line); padding: 1.6rem 1.8rem; }

.error-404 { background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--red); padding: 2.4rem 2rem 2.6rem; text-align: center; }
.err-code { font-family: var(--mono); font-size: 4.5rem; color: var(--red); margin: 0.3rem 0 0; line-height: 1; }
.err-title { font-size: 1.6rem; margin: 0.4rem 0 0.8rem; }
.err-text { color: var(--muted); max-width: 46ch; margin: 0 auto 1.4rem; }
.error-404 .search-form { max-width: 460px; margin-inline: auto; }
.err-home { margin-top: 1.4rem; }

/* ============================================================
   Комментарии
   ============================================================ */
.comments { margin-top: 2.4rem; background: var(--white); border: 1px solid var(--line); padding: 1.6rem 1.8rem 1.8rem; }
.comments-title { font-size: 1.4rem; margin: 0 0 1.2rem; }
.comment-list { list-style: none; margin: 0 0 1.6rem; padding: 0; }
.comment-list .children { list-style: none; margin: 0.8rem 0 0 1.4rem; padding-left: 1rem; border-left: 2px solid var(--line); }
.comment-item { margin-bottom: 1.2rem; }
.comment-body { background: var(--paper); border: 1px solid var(--line); padding: 1rem 1.2rem; }
.comment-head { display: flex; gap: 1rem; align-items: baseline; margin-bottom: 0.5rem; flex-wrap: wrap; }
.comment-author { font-weight: 700; }
.comment-date { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.comment-text { font-size: 0.98rem; }
.comment-await { color: var(--red-dk); font-style: italic; font-size: 0.9rem; }
.comment-reply { margin-top: 0.4rem; }
.comment-reply a { font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; }
.comment-respond { margin-top: 1.4rem; }
.comment-form label { display: block; font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase; color: var(--muted); margin-bottom: 0.3rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--line-dk);
    background: var(--white);
    font-family: var(--sans);
    font-size: 1rem;
    color: var(--ink);
    margin-bottom: 1rem;
}
.comment-form textarea { min-height: 130px; }
.comments-closed { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; }

/* ============================================================
   Подвал
   ============================================================ */
.site-foot { background: var(--ink); color: #C6D2DE; margin-top: 2rem; }
.foot-rule { height: 4px; background: var(--red); }
.foot-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 2rem;
    padding: 2.6rem 0 1.8rem;
}
.foot-col { min-width: 0; }
.site-foot .widget { margin: 0; color: #C6D2DE; }
.site-foot .widget-title {
    font-family: var(--mono);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    margin: 0 0 0.9rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.site-foot .widget p, .site-foot .widget li { color: #C6D2DE; }
.site-foot .widget a { color: #E7ECF1; }
.site-foot .widget a:hover { color: var(--red); }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { padding: 0.4rem 0; border-bottom: 1px dashed rgba(255,255,255,0.12); }
.site-foot li:last-child { border-bottom: 0; }
.site-foot .recent-list time { color: #8FA1B2; }

.foot-base { padding: 1.2rem 0 1.8rem; border-top: 1px solid rgba(255,255,255,0.12); }
.copyright { margin: 0; font-family: var(--mono); font-size: 0.8rem; color: #8FA1B2; }

/* ============================================================
   Cookie-баннер
   ============================================================ */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 900;
    background: var(--ink);
    color: #E7ECF1;
    border-top: 3px solid var(--red);
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}
.cookie-text { margin: 0; font-size: 0.88rem; max-width: 80ch; }
.cookie-accept {
    flex: 0 0 auto;
    font-family: var(--mono);
    font-size: 0.82rem;
    text-transform: uppercase;
    background: var(--red);
    color: #fff;
    border: 0;
    padding: 0.65rem 1.4rem;
    cursor: pointer;
}
.cookie-accept:hover { background: var(--red-dk); }

/* ============================================================
   Адаптив
   ============================================================ */
@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; gap: 2.2rem; }
    .fs-split-inner { grid-template-columns: 1fr; gap: 1.6rem; }
    .fs-hero-title { font-size: 2.1rem; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    .site-desc { display: none; }

    .nav-toggle { display: inline-flex; }
    .site-nav {
        flex-basis: 100%;
        display: none;
    }
    .site-nav.is-open { display: block; }
    .nav-list { flex-direction: column; gap: 0; }
    .nav-list a { border: 0; border-bottom: 1px solid var(--line); }

    .layout-single { width: 100%; }
    .fs { padding: 2.2rem 0; }
    .fs-hero-inner { padding: 3rem 0; }
    .fs-hero-title { font-size: 1.7rem; }
    .fs-title { font-size: 1.5rem; }

    .fs-cta { padding: 1.8rem 1.4rem; flex-direction: column; align-items: flex-start; }
    .post-single { padding: 1.3rem 1.2rem 1.5rem; }
    .post-title { font-size: 1.6rem; }
    .post-content { font-size: 1rem; }
    .comments { padding: 1.2rem 1.1rem 1.4rem; }
    .err-code { font-size: 3.4rem; }
}
