/* Лендинг MCP: токены и кнопки — из mcp.css (подключается раньше), здесь только раскладка страницы */

/* Фирменный шрифт из брендбука: otf сконвертирован в woff2, файлы лежат в static/fonts.
   CSP страницы разрешает только свои ресурсы (font-src 'self'), внешние CDN не подключаем. */
@font-face {
    font-family: "Euclid Circular A";
    src: url("/fonts/euclid-circular-a-regular-610a6042c1abf16e18de1afc81fdba5a.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Euclid Circular A";
    src: url("/fonts/euclid-circular-a-medium-318c5e0ae18ff65a01ac580094d3081e.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Euclid Circular A";
    src: url("/fonts/euclid-circular-a-bold-ae585749257d1fedbb23142ce34413a6.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Подложки — коралловый с прозрачностью: в палитре бренда только он, белый и графит */
    --brand-soft: rgba(255, 51, 95, .08);
    --rounding16: 16px;
    --rounding24: 24px;
    --container: 1080px;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    /*
     * Типографика по дизайн-гайду Самоката: Euclid Circular A — Regular для текста, Medium для заголовков
     * и акцентов, Bold для промо. Oswald (только лигал) в вебе не используем — лигала на странице нет.
     * Запасные — Inter (как на samokat.ru) и системные.
     */
    --font-brand: "Euclid Circular A", "Euclid", "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /* Тёмный оттенок бренда для текста на белом: 6,23:1, на сером ховере — 4,72:1 (WCAG AA) */
    --brand-ink: #b82347;
}

/* mcp.css центрирует карточку входа флексом — лендингу нужен обычный поток */
body.landing {
    display: block;
    padding: 0;
    font-family: var(--font-brand);
    line-height: 1.5;
}

html { scroll-behavior: smooth; }

.landing a { color: var(--text-brand); }

/* Кнопки и подписи — Medium: в гайде это приоритетное начертание для акцентов */
.landing button { font-weight: 500; }

.landing code {
    padding: 1px 6px;
    font-family: var(--mono);
    font-size: .9em;
    background: var(--bg-primary);
    border-radius: 6px;
}

.container {
    width: 100%;
    max-width: var(--container);
    padding: 0 24px;
    margin: 0 auto;
}

/* Шапка */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--bg-primary);
}

.topbar-inner {
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
}

/* Логотип — официальный знак из брендбука, пропорции не меняем */
.logo-image {
    display: block;
    width: 122px;
    height: auto;
}

.logo-divider {
    width: 1px;
    height: 20px;
    background: var(--bg-primary-hover);
}

.logo-name {
    font-size: 17px;
    font-weight: 500;
    letter-spacing: .04em;
    color: var(--text-primary);
}

.topnav {
    display: flex;
    gap: 4px;
}

.topnav a {
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--rounding-full);
}

.topnav a:hover { background: var(--bg-primary); }

/* Первый экран: фирменный коралловый, без градиентов — в палитре бренда их нет */
.hero {
    padding: 56px 48px;
    margin-top: 24px;
    color: var(--text-inverse);
    background: var(--brand);
    border-radius: var(--rounding32);
}

.hero-title {
    max-width: 720px;
    margin: 0;
    font-size: 52px;
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: -.01em;
}

.hero-text {
    /* Без жёстких переносов: ширина в ch и balance — строки сами делятся ровно на любом экране */
    max-width: min(100%, 78ch);
    margin: 20px 0 0;
    font-size: 19px;
    line-height: 1.45;
    opacity: .95;
    text-wrap: balance;
}

.server-url {
    /* Ширина как у текста hero (78ch при 19px): правые края блоков совпадают */
    max-width: min(100%, 824px);
    padding: 16px 16px 16px 20px;
    margin-top: 32px;
    color: var(--text-primary);
    background: var(--bg-base);
    border-radius: var(--rounding24);
}

.server-url-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-description);
}

.server-url-row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.landing .server-url-value {
    padding: 0;
    font-size: 20px;
    font-weight: 500;
    overflow-wrap: anywhere;
    background: none;
}

.hero-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 24px 0 0;
    list-style: none;
}

/* Основной сценарий со страницы: на мобиле навигация скрыта, и без этой ссылки подключение ищут глазами */
.landing .hero-link {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 22px;
    margin-top: 24px;
    font-size: 16px;
    font-weight: 500;
    /* Специфичнее общего .landing a, иначе розовый текст не проходит по контрасту */
    color: var(--brand-ink);
    text-decoration: none;
    background: var(--bg-base);
    border-radius: var(--rounding-full);
}

