/* эТОИР — blog & demo-request styles. Reuses design tokens from landing.css (:root). */

/* ===== Blog page header ===== */
.blog-page-header {
    padding: 144px 0 48px;
    text-align: center;
}

.blog-page-header h1 {
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 800;
    line-height: 1.15;
    color: var(--text);
    margin-bottom: 16px;
}

.blog-page-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

/* ===== Blog card grid ===== */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    padding-bottom: 96px;
}

@media (max-width: 1024px) {
    .blog-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .blog-grid { grid-template-columns: 1fr; gap: 24px; }
}

.blog-card {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    color: var(--text);
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--card-shadow-hover);
    border-color: transparent;
    color: var(--text);
}

.blog-card-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-alt);
}

.blog-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.blog-card:hover .blog-card-cover img {
    transform: scale(1.05);
}

.blog-card-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 55%, var(--accent) 130%);
}

.blog-card-cover-placeholder::after {
    content: "";
    width: 56px;
    height: 56px;
    background-color: rgba(255, 255, 255, 0.85);
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M7 3h7l4 4v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Cline x1='8.5' y1='12' x2='15.5' y2='12'/%3E%3Cline x1='8.5' y1='15.5' x2='15.5' y2='15.5'/%3E%3Cline x1='8.5' y1='9' x2='11' y2='9'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M7 3h7l4 4v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Cline x1='8.5' y1='12' x2='15.5' y2='12'/%3E%3Cline x1='8.5' y1='15.5' x2='15.5' y2='15.5'/%3E%3Cline x1='8.5' y1='9' x2='11' y2='9'/%3E%3C/svg%3E") center / contain no-repeat;
}

.blog-card-title {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text);
    padding: 20px 20px 0;
}

.blog-card-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    padding: 10px 20px 0;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-meta {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-light);
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border);
    margin-top: 16px;
}

/* ===== Article (post detail) ===== */
.post {
    padding: 24px 0 80px;
}

.post-cover {
    aspect-ratio: 21 / 9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 32px;
    background: var(--bg-alt);
}

.post-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 55%, var(--accent) 130%);
}

.post-cover-placeholder::after {
    content: "";
    width: 96px;
    height: 96px;
    background-color: rgba(255, 255, 255, 0.85);
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M7 3h7l4 4v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Cline x1='8.5' y1='12' x2='15.5' y2='12'/%3E%3Cline x1='8.5' y1='15.5' x2='15.5' y2='15.5'/%3E%3Cline x1='8.5' y1='9' x2='11' y2='9'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M7 3h7l4 4v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Cline x1='8.5' y1='12' x2='15.5' y2='12'/%3E%3Cline x1='8.5' y1='15.5' x2='15.5' y2='15.5'/%3E%3Cline x1='8.5' y1='9' x2='11' y2='9'/%3E%3C/svg%3E") center / contain no-repeat;
}

.post h1 {
    font-size: clamp(30px, 4.5vw, 44px);
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
    max-width: 70ch;
    margin-bottom: 16px;
}

.post-meta {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 40px;
}

.post-body {
    max-width: 70ch;
    font-size: 18px;
    line-height: 1.75;
    color: var(--text);
}

.post-body h2 {
    font-size: 28px;
    font-weight: 800;
    margin: 48px 0 16px;
    color: var(--text);
}

.post-body h3 {
    font-size: 22px;
    font-weight: 700;
    margin: 36px 0 14px;
    color: var(--text);
}

.post-body p {
    margin-bottom: 20px;
}

.post-body ul,
.post-body ol {
    margin: 0 0 20px;
    padding-left: 24px;
}

.post-body li {
    margin-bottom: 8px;
}

.post-body a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-color: var(--primary-light);
}

.post-body a:hover {
    color: var(--primary-dark);
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 32px 0;
}

.post-body figure.table {
    width: 100%;
    max-width: 100%;
    margin: 32px 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.post-body figure.table table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.5;
}

.post-body figure.table th,
.post-body figure.table td {
    min-width: 72px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 13px 15px;
    text-align: left;
    vertical-align: top;
}

.post-body figure.table th {
    color: var(--text);
    background: var(--bg-alt);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.post-body figure.table tr:last-child > * {
    border-bottom: 0;
}

.post-body figure.table tr > *:last-child {
    border-right: 0;
}

.post-body blockquote {
    border-left: 3px solid var(--accent);
    background: var(--bg-alt);
    padding: 16px 24px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    margin: 28px 0;
}

.article-faq {
    position: relative;
    width: min(100%, 760px);
    margin: 64px 0 8px;
    padding: 32px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 100% 0, var(--primary-glow), transparent 38%),
        var(--card-bg);
}

.article-faq::before {
    position: absolute;
    top: 0;
    left: 32px;
    width: 72px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--primary);
    content: "";
}

.post-body .article-faq__eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.post-body .article-faq h2 {
    margin: 0 0 22px;
    font-size: 26px;
}

