/*
 * Сайт организации (resources/views/site). Значений цвета, шрифта и отступов здесь нет:
 * их задаёт тема (App\Support\SiteTheme::css) в <style> страницы.
 * - :root - шрифты, углы, плотность, цвет организации;
 * - .scheme-plain / -soft / -accent / -inverse - цветовая схема секции, одинаковый набор
 *   переменных --s-*. Вёрстка блока от схемы не зависит, поэтому любой блок ставится
 *   на любой фон без своих правил.
 * Варианты блока - классы .v-<вид> на секции (App\Support\SiteBlocks::VARIANTS).
 *
 * Эффекты темы (узор, карточки, отклик кнопок, значки соцсетей) - тоже переменные, и читаются
 * они ТОЛЬКО с запасным значением (`var(--s-decor, none)`): после выката до десяти минут
 * отдаётся закэшированный HTML со старым <style>, где этих переменных ещё нет.
 * Движения здесь нет вовсе - ни `animation`, ни `transition` (сторожит SiteThemeTest): оно
 * живёт в site-motion.css, который подключён только тем, кто не просил систему его уменьшить.
 */

/*
 * Зерно для узора `grain` (SiteTheme::DECORS). Картинкой здесь, а не в теме: строка `<svg`
 * в <style> темы уронила бы проверку на сырой ввод, и каждая тема несла бы её копию.
 * Серый шум с постоянной прозрачностью виден и на светлом фоне, и на тёмном.
 */
:root {
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 .09'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
    -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
}

[class*='scheme-'] {
    background: var(--s-bg);
    color: var(--s-fg);
}

a {
    color: var(--s-link);
}

a:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--s-mark);
    outline-offset: 3px;
    border-radius: 4px;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.15;
    font-family: var(--font-heading);
    font-weight: var(--heading-weight);
    text-transform: var(--heading-case);
    letter-spacing: var(--heading-tracking);
}

h2 {
    font-size: clamp(1.6rem, 4vw, 2.3rem);
    margin-bottom: 1.4rem;
}

h3 {
    font-size: 1.12rem;
    letter-spacing: normal;
}

p {
    margin: 0;
}

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Шапка */

.bar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--s-line);
}

.bar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 60px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--s-fg);
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 700;
}

.brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

.nav {
    display: none;
    margin-left: auto;
    gap: 22px;
}

.nav a,
.nav-mobile nav a {
    color: var(--s-fg);
    text-decoration: none;
}

/* Пункт меню не переносится: «Частые вопросы» в две строки раздували шапку. Длинный
   заголовок текстового блока обрезается многоточием, а не растягивает строку меню. */
.nav a {
    max-width: 22ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Только для программ чтения с экрана: `<h1>` страницы без первого экрана. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.nav a:hover {
    color: var(--s-link);
}

.nav-mobile {
    margin-left: auto;
    position: relative;
}

.nav-mobile summary {
    list-style: none;
    cursor: pointer;
    padding: 6px 14px;
    border: 1px solid var(--s-line);
    border-radius: 999px;
}

.nav-mobile summary::-webkit-details-marker {
    display: none;
}

.nav-mobile nav {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    display: flex;
    flex-direction: column;
    min-width: 200px;
    padding: 8px;
    background: var(--s-card);
    border: 1px solid var(--s-line);
    border-radius: 12px;
}

.nav-mobile nav a {
    padding: 10px 12px;
}

/* Целиком меню показывается с той ширины, где оно помещается в строку рядом с названием:
   её по длине пунктов выбирает сервер (`SiteRenderer::navFit`): `nav-fit-wide` с 1100px,
   `nav-fit-wider` с 1400px, `nav-fit-none` никогда. До этой ширины работает кнопка «Меню». */
@media (min-width: 1100px) {
    .nav-fit-wide .nav {
        display: flex;
    }

    .nav-fit-wide .nav-mobile {
        display: none;
    }
}

@media (min-width: 1400px) {
    .nav-fit-wider .nav {
        display: flex;
    }

    .nav-fit-wider .nav-mobile {
        display: none;
    }
}

/* Кнопки: цвета из схемы секции, вид (заливка или контур) задаёт тема */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 24px;
    border-radius: var(--radius-button);
    font-weight: 700;
    text-decoration: none;
    border: 2px solid transparent;
}

.btn-solid {
    background: var(--s-btn-bg);
    color: var(--s-btn-fg);
    border-color: var(--s-btn-border);
}

.btn-line {
    color: var(--s-fg);
    border-color: currentColor;
}

/* Отклик кнопки (SiteTheme::BUTTON_FX): тень в покое и при наведении, сдвиг. Без анимации
   здесь - мгновенная смена; плавность и бегущий блик добавляет site-motion.css.
   `overflow: hidden` - рамка для блика; тень кнопки им не обрезается. */
