/*
Theme Name: dds_anthonyrsoto.com
Author: Anthony Soto
Description: Аналитический ресурс о нарративном дизайне и сценаристике в видеоиграх. Тёмная атмосферная тема в стиле журнального эссе с режимом «Сценарий».
Version: 1.1
Text Domain: ndsoto
*/

/* =========================================================================
   Переменные
   ========================================================================= */
:root {
    --bg:           #0F1117;
    --bg-soft:      #161924;
    --bg-card:      #1A1E2A;
    --bg-elevated:  #20242F;
    --text:         #E5E5E5;
    --text-dim:     #A7ABB5;
    --heading:      #F5F5F5;
    --accent:       #D9B48B;
    --accent-soft:  rgba(217, 180, 139, 0.10);
    --accent-line:  rgba(217, 180, 139, 0.35);
    --graphite:     #6B6E7A;
    --border:       #2A2E3A;
    --radius:       4px;
    --shell:        1180px;
    --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-head:    'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-mono:    'SFMono-Regular', 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-head);
    color: var(--heading);
    line-height: 1.25;
    font-weight: 600;
    margin: 0 0 0.6em;
}
h1 { font-size: 2.3rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.12rem; }

p { margin: 0 0 1.1em; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color .2s ease, border-color .2s ease;
}
a:hover { color: #ecd2b0; }

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

ul, ol { padding-left: 1.3em; }

blockquote {
    margin: 1.6em 0;
    padding: 0.4em 1.4em;
    border-left: 3px solid var(--accent-line);
    color: var(--text-dim);
    font-style: italic;
}

code, pre {
    font-family: var(--font-mono);
    font-size: 0.92em;
}
pre {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1em 1.2em;
    overflow-x: auto;
}

/* Таблицы (видимые границы) */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    border: 1px solid var(--border);
}
th, td {
    border: 1px solid var(--border);
    padding: 0.6em 0.9em;
    text-align: left;
}
th {
    background: var(--bg-elevated);
    color: var(--heading);
    font-family: var(--font-body);
    font-weight: 600;
}

/* =========================================================================
   Контейнер
   ========================================================================= */
.shell {
    width: min(92%, var(--shell));
    margin-inline: auto;
}

/* =========================================================================
   Кнопки
   ========================================================================= */
.btn {
    display: inline-block;
    font-family: var(--font-body);
    border: 1px solid var(--accent);
    color: var(--accent);
    background: transparent;
    border-radius: var(--radius);
    padding: 0.62em 1.4em;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
    line-height: 1.3;
}
.btn:hover {
    border-color: #ecd2b0;
    background: var(--accent-soft);
    color: #ecd2b0;
}
.btn-primary { font-weight: 700; }
.btn-secondary {
    font-weight: 400;
    border-color: var(--graphite);
    color: var(--text-dim);
}
.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* =========================================================================
   Шапка
   ========================================================================= */
.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg-soft);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 0;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}
.brand-logo { display: block; height: 52px; width: auto; }
.brand-mark { flex: 0 0 auto; }
.brand-text { min-width: 0; }
.site-title {
    font-family: var(--font-head);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--heading);
    margin: 0;
    line-height: 1.3;
    max-width: 46ch;
}
.site-title a { color: inherit; }
.site-desc {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: var(--text-dim);
    max-width: 60ch;
    line-height: 1.5;
}

/* Навигация */
.main-nav { background: var(--bg); border-bottom: 1px solid var(--border); }
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 0.4em 0.8em;
    cursor: pointer;
    font-family: var(--font-body);
}
.nav-menu {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
}
.nav-menu a {
    display: block;
    color: var(--text);
    padding: 14px 16px;
    font-size: 0.95rem;
    border-bottom: 2px solid transparent;
}
.nav-menu a:hover,
.nav-menu .current-menu-item > a {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.nav-extra { display: flex; align-items: center; gap: 10px; }

/* Кнопка режима «Сценарий» */
.script-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: var(--radius);
    width: 40px; height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease;
}
.script-toggle:hover { border-color: var(--accent); color: var(--accent); }
.script-toggle svg { width: 20px; height: 20px; }

