/* ==========================================================================
   OLD WEB / РАННИЕ 2000-Е (Y2K / RETRO WEB / WIN2K STYLE)
   Блог thistle.rr.kg // Сверхбыстрый, без лагов, оптимизирован под телефон
   ========================================================================== */

:root {
    --bg-page: #14171a;
    --bg-window: #21262d;
    --bg-window-inner: #161b22;
    --text-main: #f0f6fc;
    --text-muted: #8b949e;
    --link-color: #58a6ff;
    --link-hover: #79c0ff;
    
    /* 2000s Titlebar & Accent */
    --titlebar-bg: linear-gradient(90deg, #003366, #005599);
    --titlebar-active: #004488;
    --accent-red: #da3633;
    --accent-green: #238636;
    --accent-yellow: #d29922;

    /* Bevel borders */
    --border-light: #484f58;
    --border-dark: #0d1117;
    --border-outline: #30363d;

    /* Classic 2000s typography (система, ноль скачиваемых шрифтов = 0мс задержка) */
    --font-sans: Tahoma, Verdana, "Segoe UI", Arial, sans-serif;
    --font-mono: "Courier New", Courier, monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-page);
}

/* Ссылки */
a {
    color: var(--link-color);
    text-decoration: underline;
}
a:hover {
    color: var(--link-hover);
    text-decoration: none;
}

/* ==========================================================================
   ВЕРХНЯЯ СТАТУС-СТРОКА (RETRO STATUS TICKER)
   ========================================================================== */
