/* ============================================================================
   Resoma × Ekaterina Tur — Tilda Brand Bridge v3
   ----------------------------------------------------------------------------
   v3 (2026-08-21): каталогный режим для блока 774 — включается автоматически
   селектором [data-record-type="774"] (никаких классов и скриптов вешать
   не нужно; блок 774 на сайте встречается только на страницах вебинаров).
   Действие в карточке (вариант A): цена — отдельным рядом, ниже стопка
   full-width кнопок, прижатых к низу карточки (вторичная «Узнать
   подробнее» — ghost с бордером primary, основная — брендовый primary
   pill, всегда последняя). Полное описание — на странице вебинара:
   заголовок карточки — ссылка (hover-подчёркивание как аффорданс).
   + fix дизайн-ревью: контраст описания/eyebrow 0.85 (≈4.9:1, WCAG AA),
   текст кнопок никогда не обрезается.
   (карточки по паттерну «Скоро» из /catalog). v2-базис не изменён.
   v2 (2026-08-20): FIX — удалено назначения цвета текста
   (body color, .t-title/.t-name/.t-descr/.t-text color, цвета текстовых
   ссылок и подменю): глобальный тёмно-бордовый ломал белый текст на тёмных
   секциях (hero на /veb). Цвет текста остаётся за Тильдой (Project Styles
   + настройки блоков). Шрифт/кнопки/карточки/формы — без изменений от v1.
   ----------------------------------------------------------------------------
   Цель: нативные блоки Тильды (кнопки, карточки, формы, типографика) выглядят
   как дизайн-система приложения resoma.ru «из коробки».

   Источник правды токенов: apps/web/src/styles/app.css (ДС приложения).

   Как отключить (kill-switch): удалить <link> на этот файл из
   «Настройки сайта → Ещё → HTML-код для вставки внутрь HEAD» в Тильде.

   Как обновлять: правки вносить в репо (apps/web/public/), затем
   сохранить как следующую версию (v4, v5, ...), задеплоить и обновить ссылку в HEAD Тильды.
   После любых изменений в HEAD — пере-публикация страницы в Тильде.

   Чего этот файл сознательно НЕ трогает:
   - opacity / transform и [data-animate*] — ими управляет tilda-animation;
   - цвета, заданные Екатериной явными настройками блока (rec-scoped CSS
     Тильды имеет специфичность выше и выигрывает намеренно);
   - контролы слайдеров/каруселей (t-slds__arrow, t1196__control, ...).
   ============================================================================ */

/* Defensive: Montserrat (Tilda usually loads it as project font; this makes
   the bridge self-sufficient on pages where it is not assigned yet). */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300..800&display=swap');

:root {
    /* Палитра бренда (= токенам приложения) */
    --resoma-bg: #f0e6dc;             /* фон страницы */
    --resoma-fg: #3e0b23;             /* основной текст */
    --resoma-primary: #9b3626;        /* кнопки, акценты */
    --resoma-primary-hover: #8c3122;  /* ховер primary */
    --resoma-secondary: #f1e6db;      /* вторичная кнопка / фон-подложка */
    --resoma-secondary-hover: #e7d9c8;
    --resoma-ghost: #f8f3ed;          /* «призрачная» кнопка */
    --resoma-white: #ffffff;

    /* Форма */
    --resoma-radius-btn: 999px;       /* pill, как Button в приложении */
    --resoma-radius-card: 24px;       /* = rounded-3xl карточек приложения */
    --resoma-radius-field: 10px;      /* = --radius 0.625rem */

    /* Тени (из --shadow-primary / карточек приложения) */
    --resoma-shadow-card: 0 4px 6px 0 rgba(155, 54, 38, 0.1);
    --resoma-shadow-btn: 0 4px 12px 0 rgba(155, 54, 38, 0.25);

    /* Типографика */
    --resoma-font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI',
        Roboto, Helvetica, Arial, sans-serif;
}

/* ----------------------------------------------------------------------------
   1. Кнопки — pill + Montserrat medium (форма применяется всегда;
      цвет — только когда блок НЕ задаёт свой собственный)
   ---------------------------------------------------------------------------- */
