/* ============================================================
   cert.css — bundle for MODX (assets/cert/). Fonts + tokens +
   certificate component. NO global reset (site keeps its own base).
   Source of truth: src/css/{fonts,tokens}.css + components/certificate.css
   ============================================================ */
/* ============================================================
   fonts.css — self-hosted brand faces.
   Bemount: фирменный шрифт заголовка сертификата (Дарья). Ретро-кириллица
   Anton Chernogorov. ⚠ Лицензия «free for personal use» — Заказчику
   подтвердить права для коммерческого сайта. Файл: css/fonts/bemount.woff2.
   Manrope (tagline) и остальные — через Google Fonts <link> в index.html;
   при переносе в MODX желательно тоже self-host в assets/.
   ============================================================ */
@font-face {
  font-family: "Bemount";
  src: url("bemount.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  /* ⚠ Bemount содержит ПУСТЫЕ глифы для '  -  «  ·  °  –  —  ‘  ’  “  ”  „  ×
     (проверено канвасом: 0 закрашенных пикселей, при этом » рисуется).
     Пустой глиф ≠ отсутствующий, поэтому браузер НЕ уходил в запасной шрифт и
     символы пропадали: телефон в шапке читался «469 28» вместо «469-28»,
     заголовки — «ПАРЕНИЕ ТРАДИЦИОННОЕ»» без открывающей кавычки.
     Исключаем эти кодпоинты из диапазона → их рисует следующий шрифт цепочки.
     Диапазон = всё, КРОМЕ: 27, 2D, A7, AB, B0-B1, B7, D7, 2013-2014, 2018-201E.
     » (U+00BB) НАМЕРЕННО оставлен Bemount — сверено вблизи, пара «…» смотрится единой. */
  unicode-range: U+0-26, U+28-2C, U+2E-A6, U+A8-AA, U+AC-AF, U+B2-B6, U+B8-D6,
                 U+D8-2012, U+2015-2017, U+201A-201B, U+201F-10FFFF;
}
/* ============================================================
   Design tokens — Филин Термы
   Folk (Хохлома) palette: red + gold on cream/white.
   ⚠ TODO: verify exact HEX + fonts against Figma before Этап 1 sign-off.
   These are close approximations from the ornament exports.
   ============================================================ */

:root {
  /* ---- Brand colours ---- */
  --c-red: #c8332b;          /* хохлома red — primary accent / CTA */
  --c-red-dark: #a5271f;     /* hover / pressed */
  --c-gold: #c6a15b;         /* хохлома gold — secondary accent / borders */
  --c-gold-soft: #d9c194;    /* light gold — subtle fills */
  --c-cream: #fbf7f0;        /* warm page background */
  --c-white: #ffffff;
  --c-ink: #1a1a1a;          /* body text */
  --c-ink-soft: #55524d;     /* secondary text */
  --c-line: #e7dfd2;         /* hairline borders on cream */

  /* ---- Typography ---- */
  /* Display = stylised Slavic caps used for section titles ("МЕНЮ").
     TODO: confirm the exact face from Figma; fallback stack below is safe. */
  --font-display: "Tektur", "PT Sans Caption", system-ui, sans-serif;
  --font-body: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  /* Brand face — Заказчик просит «Bemount» на заголовке сертификата.
     ⚠ Нужен файл шрифта от Заказчика (не Google Font) → положить в assets/
        и подключить @font-face. Пока — fallback на display. */
  --font-brand: "Bemount", "Tektur", "PT Sans Caption", system-ui, sans-serif;
  /* Tagline face — Manrope (Google Fonts, open source). */
  --font-tagline: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;

  --fs-h1: clamp(2rem, 5vw, 3.25rem);
  --fs-h2: clamp(1.5rem, 3.5vw, 2.25rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --lh-tight: 1.15;
  --lh-body: 1.55;

  /* ---- Spacing scale (8px base) ---- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-24: 6rem;

  /* ---- Radii / elevation ---- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --shadow-fab: 0 8px 24px rgba(0, 0, 0, 0.22);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.35);

  /* ---- Layout ---- */
  --container: 1200px;
  --gutter: clamp(1rem, 4vw, 2.5rem);

  /* ---- Z-index scale (single source of truth) ---- */
  --z-header: 100;
  --z-fab: 800;
  --z-modal: 1000;

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 220ms;
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur: 0ms;
  }
}
/* ============================================================
   Certificate — sticky FAB "Купить сертификат" + purchase popup
   Reference: Огниво-style floating button that follows scroll.
   MODX note: FAB markup → chunk `cert_fab`; popup → chunk `cert_popup`.
   ============================================================ */

/* ---------- Sticky entry point: card (default) ⇄ pill (collapsed / mobile) ----
   Огниво-style: a floating red card with heading + line + CTA. The ✕ collapses
   it to a compact pill; on mobile it starts as the pill (a full card would
   cover the screen). Both open the popup. --------------------------------- */
.cert-entry {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: var(--z-fab);
}

/* --- Card (default on ≥560px) --- */
.cert-card {
  position: relative;
  width: min(360px, calc(100vw - 2rem));
  padding: 1.75rem 1.5rem 1.25rem; /* 28 / 24 / 20 — mirrors Огниво */
  border: 1px solid var(--c-gold);
  border-radius: var(--radius-md);
  background: var(--c-red);
  color: var(--c-white);
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-fab);
  transition: transform var(--dur) var(--ease);
  /* Gentle delayed entrance (Огниво-style «появляется»); backwards fill keeps
     it hidden until the delay fires. */
  animation: cert-card-in 420ms var(--ease) 480ms both;
}
.cert-card:hover {
  transform: translateY(-2px);
}
@keyframes cert-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cert-card { animation: none; }
}