.article-faq__list {
    border-top: 1px solid var(--border);
}

.article-faq__item {
    border-bottom: 1px solid var(--border);
}

.article-faq__item summary {
    position: relative;
    padding: 18px 42px 18px 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.45;
    cursor: pointer;
    list-style: none;
}

.article-faq__item summary::-webkit-details-marker {
    display: none;
}

.article-faq__item summary::after {
    position: absolute;
    top: 50%;
    right: 4px;
    width: 22px;
    height: 22px;
    color: var(--primary);
    content: "+";
    font-size: 24px;
    font-weight: 400;
    line-height: 20px;
    text-align: center;
    transform: translateY(-50%);
    transition: transform var(--transition);
}

.article-faq__item[open] summary::after {
    transform: translateY(-50%) rotate(45deg);
}

.article-faq__answer {
    display: grid;
    grid-template-rows: 0fr;
    color: var(--text-secondary);
    transition: grid-template-rows var(--transition);
}

.article-faq__item[open] .article-faq__answer {
    grid-template-rows: 1fr;
}

.article-faq__answer p {
    min-height: 0;
    margin: 0;
    overflow: hidden;
}

.article-faq__item[open] .article-faq__answer p {
    padding: 0 42px 18px 0;
}

.post-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 56px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
    .article-faq {
        margin-top: 48px;
        padding: 24px 20px;
    }

    .article-faq::before {
        left: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .article-faq__answer,
    .article-faq__item summary::after {
        transition: none;
    }
}

/* ===== Related posts ===== */
.related-posts {
    padding: 0 0 96px;
}

.related-posts h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 32px;
}

/* ===== Demo request — split pitch / form ===== */
/* ===== /demo/ — один экран ===== */
/* Жёсткого overflow:hidden нет намеренно: на 1366×768 при 125% масштабе и при
   зуме 200% контент выше вьюпорта, и запертая страница нарушила бы WCAG 1.4.4.
   Экран просто помещается целиком — листать нечего, но выход есть. */
/* Ровно вьюпорт: шапка position:fixed и высоты не занимает, а её 72px перекрыты
   верхним отступом хлебных крошек. Подвал — обычный, он просто ниже сгиба. */
.demo-screen {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}
.demo-screen .demo-live { flex: 1; display: flex; align-items: center; padding: 24px 0 40px; }
/* Текстовой колонке нужно больше, чем на лендинге: под ней пара равных кнопок,
   и при 1fr/1.1fr обе надписи переносились на две строки. Только с 901px:
   этот селектор специфичнее, чем одноколоночное правило в медиазапросе ниже,
   и без рамки он оставлял на телефоне две колонки — страница уезжала вбок. */
@media (min-width: 901px) {
    .demo-screen .demo-live-grid { grid-template-columns: 1.15fr 1fr; gap: 48px; }
}
.demo-screen .demo-live > .container { width: 100%; }
/* На телефоне одноэкранность не удержать (стенд + мокап + кнопки), да и скролл
   там ожидаем — ограничение снимаем. */
@media (max-width: 900px) {
    .demo-screen { min-height: 0; }
    .demo-screen .demo-live { display: block; }
}


/* ══ Лид-гейт вложений ══════════════════════════════════════════════════════
   DESIGN_SYSTEM §1 Industrial Swiss: карточка-бланк, а не «поп-ап».
   §5 — радиус 4px и волосяная линия; тень только потому, что модалка физически
   над полосой (--sh-pop). §8.3 — охра засечкой 2px, одно пятно на экран.
   §9 mono — имя файла и метки полей: это данные, а не проза.
   Нативный <dialog>: фокус-ловушка, Esc и ::backdrop дарит браузер. */
.file-gate {
    /* margin: auto — не декор: глобальный сброс `* { margin: 0 }` затирает
       UA-правило dialog:modal, и модалка прилипает в левый верхний угол. */
    margin: auto;
    /* fixed + inset — правило UA для dialog:modal, которое затирал `relative`:
       без него модалка встаёт в поток на своём месте в конце body, и showModal()
       уводит страницу скроллом к ней. */
    position: fixed;
    inset: 0;
    width: min(456px, calc(100vw - 2 * var(--gutter-sm)));
    max-height: calc(100vh - var(--s-8));
    overflow: auto;
    padding: var(--s-6) var(--s-6) var(--s-5);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--sh-pop);
}

/* §8.3 — на светлом охра не заливка, а засечка. Единственное пятно в модалке. */
.file-gate::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: var(--accent);
}

/* §6.2 — появление вытиранием, не сдвигом: бланк вычерчивается сверху вниз. */
.file-gate[open] {
    animation: file-gate-draw var(--d-slow) var(--e-out);
}

