/* ===== meestereo — Общая дизайн-система ===== */
/* Подключается на всех страницах сайта */

:root {
    --bg: #050505;
    --text: #f0f0f0;
    --muted: #8a8a8a;
    --accent: #ffffff;
    --border: #222222;
    --radius: 14px;
    --radius-sm: 10px;
    --glow-soft: 0 0 14px rgba(255,255,255,.08);
    --glow: 0 0 18px rgba(255,255,255,.35), 0 0 42px rgba(160,200,255,.18);
    --mono: "SF Mono", Monaco, "Cascadia Code", "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Контейнер */
.container { max-width: 800px; margin: 0 auto; padding: 80px 24px; }

/* ===== Метка жанра: что это за текст на самом деле =====
   Ставится первой под подзаголовком. Значения — в threads.js
   (GENRE + node.genre), чтобы на хабе и на странице было одно и то же. */
.genre-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text);
}
.genre-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.genre-hypothesis,
.genre-metaphor,
.genre-thought {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.34);
    color: #dcdcdc;
}
.genre-note {
    max-width: 560px;
    margin: 0 0 40px;
    padding: 14px 18px;
    border-left: 2px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.875rem;
    line-height: 1.65;
    color: #b4b4b4;
}
.genre-note strong {
    color: #fff;
    font-weight: 500;
}
@media (max-width: 600px) {
    .genre-badge { font-size: 0.625rem; padding: 5px 12px; }
    .genre-note { margin-bottom: 32px; }
}

/* Навигация */
.back-link, .back {
    display: inline-block;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 48px;
    transition: color 0.3s;
}
.back-link:hover, .back:hover { color: var(--text); }

/* Герой-секция */
.hero { margin-bottom: 80px; }
.hero h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #f0f0f0 0%, #8a8a8a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero .subtitle {
    font-size: 1.25rem;
    color: var(--muted);
    font-weight: 300;
    max-width: 600px;
}

/* Переключатель режимов (общие стили) */
.mode-switcher {
    display: flex;
    gap: 16px;
    margin-bottom: 64px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}
.mode-btn {
    flex: 1;
    padding: 12px 24px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}
.mode-btn.active {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text);
}
.mode-btn:hover:not(.active) {
    border-color: rgba(255, 255, 255, 0.15);
    color: #c0c0c0;
}

/* Нити (общая структура) */
.thread {
    margin-bottom: 80px;
    position: relative;
    padding-left: 48px;
}
.thread::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 32px;
    bottom: -80px;
    width: 1px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
}
.thread:last-child::before { display: none; }
.thread-node {
    position: absolute;
    left: 12px;
    top: 8px;
    width: 8px;
    height: 8px;
    background: var(--text);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
.thread h2 {
    font-size: 28px;
    font-weight: 400;
    margin-bottom: 24px;
    color: var(--text);
}
.thread p {
    font-size: 16px;
    color: #c0c0c0;
    margin-bottom: 20px;
}

/* Лабораторный контент (режим «Подробно») */
.lab-content {
    display: none;
    margin-top: 24px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    font-family: var(--mono);
    font-size: 13px;
    color: #a0a0a0;
    line-height: 1.8;
}
.lab-content.visible { display: block; }
.lab-content h3 {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 16px;
    font-weight: 600;
}
.lab-content ul { list-style: none; padding-left: 0; }
.lab-content li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}
.lab-content li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--muted);
}

/* Цитаты */
.quote {
    margin: 64px 0;
    padding: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 20px;
    font-weight: 300;
    color: var(--text);
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.02);
}

/* Lead-magnet */
.lead-magnet {
    margin: 80px 0;
    padding: 48px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 0 60px rgba(255, 255, 255, 0.02);
}
.lead-magnet h2, .lead-magnet h3 {
    font-size: 28px;
    font-weight: 300;
    margin-bottom: 16px;
}
.lead-magnet p {
    font-size: 16px;
    color: #a0a0a0;
    margin-bottom: 32px;
}
.lead-magnet button, .lead-magnet .btn {
    padding: 16px 48px;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}
.lead-magnet button:hover, .lead-magnet .btn:hover {
    background: #ffffff;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

/* Перекрёстные ссылки */
.cross-links {
    margin-top: 80px;
    padding-top: 48px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.cross-links h3 {
    font-size: 20px;
    font-weight: 300;
    margin-bottom: 24px;
    color: var(--muted);
}
.cross-link {
    display: block;
    padding: 24px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s;
}
.cross-link:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}
.cross-link h4 {
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 8px;
}
.cross-link p {
    font-size: 14px;
    color: var(--muted);
}

/* Footer */
footer {
    padding: 72px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--muted);
    font-size: .875rem;
}

/* Lead-magnet form (Netlify) */
.lead-magnet-form {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 480px;
    margin: 0 auto;
}
.lead-magnet-form input[type="email"] {
    flex: 1;
    min-width: 200px;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
}
.lead-magnet-form input[type="email"]:focus {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.06);
}
.lead-magnet-form input[type="email"]::placeholder {
    color: #8a8a8a; /* было #666 — контраст 3.7:1, ниже нормы WCAG */
}
.lead-magnet-form button[type="submit"] {
    padding: 14px 32px;
    background: var(--text);
    color: var(--bg);
    border: 1px solid var(--text);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
}
.lead-magnet-form button[type="submit"]:hover {
    background: #ffffff;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}
.lead-magnet-form .form-status {
    width: 100%;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    margin-top: 8px;
    min-height: 1.4em;
}
.lead-magnet-form .form-status.success { color: #69db7c; }
.lead-magnet-form .form-status.error { color: #ff6b6b; }

/* Thread indicator & continuation containers */
#thread-indicator { display: none; }
#thread-continuation { display: none; }

/* Видимый фокус с клавиатуры */
a:focus-visible, button:focus-visible, .toggle:focus-visible, .spoiler:focus-visible {
    outline: 1px solid rgba(255, 255, 255, 0.7);
    outline-offset: 3px;
}
.spoiler { user-select: none; }

/* Адаптивность */
@media (max-width: 600px) {
    .container { padding: 60px 16px; }
    .thread { padding-left: 32px; }
    .thread::before { left: 8px; }
    .thread-node { left: 4px; }
    .hero h1 { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { animation: none !important; transition: none !important; }
}

/* ===== EMBED-РЕЖИМ (статья внутри iframe главного экрана) ===== */
body.embedded { background: var(--bg); padding-bottom: 24px; }
body.embedded .back-link,
body.embedded nav { display: none; }
body.embedded header { padding-top: 32px; }
body.embedded .container { padding: 32px 24px; }
body.embedded footer { display: none; }
/* Ссылки на хаб внутри embed не нужны: хаб — это сама оболочка */
body.embedded a[href^="index.html"] { display: none !important; }