.btn {
    position: relative;
    overflow: hidden;
    box-shadow: var(--s-btn-shadow, none);
}

.btn:hover,
.btn:focus-visible {
    box-shadow: var(--s-btn-hover-shadow, none);
    transform: translate(var(--btn-hover-x, 0px), var(--btn-hover-y, 0px));
}

/* Первый экран */

.hero {
    padding: clamp(56px, 12vw, 128px) 0 clamp(48px, 9vw, 96px);
}

.hero-inner {
    display: grid;
    gap: 32px;
    align-items: center;
}

.hero-title {
    /* 8vw на телефоне: название в широком шрифте (Unbounded) на 9vw не помещало
       слово целиком, и закрывающая кавычка уезжала на свою строку. Рвётся только
       слово, которое не влезает вовсе (break-word), а не в любом месте (anywhere). */
    font-size: clamp(2rem, 8vw, 5.5rem);
    line-height: 1;
    letter-spacing: var(--heading-tracking);
    max-width: 14ch;
    overflow-wrap: break-word;
}

.hero-sub {
    margin-top: 1.25rem;
    font-size: clamp(1.1rem, 2.4vw, 1.35rem);
    max-width: 38ch;
}

.hero-sub a {
    color: inherit;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 2rem;
}

/* На фото: затемнение снизу и белый текст при любой теме - фото бывает любым.
   Два класса: схема из <style> темы стоит в документе позже и при равном весе
   перебила бы белый текст. */
.hero.hero-cover {
    position: relative;
    background-size: cover;
    background-position: center;
    padding: clamp(96px, 20vw, 200px) 0 clamp(48px, 9vw, 96px);
    --s-fg: #ffffff;
    --s-btn-bg: var(--accent);
    --s-btn-fg: var(--on-accent);
    --s-btn-border: var(--accent);
}

.hero-cover::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgb(0 0 0 / 0.15) 0%, rgb(0 0 0 / 0.65) 100%);
}

.hero-cover .hero-inner {
    position: relative;
}

.hero-split .hero-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius);
}

.hero-minimal .hero-title {
    max-width: 18ch;
}

@media (min-width: 860px) {
    .hero-split .hero-inner {
        grid-template-columns: 1.1fr 1fr;
    }

    .hero-split .hero-title {
        font-size: clamp(2.6rem, 5vw, 4.2rem);
    }
}

/* Блоки */

.block {
    padding: var(--section-pad) 0;
}

/* Узор темы (SiteTheme::DECORS) - на первом экране и на секциях цвета организации и контрастных:
   они и так выделены, а узор на каждой секции подряд превратил бы страницу в обои.
   Слоем под содержимым (z-index -1 внутри isolation), а не фоном самой секции: фон секции
   - её цвет схемы, и узор поверх него не должен его подменять. У фото первого экрана узора
   нет: поверх снимка он только мешает. */
.hero,
.block.scheme-accent,
.block.scheme-inverse {
    position: relative;
    isolation: isolate;
    overflow: clip;
}

.hero:not(.hero-cover)::after,
.block.scheme-accent::after,
.block.scheme-inverse::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--s-decor, none);
    pointer-events: none;
}

.block.scheme-plain + .block.scheme-plain,
.block.scheme-soft + .block.scheme-soft {
    border-top: 1px solid var(--s-line);
}

.prose {
    max-width: 68ch;
}

.v-center {
    text-align: center;
}

.v-center .prose {
    margin: 0 auto;
}

/* Преимущества */

.points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 28px;
}

.points p {
    margin-top: 6px;
    color: var(--s-muted);
}

.v-columns .points li {
    padding-left: 18px;
    border-left: 4px solid var(--s-mark);
}

.v-cards .points li {
    padding: 24px;
    background: var(--s-card);
    color: var(--s-card-fg);
    border-radius: var(--radius);
}

.v-cards .points p {
    color: var(--s-card-muted);
}

.v-list .points {
    max-width: 720px;
    gap: 0;
}

.v-list .points li {
    padding: 18px 0 18px 30px;
    border-bottom: 1px solid var(--s-line);
    position: relative;
}

.v-list .points li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 26px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--s-mark);
}

