/* =====================================================
   STIHI — публичные стили (главная + страница стиха)
   Цвета и шрифты — как в новом макете dimkarmov.ru
   ===================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --main: #008585;
    --bright: #05ffff;
    --bright-rgb: 5, 255, 255;

    --bg: #050505;
    --text: #ffffff;
    --text-muted: #bbbbbb;
    --glass-1: rgba(255,255,255,0.08);
    --glass-2: rgba(255,255,255,0.03);
    --glass-brd: rgba(5,255,255,0.2);
    --line: #1a1a1a;
    --card-line: #2a2a2a;
    --footer-bg: rgba(0,0,0,0.55);

    --paper: #ffffff;
    --paper-text: #1b1b1b;
    --paper-muted: #666666;
}

body.light {
    --bg: #ffffff;
    --text: #1b1b1b;
    --text-muted: #666666;
    --bright: #008585;
    --bright-rgb: 0, 133, 133;
    --glass-1: rgba(255,255,255,0.45);
    --glass-2: rgba(255,255,255,0.25);
    --glass-brd: rgba(0,183,183,0.3);
    --line: #dddddd;
    --card-line: #9e9e9e;
    --footer-bg: rgba(255,255,255,0.6);
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Raleway', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    transition: background-color .4s ease, color .4s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Стеклянные панели ---------- */
.glass {
    background: linear-gradient(135deg, var(--glass-1) 0%, var(--glass-2) 100%);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid var(--glass-brd);
}

/* ---------- Фоновые искры ---------- */
.sparks-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: hidden; }
.spark {
    position: absolute; width: 2px; height: 2px;
    background: #05ffff; border-radius: 50%;
    box-shadow: 0 0 6px 2px #05ffff, 0 0 12px 4px rgba(0,255,255,0.5);
    animation: fly linear infinite; opacity: 0;
}
@keyframes fly {
    0%   { opacity: 0; transform: translateY(100vh) translateX(0) scale(0); }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-10vh) translateX(var(--random-x)) scale(1); }
}

/* ---------- Кнопка темы ---------- */
.theme-toggle {
    position: fixed; top: 14px; right: 14px; z-index: 100;
    width: 46px; height: 46px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--glass-1) 0%, var(--glass-2) 100%);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-brd);
    font-size: 1.3rem; line-height: 1; cursor: pointer; transition: all .3s ease;
    box-shadow: 0 0 12px rgba(5,255,255,0.25);
}
.theme-toggle:hover { transform: translateY(-2px); box-shadow: 0 0 20px rgba(5,255,255,0.5); }
body:not(.light) .icon-sun { display: none; }
body.light .icon-moon { display: none; }

/* =====================================================
   ШАПКА (как в макете): лого + DИМ КАРМОВ + субтитр-SVG
   ===================================================== */