a.t-btn:not(.t-slds__arrow):not(.t1196__control):not(.t-carousel__control),
button.t-btn:not(.t-slds__arrow):not(.t1196__control):not(.t-carousel__control),
.t-btn.t-btnflex,
.t-form__submit .t-submit,
input.t-submit {
    border-radius: var(--resoma-radius-btn) !important;
    font-family: var(--resoma-font) !important;
    font-weight: 500 !important;
    letter-spacing: 0.01em;
    transition: background-color 0.15s ease, color 0.15s ease,
        border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Цвет по умолчанию: primary-кнопка как в приложении.
   Двойная специфичность бьёт библиотечные дефолты Тильды, но НЕ трогает
   явные настройки цвета блока (rec-scoped CSS Тильды сильнее — так и надо). */
a.t-btn.t-btnflex,
button.t-btn.t-btnflex,
.t-card__btn.t-btnflex,
.t-form__submit .t-btn,
.t-form__submit .t-submit {
    background-color: var(--resoma-primary);
    color: var(--resoma-white);
    border: 0;
}

a.t-btn.t-btnflex:hover,
button.t-btn.t-btnflex:hover,
.t-card__btn.t-btnflex:hover,
.t-form__submit .t-btn:hover,
.t-form__submit .t-submit:hover {
    background-color: var(--resoma-primary-hover);
    color: var(--resoma-white);
}

/* Текстовая кнопка-ссылка (= вариант link в приложении).
   Инвариант: надпись ВНУТРИ цветной кнопки (.t-btnflex .t-btntext) всегда
   следует цвету кнопки — акцент применяется только к standalone-ссылкам. */
.t-btntext {
    font-family: var(--resoma-font) !important;
    color: var(--resoma-primary);
    text-underline-offset: 4px;
    transition: color 0.15s ease;
}
.t-btntext:hover {
    color: var(--resoma-primary-hover);
    text-decoration: underline;
}
.t-btnflex .t-btntext,
.t-btn .t-btntext {
    color: inherit !important;
    text-decoration: none !important;
}

/* ----------------------------------------------------------------------------
   2. Карточки — белые, сильно скруглённые, с мягкой бордовой тенью
      (= ProductCard / catalog-*-card в приложении)
   ---------------------------------------------------------------------------- */
.t-card__col {
    border-radius: var(--resoma-radius-card);
    background-color: var(--resoma-white);
    box-shadow: var(--resoma-shadow-card);
    overflow: hidden;
}

/* ----------------------------------------------------------------------------
   3. Типографика — ТОЛЬКО шрифт. Цвет текста мост НЕ назначает:
   он не может отличить светлую секцию от тёмной, а Тильда уже решает это
   сама (Project Styles + настройки блока). Урок v1: глобальный цвет текста
   ломал белый текст на тёмном hero (/veb, rec2432772051). Правила цвета
   .t-title/.t-name/.t-descr/.t-text и текстовых ссылок удалены в v2.
   ---------------------------------------------------------------------------- */
body {
    font-family: var(--resoma-font);
}

.t-title,
.t-name,
.t-descr,
.t-text,
.t-uptitle,
.t-section__title,
.t-card__title {
    font-family: var(--resoma-font) !important;
}

/* ----------------------------------------------------------------------------
   4. Формы — поля как Input приложения (на будущее: попапы, регистрации)
   ---------------------------------------------------------------------------- */
.t-input,
.t-textarea {
    border-radius: var(--resoma-radius-field) !important;
    border: 1px solid rgba(62, 11, 35, 0.12);
    background-color: var(--resoma-white);
    color: var(--resoma-fg);
    font-family: var(--resoma-font) !important;
}
.t-input:focus,
.t-textarea:focus {
    border-color: var(--resoma-primary);
    outline: none;
}
.t-input::placeholder,
.t-textarea::placeholder {
    color: rgba(62, 11, 35, 0.4);
}

/* ----------------------------------------------------------------------------
   5. Доступность и мелочи
   ---------------------------------------------------------------------------- */
.t-btn:focus-visible,
.t-btnflex:focus-visible,
.t-btntext:focus-visible,
.t-input:focus-visible,
.t-textarea:focus-visible,
.t-card__link:focus-visible {
    /* !important: Tilda's CDN sheets reset outline-style on links; this
       rule only ever applies in the keyboard-focus state, so it cannot
       affect the resting look. */
    outline: 2px solid var(--resoma-primary) !important;
    outline-offset: 2px !important;
}

::selection {
    background: rgba(155, 54, 38, 0.2);
}

/* ----------------------------------------------------------------------------
   6. Модификаторы для кастомных кнопок (T123 / Zero Block):
      добавить класс элементу — получить вариант кнопки из ДС.
   ---------------------------------------------------------------------------- */
/* Вторичная кнопка: бежевая подложка, бордовый текст */
.t-btn.uc-btn-secondary,
.t-btn.t-btnflex.uc-btn-secondary {
    background-color: var(--resoma-secondary);
    color: var(--resoma-primary);
}
.t-btn.uc-btn-secondary:hover,
.t-btn.t-btnflex.uc-btn-secondary:hover {
    background-color: var(--resoma-secondary-hover);
    color: var(--resoma-primary);
}

/* «Призрачная» кнопка: светлая подложка, бордовый текст */
.t-btn.uc-btn-ghost,
.t-btn.t-btnflex.uc-btn-ghost {
    background-color: var(--resoma-ghost);
    color: var(--resoma-primary);
}
.t-btn.uc-btn-ghost:hover,
.t-btn.t-btnflex.uc-btn-ghost:hover {
    background-color: var(--resoma-secondary);
    color: var(--resoma-primary);
}

/* ============================================================================
   v3 (2026-08-21): КАТАЛОЖНЫЙ РЕЖИМ — включается автоматически
   ----------------------------------------------------------------------------
   Паттерн «Скоро» из /catalog (CatalogSoonTimeline): белая карточка с
   подложкой, обложка 16:9 full-bleed, eyebrow, жирный заголовок, короткое
   muted-описание, внизу цена отдельным рядом и стопка full-width кнопок.

   Как включить: НИЧЕГО не нужно — селекторы ниже таргетят блок 774 по
   врождённому атрибуту [data-record-type="774"] (такие блоки на сайте
   живут только на страницах вебинаров, например /veb). Новая карточка в
   блоке 774 автоматически получает стиль. Явные настройки цвета внутри
   этих секций сознательно перекрываются — секция переходит под ДС
   приложения целиком.
   ============================================================================ */

/* --- Карточка-колонка: сброс глобального белого бокса v2 (на wrapper).
      display:flex + stretch — чтобы карточки в ряду были одной высоты
      (ряд цены прижимается к низу самой высокой карточки). --- */
[data-record-type="774"] .t-card__col {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    padding: 0;
    display: flex;
    flex-direction: column;
}
[data-record-type="774"] .t-card__col > * {
    flex: 1;
}

/* --- Сама карточка: белый бокс, rounded-xl, тень как Soon-карточка.
      !important: Тильда генерирует rec-scoped #recXXX .t774__wrapper
      с border-radius: 10px (ID-селектор) — в каталогом режиме карточка
      целиком под ДС.
      --- */
[data-record-type="774"] .t774__wrapper {
    background: #ffffff;
    border-radius: 12px !important;
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}
/* 774: wrapper растягивается, чтобы ряд цены прижимался к низу */
[data-record-type="774"] .t774__wrapper .t774__content {
    flex: 1;
}

/* --- Обложка: 16:9 full-bleed (инлайн-паддинг Тильды перекрывается) --- */
[data-record-type="774"] .t774__imgwrapper {
    padding-bottom: 56.25% !important;
}

/* --- Контент: сетка, прижатая к низу.
       Ряды: eyebrow / title / descr / [1fr — пустой spacer] / цена / кнопки.
       Spacer растягивается и прижимает цену и кнопки к низу карточки
       (вариант A: кнопки всегда внизу, при любой длине описания). --- */
[data-record-type="774"] .t774__content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto 1fr auto auto;
    row-gap: 6px;
    padding: 16px;
    flex: 1;
    align-content: start;
}

