/*
 * Оформление мини-аппа. Подключается после miniapp.css на страницах и в кабинете;
 * админ-панель этот файл не использует.
 * Единственная тема - «Сбалансированная»: js/theme.js ставит атрибут data-theme на <html>.
 * Фоны генерирует tools/generate-theme-backgrounds.mjs.
 */

html[data-theme] {
    --bg: #07301f;
    --bg-2: #0a3a27;
    --section: rgba(6, 46, 31, .78);
    --section-strong: rgba(5, 40, 27, .92);
    --text: #f3f8f4;
    --hint: #b7cdbf;
    --link: #6df0ae;
    --accent: #36e39a;
    --accent-text: #05291c;
    --header: #f3f8f4;
    --separator: rgba(168, 232, 186, .22);
    --danger: #ff9b8f;
    --nav-bg: #06291c;
    --nav-text: #b7cdbf;
    --edge: rgba(150, 235, 170, .4);
    --edge-strong: rgba(245, 214, 120, .75);
    --tab-active: #36e39a;
    --tab-line: rgba(245, 200, 76, .65);
    --btn-from: #5fedb0;
    --btn-to: #22c583;
    --hero-bg: rgba(6, 50, 33, .82);
    --hero-text: #ffffff;
    --hero-hint: #d4e4d8;
    --shadow: 0 8px 26px rgba(0, 20, 12, .28);
    --glow: 0 0 22px rgba(245, 214, 120, .14);
    --brand-mark: linear-gradient(145deg, #d9ad3c, #1b9c6c);
    --art-tall: url("/images/themes/balanced-tall.svg");
    --art-wide: url("/images/themes/balanced-wide.svg");
}

/* ---------- Каркас ---------- */

html[data-theme] { background: var(--bg-2); }
html[data-theme] body { background: transparent; }

html[data-theme] body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: var(--bg-2) var(--art-tall) center / cover no-repeat;
}

@media (min-aspect-ratio: 1 / 1) {
    html[data-theme] body::before { background-image: var(--art-wide); }
}

/* В широком окне колонка уже — как на макетах, по бокам виден фон. */
@media (min-width: 1000px) {
    html[data-theme] body:not(.workspace-body):not(.admin-body) > .page {
        max-width: 760px;
        margin-inline: auto;
        padding-inline: 20px;
    }
    html[data-theme] body:not(.workspace-body):not(.admin-body) .tabbar__inner { max-width: 760px; }
}

/* ---------- Блоки ---------- */

html[data-theme] .card,
html[data-theme] .list,
html[data-theme] .steps,
html[data-theme] .faq,
html[data-theme] .specs,
html[data-theme] .compare,
html[data-theme] .product-link,
html[data-theme] .stat,
html[data-theme] .note,
html[data-theme] .system-item,
html[data-theme] .dashboard-hero,
html[data-theme] .dashboard-stat {
    border: 1px solid var(--edge);
    box-shadow: var(--shadow);
}

html[data-theme] .note { background: var(--section); }

/* Шапка информационных страниц — стеклянная карточка по центру. */
html[data-theme] body:not(.workspace-body) .hero {
    max-width: none;
    padding: 22px;
    border: 1px solid var(--edge-strong);
    border-radius: var(--radius);
    background: var(--hero-bg);
    color: var(--hero-text);
    text-align: center;
    box-shadow: var(--shadow), var(--glow);
}

html[data-theme] body:not(.workspace-body) .hero h1 { color: var(--hero-text); font-size: clamp(22px, 5.4vw, 30px); letter-spacing: -.02em; }
html[data-theme] body:not(.workspace-body) .hero h1 + p { max-width: none; margin-top: 10px; color: var(--hero-hint); font-size: 14px; }

html[data-theme] .hero__eyebrow { color: var(--tab-active); }

/* Логотип с прозрачным фоном: на случай неподдерживаемого content останется обычный. */
html[data-theme] .hero__logo {
    content: url("/images/logo-emerald.webp");
    max-width: min(66vw, 290px);
    aspect-ratio: 1100 / 403;
    margin: 0 auto 14px;
    border-radius: 0;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .35));
}

html[data-theme] .section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 22px 2px 10px;
    color: var(--header);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
}

html[data-theme] .section-title::before {
    content: "";
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}

html[data-theme] .card__lead,
html[data-theme] .callout {
    padding: 2px 0 2px 12px;
    border-left: 4px solid var(--accent);
    border-radius: 2px;
}

html[data-theme] .callout { font-weight: 700; }

html[data-theme] .card { padding: 16px 18px; }

html[data-theme] .chip,
html[data-theme] .code { background: color-mix(in srgb, var(--accent) 12%, transparent); }
html[data-theme] .chip { color: var(--text); border-color: var(--separator); }

html[data-theme] .topics a { border: 1px solid var(--edge); }

/* Страницы для чтения: длинный текст только на плотной подложке. */
html[data-theme] .reader-shell,
html[data-theme] .article-body .reader-toolbar { background: var(--section-strong); }

html[data-theme] body:not(.workspace-body) > .page:not(:has(.hero, .card)) {
    border-radius: var(--radius);
    background: var(--section-strong);
}

/* ---------- Кнопки и меню ---------- */

html[data-theme] .btn:not(.btn--secondary) {
    background: linear-gradient(180deg, var(--btn-from), var(--btn-to));
    color: var(--accent-text);
}

html[data-theme] .btn--secondary {
    border: 1px solid var(--edge);
    background: var(--section);
    color: var(--link);
}

html[data-theme] .tabbar {
    border-top: 1px solid var(--tab-line);
    background: var(--nav-bg);
    backdrop-filter: none;
}

html[data-theme] .tabbar a { color: #e6efe9; }

html[data-theme] .tabbar a[aria-current="page"] {
    background: transparent;
    color: var(--tab-active);
    font-weight: 700;
}

/* ---------- Кабинет ---------- */

html[data-theme] .workspace-header { background: var(--section-strong); }
html[data-theme] .workspace-sidebar { border-right: 1px solid var(--tab-line); }
html[data-theme] .workspace-nav [aria-current="page"] { background: color-mix(in srgb, var(--tab-active) 16%, transparent); box-shadow: inset 3px 0 var(--tab-active); }
html[data-theme] .workspace-nav [aria-current="page"] svg { color: var(--tab-active); }
html[data-theme] .brand-mark { background: var(--brand-mark); }
html[data-theme] .gate-page { background: transparent; }
html[data-theme] .icon-button,
html[data-theme] .form input,
html[data-theme] .form select,
html[data-theme] .form textarea { background: var(--section-strong); color: var(--text); }
html[data-theme] .icon-button { border-color: var(--edge); color: var(--text); }

.workspace-header .icon-button svg { width: 18px; height: 18px; }

/* Кнопка кабинета в шапке «О компании»: на телефоне отдельной строкой над логотипом, на ПК в углу шапки. */
.hero__actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-bottom: 10px; }
.cabinet-link {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--edge-strong);
    border-radius: 50%;
    background: var(--section-strong);
    color: var(--text);
}
.cabinet-link:hover { background: color-mix(in srgb, var(--accent) 14%, var(--section-strong)); }
.cabinet-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cabinet-link svg { width: 20px; height: 20px; }
@media (min-width: 1000px) {
    .hero:has(> .hero__actions) { position: relative; }
    .hero__actions { position: absolute; top: 14px; right: 14px; margin: 0; }
}