header { padding: 20px 0 15px; text-align: center; position: relative; z-index: 1; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

.logo-img {
    width: 280px; height: auto;
    margin: 0 auto 10px; display: block;
    filter: drop-shadow(0 0 20px rgba(5,255,255,0.5));
}

.neon-name { width: 100%; margin: 0; padding: 0 10px; }
.neon-svg { width: 100%; height: auto; display: block; overflow: visible; animation: softPulse 3s ease-in-out infinite; }
.neon-svg text {
    font-family: 'Raleway', 'Arial', sans-serif;
    font-weight: 800; font-size: 96px;
    fill: #05ffff;
    stroke: #008585; stroke-width: 1.5;
    paint-order: stroke fill; stroke-linejoin: round;
}
body.light .neon-svg text { fill: #008585; stroke: #05ffff; }
@keyframes softPulse {
    0%, 100% { opacity: 1;
        filter: drop-shadow(0 0 8px rgba(5,255,255,0.7)) drop-shadow(0 0 18px rgba(5,255,255,0.5)) drop-shadow(0 0 36px rgba(5,255,255,0.3)); }
    50% { opacity: 0.85;
        filter: drop-shadow(0 0 14px rgba(5,255,255,0.9)) drop-shadow(0 0 30px rgba(5,255,255,0.6)) drop-shadow(0 0 55px rgba(5,255,255,0.4)); }
}

.name-subtitle-box { margin: 0 10px; padding: 0; }
.sub-svg { width: 100%; height: auto; display: block; overflow: visible; animation: softPulse 3s ease-in-out infinite; }
.sub-svg text {
    font-family: 'Raleway', 'Arial', sans-serif;
    font-weight: 700; font-size: 28px;
    fill: #05ffff;
    stroke: #008585; stroke-width: 1;
    paint-order: stroke fill; stroke-linejoin: round;
}
body.light .sub-svg text { fill: #008585; stroke: #05ffff; }

/* Кнопка «назад» — ниже шапки, стекло */
.header-back { margin-top: 14px; text-align: center; }
.back-link {
    display: inline-block;
    color: var(--bright);
    text-decoration: none;
    font-size: .9rem; font-weight: 600; letter-spacing: 1px;
    padding: 8px 16px; border-radius: 50px;
    background: linear-gradient(135deg, var(--glass-1) 0%, var(--glass-2) 100%);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-brd);
    transition: all .3s ease;
}
.back-link:hover { transform: translateY(-2px); box-shadow: 0 0 15px rgba(var(--bright-rgb), .4); }

main { flex: 1; padding: 20px 0 40px; position: relative; z-index: 1; }

/* ---------- Поиск (стеклянный блок) ---------- */
.search-section {
    background: linear-gradient(135deg, var(--glass-1) 0%, var(--glass-2) 100%);
    backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid var(--glass-brd);
    border-radius: 16px; padding: 15px; margin-bottom: 20px;
}
.search-form { display: flex; gap: 10px; }
.search-input {
    flex: 1; background: transparent;
    border: 1px solid var(--card-line); color: var(--text);
    padding: 12px 18px; border-radius: 50px;
    font-family: inherit; font-size: .95rem; outline: none; transition: all .3s ease;
}
.search-input:focus { border-color: var(--bright); box-shadow: 0 0 12px rgba(var(--bright-rgb), .35); }
.search-input::placeholder { color: var(--text-muted); }

/* ---------- Кнопки (цветная подложка, чёрная надпись) ---------- */
.btn {
    background: var(--bright);
    border: 1px solid rgba(0,0,0,0.45); color: #000;
    padding: 12px 22px; border-radius: 50px;
    font-family: inherit; font-size: .9rem; font-weight: 700;
    cursor: pointer; transition: all .3s ease; text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); filter: brightness(.92); box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.btn-small { padding: 6px 14px; font-size: .8rem; }
.btn-cancel { background: #e0e0e0; color: #333; border-color: #bbb; }

/* ---------- Теги (стеклянный блок) ---------- */
.tags-section {
    background: linear-gradient(135deg, var(--glass-1) 0%, var(--glass-2) 100%);
    backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid var(--glass-brd);
    border-radius: 16px; padding: 20px; margin-bottom: 25px;
}
.tags-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.tags-header h3 {
    font-size: 1.1rem; font-weight: 800; letter-spacing: 2px;
    color: var(--bright);
    text-shadow: 0 0 10px rgba(var(--bright-rgb), .8), 0 0 20px rgba(var(--bright-rgb), .6), 0 0 40px rgba(var(--bright-rgb), .4);
}
.tags-list { display: flex; gap: 8px; flex-wrap: wrap; }

.tag, .poem-tag {
    background: transparent; border: 1px solid var(--bright); color: var(--bright);
    padding: 6px 14px; border-radius: 50px; font-size: .85rem; text-decoration: none;
    transition: all .3s ease; display: inline-flex; align-items: center; gap: 6px; font-weight: 500;
}
.tag:hover, .poem-tag:hover { filter: brightness(1.3); box-shadow: 0 0 10px rgba(var(--bright-rgb), .35); font-weight: 700; }
.tag.active { background: var(--bright); color: #000; border-color: var(--bright); font-weight: 700; }
.tag-count { font-size: .75rem; opacity: .7; }

/* ---------- Фильтр-инфо ---------- */
.filter-info {
    background: linear-gradient(135deg, var(--glass-1) 0%, var(--glass-2) 100%);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-brd);
    border-radius: 12px; padding: 12px 18px; margin-bottom: 15px; font-size: .9rem;
}
.filter-info strong {
    color: var(--bright); font-weight: 700;
    text-shadow: 0 0 10px rgba(var(--bright-rgb), .6);
}

h2 {
    font-size: 1.6rem; color: var(--bright); margin-bottom: 18px;
    font-weight: 800; letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(var(--bright-rgb), .8), 0 0 20px rgba(var(--bright-rgb), .6), 0 0 40px rgba(var(--bright-rgb), .4), 0 0 80px rgba(var(--bright-rgb), .2);
}

/* ---------- Карточки стихов (стекло, как feature-item) ---------- */
.poem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.poem-card {
    background: linear-gradient(135deg, var(--glass-1) 0%, var(--glass-2) 100%);
    backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid #00ffff;
    border-radius: 16px; padding: 22px;
    transition: all .4s ease; position: relative; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 0 20px rgba(5,255,255,0.2), inset 0 0 30px rgba(5,255,255,0.1), 0 0 60px rgba(5,255,255,0.1);
}
.poem-card::before {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(5,255,255,0.1) 50%, transparent 70%);
    transform: rotate(30deg); animation: shimmer 4s infinite; pointer-events: none;
}
@keyframes shimmer { 0% { transform: translateX(-100%) rotate(30deg); } 100% { transform: translateX(100%) rotate(30deg); } }
.poem-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 0 40px rgba(5,255,255,0.4), inset 0 0 40px rgba(5,255,255,0.2), 0 0 80px rgba(5,255,255,0.2);
}
.poem-card h3 { font-size: 1.35rem; margin-bottom: 10px; line-height: 1.3; position: relative; z-index: 1; }
.poem-card h3 a {
    color: var(--bright); text-decoration: none; font-weight: 800; letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(var(--bright-rgb), .8), 0 0 20px rgba(var(--bright-rgb), .6), 0 0 40px rgba(var(--bright-rgb), .4), 0 0 80px rgba(var(--bright-rgb), .2);
    transition: all .3s ease;
}
.poem-card h3 a:hover { filter: brightness(1.25); }
.preview { color: var(--text); font-size: .95rem; line-height: 1.6; margin-bottom: 12px; opacity: .9; font-style: italic; position: relative; z-index: 1; flex: 1; }
.poem-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; position: relative; z-index: 1; }
.poem-tag { font-size: .75rem; padding: 3px 10px; }
.meta { font-size: .78rem; color: var(--text-muted); letter-spacing: 1px; position: relative; z-index: 1; }