/* =========================================================================
   Раскладки
   ========================================================================= */
.site-main { padding: 40px 0 60px; }

.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 67fr) minmax(0, 27fr);
    gap: 44px;
    align-items: start;
}
.layout-single { display: block; }
.layout-single .content-area { width: 100%; }

.layout-front { width: 85%; margin: 0 auto; }

@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; gap: 36px; }
    .layout-front { width: 100%; }
}

/* =========================================================================
   Сайдбар (светлый текст на тёмном фоне)
   ========================================================================= */
.sidebar { min-width: 0; }
.sidebar .widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 22px;
    margin-bottom: 26px;
}
.sidebar .widget-title {
    font-family: var(--font-head);
    font-size: 1.15rem;
    color: var(--heading);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--accent-line);
}
.sidebar .widget,
.sidebar .widget p,
.sidebar .widget li { color: var(--text); }
.sidebar .widget a { color: var(--accent); }
.sidebar .widget a:hover { color: #ecd2b0; }
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}
.sidebar li:last-child { border-bottom: 0; }
.sidebar .post-date,
.sidebar .rss-date { color: var(--text-dim); font-size: 0.82rem; }

/* =========================================================================
   Карточки записей (A8, A10)
   ========================================================================= */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 28px;
}
.card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .2s ease, transform .2s ease;
}
.card:hover { border-color: var(--accent-line); transform: translateY(-2px); }

.card-thumb {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-elevated);
}
.card-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 16 / 9;
}
.card-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #1A1E2A, #232838);
}
.card-thumb-placeholder svg { width: 56px; height: 56px; opacity: 0.5; }

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 22px 24px;
    min-width: 0;
}
.card-cat {
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}
.card-title {
    font-size: 1.25rem;
    margin: 0 0 10px;
    line-height: 1.3;
}
.card-title a { color: var(--heading); }
.card-title a:hover { color: var(--accent); }
.card-excerpt { color: var(--text-dim); font-size: 0.95rem; }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-meta {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.82rem;
    color: var(--text-dim);
}

/* Горизонтальная карточка (лента на главной) — паттерн position:absolute (A10) */
.card-row {
    flex-direction: row;
    align-items: stretch;
}
.card-row .card-thumb-wrap {
    flex: 0 0 300px;
    position: relative;
    overflow: hidden;
    min-width: 0;
}
.card-row .card-thumb-wrap a {
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
.card-row .card-thumb-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-row .card-thumb-placeholder { position: absolute; inset: 0; aspect-ratio: auto; }

@media (max-width: 600px) {
    .card-row { flex-direction: column; }
    .card-row .card-thumb-wrap {
        flex: none;
        width: 100%;
        position: static;
    }
    .card-row .card-thumb-wrap a { position: static; }
    .card-row .card-thumb-wrap img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

.feed { display: flex; flex-direction: column; gap: 24px; }

/* =========================================================================
   Тематические секции (front-page)
   ========================================================================= */
.section { margin: 56px 0; }
.section-lead { margin-top: 28px; }
.section-head {
    margin-bottom: 26px;
}
.section-eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}
.section-title { font-size: 2rem; margin: 0 0 12px; }
.section-intro { color: var(--text-dim); max-width: 68ch; }

.hero {
    padding: 70px 0 50px;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(900px 320px at 80% -10%, rgba(217,180,139,0.10), transparent 60%),
        var(--bg-soft);
}
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); max-width: 22ch; }
.hero p { color: var(--text-dim); max-width: 60ch; font-size: 1.05rem; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 26px; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}
.feature {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 24px;
    min-width: 0;
}
.feature h3 { font-size: 1.2rem; }
.feature p { color: var(--text-dim); margin: 0; font-size: 0.95rem; }
.feature .num {
    font-family: var(--font-head);
    font-size: 1.6rem;
    color: var(--accent);
    display: block;
    margin-bottom: 8px;
}