@media (min-width: 700px) {
    .v-columns .points,
    .v-cards .points {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1000px) {
    .v-columns .points,
    .v-cards .points {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Направления и группы */

.directions {
    display: grid;
    gap: 36px;
}

.direction h3 {
    margin-bottom: 10px;
}

.groups {
    list-style: none;
    margin: 0;
    padding: 0;
}

.groups li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--s-line);
}

.group-name {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    font-weight: 600;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    transform: translateY(-1px);
}

.times {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.time {
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--s-line);
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.v-cards .directions {
    gap: 16px;
}

.v-cards .direction {
    padding: 24px;
    background: var(--s-card);
    color: var(--s-card-fg);
    border-radius: var(--radius);
}

.v-cards .groups li {
    border-color: var(--s-card-line);
}

.v-cards .groups li:last-child {
    border-bottom: 0;
}

.v-cards .time {
    border-color: var(--s-card-line);
}

@media (min-width: 860px) {
    .v-cards .directions {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Расписание */

.widget {
    min-height: 240px;
}

.widget-stub {
    display: grid;
    place-items: center;
    min-height: 240px;
    padding: 24px;
    text-align: center;
    color: var(--s-muted);
    border: 2px dashed var(--s-line);
    border-radius: var(--radius);
}

/* Цены */

.plans {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 16px;
}

.plan-price {
    font-family: var(--font-heading);
    font-weight: var(--heading-weight);
    font-variant-numeric: tabular-nums;
}

/* Не переносится только сумма: «за занятие» рядом с крупной ценой широким шрифтом
   на 320px не помещалась в карточку и выталкивала страницу вбок. */
.plan-amount {
    white-space: nowrap;
}

.plan-note {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
}

.plan-meta {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.95rem;
}

.v-cards .plans {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}

.v-cards .plan {
    padding: 24px;
    background: var(--s-card);
    color: var(--s-card-fg);
    border-radius: var(--radius);
}

.v-cards .plan-price {
    margin-top: 12px;
    font-size: 2rem;
}

.v-cards .plan-note,
.v-cards .plan-meta {
    color: var(--s-card-muted);
}

.v-cards .plan-meta {
    margin-top: 12px;
}

/* Список: название и подробности слева, цена справа - как в меню. */
.v-list .plans {
    gap: 0;
    max-width: 820px;
}

.v-list .plan {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 20px;
    padding: 18px 0;
    border-bottom: 1px solid var(--s-line);
}

.v-list .plan-price {
    grid-column: 2;
    grid-row: 1 / span 2;
    font-size: 1.5rem;
    text-align: right;
}

.v-list .plan-note {
    display: block;
    color: var(--s-muted);
    font-size: 0.85rem;
}

.v-list .plan-meta {
    color: var(--s-muted);
}

.v-list .plan-meta li {
    display: inline;
}

.v-list .plan-meta li + li::before {
    content: ', ';
}

/* Частые вопросы */

.faq {
    max-width: 760px;
}

.faq details {
    border-bottom: 1px solid var(--s-line);
}

.faq summary {
    cursor: pointer;
    list-style: none;
    padding: 18px 36px 18px 0;
    font-weight: 600;
    position: relative;
}

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

.faq summary::after {
    content: '+';
    position: absolute;
    right: 4px;
    top: 14px;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--s-mark);
}

.faq details[open] summary::after {
    content: '\2212';
}

.faq .prose {
    padding-bottom: 18px;
    color: var(--s-muted);
}

.v-open .faq {
    max-width: none;
    display: grid;
    gap: 28px 40px;
}

.v-open .faq-item .prose {
    margin-top: 8px;
    padding: 0;
}

@media (min-width: 860px) {
    .v-open .faq {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Контакты */

.contacts {
    margin: 0;
    display: grid;
    gap: 16px;
}

.contacts dt {
    color: var(--s-muted);
    font-size: 0.9rem;
}

.contacts dd {
    margin: 2px 0 0;
    font-size: 1.15rem;
    overflow-wrap: anywhere;
}

.map-link {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.95rem;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.v-card .wrap {
    max-width: 640px;
}

.v-card .contacts-body {
    padding: clamp(24px, 5vw, 40px);
    background: var(--s-card);
    color: var(--s-card-fg);
    border-radius: var(--radius);
}

.v-card .contacts dt {
    color: var(--s-card-muted);
}

.v-card .contacts-body a {
    color: inherit;
}

.v-card .contacts-body .btn-line {
    color: var(--s-card-fg);
}

/* Заявка на пробное */

.trial {
    display: grid;
    gap: 20px;
}

.trial-form {
    display: grid;
    gap: 14px;
    max-width: 520px;
}

.v-card .trial-form {
    padding: clamp(20px, 4vw, 32px);
    background: var(--s-card);
    color: var(--s-card-fg);
    border-radius: var(--radius);
}

/* Значки соцсетей в контактах (App\Support\SiteSocial). Кружок 44px - удобная цель для пальца.
   Цветные: подложка цветом сети (`--brand` у значка), знак белый. Однотонные (тема
   `social: mono`) задают свои переменные в :root: прозрачная подложка, знак и обводка
   цветом текста - все сети выглядят одинаково. */
.socials {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.social {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--social-plate, var(--brand));
    color: var(--social-glyph, #ffffff);
    border: 2px solid var(--social-ring, transparent);
}

.social svg {
    fill: currentColor;
}

.social:hover,
.social:focus-visible {
    transform: translateY(-2px);
}

.v-card .contacts-body .social {
    color: var(--social-glyph, #ffffff);
}

/* Кнопка «наверх». Справа снизу, над краем безопасной зоны телефона. Скрыта через
   `visibility`, а не одну прозрачность: невидимая кнопка не должна ловить Tab. Показывает
   её `data-scrolled` на <html> (site.js), а не класс на самой кнопке: предпросмотр сверяет
   разметку и заменил бы кнопку с чужим классом (preview.js). Цвет организации, а не цвет
   кнопок схемы: у контурных кнопок он прозрачный, и кнопка растворялась бы в тексте под ней. */
.to-top {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 9;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-accent);
    border: 0;
    box-shadow: 0 8px 22px -10px rgb(0 0 0 / 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
}

[data-scrolled] .to-top {
    opacity: 1;
    visibility: visible;
    transform: none;
}

/* Вид карточек (SiteTheme::CARDS) - у всех карточек сразу: пунктов, направлений, цен,
   контактов и заявки. Обводка - `outline` внутрь, а не `border`: рамка не меняет размер
   карточки, и сетка не прыгает при смене вида. Подъём при наведении - только там, где
   карточка что-то значит сама по себе (направление, цена). */
.v-cards .points li,
.v-cards .direction,
.v-cards .plan,
.v-card .contacts-body,
.v-card .trial-form {
    box-shadow: var(--s-card-shadow, none);
    outline: 1px solid var(--s-card-edge, transparent);
    outline-offset: -1px;
}

.v-cards .direction:hover,
.v-cards .plan:hover {
    transform: translateY(var(--card-lift, 0px));
}

.v-card .trial-form a {
    color: inherit;
}

@media (min-width: 860px) {
    .v-side .trial {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.field {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 0.95rem;
}

.field em {
    font-style: normal;
    font-weight: 400;
    opacity: 0.7;
}

.field input,
.field textarea {
    font: inherit;
    font-weight: 400;
    font-size: 1rem;
    padding: 12px 14px;
    border: 1px solid currentColor;
    border-radius: var(--radius-button);
    background: transparent;
    color: inherit;
    min-height: 48px;
}

/* Обводка цветом метки СХЕМЫ, а не акцента: на фоне «цвет организации» акцентная
   обводка совпадала с фоном, и фокус пропадал. */
.field input:focus-visible,
.field textarea:focus-visible {
    outline: 3px solid var(--s-mark);
    outline-offset: 1px;
}

/* Ошибка на своей светлой подложке: красный текст прямо на фоне секции не читался
   ни на тёмной схеме, ни на красном акценте. Пара цветов даёт контраст около 6.5. */
.field-error {
    width: fit-content;
    padding: 4px 8px;
    border-radius: 6px;
    background: #fff1f1;
    color: #a51d1d;
    font-weight: 500;
    min-height: 0;
}

.field-error:empty {
    display: none;
}

.consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.92rem;
}

.consent input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
}

.trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.trial-form .btn {
    justify-self: start;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.trial-form .btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.trial-note,
.form-status {
    font-size: 0.92rem;
}

.form-status:empty {
    display: none;
}

.trial-done {
    font-size: 1.15rem;
    font-weight: 600;
}

/* Покупка с сайта */

.plan-buy {
    margin-top: 16px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.v-list .plan-buy {
    grid-column: 2;
    margin-top: 8px;
}

.buy-dialog {
    width: min(480px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    padding: clamp(20px, 5vw, 32px);
    border: 0;
    border-radius: var(--radius);
}

.buy-dialog::backdrop {
    background: rgb(0 0 0 / 0.5);
}

.buy-dialog .site-form {
    display: grid;
    gap: 14px;
}

.offer-note {
    font-size: 0.88rem;
    color: var(--s-muted);
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.dialog-actions .btn {
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

/* Исход оплаты */

.pay-result {
    min-height: 100dvh;
}

.pay-org {
    color: var(--s-muted);
    margin-bottom: 12px;
}

.pay-result h1 {
    font-size: clamp(2rem, 6vw, 3rem);
    margin-bottom: 16px;
}

.pay-actions {
    margin-top: 28px;
}

/* Подвал */

.foot {
    padding: 40px 0 48px;
    border-top: 1px solid var(--s-line);
    color: var(--s-muted);
    font-size: 0.92rem;
}

.foot-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
}

.foot p + p {
    margin-top: 4px;
}

.foot-name {
    color: var(--s-fg);
    font-weight: 700;
}

.badge {
    color: var(--s-muted);
    font-size: 0.85rem;
}