.landing .hero-link:hover { background: var(--bg-primary-hover); }

.hero-facts li {
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 500;
    background: rgba(255, 255, 255, .18);
    border-radius: var(--rounding-full);
}

/* Секции */
.section {
    padding-top: 72px;
    scroll-margin-top: 64px;
}

.landing .section-title {
    margin: 0 0 8px;
    font-size: 32px;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -.01em;
    color: var(--text-primary);
}

.section-lead {
    max-width: min(100%, 82ch);
    text-wrap: pretty;
    margin: 0 0 24px;
    font-size: 17px;
    color: var(--text-secondary);
}

.subsection-title {
    margin: 40px 0 16px;
    font-size: 20px;
    font-weight: 500;
}

.landing h3 { color: var(--text-primary); }

/* Шаги */
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 0;
    margin: 24px 0 0;
    list-style: none;
}

.step,
.feature {
    padding: 24px;
    background: var(--bg-primary);
    border-radius: var(--rounding24);
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-inverse);
    background: var(--brand);
    border-radius: var(--rounding-full);
}

.step h3,
.feature h3 {
    margin: 16px 0 8px;
    font-size: 19px;
    font-weight: 500;
    line-height: 1.25;
}

.feature h3 { margin-top: 0; }

.step p,
.feature p {
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
}

.hint {
    margin: 20px 0 0;
    font-size: 14px;
    color: var(--text-description);
}

/* Инструкции по ассистентам: пять карточек, команды — моноширинным блоком */
.agents {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.agent {
    padding: 24px;
    background: var(--bg-primary);
    border-radius: var(--rounding24);
}

.agent h4 {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.agent-steps {
    padding-left: 20px;
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
}

.agent-steps li + li { margin-top: 10px; }

.agent-steps li::marker { color: var(--text-description); }

.agent-steps a { color: var(--text-brand); }

.agent-cmd {
    padding: 10px 14px;
    margin: 8px 0 0;
    overflow-x: auto;
    background: var(--text-primary);
    border-radius: 10px;
}

.landing .agent-cmd code {
    padding: 0;
    font-size: 12.5px;
    color: var(--text-inverse);
    /* Команда длиннее карточки: переносим, чтобы адрес сервера был виден целиком */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: none;
}

.agent-note {
    margin: 12px 0 0;
    font-size: 13px;
    color: var(--text-description);
}

.agent-doc {
    display: inline-block;
    margin-top: 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-brand);
}

/* Блоки кода с кнопкой копирования */
.code {
    position: relative;
    margin-top: 12px;
}

.code pre {
    padding: 16px 128px 16px 20px;
    margin: 0;
    overflow-x: auto;
    background: var(--text-primary);
    border-radius: var(--rounding16);
}

.landing .code code {
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-inverse);
    white-space: pre;
    background: none;
}

.code .copy {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Фраза агенту — обычный текст: переносится, а не уезжает в горизонтальный скролл */
.landing .code--prompt code { white-space: pre-wrap; overflow-wrap: anywhere; }

button.copy {
    height: 36px;
    padding: 0 16px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-base);
    flex: none;
}

button.copy:hover { background: var(--bg-primary-hover); }

button.copy--light {
    color: var(--text-inverse);
    background: var(--brand);
}

button.copy--light:hover { background: var(--brand-hover); }