.telemetry-bar {
    background: #0d1117;
    border-bottom: 2px solid #30363d;
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.status-indicator {
    display: inline-block;
    width: 9px;
    height: 9px;
    background: #3fb950;
    margin-right: 6px;
    border: 1px solid #fff;
}

.status-link {
    color: #58a6ff;
    text-decoration: underline;
}
.status-link:hover {
    color: #fff;
    background: #003366;
}

/* ==========================================================================
   ШАПКА САЙТА В СТИЛЕ WEB 2000-х
   ========================================================================== */
.site-header {
    background: #161b22;
    border-bottom: 2px solid #30363d;
    padding: 16px 12px;
}

.header-container {
    max-width: 920px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.brand-box {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.site-title {
    font-family: var(--font-sans);
    font-size: clamp(1.4rem, 4vw, 1.9rem);
    font-weight: bold;
    letter-spacing: -0.5px;
    color: #fff;
}

.site-title a {
    color: #fff;
    text-decoration: none;
}
.site-title a:hover {
    color: #58a6ff;
}

.site-desc {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

/* Панель навигации (кнопки в стиле тулбара 2000-х) */
.main-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.nav-btn {
    display: inline-block;
    padding: 5px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: bold;
    color: #f0f6fc;
    background: #21262d;
    border-top: 2px solid var(--border-light);
    border-left: 2px solid var(--border-light);
    border-right: 2px solid var(--border-dark);
    border-bottom: 2px solid var(--border-dark);
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

.nav-btn:hover {
    background: #30363d;
    color: #fff;
    text-decoration: none;
}

.nav-btn:active, .nav-btn.active {
    border-top: 2px solid var(--border-dark);
    border-left: 2px solid var(--border-dark);
    border-right: 2px solid var(--border-light);
    border-bottom: 2px solid var(--border-light);
    background: #161b22;
    color: #58a6ff;
}

/* ==========================================================================
   ОСНОВНАЯ РАЗМЕТКА
   ========================================================================== */
.main-wrapper {
    flex: 1;
    max-width: 920px;
    width: 100%;
    margin: 16px auto;
    padding: 0 10px;
}

/* Окно / Карточка в стиле 2000-х (Retro Window) */
.retro-window {
    background: var(--bg-window);
    border: 2px solid #30363d;
    border-top: 2px solid var(--border-light);
    border-left: 2px solid var(--border-light);
    border-right: 2px solid var(--border-dark);
    border-bottom: 2px solid var(--border-dark);
    margin-bottom: 20px;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}

.retro-titlebar {
    background: var(--titlebar-bg);
    color: #ffffff;
    padding: 4px 8px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #000;
}

.win-controls {
    display: flex;
    gap: 3px;
}
.win-btn {
    width: 16px;
    height: 14px;
    line-height: 12px;
    font-size: 10px;
    font-family: var(--font-sans);
    font-weight: bold;
    text-align: center;
    background: #21262d;
    border: 1px outset #666;
    color: #fff;
    cursor: default;
}

.retro-content {
    padding: 16px;
    background: var(--bg-window-inner);
}

/* ==========================================================================
   СТАТЬИ И ЛЕНТА ЗАПИСЕЙ
   ========================================================================== */
.post-list, .notes-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.post-item {
    background: #1c2128;
    border: 1px solid #30363d;
    padding: 14px;
}

.post-item:hover {
    border-color: #58a6ff;
}

.post-item-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 6px;
}

.post-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.post-summary {
    color: #c9d1d9;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
}

/* Микро-заметки */
.note-item {
    background: #1c2128;
    border: 1px solid #30363d;
    border-left: 4px solid var(--accent-yellow);
    padding: 12px;
}

.note-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.note-text {
    font-size: 13.5px;
    line-height: 1.5;
}

.note-text p {
    margin-bottom: 6px;
}
.note-text p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   СТАТЬЯ И ТЕКСТ (ПРОСТОЙ, ЧИТАЕМЫЙ, БЕЗ ЛАГОВ)
   ========================================================================== */
.article-title {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    font-weight: bold;
    margin-bottom: 10px;
    line-height: 1.3;
}

.article-body {
    font-size: 15px;
    line-height: 1.65;
    color: #e6edf3;
}

.article-body h1, .article-body h2, .article-body h3 {
    margin: 24px 0 10px 0;
    color: #fff;
    border-bottom: 1px solid #30363d;
    padding-bottom: 4px;
}

.article-body p {
    margin-bottom: 14px;
}

.article-body blockquote {
    margin: 14px 0;
    padding: 8px 14px;
    background: #161b22;
    border-left: 3px solid #58a6ff;
    color: #8b949e;
    font-style: italic;
}

.article-body code:not([class]) {
    font-family: var(--font-mono);
    background: #21262d;
    padding: 2px 5px;
    border: 1px solid #30363d;
    font-size: 13px;
    color: #f0883e;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}
.article-body th, .article-body td {
    padding: 8px 10px;
    border: 1px solid #30363d;
    font-size: 13px;
}
.article-body th {
    background: #21262d;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border: 1px solid #30363d;
    margin: 12px 0;
}

/* Блоки кода */
.codehilite {
    margin: 16px 0;
    border: 1px solid #30363d;
    position: relative;
    background: #0d1117;
}

.codehilite pre {
    padding: 12px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.45;
}

.copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #21262d;
    border: 1px solid #484f58;
    color: #c9d1d9;
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 3px 6px;
    cursor: pointer;
}
.copy-btn:hover {
    background: #30363d;
    color: #fff;
}

/* ==========================================================================
   РЕАКЦИИ
   ========================================================================== */
.reactions-panel {
    margin: 24px 0;
    padding: 12px;
    background: #161b22;
    border: 1px solid #30363d;
}

.reactions-heading {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.reactions-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.reaction-btn {
    background: #21262d;
    border-top: 2px solid var(--border-light);
    border-left: 2px solid var(--border-light);
    border-right: 2px solid var(--border-dark);
    border-bottom: 2px solid var(--border-dark);
    padding: 5px 10px;
    font-size: 14px;
    cursor: pointer;
    color: #f0f6fc;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    touch-action: manipulation;
}

.reaction-btn:active {
    border-top: 2px solid var(--border-dark);
    border-left: 2px solid var(--border-dark);
    border-right: 2px solid var(--border-light);
    border-bottom: 2px solid var(--border-light);
}

.reaction-count {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: bold;
    color: #58a6ff;
}

/* ==========================================================================
   КОММЕНТАРИИ
   ========================================================================== */
.comment-box {
    background: #1c2128;
    border: 1px solid #30363d;
    padding: 12px;
    margin-bottom: 12px;
}

.comment-box.is-author {
    border-left: 4px solid var(--accent-red);
    background: #1f1d24;
}

.comment-header {
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid #30363d;
    padding-bottom: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}

.comment-author-badge {
    background: var(--accent-red);
    color: #fff;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 4px;
}

.comment-content {
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 8px;
}
.comment-content p {
    margin-bottom: 6px;
}
.comment-content p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   ФОРМЫ, КНОПКИ И МОБИЛЬНЫЙ РЕДАКТОР (МОМЕНТАЛЬНЫЙ ПОСТИНГ)
   ========================================================================== */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
    color: #c9d1d9;
}

/* 16px font-size на инпутах исключает нежелательный зум на iOS/Android */
.form-input, .form-textarea {
    width: 100%;
    background: #0d1117;
    border: 1px solid #30363d;
    color: #f0f6fc;
    font-family: var(--font-sans);
    font-size: 15px;
    padding: 8px 10px;
    border-radius: 0;
}

.form-textarea {
    font-family: var(--font-sans);
    line-height: 1.45;
    resize: vertical;
}

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 1px #58a6ff;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Скрытая ловушка спама */
.trap-field {
    display: none !important;
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
}

/* Основная кнопка 2000-х */
.btn-submit, .btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: bold;
    color: #ffffff;
    background: #238636;
    border-top: 2px solid #3fb950;
    border-left: 2px solid #3fb950;
    border-right: 2px solid #0d1117;
    border-bottom: 2px solid #0d1117;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    touch-action: manipulation;
    min-height: 38px;
}

.btn-submit:hover, .btn-action:hover {
    background: #2ea043;
    text-decoration: none;
}

.btn-submit:active, .btn-action:active {
    border-top: 2px solid #0d1117;
    border-left: 2px solid #0d1117;
    border-right: 2px solid #3fb950;
    border-bottom: 2px solid #3fb950;
    background: #196c2e;
}

.btn-danger {
    background: #da3633;
    border-top: 2px solid #f85149;
    border-left: 2px solid #f85149;
    border-right: 2px solid #541315;
    border-bottom: 2px solid #541315;
}
.btn-danger:hover { background: #b62324; }

.btn-secondary {
    background: #21262d;
    border-top: 2px solid var(--border-light);
    border-left: 2px solid var(--border-light);
    border-right: 2px solid var(--border-dark);
    border-bottom: 2px solid var(--border-dark);
    color: #c9d1d9;
}
.btn-secondary:hover { background: #30363d; color: #fff; }

.btn-small {
    padding: 3px 8px;
    font-size: 12px;
    min-height: 26px;
}

/* ==========================================================================
   АДМИНКА
   ========================================================================== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 12px 0;
}
.admin-table th, .admin-table td {
    padding: 8px;
    border: 1px solid #30363d;
    text-align: left;
}
.admin-table th {
    background: #161b22;
    font-weight: bold;
}
.admin-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    border: 1px solid;
}
.badge.ok { color: #3fb950; border-color: #3fb950; }
.badge.warn { color: #d29922; border-color: #d29922; }

/* Подвал */
.site-footer {
    background: #161b22;
    border-top: 2px solid #30363d;
    padding: 16px 12px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: auto;
}
.footer-container {
    max-width: 920px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Мобильная адаптивность для телефонов */
@media (max-width: 768px) {
    .header-container, .main-wrapper, .footer-container {
        padding: 0 8px;
    }
    .retro-content {
        padding: 10px;
    }
    .main-nav {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        width: 100%;
    }
    .nav-btn {
        text-align: center;
        padding: 8px 6px;
    }
    .btn-submit, .btn-action {
        width: 100%;
    }
    .admin-table {
        display: block;
        overflow-x: auto;
    }
}