.topic-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.topic-list li {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-line);
    border-radius: var(--radius);
    padding: 16px 18px;
    color: var(--text);
    min-width: 0;
}

/* =========================================================================
   Запись / страница
   ========================================================================= */
.entry { min-width: 0; }
.entry-header { margin-bottom: 26px; }
.entry-title { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--text-dim);
    font-size: 0.88rem;
    margin-top: 12px;
}
.entry-meta .cat-link { color: var(--accent); }
.entry-thumb { margin: 0 0 30px; }
.entry-thumb img { width: 100%; border-radius: var(--radius); display: block; }
.entry-content > * { max-width: 100%; }
.entry-content h2 { margin-top: 1.6em; }
.entry-content img { border-radius: var(--radius); }

.entry-footer {
    margin-top: 36px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}
.tag-links a {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 12px;
    margin: 0 6px 6px 0;
    font-size: 0.85rem;
    color: var(--text-dim);
}
.tag-links a:hover { border-color: var(--accent); color: var(--accent); }

/* Спойлер-блоки (вторичный акцент) */
.spoiler {
    border: 1px solid var(--graphite);
    border-radius: var(--radius);
    margin: 1.6em 0;
    background: rgba(107, 110, 122, 0.08);
}
.spoiler > summary,
.spoiler-toggle {
    cursor: pointer;
    padding: 14px 18px;
    font-weight: 600;
    color: var(--heading);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.spoiler > summary::-webkit-details-marker { display: none; }
.spoiler > summary::before {
    content: '▸';
    color: var(--graphite);
    transition: transform .2s ease;
}
.spoiler[open] > summary::before { transform: rotate(90deg); }
.spoiler .spoiler-body { padding: 0 18px 16px; color: var(--text-dim); }

/* Врезка «точка принятия решения» */
.decision-point {
    border: 1px solid var(--graphite);
    border-left: 4px solid var(--graphite);
    border-radius: var(--radius);
    background: rgba(107, 110, 122, 0.10);
    padding: 20px 22px;
    margin: 1.8em 0;
}
.decision-point .dp-label {
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--graphite);
    font-weight: 700;
    margin-bottom: 6px;
}
.decision-point .dp-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}
.decision-point .dp-option {
    text-align: left;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: var(--radius);
    padding: 10px 14px;
    cursor: pointer;
    font-family: var(--font-body);
    transition: border-color .2s ease;
}
.decision-point .dp-option:hover { border-color: var(--graphite); }
.decision-point .dp-result {
    margin-top: 12px;
    color: var(--text-dim);
    font-size: 0.95rem;
}
.decision-point .dp-result[hidden] { display: none !important; }

/* =========================================================================
   Хлебные крошки
   ========================================================================= */
.breadcrumbs {
    font-size: 0.85rem;
    color: var(--text-dim);
    padding: 16px 0 6px;
}
.breadcrumbs a { color: var(--text-dim); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 4px; color: var(--graphite); }
.breadcrumbs span:last-child { color: var(--text); }

/* =========================================================================
   Пагинация
   ========================================================================= */