.cert-card__dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.cert-card__dismiss:hover,
.cert-card__dismiss:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  color: var(--c-white);
}

.cert-card__ornament {
  display: block;
  width: 64px;
  margin: 0 auto 0.5rem;
  color: var(--c-gold);
}
.cert-card__ornament svg {
  display: block;
  width: 100%;
  height: auto;
}

.cert-card__title {
  margin: 0;
  font-family: var(--font-brand); /* Bemount (файл от Заказчика) → fallback */
  font-size: 1.6rem;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--c-white);
}
.cert-card__text {
  margin: 0.4rem 0 1rem;
  font-family: var(--font-tagline); /* Manrope */
  font-size: 0.95rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.92);
}
.cert-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--c-gold);
  color: var(--c-ink);
  font-family: var(--font-display);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.cert-card__cta:hover,
.cert-card__cta:focus-visible {
  background: var(--c-gold-soft);
  transform: translateY(-1px);
}

/* --- Collapsed pill (after ✕ / mobile) --- */
.cert-fab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border: 2px solid var(--c-gold);
  border-radius: var(--radius-pill);
  background: var(--c-red);
  color: var(--c-white);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-fab);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.cert-fab:hover,
.cert-fab:focus-visible {
  background: var(--c-red-dark);
  transform: translateY(-2px);
}
.cert-fab__icon {
  width: 22px;
  height: 22px;
  flex: none;
}
.cert-fab__label-short {
  display: none;
}

/* --- State machine: card shown, pill hidden (until collapsed) --- */
.cert-entry .cert-fab {
  display: none;
}
.cert-entry.is-collapsed .cert-card {
  display: none;
}
.cert-entry.is-collapsed .cert-fab {
  display: inline-flex;
}

/* --- Mobile: pill only (a full card would cover the screen) --- */
@media (max-width: 559px) {
  .cert-entry .cert-card {
    display: none;
  }
  .cert-entry .cert-fab {
    display: inline-flex;
    padding: var(--sp-3) var(--sp-4);
    font-size: 0.9375rem;
  }
  /* Дарья 2026-07-13: на телефоне тоже показываем «Купить сертификат» (со словом «Купить») */
  .cert-fab__label-long {
    display: inline;
  }
  .cert-fab__label-short {
    display: none;
  }
  /* When the cookie consent bar is showing, lift the pill above it so it
     doesn't cover the "ОК" button. Drops back once the bar is dismissed.
     #cookie_note and .cert-entry are body-level siblings (verified). */
  #cookie_note.show ~ .cert-entry {
    bottom: calc(clamp(1rem, 3vw, 2rem) + 84px);
  }
}

/* ---------- Modal / popup ---------- */
.cert-modal[hidden] {
  display: none;
}

.cert-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--gutter);

  background: rgba(26, 16, 12, 0.62);
  animation: cert-fade var(--dur) var(--ease);
}

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

.cert-modal__dialog {
  position: relative;
  width: min(560px, 100%);
  max-height: min(90vh, 720px);
  overflow-y: auto;

  background: var(--c-cream);
  border: 1px solid var(--c-gold);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  animation: cert-rise var(--dur) var(--ease);
}

@keyframes cert-rise {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.cert-modal__close {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;

  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--c-ink-soft);
  font-size: 1.5rem;
  line-height: 1;
}
.cert-modal__close:hover {
  background: var(--c-white);
  color: var(--c-red);
}

.cert-modal__header {
  padding: var(--sp-8) var(--sp-8) var(--sp-4);
  border-bottom: 1px solid var(--c-line);
  text-align: center;
}
.cert-modal__title {
  color: var(--c-red);
  margin: 0;
}
.cert-modal__subtitle {
  margin: var(--sp-2) 0 0;
  color: var(--c-ink-soft);
  font-size: var(--fs-small);
}

.cert-modal__body {
  padding: var(--sp-8);
}

.cert-modal__footer {
  padding: 0 var(--sp-8) var(--sp-8);
}

/* Primary button reused inside modal (placeholder — no payment wiring yet) */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--sp-4) var(--sp-6);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--c-red);
  color: var(--c-white);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  transition: background var(--dur) var(--ease);
}
.btn-primary:hover {
  background: var(--c-red-dark);
}

/* ---------- metechcards widget mount ---------- */
/* min-height keeps the modal from collapsing while the external widget
   loads; the subtle "Загрузка…" hint sits behind the mount and is covered
   once the widget injects its own markup. */
.cert-widget {
  position: relative;
  min-height: 220px;
}
.cert-widget:empty::before {
  content: "Загрузка…";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--c-ink-soft);
  font-size: var(--fs-small);
}

.cert-widget__fallback {
  margin: var(--sp-6) 0 0;
  padding: var(--sp-4) var(--sp-6);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  background: var(--c-white);
  color: var(--c-ink-soft);
  font-size: var(--fs-small);
  text-align: center;
}
.cert-widget__fallback a {
  color: var(--c-red);
  font-weight: 600;
  white-space: nowrap;
}

/* Кнопка «Смотреть подробнее» внизу поп-апа (Дарья 2026-07-19).
   Вторичный стиль — рядом с ней в виджете живут красные «Купить»,
   и второй красной кнопки быть не должно. */
.cert-btn-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--sp-3) var(--sp-6);
  border: 1px solid var(--c-gold);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--c-red);
  font-weight: 600;
  font-size: var(--fs-small);
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}
.cert-btn-more:hover,
.cert-btn-more:focus-visible {
  background: var(--c-gold);
  color: var(--c-white);
}