/* Возможности */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.examples {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

button.example {
    height: auto;
    min-height: 44px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: left;
    background: var(--brand-soft);
}

button.example:hover { background: rgba(255, 51, 95, .14); }

/* Короткое подтверждение копирования: подпись примера не меняем, иначе поедет ширина */
button.example.is-copied::after {
    margin-left: 8px;
    font-weight: 700;
    color: var(--brand);
    content: "✓";
}

/* Доступы */
.permissions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.permissions li {
    padding: 18px 20px 18px 52px;
    font-weight: 500;
    background: var(--bg-primary) url("/img/check-ff1512e7f3543b167177dcbd6654a90f.svg") no-repeat 20px 50% / 20px;
    border-radius: var(--rounding16);
}

/* Безопасность и ограничения */
.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.panel {
    padding: 32px;
    background: var(--brand-soft);
    border-radius: var(--rounding24);
}

.panel--muted { background: var(--bg-primary); }

.checklist {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0;
    margin: 16px 0 0;
    list-style: none;
}

.checklist li {
    position: relative;
    padding-left: 22px;
    font-size: 15px;
    color: var(--text-secondary);
}

.checklist li::before {
    position: absolute;
    top: .6em;
    left: 2px;
    width: 8px;
    height: 8px;
    content: "";
    background: var(--brand);
    border-radius: var(--rounding-full);
}

.checklist--muted li::before { background: var(--text-description); }

.checklist b { color: var(--text-primary); }

/* Вопросы и раздел для разработчиков */
.faq {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.faq details,
.dev {
    background: var(--bg-primary);
    border-radius: var(--rounding16);
}

.faq summary,
.dev summary {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
}

.faq summary::-webkit-details-marker,
.dev summary::-webkit-details-marker { display: none; }

.faq summary::after,
.dev summary::after {
    flex: none;
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
    color: var(--text-brand);
    content: "+";
}

.faq details[open] summary::after,
.dev[open] summary::after { content: "−"; }

.faq details p {
    margin: 0;
    padding: 0 24px 20px;
    color: var(--text-secondary);
}

.dev { padding-bottom: 4px; }

.dev[open] { padding-bottom: 24px; }

.dev-title { font-size: 20px; font-weight: 500; }

.dev-meta {
    margin-left: auto;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-description);
}

.dev-details {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 12px 24px;
    padding: 0 24px;
    margin: 8px 0 0;
    font-size: 15px;
}

.dev-details dt { font-weight: 500; color: var(--text-secondary); }
.dev-details dd { margin: 0; overflow-wrap: anywhere; }

.landing .dev-details code,
.landing .tools code { background: var(--bg-base); }

.scope-codes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.scope-codes span {
    margin-left: 8px;
    color: var(--text-description);
}

.tool-group {
    padding: 0 24px;
    margin: 28px 0 10px;
    font-size: 17px;
    font-weight: 500;
}

.tools {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 24px;
    margin: 0;
    list-style: none;
}

.tool {
    display: grid;
    grid-template-columns: 260px 1fr auto;
    gap: 16px;
    align-items: baseline;
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--bg-primary-hover);
}

.tool:last-child { border-bottom: 0; }

.landing .tool-name { justify-self: start; }

.tool-summary { color: var(--text-secondary); }

.tool-scope {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-description);
    white-space: nowrap;
}

/* Подвал */
.footer {
    padding: 40px 0 48px;
    margin-top: 88px;
    background: var(--bg-primary);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
    align-items: center;
    justify-content: space-between;
}

.footer-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Строки не рвём: две фразы должны читаться целиком, ссылки при нехватке места уходят на свою строку */
    flex: 1 1 640px;
}

.footer-support {
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
}

.footer-support a { color: var(--text-brand); }

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.footer-links a {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-links a:hover { color: var(--text-brand); }

/* Планшеты */
@media (max-width: 960px) {
    .hero { padding: 40px 32px; }
    .hero-title { font-size: 40px; }
    .features { grid-template-columns: repeat(2, 1fr); }
    .tool { grid-template-columns: 1fr; gap: 4px; }
    .tool-scope { white-space: normal; }
}

/* Телефоны */
@media (max-width: 640px) {
    .container { padding: 0 16px; }
    .topnav { display: none; }
    .hero { padding: 32px 20px; margin-top: 16px; border-radius: var(--rounding24); }
    .hero-title { font-size: 32px; }
    .hero-text { font-size: 16px; }
    .server-url-row { flex-direction: column; align-items: stretch; }
    .landing .server-url-value { font-size: 16px; }
    .section { padding-top: 56px; }
    .landing .section-title { font-size: 26px; }
    .steps,
    .features,
    .permissions,
    .split { grid-template-columns: 1fr; }
    .code pre { padding: 52px 16px 16px; }
    .panel { padding: 24px 20px; }
    .dev-details { grid-template-columns: 1fr; gap: 4px; }
    .dev-details dd { margin-bottom: 12px; }
    .dev-meta { display: none; }
}

/* Временное поле для копирования без Clipboard API */
.visually-hidden {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* Печать и «Сохранить в PDF»: карточки и панели не рвутся между страницами */
@media print {
    .topbar { position: static; }

    /* Grid и flex в Chromium игнорируют break-inside, поэтому в печати — обычный поток */
    .split { display: block; }
    .split > * + * { margin-top: 16px; }

    .step,
    .feature,
    .agent,
    .panel,
    .server-url,
    .code,
    .dev,
    .faq details { break-inside: avoid; page-break-inside: avoid; }

    .section-title { break-after: avoid; }
}