/* ---------- Пагинация ---------- */
.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 30px 0 10px; flex-wrap: wrap; }
.page-btn {
    min-width: 40px; height: 40px; padding: 0 14px; border-radius: 50px;
    border: 1px solid var(--bright);
    background: transparent; color: var(--bright);
    display: inline-flex; align-items: center; justify-content: center;
    text-decoration: none; font-weight: 600; font-size: .9rem; transition: all .3s ease;
}
.page-btn:hover { filter: brightness(1.3); box-shadow: 0 0 12px rgba(var(--bright-rgb), .4); }
.page-btn.active { background: var(--bright); color: #000; border-color: var(--bright); font-weight: 700; }

/* =====================================================
   СТРАНИЦА СТИХОТВОРЕНИЯ («лист бумаги»)
   ===================================================== */
.poem-full {
    background: var(--paper); color: var(--paper-text);
    max-width: 900px; margin: 0 auto 30px; padding: 40px 35px;
    border-radius: 16px; border: 1px solid rgba(0,0,0,0.15);
    box-shadow: 0 4px 24px rgba(0,0,0,0.25), 0 0 40px rgba(5,255,255,0.15);
}
.poem-full h1 {
    text-align: center; font-size: 2.2rem; margin-bottom: 10px; letter-spacing: 1px; font-weight: 800;
    color: var(--main); text-shadow: 0 0 10px rgba(5,255,255,0.5), 0 0 25px rgba(5,255,255,0.3);
}
.poem-tags-full { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 0 0 26px; }
.poem-tags-full strong { color: var(--main); letter-spacing: 2px; margin-right: 4px; font-weight: 800; }
.poem-tags-full .poem-tag { color: var(--main); border-color: var(--main); }
.poem-tags-full .poem-tag:hover { filter: brightness(1.2); box-shadow: 0 0 10px rgba(5,255,255,.3); }
.poem-full .content, .poem-full .content p { max-width: 720px; margin: 0 auto; text-align: center; }
.poem-full .content { font-size: 16px; line-height: 1.8; }
.poem-full .content p { margin: 10px auto; }
.poem-full .content img { max-width: 100%; height: auto; }
.poem-full .content .ql-align-center  { text-align: center; }
.poem-full .content .ql-align-right   { text-align: right; }
.poem-full .content .ql-align-justify { text-align: justify; }

/* =====================================================
   КОММЕНТАРИИ (древовидные)
   ===================================================== */
.comments-section {
    background: var(--paper); color: var(--paper-text);
    max-width: 900px; margin: 0 auto 40px; padding: 30px;
    border-radius: 16px; border: 1px solid rgba(0,0,0,0.15);
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}
.comments-section h3 {
    color: var(--main); font-size: 1.4rem; letter-spacing: 1px; margin-bottom: 18px; font-weight: 800;
    text-shadow: 0 0 10px rgba(5,255,255,0.4);
}
.comment-form input, .comment-form textarea {
    width: 100%; padding: 10px 14px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 10px;
    font-family: inherit; font-size: .95rem; background: #fafafa; color: #1b1b1b;
}
.comment-form textarea { resize: vertical; }
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--main); box-shadow: 0 0 0 2px rgba(0,133,133,0.2); }
.comments-list { margin-top: 24px; }
.comment { padding: 14px 0; }
.comment-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.comment-avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--main); color: #fff;
    font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid rgba(0,0,0,0.3); flex-shrink: 0;
}
.comment-author { font-weight: 700; }
.comment-date { color: #888; font-size: .78rem; }
.comment-reply-btn {
    margin-left: auto; background: none; border: 1px solid #ccc; border-radius: 50px;
    padding: 4px 12px; font-size: .78rem; cursor: pointer; color: #555; transition: .2s; font-family: inherit;
}
.comment-reply-btn:hover { color: var(--main); border-color: var(--main); background: rgba(0,133,133,0.08); }
.comment-text { white-space: pre-wrap; line-height: 1.6; font-size: .95rem; margin-left: 44px; }
.comment-children { margin-left: 44px; padding-left: 16px; border-left: 2px solid rgba(0,133,133,0.25); }
.reply-form { margin: 10px 0 6px 44px; }
.reply-form form { background: #f4f4f4; border: 1px solid #ddd; border-radius: 12px; padding: 12px; }
.reply-form input, .reply-form textarea {
    width: 100%; padding: 8px 12px; margin-bottom: 8px; border: 1px solid #ccc; border-radius: 8px;
    font-family: inherit; font-size: .9rem; background: #fff; color: #1b1b1b;
}
.reply-form-actions { display: flex; gap: 8px; }

/* =====================================================
   ФУТЕР — стеклянная плашка с неоном (как в макете)
   ===================================================== */
footer {
    background: var(--footer-bg);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    padding: 25px 20px; text-align: center;
    border-top: 1px solid var(--line);
    position: relative; z-index: 1; margin-top: auto; transition: background .4s ease;
}
.footer-bottom {
    display: inline-block; padding: 12px 24px;
    background: linear-gradient(135deg, var(--glass-1) 0%, var(--glass-2) 100%);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-brd); border-radius: 14px;
    font-size: 1.05rem; color: var(--bright); letter-spacing: 3px; font-weight: 700;
    text-shadow: 0 0 10px rgba(var(--bright-rgb), .8), 0 0 20px rgba(var(--bright-rgb), .6), 0 0 40px rgba(var(--bright-rgb), .4), 0 0 80px rgba(var(--bright-rgb), .2);
    white-space: nowrap;
}
.footer-bottom strong { color: var(--bright); font-weight: 800; }
.footer-divider { color: var(--bright); margin: 0 8px; }

/* =====================================================
   МОБИЛЬНАЯ ВЕРСИЯ
   ===================================================== */
@media (max-width: 768px) {
    .logo-img { width: 180px; }
    .search-form { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
    .poem-grid { grid-template-columns: 1fr; }
    .tags-header { flex-direction: column; align-items: flex-start; }
    h2 { font-size: 1.3rem; }
    .poem-full { padding: 25px 18px; }
    .poem-full h1 { font-size: 1.5rem; }
    .comment-text { margin-left: 0; }
    .comment-children { margin-left: 12px; padding-left: 10px; }
    .reply-form { margin-left: 0; }
    .comment-reply-btn { margin-left: 0; }
    .footer-bottom { font-size: .8rem; letter-spacing: 2px; padding: 10px 16px; white-space: normal; }
}