.file-gate::backdrop {
    /* Фолбэк первым: color-mix() — 2023 год, а корпоративные браузеры отстают,
       и без него ::backdrop остался бы прозрачным. §8.7 не нарушен: оба
       значения берутся от той же ступени --n-950 (#0D100E). */
    background: rgba(13, 16, 14, 0.58);
    background: color-mix(in srgb, var(--n-950) 58%, transparent);
}

.file-gate[open]::backdrop {
    animation: file-gate-fade var(--d-base) var(--e-out);
}

@keyframes file-gate-draw {
    from { opacity: 0; clip-path: inset(0 0 100% 0); }
    to   { opacity: 1; clip-path: inset(0); }
}

@keyframes file-gate-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .file-gate[open],
    .file-gate[open]::backdrop { animation-duration: 1ms; }
}

/* Надзаголовок — mono-метка приборного щита: тип файла, а не «бейдж». */
.file-gate-kicker {
    margin-bottom: var(--s-2);
    font-family: var(--font-mono);
    font-size: var(--t-label);
    font-weight: var(--fw-medium);
    letter-spacing: var(--tr-label);
    text-transform: uppercase;
    color: var(--text-faint);
}

.file-gate h2,
.file-gate-card h2 {
    /* §8.13 — вес 900 только у h1 и дисплея, здесь 700. */
    margin-bottom: var(--s-3);
    padding-right: var(--s-5);
    font-size: var(--t-h3);
    font-weight: var(--fw-bold);
    letter-spacing: var(--tr-head);
    line-height: var(--lh-snug);
    overflow-wrap: anywhere;
}

.file-gate-close {
    position: absolute;
    top: var(--s-4);
    right: var(--s-4);
    display: flex;
    padding: var(--s-1);
    border: 0;
    border-radius: var(--r-sm);
    background: none;
    color: var(--text-faint);
    cursor: pointer;
    transition: color var(--d-fast) var(--e-out);
}

.file-gate-close:hover { color: var(--text); }
.file-gate-close:focus-visible { outline: none; box-shadow: var(--sh-focus); }

/* ── Страница-гейт: та же карточка для прямой ссылки и режима без JS ── */
.file-gate-page { padding: var(--section-y) 0; }

.file-gate-card {
    position: relative;
    max-width: 456px;
    margin: 0 auto;
    padding: var(--s-6);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
}

.file-gate-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: var(--accent);
}

/* ── Форма ───────────────────────────────────────────────────────────────── */
.file-gate-lead {
    margin-bottom: var(--s-5);
    font-size: var(--t-sm);
    line-height: var(--lh-body);
    color: var(--text-muted);
}

.file-gate-label {
    display: block;
    margin-bottom: var(--s-2);
    font-family: var(--font-mono);
    font-size: var(--t-label);
    font-weight: var(--fw-medium);
    letter-spacing: var(--tr-label);
    text-transform: uppercase;
    color: var(--text-muted);
}

.file-gate-form input[type="email"] {
    width: 100%;
    padding: 13px 14px;
    font-family: var(--font-sans);
    font-size: var(--t-body);
    color: var(--text);
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: border-color var(--d-fast) var(--e-out),
                background-color var(--d-fast) var(--e-out);
}

.file-gate-form input[type="email"]::placeholder { color: var(--text-faint); }

.file-gate-form input[type="email"]:focus {
    /* §5 — фокус двойным кольцом, читается и на светлом, и на цветном. */
    outline: none;
    background: var(--surface);
    border-color: var(--border-strong);
    box-shadow: var(--sh-focus);
}

.file-gate-form .file-gate-consent {
    display: flex;
    gap: var(--s-2);
    align-items: flex-start;
    margin: var(--s-4) 0 var(--s-5);
    font-size: var(--t-xs);
    line-height: var(--lh-flat);
    color: var(--text-muted);
    cursor: pointer;
}

.file-gate-form .file-gate-consent input[type="checkbox"] {
    flex: none;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    accent-color: var(--primary);
}

.file-gate-form .file-gate-consent input:focus-visible {
    outline: none;
    box-shadow: var(--sh-focus);
}

/* Кнопка сайта живёт с радиусом 12px и цветной тенью — приборному бланку
   это чужой язык. Правим только внутри гейта, глобальную .btn не трогаем. */
.file-gate-form .btn {
    width: 100%;
    justify-content: center;
    padding: 14px var(--s-5);
    border-radius: var(--r-md);
    box-shadow: none;
}

.file-gate-form .btn:hover {
    box-shadow: none;
    transform: none;
}

/* §8.5 — кнопка утапливается на 1px, не пружинит и не растёт. */
.file-gate-form .btn:active { transform: translateY(1px); }

.file-gate-form .btn:disabled { opacity: .6; cursor: progress; }

.file-gate-error {
    margin-bottom: var(--s-3);
    padding: var(--s-2) var(--s-3);
    font-size: var(--t-xs);
    line-height: var(--lh-flat);
    color: var(--stop-ink);
    background: var(--stop-bg);
    border-left: 2px solid var(--stop);
}

.file-gate-error:empty { display: none; }