/* textwrapper исчезает как бокс — дети участвуют в сетке контента */
[data-record-type="774"] .t774__textwrapper {
    display: contents;
}

/* Eyebrow «ВЕБИНАР» — генерируется CSS (в редакторе Тильды не виден) */
[data-record-type="774"] .t774__content::before {
    content: 'Вебинар';
    grid-column: 1 / -1;
    font-family: var(--resoma-font);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(62, 11, 35, 0.85);
}

/* Заголовок: тёмный, не uppercase, 2 строки */
[data-record-type="774"] .t-card__title {
    grid-column: 1 / -1;
    color: var(--resoma-fg) !important;
    text-transform: none !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
[data-record-type="774"] .t-card__title .t-card__link {
    color: inherit !important;
    text-decoration: none;
}
/* Аффорданс полного описания (CSS-only): заголовок — ссылка на страницу
   вебинара, где Екатерина публикует полный анонс. Подчёркивание на ховере
   показывает кликабельность; полный текст — там, не на карточке. */
[data-record-type="774"] .t-card__title .t-card__link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Описание: muted, 4 строки (решение: место на карточке не экономим —
   пользователь видит почти весь текст, полнота по клику на заголовок).
   0.85 alpha ≈ 4.9:1 на белом — проходит WCAG AA для мелкого текста
   (fix дизайн-ревью: было 0.55 ≈ 2:1). */
[data-record-type="774"] .t-card__descr {
    grid-column: 1 / -1;
    color: rgba(62, 11, 35, 0.85) !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Uptitle (цена Тильды в 774)
   → отдельный ряд над кнопками (вариант A), слева */
[data-record-type="774"] .t-card__uptitle {
    grid-column: 1 / -1;
    grid-row: 5;
    align-self: end;
    /* Цена — жирный красный размером с текст кнопки (16px): как цена
       коллекций в приложении (text-sm font-bold text-primary) */
    color: var(--resoma-primary) !important;
    text-transform: none !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    /* Тильда инлайнит min-height (48px) — сбрасываем, иначе цена вылезает
       из ряда */
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    /* цена одной строкой */
    white-space: nowrap;
}
/* Кнопки → ряд 6, во всю ширину карточки, стопкой (вариант A):
   вторичная («Узнать подробнее») — ghost-кнопка с бордером, основная
   («Купить в записи») — брендовый primary pill, всегда последняя.
   Обе прижаты к самому низу карточки spacer-рядом выше. */
[data-record-type="774"] .t-card__btn-wrapper {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin: 0 !important;
    padding: 0 !important;
    min-width: 0;
}
[data-record-type="774"] .t-card__btn-wrapper .t-card__btn {
    margin: 0 !important;
    min-width: 0;
    width: 100%;
}
[data-record-type="774"] .t774__content .t-card__btn-wrapper {
    grid-row: 6;
}
/* Вторичная кнопка (не последняя) → ghost с обводкой primary, full-width.
   Обводка — псевдоэлементом ::before: Тильда генерирует rec-scoped правило
   `#rec… .t-btnflex { border-style: none !important; box-shadow: none
   !important }` (ID-специфичность), которое убивает и border, и box-shadow
   на самой кнопке. Псевдоэлемент этим селекторам не матчится — кольцо
   неуязвимо. border-radius: inherit повторяет pill. */
[data-record-type="774"] .t-card__btn-wrapper .t-card__btn.t-btnflex:not(:last-child) {
    background-color: transparent !important;
    color: var(--resoma-primary) !important;
    border-radius: var(--resoma-radius-btn) !important;
    padding: 8px 16px !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    position: relative;
}
[data-record-type="774"] .t-card__btn-wrapper .t-card__btn.t-btnflex:not(:last-child)::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid var(--resoma-primary);
    border-radius: inherit;
    pointer-events: none;
}
[data-record-type="774"] .t-card__btn-wrapper .t-card__btn.t-btnflex:not(:last-child):hover {
    background-color: rgba(155, 54, 38, 0.08) !important;
    color: var(--resoma-primary) !important;
}
[data-record-type="774"] .t-card__btn.t-btnflex {
    background-color: var(--resoma-ghost) !important;
    color: var(--resoma-primary) !important;
    border-radius: var(--resoma-radius-btn) !important;
    text-transform: none !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    padding: 8px 16px !important;
    box-shadow: none !important;
    /* Текст кнопки НИКОГДА не обрезаем (fix дизайн-ревью): длинная подпись
       переносится строками внутри pill. На full-width перенос не нужен. */
    white-space: normal;
    text-align: center;
}
[data-record-type="774"] .t-card__btn.t-btnflex:hover {
    background-color: rgba(248, 243, 237, 0.8) !important;
    color: var(--resoma-primary) !important;
}

/* Primary CTA (:last-child): заливка рисуется ::before-оверлеем.
   Причина: Тильда генерирует ID-специфичные правила
   `#rec… .t-btnflex_type_button2:hover/:focus-visible { background: #edd6b2
   !important }` — светлый беж под белым текстом (контраст FAIL). Классами
   ID-специфичность не перебить, поэтому primary-цвет держит оверлей
   (каскадно неуязвим, как и кольцо вторичной кнопки). Текст поднят
   z-index'ом над оверлеем. Ховер/фокус затемняют оверлей до primary-hover. */
[data-record-type="774"] .t-card__btn-wrapper .t-card__btn.t-btnflex:last-child {
    position: relative;
    background-color: transparent !important;
}
[data-record-type="774"] .t-card__btn-wrapper .t-card__btn.t-btnflex:last-child .t-btnflex__text {
    position: relative;
    z-index: 1;
}
[data-record-type="774"] .t-card__btn-wrapper .t-card__btn.t-btnflex:last-child::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--resoma-primary);
    pointer-events: none;
}
[data-record-type="774"] .t-card__btn-wrapper .t-card__btn.t-btnflex:last-child:hover::before,
[data-record-type="774"] .t-card__btn-wrapper .t-card__btn.t-btnflex:last-child:focus-visible::before {
    background: var(--resoma-primary-hover);
}

/* Мобильный touch-target: обе кнопки ≥44px по высоте (Apple HIG/основа a11y
   для сенсорных целей; на десктопе 38px достаточно, курсор точнее пальца).
   Атрибут задублирован: специфичность должна быть ≥ базового правила
   secondary (:not(:last-child) = 5 классов), иначе !important-тайбрейк
   уходит базовому правилу и кнопка остаётся 38px. */
@media (max-width: 640px) {
    [data-record-type="774"][data-record-type="774"] .t-card__btn-wrapper .t-card__btn.t-btnflex {
        padding: 12px 16px !important;
    }
}
/* Основная кнопка (последняя): цвет текста; фон отвечает ::before-оверлей
   (см. блок выше). */
[data-record-type="774"] .t-card__btn-wrapper .t-card__btn.t-btnflex:last-child {
    color: #ffffff !important;
}