.pagination { margin: 44px 0 0; }
.pagination ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    margin: 0;
}
.pagination a,
.pagination span {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px;
    color: var(--text);
    font-size: 0.92rem;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

/* =========================================================================
   Форма поиска
   ========================================================================= */
.search-form {
    display: flex;
    gap: 8px;
    max-width: 520px;
}
.search-form .search-field {
    flex: 1;
    min-width: 0;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 0.6em 0.9em;
    font-family: var(--font-body);
    font-size: 0.95rem;
}
.search-form .search-field:focus {
    outline: none;
    border-color: var(--accent);
}
.search-form .search-submit { white-space: nowrap; }

/* =========================================================================
   Комментарии
   ========================================================================= */
.comments-area { margin-top: 48px; padding-top: 30px; border-top: 1px solid var(--border); }
.comments-title, .comment-reply-title { font-size: 1.5rem; }
.comment-list { list-style: none; padding: 0; margin: 0 0 30px; }
.comment-list .children { list-style: none; margin: 0; padding-left: 26px; }
.comment-item { margin: 0 0 18px; }
.comment-inner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.comment-head {
    display: flex;
    gap: 14px;
    align-items: baseline;
    margin-bottom: 8px;
}
.comment-author { font-weight: 600; color: var(--heading); }
.comment-date { font-size: 0.82rem; color: var(--text-dim); }
.comment-await { color: var(--accent); font-size: 0.88rem; }
.comment-actions { margin-top: 8px; font-size: 0.88rem; }

.comment-form { max-width: 640px; }
.comment-form p { margin-bottom: 14px; }
.comment-form label { display: block; margin-bottom: 4px; color: var(--text-dim); font-size: 0.9rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 0.6em 0.9em;
    font-family: var(--font-body);
    font-size: 0.95rem;
}
.comment-form input:focus,
.comment-form textarea:focus { outline: none; border-color: var(--accent); }
.comment-form .form-submit input { cursor: pointer; }

/* =========================================================================
   404
   ========================================================================= */
.error-404 { text-align: center; padding: 50px 0; }
.error-404 .code {
    font-family: var(--font-head);
    font-size: clamp(4rem, 12vw, 8rem);
    color: var(--accent);
    line-height: 1;
    margin: 0;
}
.error-404 .search-form { margin: 26px auto 0; }

/* =========================================================================
   Подвал (тёмный фон → светлый текст)
   ========================================================================= */
.site-footer {
    background: #0B0D13;
    border-top: 1px solid var(--border);
    padding: 50px 0 0;
    margin-top: 40px;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px;
}
@media (max-width: 960px) {
    .footer-cols { grid-template-columns: 1fr; gap: 32px; }
}
.footer-cols .widget { margin: 0; }
.footer-cols .widget-title {
    font-family: var(--font-head);
    font-size: 1.1rem;
    color: var(--heading);
    margin: 0 0 14px;
}
.footer-cols .widget,
.footer-cols .widget p,
.footer-cols .widget li { color: #C6C9D2; font-size: 0.92rem; }
.footer-cols .widget a { color: var(--accent); }
.footer-cols .widget a:hover { color: #ecd2b0; }
.footer-cols ul { list-style: none; padding: 0; margin: 0; }
.footer-cols li { padding: 6px 0; }
.site-info {
    border-top: 1px solid var(--border);
    margin-top: 44px;
    padding: 22px 0;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-align: center;
}

/* =========================================================================
   Cookie-баннер (A11)
   ========================================================================= */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    background: var(--bg-elevated);
    border-top: 1px solid var(--accent-line);
    padding: 16px 0;
}
.cookie-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.cookie-text { color: var(--text); font-size: 0.9rem; margin: 0; max-width: 70ch; }
.cookie-text a { color: var(--accent); }

/* =========================================================================
   Режим «Сценарий» — моноширинный шрифт, без изображений
   ========================================================================= */
body.script-mode .entry-content,
body.script-mode .entry-content p,
body.script-mode .entry-content li,
body.script-mode .card-excerpt,
body.script-mode blockquote {
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}
body.script-mode .entry-thumb,
body.script-mode .entry-content img,
body.script-mode .card-thumb,
body.script-mode .card-thumb-wrap,
body.script-mode .hero { display: none !important; }
body.script-mode .script-toggle { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* =========================================================================
   Адаптив
   ========================================================================= */
@media (max-width: 600px) {
    body { font-size: 16px; }
    h1 { font-size: 1.9rem; }
    .menu-toggle { display: inline-block; }
    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 8px 0 14px;
    }
    .nav-menu.is-open { display: flex; }
    .nav-inner { flex-wrap: wrap; padding: 8px 0; }
    .nav-menu a { padding: 12px 6px; }
    .header-inner { padding: 18px 0; }
    .site-title { font-size: 1.02rem; }
}
